WS-ART-001-02C2: verification publication and fencing#159
Conversation
…-verification-publication-fencing # Conflicts: # .agent-loop/LOOP_STATE.md # .agent-loop/WORK_QUEUE.md # .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/CHUNK_MAP.md # .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/STATUS.md # scripts/test_agent_gates.py
📝 WalkthroughWalkthroughThis change advances ART to active chunk 02C2, adding verification jobs, immutable receipts, execution fencing, bounded scanning, deny-only internal authority, expanded orchestration and repository logic, migrations, tests, documentation, and updated AUTH/ART gate tracking. ChangesArtifact verification and fencing
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
…-verification-publication-fencing
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
@.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-02C2-internal-review-evidence.md:
- Around line 52-56: Update the reviewer result values in the evidence table to
use only the repository’s accepted outcome strings, replacing the invalid
conditional variants in the product/ops, CI integrity, and docs rows while
preserving their conclusions. Also refresh the Reviewed code SHA metadata to
match the latest code revision, including non-evidence changes such as
WORK_QUEUE.md.
In `@backend/app/modules/artifacts/service.py`:
- Around line 395-397: Roll back the active claim transaction before returning
"stale" when _matching_job_fence fails after lock_verification_job in the
verification-job flow. Update this post-claim mismatch branch to match the
rollback behavior in execute_committed_put and resolve_put_attempt, while
preserving the existing stale return.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 82105bf9-8e37-4f23-8c26-749168909f0f
📒 Files selected for processing (29)
.agent-loop/LOOP_STATE.md.agent-loop/WORK_QUEUE.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/CHUNK_MAP.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/STATUS.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/chunks/WS-ART-001-02C2-verification-publication-fencing.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/chunks/WS-ART-001-02C3-recovery-attempt-idempotency.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-02C2-external-review-response.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-02C2-internal-review-evidence.md.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-02C2-pr-trust-bundle.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/CHUNK_MAP.md.agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/STATUS.md.agent-loop/merge-intents/WS-ART-001-02C2.jsonbackend/alembic/versions/0030_artifact_verification_fencing.pybackend/app/core/config.pybackend/app/modules/artifacts/models.pybackend/app/modules/artifacts/repository.pybackend/app/modules/artifacts/schemas.pybackend/app/modules/artifacts/service.pybackend/app/modules/outbox/service.pybackend/app/workers/artifacts.pybackend/app/workers/celery_app.pybackend/tests/assertion_helpers.pybackend/tests/test_alembic.pybackend/tests/test_artifact_admission.pybackend/tests/test_artifact_architecture.pybackend/tests/test_artifact_verification.pybackend/tests/test_assertion_helpers.pydocs/spec_artifact_storage_service.mdscripts/test_agent_gates.py
| claimed = await self._repo.lock_verification_job(str(job_id)) | ||
| if not _matching_job_fence(claimed, executor_id, candidate_generation + 1): | ||
| return "stale" |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Missing claim_transaction.rollback() on post-claim fence mismatch.
Unlike execute_committed_put (Lines 225-227) and resolve_put_attempt (Lines 305-307), this early return "stale" leaves the async with self._session.begin() block via normal exit, which commits the just-performed claim (generation+1, executor, running, lease). If this branch is ever reached, the job is orphaned in running and is only recovered on lease expiry rather than being immediately released. Roll back for consistency with the put paths.
🔒 Proposed fix
claimed = await self._repo.lock_verification_job(str(job_id))
if not _matching_job_fence(claimed, executor_id, candidate_generation + 1):
+ await claim_transaction.rollback()
return "stale"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| claimed = await self._repo.lock_verification_job(str(job_id)) | |
| if not _matching_job_fence(claimed, executor_id, candidate_generation + 1): | |
| return "stale" | |
| claimed = await self._repo.lock_verification_job(str(job_id)) | |
| if not _matching_job_fence(claimed, executor_id, candidate_generation + 1): | |
| await claim_transaction.rollback() | |
| return "stale" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@backend/app/modules/artifacts/service.py` around lines 395 - 397, Roll back
the active claim transaction before returning "stale" when _matching_job_fence
fails after lock_verification_job in the verification-job flow. Update this
post-claim mismatch branch to match the rollback behavior in
execute_committed_put and resolve_put_attempt, while preserving the existing
stale return.
…-verification-publication-fencing # Conflicts: # scripts/test_agent_gates.py
…to codex/ws-art-001-02c2-verification-publication-fencing
…to codex/ws-art-001-02c2-verification-publication-fencing
PR Trust Bundle: WS-ART-001-02C2
Chunk
WS-ART-001-02C2- Verification Publication And FencingReviewed implementation SHA:
e59a6dfc977fa63ad7177ab9adb8338333aa1dafTrusted base:
42a89b2dMerge intent:
.agent-loop/merge-intents/WS-ART-001-02C2.jsonGoal And Human-Approved Intent
Resolve committed artifact puts, publish bounded pending work, verify complete
provider reads, and fence every terminal transition without activating product
callers, recovery, Operator routes, or background write replay.
What Changed And Why
observation so acknowledgement loss cannot cause a second write.
verification receipts for auditable outcomes.
authority revalidation so stale or revoked work cannot commit terminal facts.
deadlines.
artifact verification 0030, eliminating the duplicate-head collision.
Design And Alternatives
The orchestrator owns provider execution through
ArtifactStore; productservices do not receive raw provider access. Background resolution observes
only and never retries writes. Production tasks remain deny-only with no Beat
schedule. Ad hoc provider factories, a second AUTH evaluator, background write
replay, and dual scanner/outbox publication were rejected.
Scope Control And Product Behavior
No task, submission, checker, review, revision, contribution, compensation,
reputation, deletion, recovery, Operator API, R2, Flow Node, or product-cutover
behavior changed. Review decisions remain
accept,needs_revision, andreject. The three ART internal actions remain planned and inactive.Acceptance Criteria Proof
and fenced.
production.
02C3andrequires a separate explicit start.
Tests And Checks
The transient failure is disclosed, not converted into a green aggregate. It
is non-reproduced and reviewers found no assertion weakening or fixture defect.
CI Integrity And Test Delta
No workflow, threshold, ignore, skip, xfail, retry, or failure-bypass change was
introduced. The 90 percent affected-subsystem floor and 78 percent repository
floor remain intact. Thirty-two named tests were added and none removed or
skipped.
Reviewer Results
All nine exact-SHA tracks completed: senior engineering PASS; security PASS;
product/ops PASS; reuse PASS; CI integrity PASS; docs PASS; architecture, QA,
and test delta PASS WITH LOW RISKS. No required fix remains and no reviewer
session is open.
External Review
Remaining Risks And Follow-Up
product cutover remain separate, explicitly started chunks.
Human Review Focus
terminal state?
Human Merge Ownership
Summary by CodeRabbit
New Features
Bug Fixes
Documentation