Skip to content

handle absent keys in ssi transactions - #18

Merged
withinboredom merged 1 commit into
mainfrom
fix/dag-walk
Oct 27, 2026
Merged

withinboredom merged 1 commit into
mainfrom
fix/dag-walk

Conversation

@withinboredom

@withinboredom withinboredom commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

An optimization causes an SSI write-skew violation for absent keys.

Summary by CodeRabbit

  • Bug Fixes
    • Improved transaction conflict detection when transactions read keys that do not yet exist, helping prevent conflicting writes from committing.
    • Improved dependency tracking for transactional updates involving active subscriptions.
  • Tests
    • Added coverage for recovering missed policy updates after peers reconnect and for transaction conflicts involving absent, existing, and deleted keys.

Signed-off-by: Robert Landers <landers.robert@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 585c57e6-0a44-4046-a01c-1b6d97c97176
Commits

Reviewing files that changed from the base of the PR and between 76b663b and 062fa51.

Files selected for processing: 5
  • beacon/discovery_recovery_test.go
  • beacon/ssi_absence_test.go
  • effects/context.go
  • effects/horizon.go
  • effects/ssi_absence_test.go

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Walkthrough

The changes record absent-key reads and subscription dependencies in transactional effects, add tests for SSI write skew and replicated runtime behavior, add a discovery recovery test, and capture a horizon group size under lock before logging.

Changes

SSI Absent-Key Transactions

Layer / File(s) Summary
Record absent-key reads and dependencies
effects/context.go
Successful reads emit NOOP effects when snapshots have empty frontiers. Transactional effects use blocking subscription setup and include subscription tips in dependencies.
Verify absent-key transaction behavior
effects/ssi_absence_test.go
Tests cover absent-key read dependencies, transaction binds, concurrent key creation, and write-skew aborts for absent, existing, and deleted keys.
Verify replicated write-skew behavior
beacon/ssi_absence_test.go
A clustered-runtime test checks replication, conflicting transactions on absent keys, resulting values, and a later successful transaction.

Discovery Recovery

Layer / File(s) Summary
Test recovery of a missed policy write
beacon/discovery_recovery_test.go
The test writes a policy while peers are disconnected, then checks that anti-entropy and reconvergence deliver it after the peers connect.

Horizon Logging

Layer / File(s) Summary
Capture group size under lock
effects/horizon.go
HorizonSet.Add captures the target group’s entry count before unlocking and uses that value in the debug log.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • swytchdb/engine#16: Adds the SSI transaction snapshot and Context read paths that the absent-key handling changes extend.
Merge Risk: Minimal · up to 062fa

No merge-blocking issue is established; the change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: handling absent keys in SSI transactions.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 5 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit reads where keys are bare,
And leaves a NOOP marker there.
Two peers reconnect; the value flows,
While skewed transactions meet their woes.
The horizon count stays safely in tow.

Comment @coderabbitai help to get the list of available commands.

@withinboredom
withinboredom merged commit d9d7ab5 into main Oct 27, 2026
5 checks passed
@withinboredom
withinboredom deleted the fix/dag-walk branch October 27, 2026 13:27
@coderabbitai coderabbitai Bot mentioned this pull request Nov 4, 2026
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