Skip to content

WS-ART-001-04A1: remove legacy contributor intake - #264

Merged
abiorh-claw merged 10 commits into
mainfrom
codex/ws-art-001-04a1-legacy-intake-removal
Aug 4, 2026
Merged

WS-ART-001-04A1: remove legacy contributor intake#264
abiorh-claw merged 10 commits into
mainfrom
codex/ws-art-001-04a1-legacy-intake-removal

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

WS-ART-001-04A1 PR Trust Bundle

Chunk

WS-ART-001-04A1 — Legacy Contributor Intake Removal (L1)

Goal and approved intent

Remove the inactive multi-step contributor upload-session/item path before the
one-outer-ZIP submission pipeline is built. Preserve historical evidence by
refusing populated deployments; do not translate, detach, delete, or fabricate
legacy lineage.

What changed and why

  • Removed legacy upload session/item ORM records, contributor admission request
    and dispatch, repository lookups, and shared mutation branches.
  • Narrowed put-attempt and receipt constraints to current guide/checker
    producers only.
  • Added migration 0051_legacy_intake_removal: exclusive-lock preflight,
    atomic populated refusal, safe-empty removal, and exact empty downgrade.
  • Replaced useful generic contributor-fixture coverage with guide and
    task-scoped checker-output proofs.
  • Updated current specification, glossary, decisions, and operator deployment
    guidance.

Design and rejected alternatives

Chosen: a complete safe-empty clean cut. Rejected: detached compatibility
columns, inferred backfill, automatic deletion, dual runtime paths, and adding
the replacement submission route in this chunk.

Scope and product behavior

No public contributor intake is added. Existing guide and checker storage,
verification, and recovery behavior remains available. A deployment with any
legacy intake evidence remains on 0050_guide_source_v2 and requires separately
approved maintenance work.

Acceptance proof

  • Empty 0050 -> 0051 -> 0050 -> 0051 round trip passed with exact physical
    schema comparison.
  • All six populated preflight predicates refused atomically.
  • Direct contributor producer and v1 receipt mutations were rejected.
  • OpenAPI contains neither retired routes nor the future submission-bundle
    surface.
  • Guide/checker put, missing, mismatch, verification, stale-race, retry,
    concurrency, and recovery lineage tests passed.

CI and test integrity

No CI, threshold, dependency, or package-script changes. Ruff, stale scans,
Markdown links, and diff checks pass. Contributor-specific tests were removed;
their surviving generic guarantees were re-established on current producers.

Reviewer results and external review

Architecture, security, QA, product/operations, senior engineering,
documentation, reuse, and test-delta reviews pass. Hosted GitHub Backend/Agent
Gates and CodeRabbit remain pending when this bundle is written.

Remaining risks and follow-up

  • Populated deployments intentionally cannot apply 0051 without separately
    approved maintenance/audit work.
  • The replacement one-ZIP preparation begins only in the next approved ART
    chunk; 04A1 creates no submission behavior.

Human review focus and merge ownership

Confirm the preflight predicates, exact downgrade shape, absence of a
replacement route, and the replacement checker/guide coverage. Human approval
is required for merge; the agent will not merge this PR.

Summary by CodeRabbit

  • Changes

    • Removed the legacy contributor upload intake flow and related staging records.
    • Artifact admissions now support guide and checker-output sources only.
    • Strengthened receipt and artifact tracking requirements for reliable verification and recovery.
    • Added safe migration handling that refuses changes when incompatible legacy data is present.
    • Updated recovery, verification, and operational behavior to use the current immutable artifact workflow.
  • Documentation

    • Updated artifact storage specifications, glossary, decisions, and migration guidance.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes legacy contributor upload intake from artifact models, admission, repository, service, and routes. It adds migration 0052_legacy_intake_removal with populated-data refusal and empty-schema downgrade support. Tests now cover migration, architecture, checker-output admission, recovery, and operator retries.

Changes

Artifact intake removal

Layer / File(s) Summary
Removal contract and state semantics
.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/*, docs/*
Updates the initiative contract, durable state semantics, specifications, operations guidance, glossary, and review evidence for legacy intake removal.
Runtime contract and lifecycle removal
backend/app/db/models.py, backend/app/modules/artifacts/*, backend/tests/test_artifact_authorization.py
Removes contributor admission, upload-session/item models, repository methods, upload-item lifecycle updates, and legacy receipt contracts. Guide and checker-output producers remain supported.
Safe-empty schema migration
backend/alembic/versions/0052_legacy_intake_removal.py, backend/tests/test_alembic.py, backend/tests/conftest.py, backend/tests/test_artifacts.py, backend/tests/test_review_queue_persistence.py
Adds locked atomic refusal for populated legacy data, removes legacy tables and columns on upgrade, and recreates the exact empty legacy schema on downgrade.
Validation and recovery coverage
backend/tests/test_artifact_architecture.py, backend/tests/test_artifact_admission.py, backend/tests/test_artifact_recovery.py, backend/tests/test_artifact_operator_api.py
Adds route and stale-symbol checks, checker-output lifecycle coverage, submission-linked recovery requests, and operator retry coverage.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant Migration0052
  participant PostgreSQL
  Operator->>Migration0052: Run upgrade
  Migration0052->>PostgreSQL: Lock legacy intake tables
  PostgreSQL-->>Migration0052: Check legacy rows and references
  Migration0052->>PostgreSQL: Remove legacy schema if checks are empty
  PostgreSQL-->>Operator: Commit revision 0052
Loading

Possibly related PRs

Suggested reviewers: abiorh-claw

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed and relevant, but it omits several required template sections and incorrectly names migration 0051 instead of 0052. Align the description with the required trust-bundle template, add commands and reviewer tables, and correct all migration references to 0052_legacy_intake_removal.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.37% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the removal of the legacy contributor intake path.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-art-001-04a1-legacy-intake-removal

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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
backend/tests/test_artifact_recovery.py (1)

63-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the shared checker-output helper into a helper module.

Line 65 imports the module-private _admit_checker_output from another test module. The repository already has a shared helper module, tests/artifact_store_helpers.py, used on line 64. A test-to-test import couples collection order between test_artifact_recovery.py and test_artifact_admission.py, and it re-executes the other module at import time.

Move _admit_checker_output and its dependency _seed_checker_output_relationships into a shared helper module, then import both test modules from there.

♻️ Proposed import change after moving the helpers
 from tests.artifact_store_helpers import artifact_admission_limit_settings, minted_source
-from tests.test_artifact_admission import _admit_checker_output
+from tests.artifact_checker_helpers import admit_checker_output
🤖 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/tests/test_artifact_recovery.py` around lines 63 - 65, Move the
shared helpers _admit_checker_output and _seed_checker_output_relationships from
tests/test_artifact_admission.py into tests/artifact_store_helpers.py,
preserving their behavior and dependencies. Update both
test_artifact_admission.py and test_artifact_recovery.py to import these helpers
from artifact_store_helpers, and remove the test-to-test import and duplicate
definitions.
backend/app/modules/artifacts/models.py (1)

844-856: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Align put_attempt_id nullability with the CHECK.

contract_producer_reference requires put_attempt_id is not null, but ArtifactOperationReceipt.put_attempt_id is still declared as Mapped[str | None] without nullable=False. Add nullable=False and change the type to Mapped[str] with a matching Alembic alteration once a live not-null transition is needed.

🤖 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/models.py` around lines 844 - 856, Update
ArtifactOperationReceipt.put_attempt_id to Mapped[str] with nullable=False so
its SQLAlchemy declaration matches the contract_producer_reference CHECK
constraint, and add the corresponding Alembic schema alteration for the database
column.
🤖 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 `@backend/tests/test_artifact_recovery.py`:
- Around line 341-345: Remove all test assignments and reads of the unmapped
ArtifactVerificationJob.recovery_submission_id in
backend/tests/test_artifact_recovery.py at lines 341-345, 362-366, 501, and 749;
use the corresponding recovery attempt’s submission_id when constructing or
validating recovery requests, preserving the existing recovery flow.

---

Nitpick comments:
In `@backend/app/modules/artifacts/models.py`:
- Around line 844-856: Update ArtifactOperationReceipt.put_attempt_id to
Mapped[str] with nullable=False so its SQLAlchemy declaration matches the
contract_producer_reference CHECK constraint, and add the corresponding Alembic
schema alteration for the database column.

In `@backend/tests/test_artifact_recovery.py`:
- Around line 63-65: Move the shared helpers _admit_checker_output and
_seed_checker_output_relationships from tests/test_artifact_admission.py into
tests/artifact_store_helpers.py, preserving their behavior and dependencies.
Update both test_artifact_admission.py and test_artifact_recovery.py to import
these helpers from artifact_store_helpers, and remove the test-to-test import
and duplicate definitions.
🪄 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: 2329652d-a0cc-417d-9d99-f05fc6ab0599

📥 Commits

Reviewing files that changed from the base of the PR and between 2feaf47 and 9c8935c.

📒 Files selected for processing (23)
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/CHUNK_MAP.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/DECISIONS.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/DISCOVERY.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/PLAN.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/chunks/WS-ART-001-04A1-legacy-contributor-intake-removal.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-04A1-internal-review-evidence.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-04A1-pr-trust-bundle.md
  • backend/alembic/versions/0051_legacy_intake_removal.py
  • backend/app/db/models.py
  • backend/app/modules/artifacts/models.py
  • backend/app/modules/artifacts/repository.py
  • backend/app/modules/artifacts/schemas.py
  • backend/app/modules/artifacts/service.py
  • backend/tests/conftest.py
  • backend/tests/test_alembic.py
  • backend/tests/test_artifact_admission.py
  • backend/tests/test_artifact_architecture.py
  • backend/tests/test_artifact_authorization.py
  • backend/tests/test_artifact_recovery.py
  • docs/decision_0013_immutable_artifact_storage_boundary.md
  • docs/glossary.md
  • docs/operations_artifact_storage.md
  • docs/spec_artifact_storage_service.md
💤 Files with no reviewable changes (5)
  • docs/glossary.md
  • backend/tests/test_artifact_authorization.py
  • backend/app/db/models.py
  • backend/app/modules/artifacts/service.py
  • backend/app/modules/artifacts/repository.py

Comment thread backend/tests/test_artifact_recovery.py
@abiorh-claw
abiorh-claw self-requested a review August 4, 2026 07:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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-04A1-pr-trust-bundle.md:
- Around line 20-21: Synchronize the acceptance proof’s migration revision with
the reconciled migration identified in the external review response: replace the
stale 0050 → 0051 → 0050 → 0051 sequence with 0052_legacy_intake_removal or the
established HEAD_REVISION symbol, while preserving the surrounding proof.
🪄 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: a9401505-bdc2-4a63-aba1-d79542a95e42

📥 Commits

Reviewing files that changed from the base of the PR and between 7ee7988 and df9077e.

📒 Files selected for processing (11)
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-04A1-external-review-response.md
  • .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-04A1-pr-trust-bundle.md
  • backend/alembic/versions/0052_legacy_intake_removal.py
  • backend/app/db/models.py
  • backend/app/modules/artifacts/models.py
  • backend/tests/conftest.py
  • backend/tests/test_alembic.py
  • backend/tests/test_artifact_operator_api.py
  • backend/tests/test_artifact_recovery.py
  • backend/tests/test_artifacts.py
  • backend/tests/test_review_queue_persistence.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • backend/app/db/models.py
  • backend/tests/test_artifact_operator_api.py
  • backend/app/modules/artifacts/models.py

Comment on lines +20 to +21
- Added migration `0052_legacy_intake_removal`: exclusive-lock preflight,
atomic populated refusal, safe-empty removal, and exact empty downgrade.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Synchronize the migration revision in the acceptance proof.

This section names 0052_legacy_intake_removal. Line 42 still records 0050 -> 0051 -> 0050 -> 0051, while .agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-04A1-external-review-response.md Lines 45-56 identifies 0052_legacy_intake_removal as the reconciled migration. Update the proof to use 0052_legacy_intake_removal or HEAD_REVISION. Otherwise, reviewers can validate the wrong migration path.

Proposed documentation fix
-- Empty `0050 -> 0051 -> 0050 -> 0051` round trip passed with exact physical
+- Empty `0050_guide_source_v2 -> HEAD_REVISION (0052_legacy_intake_removal) ->
+  0050_guide_source_v2 -> HEAD_REVISION` round trip passed with exact physical
🤖 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
@.agent-loop/initiatives/WS-ART-001-immutable-artifact-storage/reviews/WS-ART-001-04A1-pr-trust-bundle.md
around lines 20 - 21, Synchronize the acceptance proof’s migration revision with
the reconciled migration identified in the external review response: replace the
stale 0050 → 0051 → 0050 → 0051 sequence with 0052_legacy_intake_removal or the
established HEAD_REVISION symbol, while preserving the surrounding proof.

@abiorh-claw
abiorh-claw merged commit b47a7e6 into main Aug 4, 2026
10 checks passed
@abiorh-claw
abiorh-claw deleted the codex/ws-art-001-04a1-legacy-intake-removal branch August 4, 2026 08:24
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.

2 participants