Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ atomicity.
truncation, changed bytes, missing object, range read, timeout, throttle,
broker failure, periodic republish, duplicate Celery delivery, expired lease,
stale finalization, and cross-resource authorization all have tests.
- New or changed backend subsystems remain at least 90 percent covered; the
- New or materially changed backend subsystems remain at least 90 percent covered; the
repository baseline cannot decrease.
- The 15 implementation chunk contracts define one ordered deterministic
coverage table. Backend CI first runs the one exact full-suite
Expand All @@ -542,11 +542,23 @@ atomicity.
changes only reports for newly owned surfaces; it never freezes a partial
test list for a package that later expands. Independently executable
services/examples have their own exact test-and-coverage steps.
- The active artifact implementation coverage phase advances only after
`scripts/test_agent_gates.py` proves each expected step occurs exactly once in
the backend `test` job, after the full-suite test step, without job/step
conditions, `continue-on-error`, shell overrides, hidden step environment, or
working-directory drift. Raw text or source-set matching is insufficient.
- A narrow composition change in a subsystem that the chunk does not materially
own does not create a new whole-subsystem gate over inherited code. Its new
behavior must instead be exercised by focused tests and the repository
baseline, while the owning subsystem's files retain their 90 percent gate.
For 03A, the hidden project route, response schema, and staging relation are
narrow ART composition surfaces exercised by guide-ingest tests and repository
coverage; ART-owned files remain enforced by the ART foundation gate. Merged
AUTH 11B's broader projects package remains outside
03A and measured 71.54 percent when the proposed whole-project gate first ran.
A later chunk that materially owns projects must close that debt before adding
the projects 90 percent report; 03A may not claim or bypass such a report.
- When a chunk adds a newly owned coverage report, the active artifact
implementation phase advances only after
`scripts/test_lightweight_agent_gates.py` proves that command and step name
occur exactly once in the backend workflow. 03A adds no new coverage report;
hosted CI remains the authoritative proof that its retained repository, ART,
and pre-existing subsystem gates execute without bypass configuration.
- Final proof uses real HTTP APIs and visible job/recovery endpoints, not direct
database inspection.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,83 @@
# Review Log: WS-ART-001 Immutable Artifact Storage

## WS-ART-001-03A

- Reconciled on 2026-07-28 with trusted `main` `033654ac`, after merged
WS-XINT-002-01 through 04 planning, internal-service activation, and AUTH 11B
project identity/read context.
- Preimplementation reconciliation review rejected the preserved raw
`AuthorizationContext`, custom evidence, and callback revalidation seam. The
repair uses only the merged opaque `PreparedAuthorizationHandle` operation
contract and one request-local PREP adapter lifecycle.
- The route-facing command performs Project Manager preflight before body read,
scratch construction, or provider runtime. Production remains deny-only
while `artifact.guide_source.ingest` is planned.
- Transaction A locks canonical project/guide/snapshot/item lineage, consumes
the issuer-local handle against server-computed digest, byte count, and media
type, stages non-authoritative `GuideSourceArtifactIngest`, reserves capacity,
and creates put intent atomically. Provider I/O remains after commit.
- Migration `0038_guide_source_ingest` follows the merged `0037`
authorization evidence head. Binding, reads, setup activation,
materialization, and action availability remain outside 03A.
- Final internal review: senior engineering PASS WITH LOW RISKS; architecture
PASS WITH LOW RISKS; QA PASS WITH LOW RISKS; security/auth PASS WITH LOW
RISKS; product/ops PASS; reuse/dedup PASS WITH LOW RISKS; CI integrity PASS
WITH LOW RISKS; test delta PASS; docs PASS. All blocking findings were
repaired before PR creation.
- Repairs include commit-before-provider execution, activated fixed-service
put-resolver composition, confirmed-missing replay with capacity
reacquisition, concealed request-metadata validation, populated downgrade
refusal, and preservation of existing hosted coverage gates.
- Initial hosted Backend run `30360132709` failed before execution because the
new guide test module lacked semantic-lane custody. The bounded repair assigns
it to `shared_foundations` and makes that ownership an exact regression;
local canonical lane collection and CI/test-delta re-review pass.
- Hosted rerun `30360448433` cleared lane collection/validation and executed all
lanes, then schema custody rejected the pre-constraint expected fingerprint.
The exact hosted canonical fingerprint after the SHA-256 check constraint is
now recorded; no schema or runtime behavior changed in that repair.
- Hosted run `30360906515` then executed 1,618 tests: 1,615 passed and three
stale test fixtures failed. The bounded repair supplies complete guide
lineage to the real admission proof, uses the pre-staging lineage lock helper
for its intended test, and adds the new optional lineage fields to the quota
unit fixture. Production code is unchanged by this repair.
- Hosted run `30361748346` proved all 1,618 shared, 236 project, and 217 task
tests pass. Its sole failure was asyncpg rejecting the populated-downgrade
test's multi-command prepared seed. The seed now executes six parameterized
statements in one transaction; the exact isolated migration test passes.
- Hosted run `30363061162` again proved all shared, project, and task tests pass.
Its sole schema failure was the migration fixture omitting the identity link
now required for every human actor. The fixture creates the canonical active,
verified link, and the exact isolated migration test passes.
- Hosted run `30364425613` passed every semantic lane, API E2E, and repository
coverage, then measured the unchanged artifact-foundation gate at 89.77%.
Focused tests now cover absent/missing/resolved replay selection and the
fail-closed missing PREP transaction boundary; no threshold or production
behavior changed.
- The final rebase preserved AUTH 11B project-read dependencies alongside the
hidden ART route. Senior, QA, security/auth, and CI-integrity reconciliation
reviews passed with no blockers.
- Rebased hosted run `30366469273` passed all lanes, API E2E, and repository
coverage, raising artifact-foundation coverage to 89.87%. Additional focused
tests cover invalid-role rejection before preparation and cleanup when PREP
commit fails; production and the 90% threshold remain unchanged.
- Hosted run `30367711119` again passed all lanes, API E2E, and repository
coverage, raising artifact-foundation coverage to 89.98%. A focused boundary
proof now covers fail-closed partial guide lineage claims; production and the
90% threshold remain unchanged.
- Hosted run `30369062154` remained at 89.98% after one repository branch varied
between runs. A deterministic deny-only seam test now proves the default 04A
selector rejects final PREP consumption, providing margin without changing
production or the threshold.
- Hosted run `30370291310` passed artifact-foundation coverage, then failed only
the ART-added whole-projects gate against merged AUTH 11B's unrelated 71.54%
project coverage. The new out-of-scope gate and its self-test were removed;
repository and every pre-existing subsystem gate remain unchanged.
- Final CodeRabbit review findings were triaged separately. Valid bootstrap
cleanup, route exception-boundary, exact exception, typed digest, and result
contract findings were repaired with focused tests. Reuse/query optimizations
were deferred; PREP transaction duration remains an AUTH 04A activation gate.

## WS-ART-001-02D

- Signed explicit start verified on 2026-07-22 against trusted main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,25 @@ coverage report --include='app/adapters/artifacts/s3_compatible.py' --precision=
coverage report --include='app/core/s3_validation.py' --precision=2 --fail-under=90
coverage report --include='app/modules/audit/*' --precision=2 --fail-under=90
coverage report --include='app/api/router.py' --precision=2 --fail-under=90
coverage report --include='app/modules/projects/*' --precision=2 --fail-under=90
```

03A's project-router change is composition glue for an ART-owned hidden route,
exercised by focused tests and repository coverage, not a material
project-subsystem change. ART-owned files remain enforced by the ART foundation
gate. The whole-projects 90 percent gate is
therefore outside 03A; after merged AUTH 11B it measures unrelated inherited
project code at 71.54 percent. Repository coverage, artifact-foundation 90
percent coverage, and every pre-existing subsystem gate remain mandatory.

## Verification

```bash
docker compose up -d --wait postgres redis minio
(cd backend && WORKSTREAM_TEST_DATABASE_URL=postgresql+asyncpg://workstream:workstream@localhost:5433/workstream_test .venv/bin/pytest tests/test_alembic.py tests/test_guide_artifacts.py tests/test_artifact_admission.py tests/test_artifact_put_resolution.py tests/test_artifact_verification.py -q --cov=app.modules.projects --cov=app.modules.artifacts --cov-report=term-missing --cov-fail-under=90)
(cd backend && WORKSTREAM_TEST_DATABASE_URL=postgresql+asyncpg://workstream:workstream@localhost:5433/workstream_test .venv/bin/pytest tests/test_alembic.py tests/test_guide_artifacts.py tests/test_artifact_admission.py tests/test_artifact_put_resolution.py tests/test_artifact_verification.py -q --cov=app.modules.artifacts --cov-report=term-missing --cov-fail-under=90)
(metadata_dir="$(mktemp -d)" && trap 'rm -rf "$metadata_dir"' EXIT && (cd backend && WORKSTREAM_TEST_ADMIN_DATABASE_URL=postgresql+asyncpg://workstream:workstream@localhost:5433/postgres .venv/bin/python scripts/run_isolated_tests.py --metadata-json "$metadata_dir/result.json" --timeout-seconds 12600 -- .venv/bin/python -m pytest -q --ignore=tests/test_isolated_database_runner.py --cov=app --cov-report=term-missing --cov-fail-under=78))
(cd backend && .venv/bin/ruff check app tests)
python3 scripts/check_stale_artifact_contracts.py
python3 scripts/test_agent_gates.py
PYTHONPATH=. python3 scripts/test_lightweight_agent_gates.py
```

## Required Reviewers
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# WS-ART-001-03A External Review Response

Reviewed at: `2026-07-28`

## Comments Addressed

- Bootstrap cleanup now closes an already-created provider bootstrap when
scratch-manager construction fails; a focused test proves the failure path.
- Route UUID parsing is isolated from ingest execution, so malformed request
identifiers remain concealed while an unrelated implementation `ValueError`
is no longer converted to `404`; both outcomes have focused tests.
- The invalid logical-role test now asserts the exact
`ArtifactAdmissionRelationshipError` contract.
- The prepared-request digest now exposes the same five explicit keyword-only
UUID parameters as its canonical request-value helper.
- Artifact operation structural checks now apply forbidden provider fields to
canonical result classes as well as request classes.

## Comments Deferred

- Consolidating three small prepared-authorization test doubles is a reuse-only
cleanup with no behavior or security effect; retain local test ownership in
03A and revisit if the fake contract changes.
- Passing the already-locked lineage into staging would remove one same-
transaction query but is an optimization, not a correctness repair.
- The PREP transaction remains bounded by the canonical scratch deadline while
guide ingest is hidden and deny-only. AUTH `WS-XINT-002-04A` must review the
transaction/read duration before activation; 03A does not activate the
action or introduce a second authorization path.
- The comment about strengthening the removed project-coverage self-test is
obsolete after the reviewed 03A coverage-ownership reconciliation.

## Human Decisions Needed

None for 03A. Activating guide ingestion remains the explicit AUTH 04A gate.

## Commands Rerun

```text
python3 -m ruff check app/adapters/artifacts/__init__.py app/modules/projects/router.py app/modules/artifacts/authorization.py tests/test_guide_artifacts.py tests/test_artifact_architecture.py
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python3 -m pytest -q -p pytest_asyncio.plugin tests/test_guide_artifacts.py tests/test_artifact_architecture.py
python3 scripts/check_markdown_links.py
git diff --check
```

## Remaining Risks

- Guide ingestion remains intentionally unavailable until AUTH 04A installs
and proves the exact adapter.
- The transaction-duration observation is an activation concern, not a live
production exposure in 03A.
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Internal Review Evidence: WS-ART-001-03A

Reviewed against trusted main: `033654ac129eea05e0f00176257c94e6b3447dcf`

Reviewed at: `2026-07-28`

## Candidate

Hidden, fail-closed guide-source byte ingest through the existing bounded
scratch, admission, immutable put, verification, and publication path. The
guide ingest action remains planned and unavailable pending AUTH 04A.

## Deterministic Evidence

- changed-file Ruff and Python compilation: PASS;
- `tests/test_guide_artifacts.py`: PASS, 9 tests;
- artifact architecture tests: PASS, 11 tests;
- isolated PostgreSQL migration replay/populated downgrade refusal: PASS;
- isolated PostgreSQL admission, lineage mismatch, transaction boundary, and
confirmed-missing replay/capacity reacquisition: PASS;
- stale wording, artifact/auth contract, Markdown link, diff, and lightweight
agent gates: PASS;
- full repository Ruff currently reports four unchanged `app/core/config.py`
F821 findings already present on trusted main; no ART file fails Ruff;
- full sharded suite and 78/90 percent coverage remain hosted GitHub gates to
avoid loading the user's machine.
- initial hosted Backend run `30360132709` exposed missing semantic-lane
ownership for the new test module; the repair assigns it to
`shared_foundations`, strengthens the lane regression, and passes canonical
collect-only validation.
- hosted rerun `30360448433` reached lane execution and identified only the
expected-schema fingerprint stale after the SHA-256 constraint was added;
the guard now records GitHub's canonical migrated-schema fingerprint.
- hosted run `30360906515` executed 1,618 tests with 1,615 passing and exposed
three stale fixtures for complete guide lineage/staged facts. Those fixtures
now exercise the intended exact-lineage boundaries; production is unchanged.
- hosted run `30361748346` passed all shared (1,618), project (236), and task
(217) tests. Schema passed 91/92; the sole failure was a multi-command asyncpg
test seed, now split into six transactional statements with isolated proof.
- hosted run `30363061162` again passed all shared (1,618), project (236), and
task (217) tests. Schema passed 91/92; its sole failure was that the migration
fixture did not create the identity link now required for every human actor.
The fixture now creates the canonical active, verified link, and the exact
isolated migration proof passes.
- hosted run `30364425613` passed all four semantic lanes, the API E2E proof,
and repository coverage. The unchanged 90% artifact-foundation gate measured
89.77%; focused production-path tests now cover absent/missing/resolved replay
selection and fail-closed missing PREP transaction behavior without changing
production code or the threshold.
- The final rebase onto merged AUTH 11B preserved both the new project-read
authorization dependencies and hidden ART ingest wiring. Bounded senior,
QA, security/auth, and CI-integrity reconciliation reviews passed.
- rebased hosted run `30366469273` passed all semantic lanes, API E2E, and
repository coverage, and raised artifact-foundation coverage to 89.87%.
Additional focused proofs cover rejection before preparation for an invalid
guide logical role and scratch cleanup when PREP commit itself fails.
- hosted run `30367711119` passed all semantic lanes, API E2E, and repository
coverage, raising artifact-foundation coverage to 89.98%. A final focused
boundary proof exercises fail-closed rejection of partial guide lineage
claims; production code and the 90% gate remain unchanged.
- hosted run `30369062154` again measured 89.98% because one repository branch
varied between lane runs. A deterministic deny-only seam proof now verifies
that the default 04A selector rejects final PREP consumption, adding coverage
margin without changing production or the gate.
- hosted run `30370291310` passed artifact-foundation coverage, then exposed the
ART-added whole-projects gate measuring merged AUTH 11B's unrelated project
debt at 71.54%. That new out-of-scope gate and its self-test were removed;
repository and every pre-existing subsystem gate remain unchanged.

## Reviewer Results

| Reviewer | Result | Blocking findings |
|---|---|---|
| senior engineering | PASS WITH LOW RISKS | none |
| architecture | PASS WITH LOW RISKS | none |
| QA/test | PASS WITH LOW RISKS | none |
| security/auth | PASS WITH LOW RISKS | none |
| product/ops | PASS | none |
| reuse/dedup | PASS WITH LOW RISKS | none |
| CI integrity | PASS WITH LOW RISKS | none |
| test delta | PASS | none |
| docs | PASS | none |

## Material Repairs

- replaced raw durable authorization with the merged opaque PREP handle;
- kept preflight, final lineage/fact consumption, capacity, and put intent in
one root transaction, with provider I/O only after commit;
- composed post-commit writes through the activated fixed-service put resolver;
- made confirmed-missing exact replay reacquire capacity and write again;
- concealed missing/malformed idempotency metadata without invoking ingest;
- refused populated migration downgrade and preserved existing coverage gates.

## Accepted Low Risks

- The explicit PREP context-manager handoff is delicate but bounded and covered
for active/committed ordering and scratch cleanup.
- Lower-level admission tests use process-local fake opaque handles; production
uses the merged issuer-local PREP implementation.

Valid findings addressed: yes

Open sub-agent sessions: none
Loading
Loading