Skip to content

WIP: Remove interactions with name/email on Agent type#4

Closed
jdeepee wants to merge 1 commit intomainfrom
remove-author-profile-fields
Closed

WIP: Remove interactions with name/email on Agent type#4
jdeepee wants to merge 1 commit intomainfrom
remove-author-profile-fields

Conversation

@jdeepee
Copy link
Contributor

@jdeepee jdeepee commented Jun 9, 2021

No description provided.

@jdeepee jdeepee closed this Jun 30, 2021
@lucksus lucksus mentioned this pull request Jan 7, 2026
data-coasys added a commit that referenced this pull request Jan 28, 2026
)

Instead of hardcoding LinkStatus::Local, now reads link.status and uses it
(falls back to Local if None). This preserves the original link status during
import operations.

Addresses CodeRabbit actionable comment on PR #652
data-coasys added a commit that referenced this pull request Feb 17, 2026
* Surreal files per perspective wip 1

* Avoid duplicate links w/ unique index and handle lock and write errors

* Fix new remove_link on surreal service

* Rename update_surreal_cache() to persist_link_diff()

* Temporary perspective data migration from rusqlite to surreal

* fmt

* fix: address CodeRabbit issues #2, #3, #7

- MIGRATION_REMOVAL_GUIDE.md: Complete sentence in heading
- migration.rs: Only mark as migrated when error_count == 0 (prevents data loss)
- surreal_service/mod.rs: Remove overly broad 'index' error check (more precise error handling)

Addresses CodeRabbit actionable comments on PR #652

* fix: preserve original link status instead of hardcoding Local (issue #4)

Instead of hardcoding LinkStatus::Local, now reads link.status and uses it
(falls back to Local if None). This preserves the original link status during
import operations.

Addresses CodeRabbit actionable comment on PR #652

* fix: propagate SurrealDB write failures to prevent desync (issue #1)

- retry_surreal_op now returns Result and propagates errors
- persist_link_diff now returns Result instead of silently swallowing errors
- Updated all callsites:
  - Functions returning Result: use .await? to propagate
  - Functions returning (): use .await.expect() to fail-fast
- Critical synchronization operations now fail loudly instead of silently

Addresses CodeRabbit actionable comment #1 on PR #652

* fix: honor full unique constraint in SurrealDB lookups (issue #6)

Updated get_link to accept and use author and timestamp parameters:
- get_link now takes optional author and timestamp
- When provided, queries using all 5 unique fields (source, target, predicate, author, timestamp)
- When not provided, falls back to 3-field lookup for backward compatibility
- Updated all callsites to pass author and timestamp from LinkExpression

This prevents returning arbitrary links when multiple authors/timestamps exist
for the same source/predicate/target combination.

Addresses CodeRabbit actionable comment #6 on PR #652

* fix: prevent TOCTOU race in initialize_from_db (issue #5)

Added atomic check-and-insert before storing perspective:
- Initial read-lock check remains for quick filtering
- After async initialization completes, do final write-lock check
- Only insert if another task hasn't already initialized this perspective
- Discard duplicate work and don't start background tasks if race lost

This prevents multiple tasks from creating duplicate SurrealDB services
for the same perspective UUID.

Addresses CodeRabbit actionable comment #5 on PR #652

* fix: clone link.status to avoid partial move

Compilation error: link.status.unwrap_or() moves the value, preventing
use of 'link' afterwards. Use clone() to avoid the partial move.

* fix: borrow links in migration loop to avoid partial move

Changed 'for (link_expr, status) in links' to '&links' and cloned status
to avoid moving values out of the vector.

* chore: run cargo fmt and add PR fixes summary

* refactor: remove redundant variable reassignments in get_link

Addresses CodeRabbit feedback: simplified variable flow by directly
assigning query result to response instead of going through intermediate
query and results variables.

Co-authored-by: CodeRabbit AI <coderabbit@example.com>

* fix: address CodeRabbit feedback on PR #652

1. Remove 'WHERE perspective = $perspective' from test queries
   - Each perspective has isolated database, no filtering needed
   - Fixed 11 test queries in surreal_service/mod.rs

2. Make status parsing case-insensitive in SurrealLink conversion
   - Now handles 'Shared'/'shared' and 'Local'/'local' correctly
   - Preserves migrated data regardless of case

3. Require author/timestamp in get_link() signature
   - Changed from Option<&str> to &str for both params
   - Removed fallback branch (always use full unique constraint)
   - Updated 4 callsites in perspective_instance.rs
   - Enforces UNIQUE index (in, out, predicate, author, timestamp)

Co-authored-by: CodeRabbit AI <coderabbit@example.com>

* reset bootstrapSeed.json

* Handle fallback sync read failure gracefully.

* Don’t proceed when migration fails.

* Fix inconsistent error handling: .expect() vs. map_err()?

* fix: handle SurrealDB service creation failure in initialize_from_db

Complements commit e57b8f8 which fixed the same issue in add_perspective().
This fix addresses the spawned task in initialize_from_db() which also had
a panicking .expect() call.

Changes:
- Replace .expect() with match expression
- Log error and return early on failure
- Prevents panic if SurrealDB creation fails (RocksDB lock, disk, permissions)

Addresses CodeRabbit feedback on PR #652 (line 90 issue)

* don't fail silently if links from DB can't be parsed

* don't panic on DB write failures but log error

---------

Co-authored-by: Data <data.coasys@gmail.com>
Co-authored-by: CodeRabbit AI <coderabbit@example.com>
data-bot-coasys added a commit that referenced this pull request Mar 1, 2026
…rdcoding

Address review comments #3 and #4 from Nico:
- subscriptions.rs: When no explicit predicate is provided, load the
  SHACL class definition and derive the SurrealQL query from its
  property predicates (IN clause). No more hardcoded flux:// types.
- shacl.rs: Enrich ShaclClass with shape_uri and all_predicates fields,
  providing enough metadata to construct targeted queries without
  type-specific knowledge.
- Add load_class_properties_with_uri() to return shape URI alongside
  properties for richer metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant