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 @@ -95,14 +95,15 @@ on 2026-08-08.
setup generation changes.
- Representative task material is optional bounded context. Guide setup must
not depend on tasks already existing.
- Current post-submit compilation must gain a trusted hard rejection for
platform-default repetition; prompt instructions are insufficient.
- The new unified proposal validator must reject platform-default repetition;
POL-01 does not change historical post-submit compiler behavior.
- A catalogue is not an execution API. The checker service must expose exactly
one typed call per phase and accept no caller-selected checker names.

## Unknowns to resolve in the planning PR
## Remaining unknowns after POL-01 contract repair

- Final names and limits for evidence-reference and safe-text schemas.
- POL-01 freezes evidence-reference and safe-text names/limits in its active
executable contract; implementation must prove them before later chunks.
- Exact AUTH action/resource binding for creation of the compilation record;
use narrow XINT/AUTH compilation request+execute actions for the parent while
preserving separate 12E/12F/12G projection actions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,19 @@ boundaries without WS-POL-003 modifying ART code or forcing ART lifecycle change

`ProjectGuideCompilationContext` is strict (`extra="forbid"`) and contains:

- exact existing ART-verified `GuideSourceMaterial`;
- a deeply immutable canonical snapshot of exact ART-verified
`GuideSourceMaterial`, its payload hash, and source evidence lineage;
- optional bounded representative task context;
- non-selectable `platform_coverage` generated from ART-04B1 platform entries
plus CHECKER-owned durable post-submit defaults;
- selectable `project_capabilities` generated from ART-04B1's project-rule
namespace for pre-submit and CHECKER/POL's registered rules for post-submit;
- server-owned classification policy and schema versions;
- optional bounded correction feedback tied to an exact superseded
compilation.
- one exact `pre_submission_capabilities` projection generated from ART-04B1,
carrying both non-selectable platform entries and selectable project-policy
primitives;
- one exact `post_submission_capabilities` projection generated from
CHECKER-owned registration plus the frozen durable default snapshot; and
- server-owned setup run/generation, instruction version, and agent identity.

Later persistence/correction chunks bind classification policy and bounded
correction feedback to an exact superseded compilation; POL-01 does not expose
those fields prematurely.

Representative task context is tenant-local, server-redacted, and limited to
policy shape. It excludes actor/user IDs, emails, submission artifacts, review
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,181 @@
# Chunk Contract: WS-POL-003-01 - Unified Contract and Catalogue Projection

Status: Proposed, inactive. Risk: L1.
Status: Active after explicit human start on 2026-08-08. Risk: L1.

## Goal

Add strict unified input/result/evidence models and read-only projections from
ART-04B1's complete pre-submit catalogue and CHECKER/POL's durable post-submit
capability truth. No model call, persistence, registry, or lifecycle change.
Add strict bounded unified input/result/evidence contracts and two read-only
capability projections from existing phase-owner truth. No model call,
persistence, registry, compiler behavior, composition-root, or lifecycle
change is permitted.

## Why this chunk exists

The later unified adapter needs one closed model-facing contract without
copying ART's 26-entry catalogue or treating CHECKER's runtime registry as a
second POL-owned registry.

## Allowed files

`backend/app/interfaces/project_agents.py`, canonical ART and CHECKER/POL
projection interfaces/composition only, focused tests, and WS-POL-003 docs.
```text
backend/app/interfaces/project_agents.py
backend/app/modules/checkers/catalogue.py
backend/app/modules/projects/post_submit_policy.py
backend/scripts/run_test_lanes.py
backend/tests/test_ci_test_lanes.py
backend/tests/test_project_guide_compilation_contracts.py
.agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/**
```

`catalogue.py` and `post_submit_policy.py` may add pure read-only projection
functions only. Their existing registry, definitions, defaults, compiler,
validation, hashing, and execution semantics are frozen.

The CI lane files may change only to assign the new test module exactly once
to the existing task-lifecycle lane and update its exact-inventory assertion.

## Not allowed

ART/CHECKER catalogue changes, duplicate project registry, database/model/Celery
changes, action activation, or checker execution.

## Acceptance

- Strict bounded schemas reject extra/executable/unsafe fields.
- ART platform coverage is non-selectable. Pre-submit project capabilities come
only from ART-04B1; post-submit project capabilities come only from the
canonical durable CHECKER/POL source.
- Pre-submit input preserves the exact full 26-entry ART-04B1 manifest,
including enabled and disabled advisory entries, catalogue ID/version/schema,
`manifest_sha256`, definition identities and states, dispatch kinds,
classifications, phases, policy fields, resource budgets, and disabled
behavior. Selection remains limited to enabled policy primitives. POL invents
no missing timeout/safety fields and cannot mutate catalogue state.
- `GuideEvidenceRef` is closed and raw excerpts/URLs/paths cannot enter it.
- Optional representative task context does not gate compilation.
- Unknown/default/wrong-stage bindings fail closed.

## Verification and review

Focused schema/catalogue tests, Ruff, type checks, stale-registry scan. Required
reviewers: architecture, security, QA, product, reuse, test delta, CI integrity.
Human focus: no second registry and no executable model fields.
```text
new or changed ART/CHECKER catalogue definitions/defaults/registrations
new registry, service locator, composition-root state, or startup wiring
database/model/migration/repository/Celery/API/authorization changes
agent adapter, prompt, provider/model call, checker dispatch, or execution
post-submit compiler behavior changes, including default-checker handling
effective-plan reconstruction or independent canonical/hash algorithms
open Any/dict model-visible configuration or executable suggestion fields
```

Default-checker repetition is rejected only by the new unified proposal
validator. This chunk does not change the historical post-submit compiler.

## Frozen contracts and bounds

- New Pydantic contracts use `extra="forbid"` and strict scalar validation.
- At most: 100 findings, 200 atomic requirements, 100 pre bindings, 100 post
bindings, 50 capability suggestions, 20 setup notes, and 20 evidence refs
per item. Safe operator text is at most 1,000 characters per field and
rejects control characters, URL/scheme/path/credential/command/import/
dependency-shaped content where the field is model-produced.
- `GuideEvidenceRef` contains only server-minted immutable lineage:
`source_item_id`, `extraction_usage_id`, canonical output SHA-256, and bounded
numeric start/end ordinals. It contains no raw excerpt, URL, path,
credential, signed reference, caller text, or provider/scratch handle.
- Representative task context is optional and contains only bounded
server-redacted policy-shape identifiers. It contains no actor/user ID,
email, raw task body, submission/review/payment data, secret, URL, or path.
- The ART guide material must be marked verified, contain no legacy raw
representative-task items, and expose only the canonical `content_markdown`
guide field plus ART-verified source items. The unified context receives a
deeply immutable canonical payload snapshot, payload hash, and immutable
source lineage so post-validation mutation cannot change evidence truth.
Extracted guide content remains explicitly untrusted model input; it is not
accepted as output evidence.
- Capability configuration is a tuple of closed key/value parameters. Keys
must be present in the selected canonical definition's policy fields; values
are bounded JSON scalars or bounded scalar tuples, never nested objects,
source code, commands, imports, dependencies, URLs, or paths.

## Canonical pre-submit projection

- The projection consumes one exact startup-composed
`PreSubmissionCheckerCatalogue`; it never calls a second builder in product
execution.
- It preserves the complete immutable envelope, `manifest_sha256`, and all 26
exact definition projections in canonical order, including disabled advisory
rows and all 19 existing definition fields.
- The first 14 `platform_capability` definitions are non-selectable platform
coverage. Only enabled `project_policy`/`policy_primitive` definitions are
selectable project capabilities.
- Disabled mandatory catalogue state makes the projection unavailable;
disabled advisory rows remain visible but non-selectable.
- The projection does not invent timeout, safety, implementation-version, or
other metadata absent from ART-04B1.

## Canonical post-submit projection

- The projection remains in `post_submit_policy.py`, adjacent to the existing
compiler-version default snapshot, and consumes
`default_checker_registry().names()` plus
`POST_SUBMIT_DEFAULT_CHECKERS_BY_COMPILER_VERSION`.
- Envelope identity is
`workstream.post_submission_checkers`, schema
`post_submission_checker_capability_projection.v1`, and source version
`POST_SUBMIT_COMPILER_VERSION`; its canonical SHA-256 commits the sorted
registered names, frozen default names, stage, and selectability.
- Capability identity is the registered checker name; capability version is
the frozen source/compiler version; stage is exactly `post_submit`.
- The eight frozen v0.1 defaults are non-selectable platform coverage. A
separate frozen compiler-version snapshot explicitly owns project-selectable
capabilities; it is disjoint from the defaults and currently contains only
`check_acceptance_criteria_present`. Registered but unlisted capabilities are
neither default nor selectable.
- Default/unknown/wrong-stage/stale-snapshot bindings fail in unified proposal
validation. No registry or compiler mutation occurs.

## Acceptance criteria

- Strict input/result/evidence schemas reject extra, unsafe, executable,
over-limit, PII-bearing, raw-source, and nested-open configuration fields.
- One atomic requirement has exactly one canonical disposition. Binding and
evidence references resolve to existing requirement/source lineage.
- `platform_covered` requires an exact stage/ID/version reference to an
enabled mandatory pre-submit platform capability or a canonical post-submit
default. Advisory pre-submit rows remain visible but cannot satisfy required
coverage. Ready/blocked status must agree with warning, blocking-gap, and
capability-gap evidence.
- ART projection equality covers the exact 26-entry manifest and hash; no field
is dropped, retyped, inferred, or reordered.
- Platform/default and disabled definitions cannot be selected. Enabled
project capabilities can be selected only at their exact stage/version and
with catalogue-owned policy fields.
- Post-submit projection is derived solely from the canonical registry and
frozen default snapshot; parity drift fails closed.
- Optional representative task context may be omitted without invalidating the
compilation context.
- Static proof finds no new registry, model/provider call, persistence, route,
Celery, authorization, or catalogue mutation.

## Verification commands

```bash
(cd backend && .venv/bin/python -m ruff check app/interfaces/project_agents.py app/modules/checkers/catalogue.py app/modules/projects/post_submit_policy.py tests/test_project_guide_compilation_contracts.py)
(cd backend && .venv/bin/python -m pytest -q tests/test_project_guide_compilation_contracts.py tests/test_checker_catalogue.py)
# Hosted Backend lane (supplies WORKSTREAM_TEST_DATABASE_URL/Postgres):
(cd backend && .venv/bin/python -m pytest -q tests/test_project_guide_compilation_contracts.py tests/test_checker_catalogue.py tests/test_checkers.py --cov=app.interfaces.project_agents --cov=app.modules.checkers.catalogue --cov=app.modules.projects.post_submit_policy --cov-report=term-missing --cov-fail-under=90)
# Hosted full Backend matrix and repository coverage gate:
(cd backend && .venv/bin/python -m pytest -q)
python3 scripts/check_stale_workstream_wording.py
python3 scripts/check_stale_authorization_docs.py
python3 scripts/check_markdown_links.py
! git diff origin/main -- backend/app/interfaces/project_agents.py backend/app/modules/checkers/catalogue.py backend/app/modules/projects/post_submit_policy.py | rg '^\+.*(class .*Registry|\.register\(|responses\.create|Runner\.run|Celery|Mapped\[|APIRouter)'
git diff --check
```

No configured repository type-check command exists on current main; strict
Pydantic construction, Ruff, focused tests, and the full hosted Backend matrix
are the type/runtime gates for this chunk.

## Required reviewers

- architecture
- security/auth and data safety
- QA/test
- product/operations
- senior engineering
- reuse/dedup
- test delta
- CI integrity
- docs

## Human review focus

Confirm exact phase-owner reuse, no second registry, no executable or leaking
model fields, and no change to catalogue/compiler/runtime behavior.

## Stop conditions

Stop if current canonical sources cannot provide a deterministic read-only
projection without inventing authority metadata, if a projection requires
registry/compiler mutation, or if safe strict configuration requires an open
model-visible object.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# WS-POL-003-01 Internal Review Evidence

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

## Deterministic evidence

- Scoped Ruff: passed.
- Focused non-database tests: 91 passed after external-review corrections.
- Changed-subsystem coverage with the neighboring checker tests reached above
90 percent; database-backed completion remains assigned to the hosted
Backend lane because it supplies Postgres and `WORKSTREAM_TEST_DATABASE_URL`.
- Stale Workstream wording, stale authorization docs, Markdown links, static
boundary scan, and `git diff --check`: passed.
- No workflow, coverage threshold, skip, xfail, or bypass change exists.

## Review results

- Architecture: pass after replacing mutable legacy material with an immutable
canonical payload/hash/lineage snapshot and excluding advisory/disabled
capabilities from required platform coverage.
- Security: pass after closing evidence lineage, non-finite scalar, unsafe
text/path/PII, service-owned version, status, platform-coverage, and mutable
context gaps.
- Product/operations: pass after ready/blocked status consistency and exact
platform-coverage proof were enforced.
- QA: pass; strict scalar, catalogue parity, immutable projection, status,
binding, evidence, and stage cases are covered.
- Senior engineering: pass after deep immutability and canonical snapshot hash
validation were added.
- Reuse/dedup: pass; the pre-submit projection consumes
`manifest_entry()` and the post-submit projection consumes the existing
registry/default snapshot without another registry.
- Test delta: pass after invalid parameter ownership and all platform-coverage
branches received regression tests.
- CI integrity: pass; local non-database and hosted database/full-suite duties
are explicit and no gate is weakened.
- Docs: pass; the active plan now distinguishes POL-01 context fields from
later correction/persistence fields.

## External-review correction re-review

- Architecture: pass after explicit post-submit selectability, default/selectable
disjointness, and matching chunk-contract wording were added.
- Security: pass after bare value-shaped credential forms, complete non-empty
ART lineage, unavailable mandatory pre-submit coverage, and closed
post-submit selectability were enforced.
- QA: pass; all six CodeRabbit findings have regression proof.
- Senior engineering: pass after credential detection was narrowed to preserve
ordinary security-policy language.
- Test delta: pass after missing selectable-registration and snapshot-overlap
regressions were added; no tests were removed or skipped.

All blocking findings were corrected and re-reviewed. No reviewer session
remains open.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# WS-POL-003-01 PR Trust Bundle

## Intent

Create the strict unified project-guide compilation contract and read-only
pre/post capability projections without activating a model call, persistence,
API, worker, authorization action, or checker execution path.

## Design and scope

- Snapshot exact ART-verified guide material as immutable canonical bytes,
payload hash, and immutable source lineage.
- Treat model output as an untrusted bounded proposal with closed findings,
atomic requirements, artifact policy, capability bindings, evidence refs,
suggestions, and setup notes.
- Project all 26 ART pre-submit definitions from the supplied canonical
catalogue and preserve its manifest/hash/state.
- Project post-submit capabilities from the existing checker registry and
frozen compiler-version defaults.
- Validate exact stage/version/selectability, catalogue-owned parameters,
status consistency, evidence lineage, and mandatory/default platform
coverage fail closed.

## Explicitly unchanged

No registry/default mutation, compiler behavior change, model/provider call,
database model or migration, route, Celery task, authorization action,
composition wiring, or live lifecycle change.

## Evidence

- Ruff passed.
- Focused tests: 66 passed.
- Changed subsystem coverage remains above 90 percent in the combined focused
run; hosted Backend lanes own the Postgres-backed completion and repository
coverage floor.
- Stale wording, stale authorization docs, Markdown links, static boundary
scan, and whitespace validation passed.
- Architecture, security, product/operations, QA, senior engineering,
reuse/dedup, test-delta, CI-integrity, and docs reviewers passed after all
valid findings were fixed.

## Human review focus

Confirm that the snapshot is deeply immutable, phase-owner catalogue truth is
reused without duplication, advisory/default rows cannot masquerade as
required project coverage, and this chunk does not activate runtime behavior.

## Remaining external proof

GitHub must run the complete Backend matrix, database-backed focused coverage,
repository coverage floor, and external CodeRabbit review on the exact PR
head before merge.
Loading
Loading