Skip to content

Await dna installs - depends on version 0.0.5 of language-context to be published#2

Merged
jdeepee merged 3 commits intomainfrom
await-dna-installs
May 28, 2021
Merged

Await dna installs - depends on version 0.0.5 of language-context to be published#2
jdeepee merged 3 commits intomainfrom
await-dna-installs

Conversation

@jdeepee
Copy link
Contributor

@jdeepee jdeepee commented May 28, 2021

No description provided.

@jdeepee jdeepee merged commit 75c10f1 into main May 28, 2021
@lucksus lucksus deleted the await-dna-installs branch August 22, 2025 12:17
@lucksus lucksus mentioned this pull request Jan 7, 2026
data-coasys added a commit that referenced this pull request Jan 28, 2026
- 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
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>
lucksus added a commit that referenced this pull request Mar 15, 2026
  #1: Replace growing result hashes with seen message IDs
  - resultHashes: Record<string, string> → seenMessages: Record<string, string[]>
  - For mention subs: stores only the message addresses (e.g. ["msg-1", "msg-2"]), not the entire serialized result. Only new unseen messages trigger a wake.
  - For channel-messages subs: still uses a single result hash (stored as the sole entry in the set)
  - Backwards-compatible: loadWakerState handles both old and new formats
  - Files: wakerSubscriptionManager.ts (plugin + core), config.ts, index.ts, tests

  #2: Add limit parameter to get_children_body_parsed
  - New optional limit: Option<usize> parameter, defaults to 50
  - Returns the most recent N messages (sorted by timestamp, takes the tail)
  - Prepends (showing last N of M messages) when truncated
  - File: children.rs
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.

2 participants