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
@@ -1,13 +1,14 @@
# Status

- Initiative state: AUTH module-boundary recovery active
- Current branch: `codex/ws-auth-003-01-boundary-foundation`
- Base: `origin/main` at `aa0854ad`
- Current consumer repair branch: `codex/ws-pol-003-03a-hidden-compilation-resume`
- Foundation merge: PR #305 at `3c260e20`
- Current chunk: `WS-AUTH-003-01` boundary foundation
- Chunk state: AUTH boundary foundation awaiting human merge
- Implementation: focused deterministic proof, required internal/external
review repairs, and exact-head hosted CI passed
- Chunk state: AUTH boundary foundation merged through PR #305
- Implementation: public boundary foundation is merged; incremental capability
repair is active through POL-03A
- Current import debt: inventoried in `IMPORT_LEDGER.md`
- POL-03A: preserved separately at `1a7242f2`; first incremental repair after foundation merge
- POL-03A: active on a fresh branch from merged main; preserved WIP `1a7242f2`
is reference evidence only and will not be replayed wholesale
- REV rule: no private AUTH/ART import exception at `allow_reviews`
- Human approval required: review and merge the completed foundation PR after hosted gates pass
- Human approval required: review and merge each incremental capability repair
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@
},
{
"capability": "unassigned_legacy_auth",
"content_sha256": "291531995acdf513a50a726b108462730ec3f5f5004bc541b1c03f3ca0be6212",
"end_line": 14097,
"content_sha256": "a22db9cfc5dc48abeb980b4dab760748caffd9ef9894dc20e388ce10ba423f80",
"end_line": 14093,
"hard_limit": 1200,
"kind": "test_file",
"observed_lines": 14097,
"observed_lines": 14093,
"path": "backend/tests/test_alembic.py",
"qualified_symbol": null,
"removal_chunk": "WS-AUTH-003-CLOSE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ determine transient implementation ownership.
| Canonical CHECKER/POL post-submit registry | POL-01 | Present; remaining POL-002 work must be reframed as executor ownership, not inference |
| POL-01 strict manifest | POL-02 | Merged PR #299 |
| POL-02 adapter | POL-03A | Merged PR #301 |
| Hidden POL-03A compilation manifest | AUTH-12I compilation request/execute activation | Proposed |
| Hidden POL-03A compilation manifest | AUTH-12I compilation request/execute activation | Active; not merged |
| AUTH-12I | POL-03B authorized persistence | Not yet implemented |
| Hidden POL-04A unified setup-service manifest | AUTH-12B2 setup-ledger activation | Not yet implemented |
| Hidden POL-05A approval manifest | AUTH-12F4 approval activation | Not yet implemented |
Expand All @@ -45,6 +45,6 @@ before any is started, its contract must be expanded on then-current main with
explicit allowed/not-allowed paths, runnable verification commands, and named
reviewer tracks. They cannot authorize implementation in their current form.

The next dependency-ordered boundary is `WS-POL-003-03A`. It and later chunks
and corresponding AUTH gates remain planned and inactive until
their exact dependencies and executable contracts are current.
`WS-POL-003-03A` is the active dependency-ordered boundary. Its executable
contract was reconciled on merged AUTH boundary foundation before
implementation. Later chunks and AUTH gates remain planned and inactive.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# WS-POL-003-03A External Review Response

## Comments addressed

- All five substantive CodeRabbit threads were validated and corrected:
compilation attempt states are subsystem-specific; repository failures expose
one domain hierarchy with a retryable lineage-race subtype; the canonical
execute digest has explicit behavior ownership; deny-only coroutines are
created inside their assertion scopes; and local PostgreSQL uses CI's exact
image digest.
- Valid review-body findings were also corrected: explicit public-fact test
construction, canonical-result equality, shared component-hash constraint
composition, full-result-hash coverage, fresh ORM reloads, fixed-service
narrowing, migration cleanup safety and schema-scoped trigger inspection,
and application/database terminal-code parity.
- Initial exact-head GitHub backend lanes all stopped at the shared docstring
gate before test execution. The nine new repository callables and six
deny-only authorization methods now document their exact responsibilities;
repository-wide docstring coverage is 80.4 percent, above the unchanged 80
percent docstring gate. This is distinct from the 78 percent repository test
coverage floor.
- On the corrected head, four semantic lanes passed. `schema_contracts_a`
exposed a stale 0049 round-trip assertion: it stripped only 0049 action
tokens before comparing the current head to 0048. The assertion now also
strips 0062's exact, independently tested compilation action token. Migration
behavior and database guards are unchanged.
- The first assertion-fix head was rejected by the zero-growth preflight because
it expanded the already oversized historical migration test. The correction
was reformatted to shrink that file from 14,096 to 14,093 lines; the debt
ledger records only that exact shrink and new content hash. CI-integrity
re-review and canonical structure validation pass with no exception or new
debt.

## Comments deferred

- The suggested `NOT VALID` rewrite for the three `audit_events` constraints was
not applied. Migration 0062 deliberately locks and rewrites all three closed
registries in one transaction so no observer can see a partial catalogue.
PostgreSQL retains the `ACCESS EXCLUSIVE` lock until that transaction commits,
so adding and validating `NOT VALID` constraints inside the same transaction
would not shorten the lock and would weaken the single atomic registry change.
- Test-only fixture consolidation suggestions are recorded as non-functional
cleanup, not mixed into this security correction; every affected test retains
explicit engine cleanup and focused behavior ownership.
- The request to express internal engineering reviewer results as
`accept`/`needs_revision`/`reject` was not applied. Those values are reserved
for Workstream product review decisions; engineering review evidence remains
pass/fail with residual risk recorded separately, as required by `AGENTS.md`.

## Human decisions needed

- None for this correction. Human merge approval remains required after all
exact-head checks and external review complete.

## Commands rerun

- Scoped Ruff for both corrected modules.
- Repository `docstr-coverage --config .docstr.yaml`.
- Test-structure validation and diff integrity.
- Focused 0062 migration-contract tests: 2 passed against PostgreSQL.
- Final isolated guide-compilation suite: 31 passed with 93.08 percent package
coverage against the unchanged 90 percent floor.
- Structure, behavior-ownership, and lane-inventory regression bundle: 161
passed.
- Test-delta re-review: pass; the historical assertion still requires both the
0049 and 0062 additions exactly twice and rejects all other definition drift.
- Hosted schema lane on the corrected head.

## Remaining risks

- GitHub must rerun every backend lane and coverage gate on the corrected head.
- CodeRabbit must receive the corrective head and every resolved thread must be
verified through the thread-aware API before merge readiness.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# WS-POL-003-03A Internal Review Evidence

Date: 2026-08-10. Risk: L1.

## Deterministic evidence

- Real-PostgreSQL focused compilation suite: 31 passed after external-review
corrections.
- New guide-compilation subsystem coverage: 93.08 percent, above the required
90 percent floor.
- Focused AUTH boundary, structure, behavior-ownership, and public contract
proof: passed; reviewer run recorded 184 passing tests.
- Structure-boundary regression suite: 25 passed after explicitly placing
every POL-03A production and test file inside the zero-growth/skip gate.
- Hosted-style semantic-lane collection: 3,764 tests collected and exact lane
evidence validated; lane inventory regression suite: 34 passed.
- Empty upgrade/downgrade, non-empty downgrade refusal, real trigger,
concurrency, replay, immutability, and crash-recovery tests passed.
- Scoped Ruff, authorization boundary, test structure, behavior ownership,
stale wording, Markdown links, and diff integrity checks passed.
- GitHub now preserves the repository-wide 78 percent gate and adds an exact
90 percent guide-compilation subsystem gate. No workflow failure policy or
threshold was weakened.

## Review results

- Architecture: pass; the new Projects package depends only on the
dependency-free AUTH public API and creates no competing protocol or live
cross-module path.
- Security/authorization: pass after exact canonical resource-context digest,
fixed service profile/link, action, permission, project, attempt, and audit
evidence binding were enforced at the database boundary.
- QA: pass; exact attempt identity, crash replay, append-only root/child CAS,
concurrent fork prevention, stale predecessor denial, state shapes, guarded
downgrade, and hidden deny-only behavior are covered.
- Product/operations: pass; `provider_result_accepted` remains provider-result custody only and
creates no approval, activation, review, payment, contribution, or reputation
truth.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- Senior engineering: pass; package files remain below structural limits and
the unsafe evidence-fixture default was removed.
- Test delta: pass; tests are additive, behavior-focused, and contain no skip,
xfail, or weakened assertion path.
- CI integrity: pass after all focused tests entered the semantic-lane and
structure inventories and the hosted 90 percent coverage gate was added.
- Docs: pass after documenting that downgrade is empty-only and otherwise
requires forward recovery or separately reviewed destructive cleanup.
- Reuse/dedup: pass; keeping the public digest implementation dependency-light
and the fixed service literal inside the boundary avoids introducing a
private cross-module dependency.

Fresh corrective reviews after the CodeRabbit findings:

- Architecture: pass with low risks; the suggested distinction for unexpected
storage failures was implemented as `GuideCompilationStorageError` while one
repository-domain base remains catchable.
- Security: pass; state, authority evidence, lineage, migration, and deny-only
behavior remain fail closed.
- QA: pass with low risks; the required PostgreSQL suite subsequently passed
locally against a runner-owned isolated database.
- Test delta: initial fail was corrected, then pass with low risks after live
migrated-vocabulary proof, deterministic DB-error classification, and
trigger-cause plus durable-state assertions were added.
- CI integrity: pass with low risks; no threshold, failure policy, lane, lint,
or test gate was weakened, and local PostgreSQL now matches CI's exact image.
- Senior engineering: pass with low risks; its live-migration parity concern is
covered by the new `pg_get_constraintdef` and direct rejection test.

All valid findings were corrected and re-reviewed. No internal reviewer session
remains open; external CodeRabbit thread verification is tracked separately in
the external review response.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# WS-POL-003-03A PR Trust Bundle

## Goal and design

Install hidden, immutable custody for one logical unified project-guide
compilation attempt per exact setup generation. Reservation persists before any
future provider I/O, uncertainty retains the same provider key, accepted output
survives a crash before projection, and append-only predecessor CAS prevents a
current-compilation fork.

The new Projects package is isolated from broad legacy project services. Its
only authorization dependency is a dependency-free public AUTH facts/port
module. The project-side adapter denies every operation in this chunk; no
action is activated and no route, worker, provider call, policy projection, or
live product behavior is added.

## Protected custody

- Exact attempt identity binds project, guide, source, setup generation,
canonical inputs, catalogue snapshots, agent/instruction versions, operation,
request, and one derived provider idempotency key.
- Accepted output is canonical, bounded, and revalidated against complete and
component hashes before immutable persistence.
- A compilation requires matching allowed audit evidence for the exact actor,
active fixed service profile/link, execute action, permission, attempt,
project, and canonical resource-context digest.
- Database triggers reject illegal state transitions, mutation, deletion,
truncation, stale predecessor use, concurrent forks, unrelated evidence, and
non-empty downgrade.

## Scope and non-goals

The change adds migration 0062, focused ORM/contracts/repository/validation,
the public deny-only AUTH seam, behavior ownership records, structural and lane
registration, and tests. It does not call the compilation agent, enable AUTH
runtime actions, start Celery work, expose an API, approve or activate policy,
or alter submission/checker/review/contribution/compensation behavior.

## Evidence and reviews

- 26 focused PostgreSQL tests passed with 93.83 percent subsystem coverage.
- Boundary, behavior ownership, test structure, stale wording, links, Ruff, and
diff checks passed.
- The unchanged repository docstring gate passes after documenting every new
repository and deny-only authorization callable.
- Hosted-style inventory collected 3,764 tests with exact lane evidence; the
new package has an additive hosted 90 percent coverage gate.
- Architecture, security, QA, product/operations, senior engineering,
test-delta, CI-integrity, docs, and reuse/dedup reviews passed after fixes.

## Remaining risk and human focus

Full repository coverage and all backend lanes must pass in GitHub Actions.
Human review should focus on whether any setup generation can acquire a second
provider key, whether accepted output can become policy accidentally, whether
append-only supersession can fork, whether audit evidence is exactly bound,
and whether the new authorization surface remains inactive and dependency-safe.
24 changes: 24 additions & 0 deletions .ci/behavior-ownership/auth/project-guide-compilation-facts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"behavior_id": "auth.project_guide_compilation.facts",
"boundaries": [],
"callables": [
"app.modules.authorization.api.project_guide_compilation.ProjectGuideCompilationAuthorizationPort.authorize_execute_preflight",
"app.modules.authorization.api.project_guide_compilation.ProjectGuideCompilationAuthorizationPort.consume_execute_persist",
"app.modules.authorization.api.project_guide_compilation.ProjectGuideCompilationAuthorizationPort.consume_request",
"app.modules.authorization.api.project_guide_compilation.ProjectGuideCompilationAuthorizationPort.prepare_execute_persist",
"app.modules.authorization.api.project_guide_compilation.ProjectGuideCompilationAuthorizationPort.prepare_request",
"app.modules.authorization.api.project_guide_compilation.ProjectGuideCompilationRequestFacts.__post_init__",
"app.modules.authorization.api.project_guide_compilation._validate_common",
"app.modules.authorization.api.project_guide_compilation.project_guide_compilation_execute_resource_digest"
],
"group": "auth",
"outcomes": ["return", "mapped_error"],
"reviewed_by": ["WS-POL-003-03A required reviewers"],
"schema": "workstream.behavior-ownership.v1",
"status": "reviewed",
"target": "backend/app/modules/authorization/api/project_guide_compilation.py",
"tests": [
"backend/tests/projects/guide_compilation/test_public_authorization.py::test_public_facts_reject_wrong_uuid_and_unbounded_token",
"backend/tests/projects/guide_compilation/test_repository_persistence.py::test_wrong_resource_authority_leaves_accepted_attempt_unpersisted"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"behavior_id": "lifecycle.project_guide_compilation.authorization",
"boundaries": [],
"callables": [
"app.modules.projects.guide_compilation.authorization.DenyProjectGuideCompilationAuthorization._deny",
"app.modules.projects.guide_compilation.authorization.DenyProjectGuideCompilationAuthorization.authorize_execute_preflight",
"app.modules.projects.guide_compilation.authorization.DenyProjectGuideCompilationAuthorization.consume_execute_persist",
"app.modules.projects.guide_compilation.authorization.DenyProjectGuideCompilationAuthorization.consume_request",
"app.modules.projects.guide_compilation.authorization.DenyProjectGuideCompilationAuthorization.prepare_execute_persist",
"app.modules.projects.guide_compilation.authorization.DenyProjectGuideCompilationAuthorization.prepare_request"
],
"group": "lifecycle",
"outcomes": ["denial"],
"reviewed_by": ["WS-POL-003-03A required reviewers"],
"schema": "workstream.behavior-ownership.v1",
"status": "reviewed",
"target": "backend/app/modules/projects/guide_compilation/authorization.py",
"tests": [
"backend/tests/projects/guide_compilation/test_public_authorization.py::test_hidden_authorization_denies_before_touching_product_state"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"behavior_id": "lifecycle.project_guide_compilation.contracts",
"boundaries": [],
"callables": [
"app.modules.projects.guide_compilation.contracts.AcceptedCompilationResult.validate_hashes",
"app.modules.projects.guide_compilation.contracts.CompilationAttemptIdentity.from_context",
"app.modules.projects.guide_compilation.contracts.CompilationAttemptIdentity.provider_idempotency_key",
"app.modules.projects.guide_compilation.contracts.accepted_compilation_result",
"app.modules.projects.guide_compilation.contracts.validate_accepted_compilation_result"
],
"group": "lifecycle",
"outcomes": ["return", "mapped_error"],
"reviewed_by": ["WS-POL-003-03A required reviewers"],
"schema": "workstream.behavior-ownership.v1",
"status": "reviewed",
"target": "backend/app/modules/projects/guide_compilation/contracts.py",
"tests": [
"backend/tests/projects/guide_compilation/test_contracts.py::test_attempt_provider_key_is_deterministic_and_context_bound",
"backend/tests/projects/guide_compilation/test_contracts.py::test_accepted_result_rejects_component_or_full_hash_drift",
"backend/tests/projects/guide_compilation/test_contracts.py::test_accepted_result_revalidates_against_fresh_context"
]
}
Loading
Loading