Skip to content

fix(drivers): build the seed tables' one-ready-seed index in a version 2 step - #1384

Merged
V3RON merged 3 commits into
mainfrom
bug/1367
Nov 6, 2026
Merged

V3RON merged 3 commits into
mainfrom
bug/1367

Conversation

@V3RON

@V3RON V3RON commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1367

Status

Implement: done, fix b7c1b25 (R1, R2) Review: round 2 passed, 0 open Hardware: n/a Gate: running
Next: gate

Assumptions

none

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 2 blocking, 2 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 2.8M.
Runs: 8. Cost USD: 2.1676. Agent seconds: 926.
Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The iOS and Android source-data schemas advance to version 2. Their migrations demote older ready seeds with the same spec_key to making before creating a partial unique index. The daemon exports stateOwners to select schema owners by role, and openStateDatabase uses this helper. Tests cover seed uniqueness, version 1 migrations, and owner migration counts for worker and gateway roles.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to b7c1b

No actionable merge-blocking risk remains in the reviewed changes; merge after normal checks.

Security architecture risk: Low · up to b7c1b

The upgrade is limited to worker-local seed state and preserves existing daemon role boundaries. Migration changes are atomic, but older duplicate seeds become eligible for deletion, and upgraded databases cannot be reopened by the previous version.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed reconciliation acts on persisted seed records in each worker database, across all spec_key groups with duplicate ready seeds. Gateway schema ownership is unchanged and excludes these platform tables. The examined change introduces no new remote request path or broader schema-owner authority.

Trust Boundaries and Controls

  • observed — The new migrations contain static SQL. Existing controls create missing disk databases with owner-only permissions, scope iOS seed deletion to the managed source set, and stop Android source emulators before deleting their recorded folders. These controls predate this PR.

Resilience and Maintainability Implications

  • inferred — Immediate transactions serialize migration writers and prevent committed reconciliation without the matching index and version update. Subsequent external cleanup is separate: database rollback does not restore a duplicate seed after its simulator or folder has been deleted.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title describes the version 2 migration that creates the one-ready-seed index.
Description check Passed The description references issue #1367, which the changes address.
Linked Issues check Passed [ #1367 ] Both source-data owners retain the version 1 table step and add a version 2 step that resolves duplicate ready seeds and creates the partial unique index. Tests cover new databases, version …
Out of Scope Changes check Passed [ #1367 ] The migration and tests address the missing indexes. The stateOwners extraction supports tests that check migration counts against the daemon's actual owner lists.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

[ #1367 ] Both source-data owners retain the version 1 table step and add a version 2 step that resolves duplicate ready seeds and creates the partial unique index. Tests cover new databases, version 1 upgrades, duplicate handling, and index enforcement on both platforms.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 4 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: fef9c5c9-e3c3-478a-a138-389e5bd75bed
Commits

Reviewing files that changed from the base of the PR and between 7b13aec and b7c1b25.

Files selected for processing: 4

  • src/daemon/main.ts
  • src/daemon/state-owners.test.ts
  • src/drivers/android/source-data.ts
  • src/drivers/ios/source-data.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@V3RON

V3RON commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: bbb2f78
Round 2: b7c1b25

Runs: 8. Cost USD: 2.1676. Agent seconds: 926.
Tokens input 186, output 48297, cache read 4240468, cache write 365774.
- build implementer: claude-sonnet-5-5 142 s $0.198
- audit implementer: claude-sonnet-5-5 55 s $0.1638
- review 1 reviewer: claude-sonnet-5-5 274 s $0.3549
- review 1 spec: claude-sonnet-5-5 10 s $0.0742
- review 1 code both: claude-opus-5-5 159 s $0.6915
- review 1 claims: claude-sonnet-5-5 27 s $0.1396
- fix 1 implementer: claude-sonnet-5-5 210 s $0.3954
- review 2 reviewer: claude-sonnet-5-5 49 s $0.1502
Finding outcomes: {"fixed":2}. Classes: {"testing 10":1,"testing 4":1}.
{"findings":[{"id":"R1","role":"code","class":"testing 10","outcome":"fixed","path":"src/daemon/state-owners.test.ts","round":"1","fix":"b7c1b25d7c9f143cb2708703ffd628a60332493e"},{"id":"R2","role":"code","class":"testing 4","outcome":"fixed","path":"src/daemon/state-owners.test.ts","round":"1","fix":"b7c1b25d7c9f143cb2708703ffd628a60332493e"}]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 6, 2026 12:40
@V3RON
V3RON merged commit f9ff4a7 into main Nov 6, 2026
68 checks passed
@V3RON
V3RON deleted the bug/1367 branch November 6, 2026 12:51
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.

The seed tables' unique index is never created: both owners list two migrations at version 1

1 participant