diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/CHUNK_MAP.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/CHUNK_MAP.md index 17ac0dc10..fca97e377 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/CHUNK_MAP.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/CHUNK_MAP.md @@ -1,36 +1,30 @@ # Chunk Map: WS-QUAL-001 Backend Coverage Floor -| Chunk | Scope | Risk | State | +## Historical completed work + +| Chunk | Durable outcome | State | +|---|---|---| +| `WS-QUAL-001-PLAN` | Original 90-percent initiative plan | Merged PR #99; superseded by PLAN2 sequencing | +| `WS-QUAL-001-01` | Original combined harness/baseline contract | Superseded by the 01A/01B split before implementation | +| `WS-QUAL-001-01A` | Isolated least-privilege database runner | Merged PR #103 | +| `WS-QUAL-001-01B1A-R2` | Coverage configuration/evidence grammar | Merged PR #105 | +| `WS-QUAL-001-01B1B-R10` | Conservative test-weakening semantic guard | Merged PR #108 | + +All other 01B/01B1/01B1A/01B1B replacement attempts are stopped historical +experiments. Do not resume them. `WS-QUAL-001-01B2` and the old 02-06 milestone +ladder are superseded before implementation. + +## Current sequence + +| Chunk | Purpose | Risk | State | |---|---|---:|---| -| `WS-QUAL-001-01` | Combined harness/baseline contract | L1 | Split after circuit-breaker review | -| `WS-QUAL-001-01A` | Isolated least-privilege database runner and two-phase complete-suite CI | L1 | Merged through PR #103 as `2901a3e` | -| `WS-QUAL-001-01B` | Combined coverage policy, baseline, and CI ratchet | L1 | Circuit breaker triggered at 480/500 before required proof; split proposed | -| `WS-QUAL-001-01B1` | Combined parser and semantic-delta policy core | L1 | Blocked at 496/500 after two repair cycles; superseded by 01B1A/01B1B | -| `WS-QUAL-001-01B1A` | Read-only coverage arithmetic and bounded policy parsers | L1 | Blocked at 394/400 after two parser repair cycles | -| `WS-QUAL-001-01B1A-R1` | Replacement parser candidate closing two normalization bypasses | L1 | Stopped at `c0fa4a2`; superseded by R2 | -| `WS-QUAL-001-01B1A-R2` | Canonical coverage.py exclusion grammar closure | L1 | Merged through PR #105 as `8a4182e` | -| `WS-QUAL-001-01B1B` | Repository-delta and semantic test-integrity guards | L1 | Blocked at 223/300 after two binding repair cycles | -| `WS-QUAL-001-01B1B-R1` | Lexical binding closure for semantic guards | L1 | Stopped at first size checkpoint; superseded by R2 | -| `WS-QUAL-001-01B1B-R2` | Measured lexical binding closure | L1 | Blocked at 348/350 after cycle-zero proof-fit failure | -| `WS-QUAL-001-01B1B-R3` | Stdlib symtable lexical closure | L1 | Blocked at 468/500 before cycle-one repair | -| `WS-QUAL-001-01B1B-R4` | Complete symtable control/value flow | L1 | Blocked at 535/550 after cycle-zero review | -| `WS-QUAL-001-01B1B-R5` | Single-pass abstract flow closure | L1 | Blocked at 641/650 after cycle-zero review | -| `WS-QUAL-001-01B1B-R6` | Transitive provenance closure | L1 | Blocked at 800/800 after cycle-one review | -| `WS-QUAL-001-01B1B-R7` | Recursive iterable provenance | L1 | Stopped after final two-cycle review; do not resume | -| `WS-QUAL-001-01B1B-R8` | Conservative syntactic integrity policy | L1 | Stopped after final review found Python 3.11 scope incompatibility | -| `WS-QUAL-001-01B1B-R9` | Python 3.11 comprehension scope compatibility | L1 | Stopped after final Python 3.13 TypeVar child-order finding | -| `WS-QUAL-001-01B1B-R10` | Python 3.13 TypeVar child order | L1 | Merged through PR #108 as `5c47aba` | -| `WS-QUAL-001-01B2` | Git provenance, configured baseline evidence, and CI ratchet | L1 | Inactive pending explicit user start | -| `WS-QUAL-001-02` | Project setup/policy/correction service coverage; floor at least 82% | L1 | Inactive | -| `WS-QUAL-001-03` | Project repository/router coverage; floor at least 84% | L1 | Inactive | -| `WS-QUAL-001-04` | Task service/repository/router coverage; floor at least 86% | L1 | Inactive | -| `WS-QUAL-001-05` | Checker service/runner/repository/router/worker coverage; floor at least 88% | L1 | Inactive | -| `WS-QUAL-001-06` | Enumerated residual gaps and permanent 90% CI floor | L1 | Inactive | +| `WS-QUAL-001-PLAN2` | Reconcile current hosted baseline, retire obsolete machinery, and define the small closure sequence | L1 | Planning in progress | +| `WS-QUAL-001-02R` | Project/setup observable behavior coverage | L2 | Proposed after PLAN2 | +| `WS-QUAL-001-03R` | Checker observable behavior coverage | L2 | Proposed after 02R only if more headroom is needed | +| `WS-QUAL-001-04R` | Change the exact global hosted CI floor from 78 to 90 after current-main proof | L1 | Proposed after measured >=90.25% proof | -Each coverage-test chunk is limited to 500 implementation lines, except the -reviewed chunk-01A genuine-proof exception capped at 700. Missing its numeric -floor or size budget stops the chunk for replanning; -scope does not spill into the next chunk. A later chunk may start only after the -prior PR merges, post-merge evidence plus initiative `STATUS.md` and global -`LOOP_STATE.md`, `WORK_QUEUE.md`, and `REVIEW_LOG.md` are updated and merged, -and the user provides a new start signal. +One chunk maps to one PR. A test chunk may close early when its behavioral scope +is exhausted. The next contract refreshes from current `main`; stale missing-line +inventories are never implementation authority. If 02R and 03R are +insufficient, PLAN2 must be amended with one exact owner-specific successor; +there is no mixed residual-coverage chunk. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DECISIONS.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DECISIONS.md index 4e17dfde8..7011b0fed 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DECISIONS.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DECISIONS.md @@ -1,256 +1,40 @@ # Decisions: WS-QUAL-001 Backend Coverage Floor -## D1: Ninety percent is authoritative +## D1: Preserve the 90-percent final target -Status: accepted by the user on 2026-07-11. +The user-set target remains 90 percent for the complete backend application. -The complete backend application must maintain at least 90 percent statement -coverage. The user corrected the initial 80 percent instruction to "90% not -80". The floor applies to all modules under `backend/app`, not only changed -files. +## D2: Treat historical QUAL machinery as completed or stopped evidence -## D2: No exclusion-based compliance +PRs #103, #105, and #108 remain durable. Stopped parser/semantic-analysis +attempts and unimplemented 01B2 are not resumed. -Status: accepted through planning PR #99 on 2026-07-12. +## D3: Use the hosted combined report as baseline truth -Coverage may not be raised by omitting application modules, adding coverage -suppression pragmas, or measuring only a favorable package subset. +The current baseline is the exact semantic-lane fan-in evidence, not a local +developer-machine timing or partial test selection. -## D3: Ratchet from a reproducible baseline +## D4: Prefer behavior depth over infrastructure -Status: accepted through planning PR #99 on 2026-07-12. +The remaining coverage is added through meaningful tests at the cheapest valid +layer. Real PostgreSQL, MinIO, and HTTP remain mandatory only for behavior that +depends on those boundaries. -Because current coverage is materially below 90 percent, implementation uses a -non-decreasing enforced ratchet across bounded PRs and reaches 90 in the final -chunk. Machine evidence preserves exact covered/total statements and a -six-decimal configured floor; base-ref comparison prevents regression. This is -an execution strategy, not a reduction of the final requirement. +## D5: Separate tests from the threshold switch -## D4: Coverage work pauses AUTH-02 publication +The global floor changes only after a current exact head proves at least 90.25 +percent. The enforced floor remains 90 percent; the extra 0.25 is merge-race +headroom. -Status: accepted through planning PR #99 on 2026-07-12. +## D6: Keep architecture and CI optimization separate -AUTH-02 remains implemented on its own worktree but is not published while the -new 90 percent repository requirement lacks an approved enforcement path. The -pause avoids mixing roughly 849 statements of legacy coverage debt into an auth -PR. Resumption requires WS-QUAL to complete through its permanent 90 percent CI -floor and final post-merge memory, followed by an explicit user signal. This -decision does not discard or redesign the off-main auth implementation. +Service decomposition, typed ports/UnitOfWork, mutation/property testing, type +checking, and semantic-lane runtime optimization are worthwhile possible +initiatives but are not QUAL coverage-closure work. -## D5: Behavior proof outranks percentage gains +## D7: Never create a mixed residual-coverage bucket -Status: accepted by the user on 2026-07-12. - -Coverage is a safety signal, not the purpose of a test. Every new test must -protect a real behavior or safety invariant and assert an observable result such -as state, lifecycle, authorization, audit, queue/retry, HTTP, redaction, cleanup, -or fail-closed behavior. Execution-only tests added to hit lines or percentages -are prohibited even if they increase coverage. Test-delta and product/ops -reviewers must reject them. - -## D6: Chunk 01A uses a bounded 700-line exception for genuine proof - -Status: accepted from the user's D5 direction on 2026-07-12 after internal L1 -circuit-breaker review. - -The original 500-line forecast proved incompatible with the required owned-DB -lifecycle, redaction, cleanup, ratchet, and negative behavior matrix: the two -control scripts alone require 387 readable lines before tests, guards, workflow, -and runbook. After the D7 split, `WS-QUAL-001-01A` may use at most 700 -implementation lines; the cap applies to 01A, not the former combined Chunk 01 -or 01B. The added budget is reserved for behavior tests and safety/error -handling. Allowed files and all production exclusions remain unchanged. -Crossing 700 requires another split and a new human decision. - -## D7: Split database isolation from coverage policy - -Status: accepted on 2026-07-12 after all required L1 reviewer groups rejected A2. - -The executable harness reached 923 implementation lines before completing the -required ratchet and negative behavior matrix. Real concurrency/interruption -catalog proof, strict policy failure tests, and the operator runbook were -underestimated by A1. The rejected A2 proposal would have raised the cap to -1,100. Reviewers required `01A` for the least-privilege database lifecycle and -`01B` for coverage policy/CI/evidence. The split preserves genuine proof without -compressing safety code. Production scope and later chunks remain unchanged. - -## D8: Split 01B policy core from baseline and CI publication - -Status: accepted after internal split review and explicit user approval on -2026-07-12. Only 01B1 is started; 01B2 retains its later separate checkpoint. - -The reviewed combined 01B contract proved larger than its 500-line boundary: -policy plus 19 behavior tests reached 480 lines before configured coverage, -workflow integration, the runbook, and several required negative cases. Further -compression would weaken proof or readability. The proposed repair is 01B1 for -pure policy parsing/arithmetic/schema/delta behavior, followed after merge and -memory by 01B2 for Git provenance, configured baseline evidence, CI ratchet, -and operations. Each retains a separate 500-line cap, L1 review, PR, merge, -memory, and explicit start checkpoint. No production or coverage-raising test -scope is added. - -## D9: Stop 01B1 after repeated semantic-integrity findings - -Status: circuit breaker triggered on 2026-07-12; replacement split direction -approved by the user and pending internal split review. - -The 01B1 candidate reached 496/500 lines after two repair cycles. Eight review -tracks passed, but final test-delta review still found executable unittest skip -forms, aliased `pytest.raises` deletion, and missing successful arithmetic -boundaries. These are valid acceptance-criterion gaps in the same repeated -semantic-integrity class. The chunk must split again rather than compress tests -or exceed its cap. No replacement chunk may start without internal plan review -and explicit user approval. - -## D10: Split parsing from semantic repository-delta enforcement - -Status: direction explicitly approved by the user on 2026-07-12; internal split -review pending. - -`01B1A` owns complete-app coverage arithmetic, intended configuration parsing, -canonical evidence parsing, strict runner metadata parsing, application pragma -validation, the compute-only CLI, and their behavior tests. `01B1B` separately -owns Git-helper integration, bounded memory/scope accounting, executable -skip/xfail detection, aliased assertion-deletion detection, and real repository -regressions. `01B2` remains unchanged. This boundary keeps parser arithmetic -independent from repository-diff semantics without weakening either proof set. - -## D11: Stop 01B1A after two parser-normalization repair cycles - -Status: circuit breaker triggered on 2026-07-12. - -The 01B1A candidate reached 394/400 lines and 56 focused tests. Final QA and -security review still found accepted `pragma:nocover` comments and leading-space -normalized duplicate pytest-cov requirements. These are valid bypasses in the -same parser-normalization class after two repairs. The task-chunk loop requires -a stop and replan instead of a third repair cycle, even though the individual -edits are small. No PR may open while required reviewers fail. - -## D12: Continue coverage and AUTH in isolated worktrees - -Status: explicitly directed by the user on 2026-07-12. - -Coverage remains isolated in `workstream-qual-001`; AUTH-02 resumes off-main in -`workstream-auth-001-02`. Each track owns its branch, tests, reviewers, and -evidence. Neither track edits the other's worktree. AUTH may prepare its PR in -parallel but must satisfy the repository's current coverage gates before merge. -The 01B1A-R1 replacement is limited to closing the two recorded parser bypasses -without reopening semantic-delta or 01B2 scope. - -## D13: Reuse the installed coverage runtime's exclusion grammar - -Status: proposed corrective replacement under the user's direction to finish -the coverage blockers; internal contract review pending. - -R1 correctly rejected the two named bypasses but used a broader approximate -regex that rejected explanatory comments coverage.py would include. R2 replaces -that approximation with `coverage.config.DEFAULT_EXCLUDE[0]` from the installed -coverage runtime selected by the pinned pytest-cov toolchain and adds -positive/negative same-runtime equivalence proof. Coverage.py itself is not -exactly pinned; R2 records the resolved version, while later 01B2 owns committed -tool-version evidence. This is a reuse correction, not new policy scope. - -## D14: Replace file-global semantic aliases with lexical binding - -Status: proposed after B1B's two-cycle circuit stop; internal contract review -pending under the user's direction to keep coverage and AUTH running in -parallel. - -The B1B candidate correctly handled committed renames and base-AST assertion -spans, but file-global alias sets misclassified locally shadowed pytest names, -and broad `.skipTest` detection caused a test expectation to be weakened. R1 -must resolve actual bindings by lexical scope, preserve arbitrary local -lookalikes, and retain every passing Git/scope/size invariant. This is a -corrective replacement, not B2 or application scope. - -## D15: Use measured lexical-binding allocation - -Status: proposed after R1's first implementation checkpoint; internal contract -review pending. - -R1's shared resolver draft measured 282 total implementation lines before its -required adversarial matrix, so the reviewed 300-line cap could not preserve -proof. The draft was discarded. R2 retains the identical behavior and file -scope with a 350-line cap allocated from measured code: 290 lines through the -lint-clean resolver, 50 lines for the matrix, and 10 reserve. This changes only -the evidence-backed size boundary; it does not admit B2, AUTH, application, -configuration, workflow, evidence, documentation, or coverage-raising scope. - -## D16: Delegate lexical facts to Python's symbol table - -Status: proposed after R2's cycle-zero proof-fit stop; internal contract review -pending. - -R2 proved that a partial AST symbol engine misses lambda, vararg, comprehension, -exception-target, nested-class, and control-flow semantics. R3 uses stdlib -`symtable` as the authority for lexical namespaces and layers only bounded AST -framework-value flow and joins on top. The normal 500-line L1 cap provides room -for the reproduced regression matrix without compression. This remains semantic -test-integrity scope only; B2, AUTH, application, configuration, workflow, -evidence, documentation, and coverage-raising tests remain forbidden. - -## D17: Fund complete control-flow proof instead of compressing cycle one - -Status: proposed after R3's proof-fit stop; internal contract review pending. - -R3's 468/500 candidate left 32 lines, while measured review requires roughly -47 policy lines and 20 regression lines after replacement savings. R4 uses a -550-line cap: existing 468, policy through 515, tests through 535, and 15 -reserve. The added budget closes already-reproduced semantic behavior only; it -does not admit B2, AUTH, app, config, workflow, evidence, docs, or coverage- -raising tests. - -## D18: Separate single syntax consumption from abstract state joins - -Status: proposed after R4's cycle-zero stop; internal contract review pending. - -R4 replayed AST subtrees to simulate paths, which is incompatible with ordinal -symtable child consumption. R5 visits every syntax node once. It joins incoming -abstract states before a handler/case, uses conservative loop-carried binding -summaries instead of replay, and applies mandatory regions afterward. Assignment -target loading/binding and comprehension ownership share one recursive helper. -This is a replacement architecture for existing findings, not new product/B2/ -AUTH/config/workflow/evidence scope. - -## D19: Close provenance transitively with evaluation-order proof - -Status: proposed after R5's cycle-zero stop; internal contract review pending. - -R5 repaired semantic replay but its loop summary was a one-step heuristic. -R6 replaces duplicate RHS walks with one shared cursor-neutral provenance -summary evaluated to closure, including outer-executed nested-scope headers. -It also funds exact iterable-to-target propagation, Python evaluation order, -and distinct sequential `except*` handling. The 800-line cap is restricted to -these reproduced integrity gaps and their tests. - -## D20: Use one recursive iterable-element abstraction - -Status: proposed after R6's hard-cap stop; internal contract review pending. - -R6 closed binding fixed points but substituted raw comprehension elements -without their target environment and special-cased generator consumers. R7 -uses one recursive element-provenance function for literal containers, -set/dict keys, and nested comprehension/genexpr environments. Control summaries -use the same abstraction to decide structural consumption/reachability. The -950-line cap funds only these reproduced semantic gaps and regressions. - -## D21: Enforce syntax integrity instead of predicting execution - -Status: proposed after R7's mandatory two-cycle stop; internal contract review -pending. - -R1-R7 demonstrated that exact reachability, value provenance, iterator -consumption, builtin behavior, and class control flow constitute an unbounded -Python abstract interpreter. That work did not raise backend coverage and kept -the measured application baseline at 79.25 percent. R8 narrows B1B to its actual -security purpose: framework-qualified weakening syntax is forbidden in changed -tests, and syntactic assertion constructs cannot be deleted. It deliberately -does not decide whether syntax executes. False-positive risk is bounded by exact -absolute-import ownership, stdlib lexical scopes, relative-import exclusion, -and local-lookalike tests. Ownership is monotone within a scope and propagates -only through cycle-safe simple Name-to-framework Name/Attribute aliases; no -container, unpacking, comprehension, iteration, call return, wrapper value, -statement order, reachability, or runtime inference is admitted. Execution -contexts cannot hide an already-owned construct and cannot create ownership. -This smaller gate must finish before B2 and the -coverage-raising service chunks can move the repository toward 90 percent. +Project and checker test chunks retain one product owner each. If they do not +reach the required headroom, planning adds one exact owner-specific successor +from refreshed evidence rather than combining ART, AUTH, TASK, background-job, +and adapter ownership to chase a percentage. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DISCOVERY.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DISCOVERY.md index acf8e293c..44080ffc1 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DISCOVERY.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/DISCOVERY.md @@ -1,66 +1,92 @@ -# Discovery: WS-QUAL-001 Backend Coverage Floor +# Discovery: WS-QUAL-001 Current-Main Coverage Closure -## Current enforcement +## Audited baseline -- `backend/pyproject.toml` has pytest configuration but no code-coverage tool or - threshold. -- `.github/workflows/backend.yml` installs the development extra and runs plain - `pytest -q`. -- `.github/pull_request_template.md` prohibits threshold weakening, but no code - threshold currently exists. +Hosted Backend run `30854931616` on the final PR #249 tested tree +`19d48f7ea4bf20cb29f03cbba54f98683ce52661` produced: -## Measured baseline +- 2,925 collected and completed tests; +- 20,793 covered statements of 23,475; +- 2,682 missed statements; +- 88.575080 percent global statement coverage; +- 640.284 seconds total backend wall time; +- 468.506 seconds in the slowest semantic lane. -An exact application measurement on the AUTH-02 tree used: +At the current denominator, 90 percent permits at most 2,347 missed statements. +The suite therefore needs 335 additional covered statements to reach 90 +percent and 394 to reach the required 90.25-percent pre-switch headroom. -```bash -pytest -q --cov=app --cov-report=term-missing --cov-fail-under=90 -``` +## Current CI behavior -After rerunning the contaminated project group against an isolated database, -the combined diagnostic result was 5,660 covered statements out of 7,232: -78.26 percent. Reaching 90 percent on that tree requires about 849 additional -covered statements, subject to the final main-based baseline. +`.github/workflows/backend.yml` runs five semantic lanes, combines exactly five +coverage files, runs the real API contract drill, blocks below 78 percent +globally, and applies multiple 90-percent subsystem/per-file checks. Lane +custody, PostgreSQL isolation, and coverage fan-in are already implemented. -Largest measured gaps: +`backend/scripts/coverage_policy.py` and +`backend/tests/test_coverage_contract.py` are merged historical integrity +machinery. The current workflow does not invoke that policy script. PLAN2 does +not wire it into CI or expand its static Python analysis. + +## Largest current gaps + +The latest hosted coverage JSON identifies these high-value gaps: | Module | Statements | Missing | Coverage | |---|---:|---:|---:| -| `app/modules/projects/service.py` | 1,631 | 656 | 60% | -| `app/modules/tasks/service.py` | 650 | 270 | 58% | -| `app/modules/checkers/service.py` | 579 | 196 | 66% | -| `app/modules/projects/repository.py` | 233 | 82 | 65% | -| `app/modules/projects/router.py` | 211 | 76 | 64% | -| `app/modules/tasks/router.py` | 152 | 49 | 68% | - -## Database contamination finding - -The shared `workstream_test` database contained Alembic revision -`0016_artifact_domain` from another worktree while the measured branch ended at -`0015_post_submit_correction`. That caused 27 cascading project fixture errors. -A new isolated database produced 234/234 passing project tests. Coverage proof -must never share a mutable migration database across concurrent worktrees. - -## Existing test ownership - -- Project behavior: `backend/tests/test_projects.py` -- Task behavior: `backend/tests/test_tasks.py` -- Checker behavior: `backend/tests/test_checkers.py` -- Auth/adapters/core: focused files under `backend/tests/` -- Shared database fixtures and locking: `backend/tests/conftest.py` - -## Unknowns to resolve in chunk 01 - -- Exact `origin/main` baseline after a clean isolated full run. -- Natural behavioral groupings that provide the largest defensible coverage - gains without coupling tests to implementation details. -- Whether existing fixture cost can be reduced without changing test semantics. -- Exact Alembic head and app-file inventory on the reviewed main tree. - -## Existing variable and guard behavior - -`backend/tests/conftest.py` gives `WORKSTREAM_TEST_DATABASE_URL` precedence over -`WORKSTREAM_DATABASE_URL`; coverage commands must therefore provision and set -the former. Both API drill scripts currently allow only `workstream_test` and -`test_workstream`, so chunk 01 must update and test those guards for the strict -derived local name. The nonlocal write-risk override is not an isolation tool. +| `app/modules/projects/service.py` | 1,451 | 550 | 62.10% | +| `app/modules/checkers/service.py` | 579 | 169 | 70.81% | +| `app/modules/authorization/router.py` | 484 | 168 | 65.29% | +| `app/modules/artifacts/service.py` | 959 | 138 | 85.61% | +| `app/modules/tasks/service.py` | 682 | 108 | 84.16% | +| `app/modules/projects/repository.py` | 285 | 96 | 66.32% | +| `app/modules/artifacts/operator.py` | 204 | 80 | 60.78% | +| `app/modules/projects/router.py` | 178 | 63 | 64.61% | +| `app/modules/artifacts/guide_extraction_worker.py` | 237 | 65 | 72.57% | + +Smaller gaps exist in checker repository/router/runner/compiler, project setup +queue and policy replay, authorization read/repository code, auth API/deps/ +schemas, artifact extraction/materialization, background-job modules, and actor +services. + +## Existing ownership and test layers + +- Project behavior: `backend/tests/test_projects.py` and focused project files. +- Task behavior: `backend/tests/test_tasks.py`. +- Checker behavior: `backend/tests/test_checkers.py` and runner tests. +- Artifact behavior: focused artifact, storage, guide, and recovery tests. +- Authorization behavior: focused actor/authorization/API tests. +- Test isolation: `backend/scripts/run_isolated_tests.py`. +- Semantic execution: `backend/scripts/run_test_lanes.py`. + +The largest services depend directly on `AsyncSession`; this makes broad unit +extraction an architectural concern outside QUAL. Tests may use small typed +fakes or existing fixtures where behavior is observable, but QUAL must not +refactor production services merely to raise coverage. + +## Risks discovered + +- Adding hundreds of database-heavy covered lines could worsen the current + 10.7-minute hosted wall time. +- Testing implementation branches without outcomes can manufacture percentage + while adding little confidence. +- Raising the floor in the same PR as broad tests makes failures harder to + diagnose and encourages threshold bargaining. +- Concurrent AUTH, ART, and REV work can increase the denominator; the final + floor chunk must remeasure current `main` and retain headroom. + +## Conventions to preserve + +- Complete `backend/app` inventory and combined semantic-lane coverage. +- Real PostgreSQL for constraints, locks, migrations, transactions, triggers, + and concurrency. +- Real MinIO for the protocol boundary. +- Global 78-percent floor until the exact 90-percent switch merges. +- Existing protected 90-percent subsystem gates. +- Test-delta and CI-integrity review for every QUAL implementation PR. + +## Unknowns resolved per implementation chunk + +The exact missing lines and best observable tests must be refreshed from the +then-current hosted coverage JSON. A contract may not promise a coverage gain +from stale line numbers or require tests that merely execute code. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/INTENT.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/INTENT.md index 76c458244..81a64b5b6 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/INTENT.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/INTENT.md @@ -2,27 +2,48 @@ ## Human goal -Maintain at least 90 percent statement coverage for the complete backend -application and make CI fail below that floor. +Make the complete backend test suite protect at least 90 percent statement +coverage without weakening tests, hiding application files, or making CI slow +through unnecessary PostgreSQL and HTTP duplication. + +## Why this matters + +Coverage is a backstop for behavior proof, not the goal by itself. Workstream's +authorization, artifact, project, task, checker, review, and contribution +boundaries need meaningful failure and recovery tests while the repository +remains practical for contributors. + +## Current truth + +The latest complete hosted result after ART-03C ran 2,925 tests and covered +20,793 of 23,475 application statements: 88.575080 percent. The +global CI floor remains 78 percent, while named new or materially changed +subsystems are already protected at 90 percent. ## Success state -- CI runs the complete backend suite with `pytest-cov` and a configured - `fail_under` of at least 90 percent. -- Coverage includes all importable modules under `backend/app`; application - modules are not omitted and lines are not suppressed to manufacture a pass. -- Tests exercise meaningful success, rejection, failure, and recovery behavior. -- Database-backed verification uses an isolated database per worktree or CI job. -- The full suite passes at or above 90 percent on the exact reviewed tree. +- The exact complete backend suite covers at least 90.00 percent globally + across the complete importable `backend/app` inventory. +- GitHub CI blocks below a global `--fail-under=90` floor. +- New tests protect observable behavior, rejection, failure, or recovery. +- Pure or adapter-contract tests are preferred when PostgreSQL and HTTP are not + the behavior under test. +- Existing semantic lanes, isolation, coverage combination, and protected + 90-percent subsystem checks remain intact. ## Non-goals -- No production behavior, public API, schema, migration, or authorization change. -- No deletion of valid code solely to improve the percentage. -- No mock-only assertions that merely execute lines without checking outcomes. -- No weakening of lint, docstring, API drill, or existing test gates. +- No production behavior, schema, migration, API, authorization, or product + lifecycle change. +- No arbitrary sharding or infrastructure purchase. +- No test deletion, weakened assertion, skip, xfail, coverage pragma, omit, or + narrowed application inventory. +- No revival of the historical signed-memory, base-evidence, semantic-parser, + line-budget, or per-milestone ratchet process. +- No promise that coverage alone proves correctness. -## Human direction +## Human decision already provided -The user first requested 80 percent, then corrected the authoritative minimum -to 90 percent on 2026-07-11. +The user directed the orchestrator to restart QUAL only after current-main +documentation reconciliation. This PLAN2 audit is authorized; implementation +still begins with the first reviewed bounded successor. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/PLAN.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/PLAN.md index 21fc791c1..b6aa7484e 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/PLAN.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/PLAN.md @@ -1,131 +1,77 @@ -# Plan: WS-QUAL-001 Backend Coverage Floor +# Plan: WS-QUAL-001 Current-Main Coverage Closure ## Approach -1. Establish the isolated least-privilege test-database provisioner. -2. Establish reproducible `pytest-cov` measurement, full `app` inventory proof, - machine-readable evidence, and a base-ref-enforced non-decreasing ratchet. -3. Cover project setup/policy/correction service behavior and reach at least 82%. -4. Cover project repository/router behavior and reach at least 84%. -5. Cover task service/repository/router behavior and reach at least 86%. -6. Cover checker service/runner/repository/router/worker behavior and reach at - least 88%. -7. Close the enumerated adapter/core/worker gaps and set the permanent CI floor - to exactly 90 percent or higher. - -Each coverage-raising implementation chunk changes tests and coverage -configuration only. Chunk 01A is the explicit exception for its isolated -database runner, API drill guards, CI wiring, and operations runbook. Any -production defect exposed by a test stops the active chunk and is repaired in a -separately scoped change rather than hidden inside coverage work. - -## Threshold policy - -- Coverage JSON supplies exact `covered_lines` and `num_statements`. The first - clean main measurement becomes the initial enforced floor, truncated to six - decimal places only so the exact suite passes. -- Every later chunk raises or preserves the floor; no chunk may lower it. -- A committed evidence summary records tree SHA, Python/coverage/pytest-cov - versions, covered statements, total statements, computed percent, configured - floor, database name, and Alembic head. It never records a credentialed URL. -- A policy checker compares the branch configuration and evidence with the - merge-base version. The configured percentage cannot decrease. When the - application denominator is unchanged, covered statements cannot decrease; - denominator changes require explicit evidence and CI-integrity review. -- The final chunk is incomplete unless `fail_under = 90` and CI passes at 90 or - above while measuring every module under `backend/app`. -- `omit`, `include`, `source`, and coverage pragmas may not exclude application - debt to satisfy the target. - -## Mechanical integrity policy - -A permanent policy check parses `pyproject.toml`, the backend workflow, and -coverage JSON. It inventories every `backend/app/**/*.py`, rejects coverage -`omit`, `include`, `exclude_lines`, or `exclude_also` rules, rejects application -coverage pragmas, rejects a narrowed `--cov` target, verifies the canonical -full-suite command, and verifies the threshold against the base ref. -It also asserts measured coverage is at least the configured six-decimal floor -and the chunk milestone. The workflow proof preserves install, full Ruff, -docstring coverage, complete pytest, and API drill steps; it rejects removed -steps, narrowed test selection, `continue-on-error`, and `|| true`. Coverage -chunks may only replace the existing pytest invocation with the canonical -coverage command and raise its threshold. - -Missing base coverage evidence is accepted only when initializing -`WS-QUAL-001-01` against a base that has no WS-QUAL coverage policy. After that -initialization, missing or malformed base/branch evidence is fatal. - -## Test quality policy - -New tests must assert externally meaningful results: returned values, persisted -state, emitted audit records, queued work, mapped HTTP errors, or fail-closed -behavior. Pure branch execution without an outcome assertion is insufficient. -Coverage percentage is a safety signal, not a reason to add a test. Every added -test must identify the real behavior or safety invariant it protects and assert -an observable outcome. Tests whose only value is executing previously uncovered -lines are rejected even when they increase the measured percentage. -Each chunk records added/modified/deleted/skipped tests and scans its diff for -`skip`, `xfail`, deleted assertions, selection changes, and coverage pragmas. -Tests reuse existing domain fixtures in their owning test file; copied database -reset, actor/project/task factories, HTTP clients, and queue helpers are banned. - -The default 500-line budget is additions plus deletions from the merge base across -implementation/config/test/workflow/runbook files. `.agent-loop` planning, -evidence, status, and trust-bundle lines are reported separately and excluded -from that implementation-size numerator. The policy checker emits both counts -and fails above the reviewed per-chunk cap supplied by the contract. Later -chunks use the default 500 cap. - -The combined chunk 01 was split after all L1 reviewer groups rejected a proposed -1,100-line cap. Chunk 01A retains the reviewed 700-line limit for the database -lifecycle boundary. Chunk 01B consumes its CLI contract and keeps coverage/CI/ -evidence review independent. Later chunks retain the default 500-line cap. - -The blocked 01B1 candidate is further split by responsibility. `01B1A` owns -read-only coverage arithmetic and config/evidence/metadata parsers. `01B1B` -then owns repository-delta scope, executable weakening detection, and deleted- -assertion proof. `01B2` remains the later configuration, evidence publication, -and CI enforcement boundary. Each replacement chunk has its own review, PR, -merge-memory, and start checkpoint. +Retire the old milestone ladder and close the remaining gap with two declared +bounded test chunks followed by one floor switch. One additional owner-specific +test chunk is permitted only when 02R and 03R exhaust their meaningful gaps +without reaching the required headroom: + +1. Add fast project/setup behavior tests for observable service, repository, + routing, queue, and replay gaps. +2. If still needed, add fast checker behavior tests for observable service, + repository, runner, compiler, and routing gaps. +3. On current `main`, prove at least 90.25 percent globally and change only the + canonical GitHub global floor from 78 to 90. + +Each test chunk starts by reading the current hosted coverage JSON and selecting +behavioral gaps. It prefers pure functions, typed fakes, direct use-case calls, +and adapter contracts. PostgreSQL, MinIO, or HTTP is used only when that +boundary is itself the assertion. + +## Coverage target + +The last necessary test chunk must reach at least 90.25 percent before the CI +switch. This is operational headroom, not a permanent higher policy floor. If +concurrent main growth moves the measured result below 90.25 percent, the floor +chunk stops and returns to one owner-specific test plan; it never lowers or +rounds around the target. + +## Test-quality rule + +Every new test must name and assert one observable contract such as returned +data, persisted state, emitted audit/outbox fact, queue decision, mapped error, +authorization denial, idempotent replay, or recovery outcome. A test whose only +effect is executing previously missed lines is invalid. + +No chunk may introduce skips, xfails, coverage pragmas, omit/include narrowing, +deleted assertions, broad mocking of the behavior under test, or duplicated +database/HTTP coverage already owned by another layer. + +## Boundaries + +- QUAL changes tests and, only in the final chunk, the global CI threshold and + its lightweight invariant test. +- A production defect discovered by a stronger test is reported and fixed in a + separate owning initiative/chunk. +- Production service decomposition, repository ports, UnitOfWork design, type + checking, mutation testing, and property-test architecture require separate + initiatives. They are not hidden inside coverage closure. +- CI runtime optimization remains WS-CI-owned. QUAL records test-time impact and + must avoid obvious regressions but does not redesign lane infrastructure. ## Alternatives rejected -- Setting 90 immediately without tests: correctly makes every PR red and gives - no reviewable repair path. -- Diff-only coverage: useful as a supplement but does not satisfy the requested - repository-wide 90 percent floor. -- Excluding large services or generated-looking schemas: hides product risk and - makes the percentage misleading. -- One giant coverage PR: crosses project, task, checker, CI, and auth boundaries - and fails the repository circuit-breaker. - -## Isolated database contract - -`WORKSTREAM_TEST_DATABASE_URL` is authoritative for tests. A shared runner -accepts a parent-only admin DSN through `WORKSTREAM_TEST_ADMIN_DATABASE_URL` and -requires exact scheme `postgresql+asyncpg` plus host `localhost`, `127.0.0.1`, or -`::1`. It derives a name matching `^workstream_test_[a-f0-9]{12}$` from the -canonical worktree path plus a nonce. The name must full-match before safely -quoted identifier use; catalog values are parameterized. - -Ownership begins only after `CREATE DATABASE` succeeds. Collision or create -failure never attaches to, terminates, or drops an existing database. After -catalog ownership validation, cleanup terminates sessions for the exact owned -`datname` and the runner-created unique ephemeral role, including a role session -on the admin database that would otherwise block `DROP ROLE`. It drops only the -owned database and role after child success, nonzero exit, timeout, or -interruption; unrelated database and role sessions survive. - -The child environment removes `WORKSTREAM_TEST_ADMIN_DATABASE_URL` and -`WORKSTREAM_ALLOW_NONLOCAL_E2E_DATABASE`, overwrites both test/runtime database -URLs with the derived target, and exposes no admin credential. Parent output and -errors redact both credentialed admin and target URLs. CI's service database is -already isolated per job. API drill guards accept the strict derived name; the -runner makes the nonlocal override unavailable to ordinary coverage proof. - -## Verification - -Every chunk runs focused tests, Ruff, `pip check`, stale-wording and Markdown -checks, policy/inventory proof, test-delta scan, and an isolated full-suite -coverage command. The final chunk also runs the real API contract drill and -proves CI uses the same 90 percent command. +- Reviving `01B2` and the complex base-evidence ratchet: unnecessary now that + exact lane custody and hosted coverage evidence exist. +- One large cross-owner coverage PR: crosses project, checker, task, artifact, and + authorization ownership and is difficult to review. +- Raising the floor immediately: current measured coverage is below 90. +- Excluding low-coverage services or files: makes the global percentage false. +- More arbitrary shards: changes runtime distribution, not test architecture or + coverage quality. + +## Verification strategy + +Every implementation chunk runs focused tests, Ruff for changed tests, complete +test-delta review, relevant stale-contract checks, and hosted Backend. The final +floor chunk additionally proves the combined coverage JSON covers the complete +application inventory at or above 90.25 percent and that every protected +90-percent check remains blocking. + +## Dependency order + +PLAN2 -> 02R -> optional 03R -> 04R. If those exact owner-scoped chunks do not +provide enough headroom, stop and plan one additional owner-specific test chunk +from the refreshed report. Do not create a percentage-driven residual bucket. +The CI floor change always remains a separate final PR. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/RISKS.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/RISKS.md index dca60f9fd..6e5f2134b 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/RISKS.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/RISKS.md @@ -1,14 +1,14 @@ -# Risks: WS-QUAL-001 Backend Coverage Floor +# Risks: WS-QUAL-001 Current-Main Coverage Closure -| Risk | Control | -|---|---| -| Tests chase lines instead of behavior | Require meaningful outcome assertions and QA/product review | -| Coverage is inflated by exclusions | Measure all `backend/app` modules; prohibit omit lists and coverage pragmas | -| Shared Postgres state corrupts evidence | One provisioner owns a strictly named local database, cleanup, and migration-head evidence | -| Giant PR becomes unreviewable | Split project, task/checker, and residual coverage into bounded chunks | -| Threshold is silently weakened later | CI-integrity review and PR template; floor can only stay level or rise | -| Tests over-mock persistence and workers | Require focused integration proof for repository, queue, and audit outcomes | -| Coverage tracing makes the suite too slow | Profile fixtures separately; never trade correctness or isolation for speed | -| A test exposes a production bug | Stop and create a separately scoped corrective chunk | -| Credentials leak through commands/evidence | Accept admin DSN only from environment; record only database name and redact URLs | -| Ratchet is lowered with its own checker | Compare configuration/evidence to merge base and require CI-integrity review | +| Risk | Consequence | Control | +|---|---|---| +| Coverage-only tests | Higher percentage without stronger behavior proof | Require observable outcomes and QA/test-delta review | +| More database/HTTP tests | Backend CI becomes slower | Prefer pure/use-case/adapter-contract tests unless the real boundary is essential | +| Concurrent denominator growth | Candidate falls below 90 before floor merge | Remeasure current main and require >=90.25% headroom before 04R | +| Threshold bundled with tests | Harder diagnosis and pressure to bargain | Keep the 90-percent switch in separate chunk 04R | +| Production defect discovered | QUAL scope expands into product repair | Stop and hand defect to owning initiative | +| Historical parser revival | Reintroduces complexity and maintenance burden | Mark 01B2 and old replacements superseded | +| File exclusion or pragma | False global measurement | Preserve complete app inventory and existing stale/coverage guards | +| Duplicate invariant tests | Slower suite and ambiguous ownership | Map each new test to its owning layer and review existing proof first | + +No secret, credential, deployment, payment, or production-data access is needed. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/STATUS.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/STATUS.md index 0a425ccd7..d4fdc4c78 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/STATUS.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/STATUS.md @@ -2,197 +2,28 @@ ## Current state -- Phase: `WS-QUAL-001-01B1B-R10` merged; post-merge memory reconciled -- Historical implementation branch: `codex/ws-qual-001-01b1b-semantic-delta-guards` -- Authoritative target: 90 percent complete backend application statement coverage -- Diagnostic AUTH-02 baseline: 78.26 percent after database isolation repair -- Final reviewed planning SHA: `0d9dd987d546c864fa8de7bae462e5e73a1b5ea9` -- Final evidence-bound branch head: `3da1769882e9f6db4c48ef3dba33da8380e6a613` -- Planning merge commit: `9046d52f31c7c39f06e06c45c43783bb08a5181c` -- Internal review: PASS after cleanup, signal, authority, CI, and split repairs -- Active implementation chunk: none -- R8 reviewed contract SHA: `9d72e42cf52f0d2da44dc37216fa38b3542dc2c1` -- R8 start signal: user's 2026-07-13 instruction to fix the blocking coverage - gate after AUTH-02 merged; implementation activated after plan review passed. -- R8 implementation candidate: - `3acf57281da4638476e70d7ed118e24413c1d20b` -- R8 pre-review proof: 117 focused tests, Ruff, `pip check`, self-applied delta - validation, repository documentation gates, and 412/700 raw lines pass. -- R8 cycle-zero review: bounded direct-import, enclosing-shadow, - `unittest.case`, conflicting-owner, PEP 695, and TestCase receiver gaps found. -- R8 cycle-one candidate: - `1a13beaaf968a00a19c64e702b33026283cf0d22` -- R8 cycle-one proof: 140 focused tests and every deterministic gate pass at - 498/700 raw lines. -- R8 cycle-one review: TypeVar-bound scopes, dotted aliases, nearer nonlocal - barriers, executable targets, and vararg annotations remained incomplete. -- R8 cycle-two candidate: - `e2ac216a114bacb4115c7b44efa736e48cd500fb` -- R8 cycle-two proof: 157 focused tests and every deterministic gate pass at - 537/700 raw lines. -- R8 final result: stopped because Python 3.11 uses child symbol tables for - list/set/dict comprehensions while the implementation assumed 3.12 inlining. -- R9 direction: introspected dual-version comprehension scope selection with - explicit Python 3.11 and 3.12 proof; implementation inactive pending review. -- R9 reviewed contract SHA: `4da088000d6f059104a08318104fd211a5e9f77f` -- R9 start signal: user's instruction to fix and finish the blocking coverage - gate; implementation activated after every plan track passed. -- R9 implementation candidate: - `5a971d80c38cbf856e9eee5bcd49fac6873c38c2` -- R9 proof: identical 161-test matrices pass on Python 3.11.15 and 3.12.3; - every deterministic gate passes at 546/600 raw lines. -- R9 cycle-zero review: nested 3.12 inline scope and Python 3.13 public - symtable-type compatibility remained incomplete. -- R9 cycle-one candidate: - `a5395c173741ee584312e5b69e70676092ce9c46` -- R9 cycle-one proof: identical 165-test matrices pass on Python 3.11.15, - 3.12.3, and 3.13.3; every deterministic gate passes at 553/600 raw lines. -- R9 final result: stopped because Python 3.13 bound/default TypeVar children - share public identifiers and require one ordered ordinal. -- R10 direction: shared public TypeVar ordinal with mixed-shape Python 3.13 - proof; the contract subsequently passed review and implementation activated. -- R10 reviewed contract SHA: `c42a67add8e68e646d64eb2bc5b4e2d86502d150` -- R10 start signal: user's instruction to keep AUTH and coverage moving; - implementation activated after all plan tracks passed. -- R10 implementation candidate: - `15d0b80e776f5be12cacc5dbe5226ffe3992dcfd` -- R10 external-repair proof: identical 172-test matrices pass on Python 3.11, - 3.12, and 3.13; Ruff and dependency integrity pass at 584/620 raw lines. -- R10 original internal review: nine required reviewer tracks and the circuit - breaker passed at `15d0b80e776f5be12cacc5dbe5226ffe3992dcfd`. -- R10 external repair: code/test change is `4bcf910`; all nine required reviewer - tracks and the circuit breaker pass at `7e192b8` after evidence-provenance - repair. -- R10 implementation PR: `https://github.com/Flow-Research/workstream/pull/108` - (merged as `5c47aba`) -- 01A implementation PR: `https://github.com/Flow-Research/workstream/pull/103` (merged) -- 01A final reviewed implementation SHA: `d1582ec64b9176c5ead62f695c7a23b48e4c72b9` -- 01A final evidence-bound branch head: `8cd7616b497ceb46d8359c25de689192632dfee8` -- 01A implementation merge commit: `2901a3ebe68b7c770ccb1ff06841d79ce0c20d94` -- 01A post-merge memory PR: `https://github.com/Flow-Research/workstream/pull/104` (merged) -- 01A post-merge memory commit: `8829a7ec3aa5199aae0aecbe5fda030c42a051cd` -- Planning PR: `https://github.com/Flow-Research/workstream/pull/99` (merged) -- 01A implementation base: `58d44596f614895964b82bb344e0ed98596eaae8` -- Start signal: explicit user start on 2026-07-12 -- Split review: combined 01 rejected; 01A database boundary accepted for repair -- Measured whole-app coverage: 79.25 percent; artifact scope: 91.07 percent -- External review: seven CodeRabbit requests repaired and internally re-reviewed - at `d1582ec64b9176c5ead62f695c7a23b48e4c72b9` -- Merge checks: Agent Gates, Backend, and CodeRabbit passed -- 01B start signal: explicit user instruction on 2026-07-12 after PR #104 merge -- 01B plan review: PASS at `7a16ee4e851b1b10315e32d3f81957acc56bf316` -- Circuit breaker: 480/500 implementation lines before configuration, workflow, - runbook, and complete negative proof; executable draft removed -- Split review: PASS at `599c7ef1a55345cd54ab8b5b34351f59c52d60bc` -- D8 approval: explicit user start of only 01B1 on 2026-07-12 -- 01B1 reviewed candidate: `7bfe3a015d10c250a80a79809e5ee65551cd1775` -- 01B1 implementation: 496/500 lines; 66 focused tests passed -- Review result: blocked after the second semantic-integrity repair cycle; - test-delta review still requires `skipTest`/`SkipTest`, aliased - `pytest.raises` deletion, and 0/100/truncation arithmetic boundaries -- Replacement split direction: user approved on 2026-07-12; internal plan - review passed at `d1819873e5ac353da3963771f70dc2be13bc72f9` -- 01B1A reviewed candidate: `5af95751c554ad022128f78c9dd8c1190f38dec4` -- 01B1A result: blocked at 394/400 after the second parser repair cycle; - `pragma:nocover` and leading-space normalized duplicate pytest-cov - requirements remain valid reviewer findings -- Corrective direction: user explicitly authorized fixing the remaining - coverage blockers while AUTH continues in its separate worktree -- R1 contract review: all required tracks passed at - `7901de94f4391c107c52ea8733ac72ad34ceb069` -- R1 implementation result: stopped at `c0fa4a2` because the approximate pragma - regex rejected comments that the installed coverage runtime does not exclude -- R2 contract review: all required tracks passed at - `6d500e8536e99fa847b77724ee4f211d0eaf4209` -- R2 implementation candidate: `40ac7a9b5a9319b0fdccef396aa82342b324e4c3` -- R2 implementation review: all required tracks passed; 58 focused tests and - complete 398/400-line scope proof passed with coverage.py 7.15.0 -- R2 implementation PR: `https://github.com/Flow-Research/workstream/pull/105` -- R2 merge commit: `8a4182edb09970131aded73edf3428ac83fe60b9` -- R2 post-merge memory PR: `https://github.com/Flow-Research/workstream/pull/106` -- R2 post-merge memory merge commit: - `6dccb8e632a6244ca575094be0e3338d49b15856` -- B1B start signal: explicit user direction on 2026-07-13 to run coverage and - AUTH in parallel using isolated worktrees -- B1B reviewed candidate: `10dff4fbbbefaec17e42cd31ca24593ee59209e2` -- B1B result: circuit stop at 223/300 after the second binding repair cycle; - lexical shadowing remained false-positive and a local-lookalike expectation - was weakened to match broader behavior -- B1B-R1 reviewed contract SHA: - `93e48b45171272f5715d00b2158ed0279e64e5e1` -- B1B-R1 start signal: explicit user direction to continue coverage in - parallel with AUTH on 2026-07-13 -- B1B-R1 result: stopped at its first size checkpoint; the shared resolver - measured 282 lines before its required matrix, so the 300-line cap could not - preserve the contract's proof. The draft was discarded without commit. -- B1B-R2 reviewed contract SHA: - `8a5fc4a801ed63b17075720cf248156d7164da7a` -- B1B-R2 start signal: continuing the user's explicit parallel coverage/AUTH - direction after internal contract approval on 2026-07-13 -- B1B-R2 reviewed candidate: `d4cef1d6042de351419d9bf07209735007cc17a7` -- B1B-R2 result: stopped at 348/350 during cycle-zero review. Stdlib lexical - cases, control-flow joins, TestCase provenance, `pytestmark`, and local - `exec` shadowing remained incomplete; the two-line reserve could not fit - genuine repairs and regressions. -- B1B-R3 reviewed contract SHA: - `245ab58b371788c02ecfda2c11c5acf859b8c318` -- B1B-R3 start signal: continuing the user's explicit parallel coverage/AUTH - direction after internal contract approval on 2026-07-13 -- B1B-R3 cycle-zero candidate: `10ca5086c52435f41f33e25cae0f94f454e30c8e` -- B1B-R3 cycle-zero result: 468/500; cycle-one findings cover independent - try/match/loop paths, chained ambiguity, actual binding targets, augmented - assignment/match captures, future annotations, and inlined comprehension - contract precision -- B1B-R3 final result: stopped before cycle-one implementation because the - complete repair and adversarial proof did not credibly fit the 32-line - reserve; no post-`10ca508` executable edit was made -- B1B-R4 reviewed contract SHA: - `ac2bcc6` -- B1B-R4 start signal: continuing the user's explicit parallel coverage/AUTH - direction after internal contract approval on 2026-07-13 -- B1B-R4 reviewed candidate: `06a6d61a0246a3975e58c0ddea2319ad74b37ba3` -- B1B-R4 result: stopped at 535/550 during cycle-zero review. Replayed syntax - corrupted ordinal symtable consumption; loop fixed points, target loads, - unpack provenance, inline ownership, and optional comprehension effects - remained incomplete. -- B1B-R5 reviewed contract SHA: `5672971` -- B1B-R5 start signal: continuing the user's explicit parallel coverage/AUTH - direction after internal contract approval on 2026-07-13 -- B1B-R5 reviewed candidate: `5f59f40` -- B1B-R5 result: stopped at 641/650 during cycle-zero review. Transitive loop - provenance, outer-executed headers, iterable target provenance, evaluation - ordering, summary pruning, and `except*` sequential behavior remained open. -- B1B-R6 reviewed contract SHA: `bfb2d8e` -- B1B-R6 start signal: continuing the user's explicit parallel coverage/AUTH - direction after internal contract approval on 2026-07-13 -- B1B-R6 reviewed candidate: `68174d1` -- B1B-R6 result: stopped at 800/800 after cycle-one review. Comprehension- - produced/set/dict element provenance, structural generator consumption, - nested reachability, and class-global import/AugAssign remained open. -- B1B-R7 reviewed contract SHA: `f0134aa` -- B1B-R7 start signal: continuing the user's explicit parallel coverage/AUTH - direction after internal contract approval on 2026-07-13 -- B1B-R7 cycle-zero candidate: `26a4e6e` -- B1B-R7 cycle-zero result: lazy unknown-call genexpr bodies, unpacked and - conditional provenance, empty-dict reachability, and class-global transfer - remained incomplete. -- B1B-R7 cycle-one candidate: - `a8e1e789f0421c35ecd6f23b9778379fb4b01156` -- B1B-R7 cycle-one proof: 254 focused behavior tests, Ruff, `pip check`, diff - hygiene, and exact 950/950 candidate lines passed. -- B1B-R7 cycle-one review: structural consumption, empty-comprehension - provenance, and class-control/import boundaries remained incomplete. -- B1B-R7 cycle-two candidate: - `5fcd9bb99a733fea9d6b05411ea26c4563375d61` -- B1B-R7 cycle-two proof: 278 focused behavior tests and Ruff passed at - 920/950 candidate lines. -- B1B-R7 final result: stopped after cycle-two review found valid adjacent - transparent-wrapper, qualified/async consumer, sequential shadowing, - relative-import, class-expression, method-consumer, and readability gaps. - No R7 PR may be opened; a replacement requires a reviewed plan and start. +`WS-QUAL-001-PLAN2` has reconciled the initiative against current `main` after +the documentation cleanup merged through PR #259. Deterministic documentation +checks and all required internal plan reviewers pass after scope, ownership, +contract, runtime, and historical-classification repairs. No QUAL implementation +chunk is active; PLAN2 awaits GitHub and human review. + +The latest complete hosted baseline after ART-03C is 88.575080 percent across +23,475 statements and 2,925 tests. The global CI floor remains 78 percent. Multiple +named changed subsystems already have blocking 90-percent checks. + +Historical QUAL work delivered the isolated database runner and test-integrity +guards through PRs #103, #105, and #108. The many stopped semantic-analysis +replacements remain historical evidence, not work to resume. + +## Current gate + +Merge PLAN2 after GitHub and human review. The first proposed implementation successor is +`WS-QUAL-001-02R`, limited to meaningful project/setup tests. It must be +refreshed on the then-current `main` before implementation. ## Stop condition -R10 merged through PR #108 as `5c47aba`; this AUTH convergence records its -post-merge memory. AUTH-03 remains independently active at ready PR #109. Do not -start 01B2 or chunk 02 without a separate explicit user start. +Planning does not change tests, application code, workflow code, or thresholds. +Do not raise the global floor until hosted combined coverage is at least 90.25 +percent on the exact candidate head. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/README.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/README.md new file mode 100644 index 000000000..ad3b62973 --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/README.md @@ -0,0 +1,13 @@ +# QUAL Chunk Records + +Only these PLAN2 records describe possible current work: + +- `WS-QUAL-001-PLAN2-current-main-reconciliation.md` +- `WS-QUAL-001-02R-project-setup-behavior-coverage.md` +- `WS-QUAL-001-03R-checker-behavior-coverage.md` +- `WS-QUAL-001-04R-global-90-floor.md` + +Every other file in this directory is historical evidence from the original +QUAL plan, a completed chunk, a stopped repair attempt, or a superseded +contract. Historical records cannot be started or treated as current +implementation authority. `CHUNK_MAP.md` records their final disposition. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-01B2-baseline-evidence-ci-ratchet.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-01B2-baseline-evidence-ci-ratchet.md index 884cc083b..9681c8617 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-01B2-baseline-evidence-ci-ratchet.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-01B2-baseline-evidence-ci-ratchet.md @@ -1,7 +1,11 @@ +# Historical Superseded Contract — Do Not Implement + +PLAN2 supersedes this unimplemented ratchet contract. It remains only as +historical evidence and cannot authorize current work. + # Chunk Contract: WS-QUAL-001-01B2 Baseline Evidence And CI Ratchet -Status: inactive until B1B-R7 merges, its post-merge memory update is complete, -and the user gives a separate explicit start signal. +Status: `historical_superseded_non_executable`. ## Goal, Risk, And Budget diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02-project-service-coverage.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02-project-service-coverage.md index ead61df3d..e62b77537 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02-project-service-coverage.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02-project-service-coverage.md @@ -1,3 +1,8 @@ +# Historical Superseded Contract — Do Not Implement + +PLAN2 supersedes this milestone contract. It remains only as historical +evidence and cannot authorize current work. + # Chunk Contract: WS-QUAL-001-02 Project Service Coverage ## Goal, risk, and budget diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02R-project-setup-behavior-coverage.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02R-project-setup-behavior-coverage.md new file mode 100644 index 000000000..9deb7d5dc --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-02R-project-setup-behavior-coverage.md @@ -0,0 +1,37 @@ +# Chunk Contract: WS-QUAL-001-02R — Project And Setup Behavior Coverage + +Parent initiative: `WS-QUAL-001` + +Goal: add meaningful fast tests for current project/setup service, repository, +router, queue, and replay gaps selected from the refreshed hosted report. + +Risk: L2 test-only; P2. + +Allowed files: + +- `backend/tests/test_projects.py` +- `.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/**` + +Not allowed: production code, migrations, workflow/threshold changes, skips, +xfails, coverage exclusions, assertion deletion, or duplicated broad HTTP flows. + +Acceptance: every test asserts an observable behavior; focused tests pass; +runtime impact is recorded; complete hosted Backend passes; global coverage is +at least 89.55 percent without weakening any protected floor. If meaningful +project/setup gaps are exhausted before that target, stop and replan rather +than add artificial tests. + +Verification commands: + +- `cd backend && ruff check tests/test_projects.py` +- `cd backend && WORKSTREAM_TEST_ADMIN_DATABASE_URL=postgresql+asyncpg://workstream:workstream@localhost:5433/postgres python scripts/run_isolated_tests.py --metadata-json .ci/qual-02r-database.json --timeout-seconds 1200 -- pytest -q tests/test_projects.py` +- Hosted Backend semantic lanes and final coverage fan-in. +- Test-delta scan for skips, xfails, deleted assertions, and coverage narrowing. + +Required reviewers: senior, QA, test-delta, CI integrity, product/ops, reuse. +Human focus: test value and avoidance of unnecessary PostgreSQL/HTTP cost. An +unexplained focused-test or hosted-wall increase above 10 percent stops the +chunk for review; ordinary hosted-run noise must be documented. + +Stop if current missing-line evidence is stale, a production defect is found, +or meaningful tests require production architecture changes. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03-project-boundary-coverage.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03-project-boundary-coverage.md index ba194a401..388b73284 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03-project-boundary-coverage.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03-project-boundary-coverage.md @@ -1,3 +1,8 @@ +# Historical Superseded Contract — Do Not Implement + +PLAN2 supersedes this milestone contract. It remains only as historical +evidence and cannot authorize current work. + # Chunk Contract: WS-QUAL-001-03 Project Boundary Coverage ## Goal, risk, and budget diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03R-checker-behavior-coverage.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03R-checker-behavior-coverage.md new file mode 100644 index 000000000..e0faa9d1a --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-03R-checker-behavior-coverage.md @@ -0,0 +1,36 @@ +# Chunk Contract: WS-QUAL-001-03R — Checker Behavior Coverage + +Parent initiative: `WS-QUAL-001` + +Goal: if still necessary after 02R, add meaningful fast tests for current +checker service, repository, runner, compiler, and routing gaps. + +Risk: L2 test-only; P2. + +Allowed files: + +- `backend/tests/test_checkers.py` +- `.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/**` + +Not allowed: production code, migrations, workflow/threshold changes, skips, +xfails, coverage exclusions, assertion deletion, or duplicate system flows. + +Acceptance: observable outcomes, focused proof, recorded runtime impact, +complete hosted Backend, and exact global coverage of at least 90.25 percent. +If meaningful checker gaps are exhausted first, stop and plan one explicit +owner-specific successor rather than add artificial tests. + +Verification commands: + +- `cd backend && ruff check tests/test_checkers.py` +- `cd backend && WORKSTREAM_TEST_ADMIN_DATABASE_URL=postgresql+asyncpg://workstream:workstream@localhost:5433/postgres python scripts/run_isolated_tests.py --metadata-json .ci/qual-03r-database.json --timeout-seconds 1200 -- pytest -q tests/test_checkers.py` +- Hosted Backend semantic lanes and final coverage fan-in. +- Test-delta scan for skips, xfails, deleted assertions, and coverage narrowing. + +Required reviewers: senior, QA, test-delta, CI integrity, product/ops, reuse. +Human focus: checker invariant ownership and fast-layer placement. This chunk +does not change or test TASK-owned lifecycle behavior merely for percentage. +An unexplained focused-test or hosted-wall increase above 10 percent stops the +chunk for review; ordinary hosted-run noise must be documented. + +Stop on stale evidence, production defect, or architecture expansion. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04-task-coverage.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04-task-coverage.md index fc6c6608f..1571e04e0 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04-task-coverage.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04-task-coverage.md @@ -1,3 +1,8 @@ +# Historical Superseded Contract — Do Not Implement + +PLAN2 supersedes this milestone contract. It remains only as historical +evidence and cannot authorize current work. + # Chunk Contract: WS-QUAL-001-04 Task Coverage ## Goal, risk, and budget diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04R-global-90-floor.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04R-global-90-floor.md new file mode 100644 index 000000000..cd9b52f5f --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-04R-global-90-floor.md @@ -0,0 +1,39 @@ +# Chunk Contract: WS-QUAL-001-04R — Global 90 Percent CI Floor + +Parent initiative: `WS-QUAL-001` + +Goal: after exact hosted proof at or above 90.25 percent, change the canonical +global Backend floor from 78 to 90 and update its lightweight invariant. + +Risk: L1 CI policy; P1. + +Allowed files: + +- `.github/workflows/backend.yml` +- `scripts/test_lightweight_agent_gates.py` +- `.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/**` + +Not allowed: test/application/dependency changes, coverage inventory narrowing, +protected-floor removal, workflow bypass, or unrelated CI optimization. + +Acceptance: current exact head proves >=90.25%; global `--fail-under=90` blocks; +all existing protected 90-percent checks remain; complete hosted Backend and +Agent Gates pass. The hosted evidence step reads generated +`.ci/test-lanes/coverage.json`, validates integer totals, and fails unless +`covered_lines * 10000 >= num_statements * 9025`. It records both the measured +global percentage and required `90.25` pre-switch percentage in +`hosted-evidence.json` on the exact checked-out head. + +Verification commands/evidence: + +- `PYTHONPATH=. python3 scripts/test_lightweight_agent_gates.py` +- Inspect the workflow diff for the unchanged complete application inventory, + integer 90.25-percent evidence check, recorded required percentage, global + `--fail-under=90`, and every existing protected check. +- Full hosted semantic lanes/fan-in and generated coverage/hosted-evidence JSON. +- Test-delta and CI-integrity review. + +Required reviewers: senior, QA, CI integrity, test-delta, architecture, docs. +Human focus: exact proof, unchanged application inventory, and no CI weakening. + +Stop if the exact candidate measures below 90.25 percent for any reason. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-05-checker-coverage.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-05-checker-coverage.md index 8535457cd..76295fcf7 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-05-checker-coverage.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-05-checker-coverage.md @@ -1,3 +1,8 @@ +# Historical Superseded Contract — Do Not Implement + +PLAN2 supersedes this milestone contract. It remains only as historical +evidence and cannot authorize current work. + # Chunk Contract: WS-QUAL-001-05 Checker Coverage ## Goal, risk, and budget diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-06-permanent-90-floor.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-06-permanent-90-floor.md index 9246b0235..b5af3a1f7 100644 --- a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-06-permanent-90-floor.md +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-06-permanent-90-floor.md @@ -1,3 +1,8 @@ +# Historical Superseded Contract — Do Not Implement + +PLAN2 supersedes this milestone contract. It remains only as historical +evidence and cannot authorize current work. + # Chunk Contract: WS-QUAL-001-06 Permanent 90 Percent Floor ## Goal, risk, and budget diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-PLAN2-current-main-reconciliation.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-PLAN2-current-main-reconciliation.md new file mode 100644 index 000000000..b0d32f7b6 --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/chunks/WS-QUAL-001-PLAN2-current-main-reconciliation.md @@ -0,0 +1,46 @@ +# Chunk Contract: WS-QUAL-001-PLAN2 — Current-Main Coverage Reconciliation + +Parent initiative: `WS-QUAL-001` + +## Goal + +Replace the obsolete milestone ladder with an evidence-backed closure plan from +the current hosted 88.575080-percent baseline. + +## Risk class and SLA + +L1 CI/test-policy planning; P2. + +## Allowed files + +- `.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/**` + +## Not allowed changes + +- Application, test, workflow, CI, dependency, or coverage configuration files. +- Any AUTH, ART, REV, CON, or external-contributor PR/branch. + +## Acceptance criteria + +- Exact hosted counts and timing are recorded. +- Completed historical work is separated from stopped/superseded experiments. +- Remaining work is PR-sized and keeps the threshold switch separate. +- Test quality and runtime guardrails are explicit. +- Required plan reviewers pass. + +## Verification commands + +- `python3 scripts/check_stale_workstream_wording.py` +- `python3 scripts/check_markdown_links.py` +- `git diff --name-only origin/main...HEAD | awk 'index($0, ".agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/") != 1 { print; bad=1 } END { exit bad }'` +- `git diff --check` + +## Required reviewers + +Plan, senior engineering, QA/test, CI integrity, architecture, product/ops, and +docs. Security is not applicable because no runtime/auth behavior changes. + +## Human review focus and stop + +Confirm the simplified sequence and baseline. Stop after the planning PR; no +test or threshold implementation starts from this contract. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/reviews/WS-QUAL-001-PLAN2-external-review-response.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/reviews/WS-QUAL-001-PLAN2-external-review-response.md new file mode 100644 index 000000000..9f7eb03a5 --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/reviews/WS-QUAL-001-PLAN2-external-review-response.md @@ -0,0 +1,46 @@ +# WS-QUAL-001-PLAN2 External Review Response + +## Comments addressed + +The hosted Agent Gates stale-authorization scanner rejected two newly changed +planning lines for ambiguous role-like vocabulary. The plan meant asynchronous +background-job modules, not a product actor class. Both lines now use explicit +background-job terminology. + +CodeRabbit's completed review identified six documentation gaps. The repair: + +- gives the superseded 01B2 contract an unambiguous machine-readable + non-executable status; +- defines the exact integer 90.25-percent hosted-evidence calculation and the + fields that 04R must record; +- limits any additional test chunk to the case where 02R and 03R cannot create + the required headroom; +- adds the omitted authorization and artifact scanners to deterministic + evidence; and +- adds a closed-path diff check proving PLAN2 changes only its initiative tree. + +## Comments deferred + +None. CodeRabbit's fresh review completed and every actionable and nitpick +finding was addressed in this repair. + +## Human decisions needed + +None beyond normal PR review and explicit merge approval. + +## Commands rerun + +- `python3 scripts/check_stale_workstream_wording.py` +- `python3 scripts/check_stale_authorization_docs.py` +- `python3 scripts/check_stale_artifact_contracts.py` +- `python3 scripts/check_markdown_links.py` +- `PYTHONPATH=. python3 scripts/test_lightweight_agent_gates.py` +- `git diff --name-only origin/main...HEAD | awk 'index($0, ".agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/") != 1 { print; bad=1 } END { exit bad }'` +- `git diff --check` + +## Remaining risks + +Hosted Agent Gates, Backend, and CodeRabbit must pass on the repaired exact +head. No backend, test, workflow, or threshold file changes originate in this +repair. PLAN2 also reconciles merged PRs #258 and #249 and uses PR #249's final +hosted coverage evidence as the current baseline. diff --git a/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/reviews/WS-QUAL-001-PLAN2-review-and-trust-bundle.md b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/reviews/WS-QUAL-001-PLAN2-review-and-trust-bundle.md new file mode 100644 index 000000000..549927ebf --- /dev/null +++ b/.agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/reviews/WS-QUAL-001-PLAN2-review-and-trust-bundle.md @@ -0,0 +1,76 @@ +# WS-QUAL-001-PLAN2 Review And PR Trust Bundle + +## Intent + +Reconcile QUAL from current hosted evidence and replace its obsolete 78-to-90 +milestone ladder with the smallest owner-scoped path to a global 90-percent +backend floor. + +## Baseline evidence + +Backend run `30854931616` on exact tested tree +`19d48f7ea4bf20cb29f03cbba54f98683ce52661` and its hosted evidence record 2,925 +completed tests, 20,793 covered of 23,475 statements, 88.575080-percent global +coverage, 640.284 seconds wall time, and a 468.506-second slowest lane. This is +the final ART-03C tested tree later merged to `main` through PR #249. + +## Scope + +Planning records only. No application, test, workflow, coverage threshold, +dependency, AUTH, ART, REV, CON, or external contributor change. + +## Design + +- 02R: exact PROJECT/setup test ownership in `test_projects.py`, target 89.55%. +- optional 03R: exact CHECKER ownership in `test_checkers.py`, target 90.25%. +- 04R: separate global CI floor change from 78 to 90 after exact >=90.25% proof. +- Any further gap requires one new owner-specific plan; no mixed residual bucket. +- Old 01B2 and 02-06 contracts are explicitly historical and non-executable. + +## Internal review + +- Architecture: initial FAIL on placeholder contracts, old active-looking + contracts, and global/per-module ambiguity; all repaired; final PASS. +- Senior engineering: same contract/classification/wording blockers repaired; + final PASS. +- QA: initial FAIL on missing exact commands/targets and inconsistent 90.25% + headroom; repaired; final PASS WITH LOW RISKS, with wording polished. +- Product/operations: initial FAIL on cross-owner residual and CHECKER/TASK + coupling; mixed residual deleted and 03R narrowed to CHECKER; final PASS. +- CI integrity: hosted counts independently verified; runtime stop controls and + exact final headroom added; final PASS. +- Docs: PASS WITH LOW RISKS; original combined chunk disposition added to the + map for complete historical navigation. + +## Deterministic evidence + +- `python3 scripts/check_stale_workstream_wording.py` +- `python3 scripts/check_stale_authorization_docs.py` +- `python3 scripts/check_stale_artifact_contracts.py` +- `python3 scripts/check_markdown_links.py` +- `PYTHONPATH=. python3 scripts/test_lightweight_agent_gates.py` +- `git diff --name-only origin/main...HEAD | awk 'index($0, ".agent-loop/initiatives/WS-QUAL-001-backend-coverage-floor/") != 1 { print; bad=1 } END { exit bad }'` +- `git diff --check` + +## Risks and human focus + +Confirm the plan does not reward artificial tests, does not revive static +parser complexity, and keeps CI runtime visible. The first implementation +contract remains separately started after this planning PR merges. + +## Merge ownership + +GitHub checks and explicit human approval are required. PLAN2 authorizes no +test or workflow implementation by itself. + +## External repair + +Hosted Agent Gates found two ambiguous role-like references in changed planning +lines. They now say background-job modules/ownership, avoiding confusion with a +product actor class. CodeRabbit's completed review then found six documentation +gaps: superseded status clarity, exact integer headroom proof, conditional extra +chunk wording, missing deterministic scanners, stale external-review status, +and missing closed-path verification. All six are addressed; none is deferred. + +After PRs #258 and #249 advanced `main`, PLAN2 merged that trusted head and +replaced its older PR #259 baseline with the final ART-03C hosted evidence.