feat(ops): add verified SQLite backup and recovery rehearsal - #531
feat(ops): add verified SQLite backup and recovery rehearsal#531seonghobae wants to merge 61 commits into
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughSQLite 라이브 백업 모듈과 읽기 전용 검증 CLI를 추가했습니다. ChangesSQLite 백업 운영 경계
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟡 Moderate · up to The backup feature currently materializes schema metadata instead of enforcing the required bounded inspection path, causing the schema-budget test to fail and weakening protection against oversized schemas. Merge should wait until schema inspection streams rows and reports the expected limit error. Sequence Diagram(s)sequenceDiagram
participant 운영자
participant 백업CLI
participant createVerifiedSqliteBackup
participant DatabaseSync
participant 파일시스템
운영자->>백업CLI: backup 또는 verify 실행
백업CLI->>createVerifiedSqliteBackup: 백업 생성 요청
createVerifiedSqliteBackup->>DatabaseSync: 무결성 검증 및 VACUUM INTO
DatabaseSync-->>createVerifiedSqliteBackup: 임시 스냅샷 반환
createVerifiedSqliteBackup->>DatabaseSync: 백업 무결성 및 메타데이터 검증
createVerifiedSqliteBackup->>파일시스템: 하드 링크로 no-overwrite 게시
파일시스템-->>백업CLI: 성공 또는 안정적인 오류 코드
백업CLI-->>운영자: JSON 결과 및 종료 코드
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@opencode-agent @cwl-noema-review |
|
@opencode-agent review Please submit a formal review for exact current head |
|
@opencode-agent review Review-only request for exact head |
Buyer / operator impact
ScopeWeave can create and verify a consistent live SQLite snapshot without raw-copying a WAL-backed database and without exposing a destructive restore command. Operators also get an executable stopped-writer recovery rehearsal that reopens the verified snapshot through ScopeWeave's real database bootstrap with customer-like tenant/project rows intact.
Closes #530 only when this change is actually merged into protected
develop.Exact current scope
develop@2c328875e00e86537df3e965170be80532571cad;9e3906a5f362d620ce4761ed5d5ce47d81b29411;aaadb5320ca5d7f9249d15caa2cdee6b97965165;feat/sqlite-backup-recovery-530;Any base or contributor-head movement invalidates ancestry- and exact-head evidence until freshly revalidated. This body is traceability, not merge authority.
Production contract
server/sqlite_backup.mjs:application_id,user_version, and bounded canonicalsqlite_schemametadata;StatementSync.iterate()instead of materializing.all()results;0600creation;VACUUM INTOfor a consistent live snapshot;TDD and review-driven hardening
The original RED contract preceded the production backup module. Subsequent regressions hardened live-WAL read-only snapshotting, metadata mismatch, parent-symlink retargeting, competing publication, owner-only permissions, portable direct-process invocation, sidecar-safe recovery, application-bootstrap recovery acceptance, bounded schema-memory behavior, foreign-key fake fidelity, and post-publication output handling.
A current-line review exposed an operator-state defect after all durable filesystem work had succeeded: if the
backupcommand published a verified snapshot and only the success output sink failed (for example a closed stdout pipeline), the CLI returned failure and encouraged an unsafe retry against an already-existing destination.The repair was test-first:
tests/unit/sqlite-backup-output-failure.test.mjscreates a real SQLite database, closes the success sink, and proves a durably published backup remains verifiable;runSqliteBackupClitreats publication as the durable backup operation boundary: a post-publication success-output failure emits a best-effort diagnostic{ok:true, operation:'backup', warning:'success_output_failed', action:'verify_destination_before_retry'}and returns 0, rather than reclassifying the completed backup as failed.Exact head
9e3906a5...additionally locks the intentionally differentverifycontract: verification is read-only/idempotent, but if its requested success output cannot be produced it returns failure withsuccess_output_failedrather than claiming a result the caller did not receive. That final commit changes the regression expectation, not the backup production boundary.A fresh current-head thread sweep has no unresolved review threads. Resolved review history records the intentional fail-closed concurrent-DDL mismatch boundary, the zero-length
VACUUM INTOreservation dependency, read-only WAL operating constraints, and stable metadata assumptions. Those observations are not approvals and are not promoted into merge evidence.Recovery and operator evidence
-wal,-shm, and-journalsidecars as one incident evidence set, prevents stale-sidecar mixing, and reopens a verified snapshot throughserver/db.mjs;README.mdanddocs/deploy.mdlead operators tonpm run ops:sqlite-backupand the recovery runbook; andCurrent exact-head evidence state
For exact contributor head
9e3906a5f362d620ce4761ed5d5ce47d81b29411, the currently associated pull-request workflow runs are terminal GitHub-success:32571299640— success;32571299608— success;32571299601— success;32571299821— success;32571299603— success; and32571299595— success.These labels are not promoted to immutable contributor-head merge authority while the known checkout-evidence defects remain unresolved. ScopeWeave #523 owns repository-native exact-head Server Tests/coverage integrity.
ContextualWisdomLab/.github#1222owns the organization-required reusable SAST/Security exact-head checkout repair through the central repository's existing dedicated writer/control path.Historical OpenCode
CHANGES_REQUESTEDreviews target predecessor heads and organization-owned coverage evidence; they are dismissed/stale and do not transfer to exact head9e3906a5.... CodeRabbit/Devin COMMENTED evidence is supplementary rather than a qualifying independent current-head approval. Pending, queued, skipped-required, cancelled, absent, neutral-required, failed, stale, predecessor, synthetic, status-only, author-only, model-only, rate-limited, or infrastructure-only evidence is non-passing.Merge gate
Do not merge or enable auto-merge until this unchanged exact head remains reconciled to freshly resolved protected
develop, #523's repository exact-head control and the central reusable exact-head SAST/Security repair are protected-shipped and regenerated on this exact head, every applicable repository/organization CI, browser, owned statement-branch-function-line coverage/docstring, CodeQL/SAST, security, dependency/supply-chain, package/provenance and required-workflow gate is substantively terminal-passing under corrected contracts, valid unresolved current-head defects are zero, and the live required approving-review rule is satisfied by a qualifying independent current-head approval (currently one approval under active ruleset18156473; no latest-push approval is required by that ruleset). Do not self-approve or transfer predecessor evidence.Closes #530