test: require existing regression classes in grpc phase gates

This commit is contained in:
Joseph Doherty
2026-11-15 21:18:42 -05:00
parent 88f0a57ab4
commit 28aabaf82d
4 changed files with 95 additions and 12 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ The [implementation plan](../../2026-11-15-grpc-data-connections-implementation-
| Phase | Scope | Status | Evidence |
|---|---|---|---|
| P00 | Unit discovery isolation and execution controls | Passed | 16 Python runner units; 2 C# guard units, zero failures/skips; phase run `20261116T020652.895154Z-0d06c2c1ac5f` |
| P00 | Unit discovery isolation and execution controls | Passed | 22 Python runner units after Astra correction; 2 C# guard units, zero failures/skips; clean phase run `20261116T020813.843515Z-2ebe0fbcb7d2` |
| P01 | Domain/protobuf contracts | In progress | Domain-contract worker next; codec follows frozen types |
| P02 | Schema/artifact/consumer projection | Pending | |
| P03 | Shared authorization and leases | Pending | |
@@ -57,4 +57,4 @@ Runtime artifacts belong under ignored `artifacts/grpc-data/`; this tracked ledg
## P00 verification
The runner tests first failed as expected while `run-unit-phase.py` was absent. After implementation, 16 fake-subprocess Python units passed. The real P00 discovery/execution runner passed both counting-probe/reaper C# tests with no skips; the starting production graph compiled successfully. No solution test run or Docker mutation occurred. Raw TRX/commands/discovery identities remain in ignored artifacts. The runner validates discovery AND executed results for every required new class, retains parameterized class filters, and sanitizes both child environments.
The runner tests first failed as expected while `run-unit-phase.py` was absent. After initial implementation, 18 fake-subprocess Python units passed. Astra found required existing regression classes were not enforced as strictly as new classes; four added regression tests failed before the correction. The final 22 Python tests passed, with red/green logs in `artifacts/grpc-data/p00-runner-regressions/`. The real P00 discovery/execution runner passed both counting-probe/reaper C# tests with no skips; the starting production graph compiled successfully. No solution test run or Docker mutation occurred. Raw TRX/commands/discovery identities remain in ignored artifacts. The runner validates discovery AND executed results for every required new class, retains parameterized class filters, and sanitizes both child environments. Astra approved P00 after the required-existing-class correction; see [checkpoint review](p00-astra-review.md).
@@ -0,0 +1,40 @@
# P00 Astra implementation checkpoint review
Date: 2026-11-15 (America/Indiana/Indianapolis)
Scope: commit `5822e37c8ae05863c325afe2d77e5aa9b668115a` plus the frozen M1 corrective runner/test diff reviewed on disk before commit, P00 only. The review covers the phase runner, environment isolation, discovery and TRX validation, evidence identity, manifest, AdminUI SQL guard, and their tests against the [implementation plan](../../2026-11-15-grpc-data-connections-implementation-plan.md), [design](../../2026-11-15-grpc-data-connections-design.md), prior Astra findings, and repository CI test policy.
**Disposition: P00 approved after correction; M1 is resolved.** The observed SQL-isolation gate is valid, and the runner now requires every selected new and existing class in discovery and execution. No high-severity SQL discovery or reaper regression was found. This is an execution-controls checkpoint, not approval of P01 contracts or completion of the gRPC data feature.
## M1 — Require existing regression classes in discovery and execution
**Severity: Medium. Status: resolved after follow-up review.** The original finding is retained below for traceability; line references describe the initial commit.
`run-unit-phase.py` uses `existing_classes` only to validate a `--case` name (lines 138–143). The discovery map at line 201 and the expected-class argument to `validate_trx` at line 214 contain only `new_classes`. Consequently, an OR selector for a renamed, removed, or misspelled required existing class can match zero tests while the new feature class makes the phase pass. This loses the regression coverage explicitly required by the plan's “each selector” zero-match policy. For example, P01 could report success without `DataChangeBatchContractTests` while `GrpcDataContractsTests` passes.
The fake runner fixture also demonstrates the gap directly in source: its discovery output lists both `NewTests` and `OldTests`, while its successful TRX contains only `NewTests`. The success test accepts that report. No speculative adapter behavior is needed to reach the finding. When `--case` names an existing class, the expected TRX class set is empty, so a different class's successful result would also be accepted after valid discovery.
**Required correction:** Validate the union of the selected `new_classes` and `existing_classes` at both discovery and TRX execution, retaining separate fields if useful for evidence. With `--case`, narrow both lists to the chosen class. Add fake-subprocess cases for an absent existing class during discovery, an existing class discovered but absent from execution, and a narrowed existing-class run whose TRX contains a different class. Keep the existing missing-new-class and skipped-result checks.
This finding does not invalidate the recorded P00 result because P00 has no required existing regression classes. It should be corrected before accepting P01 or another phase with required existing classes.
**Resolution:** The reviewed correction constructs `required_classes` from both manifest lists and uses it for the discovery map and `validate_trx`. Both lists are narrowed under `--case`; execution evidence now retains `existing_classes` alongside `new_classes`. The fake success fixture supplies both required classes instead of silently omitting the existing one. Added cases reject absent existing-class discovery and execution, verify the existing-class execution identity, and verify that either kind of narrowed run excludes the other required list. The existing wrong-class execution and skip checks remain. These paths close the false-pass condition without weakening any prior gate.
The saved `artifacts/grpc-data/p00-runner-regressions/red.log` shows 22 tests with four failures attributable to the original missing checks. `green.log` shows the same 22-test suite passing after the correction. The reviewer inspected both logs and the diff; no reviewer test execution occurred. The SQL guard and its two C# tests were unchanged by this correction.
## Evidence inspected
- The initial run `20261116T020652.895154Z-0d06c2c1ac5f` was followed by a complete repeat at `20261116T020813.843515Z-2ebe0fbcb7d2`. The repeat's `run.json` records the exact reviewed commit, an empty dirty status, the empty-diff SHA-256, and no untracked files.
- The repeat's discovery manifest contains exactly the two methods in `GrpcDataUnitDiscoveryIsolationTests`. Its TRX reports total/executed/passed = 2, zero failures and skips, and the required class in `executed_classes`. The execution log agrees. Both commands build the exact AdminUI unit project and its dependencies normally with the required Release, scheduling, and runsettings options.
- The initial Python runner had 18 test methods, with successful execution reported by the coordinator. The corrective suite contains 22 methods, and its saved red/green logs were inspected directly as described above. Integrate the final count and the clean C# repeat run identifier into the execution ledger; the earlier 16-test entry predates the reviewed correction.
- The reviewer inspected source and existing evidence only. No build, test, fixture, Docker, or migration command was run, and no production or worker file was edited.
## Checks without a blocking finding
- **SQL discovery and fixture lifecycle:** `AdminUiSqlServerProbe.SkipReason` checks `OTOPCUA_UNIT_ONLY_DISCOVERY` before evaluating the lazy connection probe. The fixture returns on that reason before reaping, creating a database, migrating, or setting teardown connection state. The reaper entry point independently checks the same switch. The parameterless production attribute and fixture both delegate to this guarded probe. Normal-mode lazy caching is preserved.
- **Behavioral guard coverage:** The two C# tests construct the actual attribute and fixture through an injected counting probe/reaper seam. Unit mode asserts zero calls, including a direct attempt to call the guarded reaper. Normal mode demonstrates that the callback path remains enabled and cached once. The environment-changing collection disables parallel execution and restores the prior switch in `finally`.
- **Discovery-side audit:** The selected phase assemblies contain one custom `FactAttribute` implementation, the guarded AdminUI SQL attribute. The Configuration SQL fixture is collection-construction driven and is not selected by its phase's unit filters; the environment also replaces its shared endpoint with a loopback unavailable sentinel. OPC UA bounds fixtures belong to their own unselected test classes. This source audit is not a claim of network tracing or of future new classes being automatically safe; later additions still require review.
- **Child environment and command scope:** Both discovery and execution receive the same explicit allowlist, dedicated unit switch, and unavailable SQL/OPC UA sentinels. Ambient fixture credentials, application connection variables, and Docker endpoint variables are omitted. The runner uses argv with `shell=False`, rejects non-unit project paths, does not use stale `--no-build` outputs, performs no automatic retry, and gives each run/project a unique artifact directory.
- **TRX and skipped-class handling:** The runner rejects missing/stale/malformed TRX, zero executed tests, failures, inconsistent result counts, and any non-Passed individual result. Executed class identity is checked against TRX definitions for every required new and existing class after the M1 correction; neither category can mask a missing class in the other.
- **Identity and scope:** SHA, dirty status, tracked diff digest, untracked file digests, exact argv/filter, and durations are retained without writing raw source diffs or inherited environment values into the report. This identity is captured at run start; it is not a guarantee against edits during a run. The clean repeat above is the evidence for this checkpoint. No SQL-backed integration coverage is inferred from the two unit tests; final local fixture coverage and removal of the unit switch remain P12 obligations.
Only this checkpoint review document was edited by the reviewer. No commit was created.