feat(persistence): persist idempotent analysis runs - #287
seonghobae wants to merge 11 commits into
Conversation
Store canonical tenant-bound requests and append-only lifecycle events with database-enforced transitions and artifact provenance. Refs: #166 Signed-off-by: Seongho Bae <me@seonghobae.me>
📝 WalkthroughWalkthrough분석 실행 요청과 상태 이벤트를 PostgreSQL에 영속화하는 기능을 추가했습니다. 정규 요청 JSON과 SHA-256 digest를 저장하고, 테넌트별 멱등 삽입과 append-only 상태 전이를 적용합니다. Rust SQL 생성 API, 마이그레이션, 계약 테스트, 실제 PostgreSQL 테스트와 관련 문서를 추가했습니다. Changes분석 실행 영속화
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller as 호출자
participant RustAPI as insert_analysis_run_request_sql
participant PostgreSQL
Caller->>RustAPI: AnalysisRunRequestRecord 전달
RustAPI->>RustAPI: 정규 JSON과 SHA-256 digest 검증
RustAPI-->>Caller: INSERT SQL 반환
Caller->>PostgreSQL: 멱등 요청 및 accepted 이벤트 삽입
PostgreSQL-->>Caller: 저장된 실행 ID와 digest 검증 결과
Caller->>RustAPI: 상태 이벤트 전달
RustAPI-->>Caller: 상태 이벤트 INSERT SQL 반환
Caller->>PostgreSQL: append-only 상태 이벤트 삽입
PostgreSQL-->>Caller: 상태 전이 및 테넌트 제약 결과
Merge Risk: 🟡 Moderate · up to This PR adds durable tenant-scoped analysis-run records and stable retries, but the current head still risks failed exact retries, production traffic blocking during migration, and weakened tenant isolation if callers do not bind tenant context correctly. Merge should wait until these issues are fixed or explicitly accepted; the remaining documentation mismatches are non-blocking. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 6 files. (9 skipped: 9 unsupported.)
✨ 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 |
Exercise digest-only request tampering and cross-tenant lifecycle events so both trust-boundary short-circuit arms remain covered. Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
…s-worker feat(persistence): add durable worker transport
Keep both CHANGELOG.md entries and let cargo regenerate Cargo.lock for the union of both dependency sets. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Restack on protected main (a243f18) + pre-existing lint findingNon-force merge of
Local evidence on the pushed head (toolchain 1.98.0): Pre-existing lint failure (not introduced by this restack)
These look like a recording test double whose captured SQL and identifiers are never asserted on — the repair is to assert the recorded calls (which also closes a real verification gap), not to silence the lint. I did not touch it: choosing what the double must prove is the writer's call. 🤖 Generated with Claude Code |
|
Current exact-head gate refresh for
No blind rerun or wake commit is justified from this evidence. The next repair must identify the current dependency-policy/Python-tooling/CodeQL/Security causes from logs or canonical owner findings rather than inheriting the older local lint diagnosis. Dependent persistence parity PR #615 is intentionally based on this exact head, uses successor migration |
|
Fresh hosted RCA on actual head The canonical foundation successor #538 already carries the causal contract repair at The other Rust Foundation failure is likewise in the dependency-policy step after fmt/Clippy/tests/doctests/rustdoc are GREEN; #538 already carries the |
Scope
Active persistence writer for tenant-scoped idempotent Analysis Run requests/state history and migration
0008_analysis_run_persistence. This PR remains Draft. It is also the required base for the dependent Membership persistence successor #615; #615 must not bypass this writer or copy its migrations.Current protected base:
main@a243f18da4a4ca8a8d068c39922537f1f8ed6ad0.Current exact head:
9fd492a3b3873d03460c1393308d3c8d1ca73f83.Current exact-head evidence
Rust Foundation
34863660899is not GREEN:Other exact-head gates:
34863660918: success;34863660843: success;34863660788: failure;34863661066: failure.There is no qualifying APPROVED review on this exact head; existing submitted reviews are COMMENTED. The previous body statement that checks are not blockers is stale and is withdrawn. Checks, security findings, ruleset requirements and independent approval remain release/merge gates.
Foundation prerequisite
Canonical protected-main successor #538
f335624cea977fea7d7fe6f36871868557fe2bb7already carries foundation/workflow andrustls >=0.23.45repairs that this persistence lane must inherit rather than duplicate. #538 itself is not merge-ready yet: its Security/Dependency Graph and CodeQL/GHAS prerequisites remain unresolved. After #538 lands normally, this branch must reconcile ordinary-forward, preserve every valid0008delta/test/fixture/contract, and reacquire exact-head evidence.Downstream persistence stack
#615 is intentionally stacked on this branch. It owns forward
0009/0010Membership persistence parity and must be restacked ordinary-forward only after this surviving persistence owner lands. Do not renumber or rewrite historical migrations to shortcut the stack.Acceptance
Require exact-head Rust/rustdoc/test/owned line+branch+edge coverage, live PostgreSQL, repository-tooling coverage, dependency/license/advisory/source policy, Documentation/Semgrep/Security/CodeQL, resolved valid review threads/findings, qualifying independent approval, and normal protected-main landing. Then #615 must inherit the landed result losslessly and reacquire all applicable gates.
No self-approval,
--admin/ruleset bypass, force push, destructive rebase, predecessor-check transfer, gate weakening, warning suppression, or historical migration rewrite is authorized.Refs #166, #538, #615.