Skip to content

feat(cli): report doctor probe route and scope - #410

Merged
barbatdev merged 1 commit into
mainfrom
fix/qa-doctor-scope
Oct 31, 2026
Merged

barbatdev merged 1 commit into
mainfrom
fix/qa-doctor-scope

Conversation

@barbatdev

Copy link
Copy Markdown
Contributor

Linked Issue

Refs #374

Umbrella: #401

PR Type

  • type:feature Feature
  • type:bug Bug fix
  • type:docs Documentation
  • type:refactor Refactoring
  • type:chore Maintenance
  • type:breaking-change Breaking change

Summary

Report the actual doctor-probed route and explicitly disclose embedded/default-route scope. Map inconclusive admission checks to non-ready assets_unverifiable and preserve observed fingerprint expected/found evidence.

Changes

This is slice 8/8, 219 authored changed lines. Code, focused tests and applicable operating documentation stay together. Exact reviewed source commit: ddd20d9e6569866b3ff0fd0d32d537cbb00df8b4. Delivery head d8acc6aace11a8b254a45246afb463cf2d0405ec has the identical complete source tree.

Focused Tests

Each cumulative prepared slice passed go test ./internal/cli ./internal/qapi ./internal/qaroute ./internal/installobserve -count=1, go vet ./... and whitespace checks. Final candidate additionally passed go test ./... -count=1, go vet ./..., go test -race ./... and all 15 repository Python policy tests on a byte-verified canonical clean snapshot. Independent source-agreement, typed-admission and final security verification passed with no severe blockers; final verification observed 19 named tests plus four package suites/vet.

Native assessment of this exact slice: medium native tier, reviewDue=false (under_budget); no new native review started. Security-affecting slices retained explicit high-risk escalation and independent verification rather than treating assessment as proof. Parser's separately requested native review completed approved and acknowledged.

Runtime Harness

Disposable public CLI fixtures, no real provider calls. Rejections pin no launch/write effects, route identity and safe profile tokens. macOS /tmp is a symlink and intentionally refused: canonical snapshot cwd passed unchanged guards. No credentials changed.

Rollback

Revert this slice. Revert any dependent later slice first; no stored-data migration.

Chain Dependencies / Out of Scope

Sequential verified-main strategy: merged #408 -> [current slice 8/8] -> remaining slices. This PR targets main only after its predecessor lands, so its diff contains only this work unit. Do not close the umbrella from this intermediate slice.

Known acceptance limit: #329's literal transient/persistent causal distinction is NOT established by stage reporting and remains open. Defensive untyped branches, a currently unreachable non_nan_route mapping and a brittle wording assertion were disclosed as nonblocking verifier advisories, not silently fixed. Provider transport #345 and lifecycle #373 are out of scope.

Checklist

  • Linked issue is open and status:approved.
  • Exactly one matching type:* label is applied.
  • Focused tests and runtime harness evidence are recorded.
  • Rollback and out-of-scope boundaries are documented.

@barbatdev barbatdev added the type:bug Bug fix label Oct 31, 2026
@barbatdev

Copy link
Copy Markdown
Contributor Author

Fleet review (qwen38)

Lens: evidence. Slice 8/8 for #374: doctor's qaBackendLine now keeps the probe's full AvailabilityVerdict instead of discarding it, names the routed pair only when the verdict carried one (qaRouteIdentity, reusing the slice-7 sanitizeRouteIdentity so caller-owned tokens still cannot inject escapes), the scope note discloses qa_route_scope=embedded_default_route, and five inconclusive admission stages map to a new assets_unverifiable token instead of implying an observed digest mismatch. Evidence that is real and reproducible from the PR: TestDoctorNamesTheProbedRouteAndItsScope pins the pair for model_unavailable, pins its absence for a ready verdict, and pins the note text; qaAssetAvailabilityFromError gains five hand-built unit cases plus the preserved fail-closed and expected/found cases; the profile-refusal tests pin exact stderr envelopes including for a hostile profile id and no-launch on refusal. Remaining gaps are evidence gaps, not demonstrated defects: (a) nothing in the diff shows that installobserve's production checks actually emit the five new stage strings, so the mapping's real-world activation is unproven; (b) the operating.md rewrite claims relative qa setup roots are accepted with no code or test for that in this slice; (c) unknown stages still default to assets_mismatch, the same misreporting class this slice fixes for the five named stages. The delivery-head source-equivalence claim (identical tree vs reviewed commit ddd20d9) is asserted without a reproducible check, same as the prior slice. No blocking finding: every concern lacks a concrete failing input/path.

Suggestion (1)

  • Unknown stages still default to assets_mismatch — the same misreport class being fixed (internal/cli/qabackend.go:133): With the new arms, the function's fallback for any AdmissionUnavailableError whose stage is in neither the missing list nor the unverifiable list is still 'assets_mismatch' with an expected/found diagnostic — a claim of digest disagreement that may never have been observed, which is precisely the defect qa run refusals do not identify the failing stage and the route note misreports the resolved route #374 S7 cites. The body already discloses an unreachable non_nan_route mapping of this shape. Consider mapping unrecognized (Expected=="" && Found=="") stages to assets_check_failed, which already exists as the fail-closed token, so future inconclusive stages degrade to 'could not conclude' rather than 'mismatch'.

Question (2)

  • The five new unverifiable stage names are only exercised by hand-built errors, not by the real check (internal/cli/qabackend.go:130): The switch arms for binding_invalid, install_root_invalid, current_directory_invalid, actor_guidance_invalid and actor_shadow_unverified are tested exclusively by constructing installobserve.AdmissionUnavailableError values with those exact strings (doctor_test.go:197-200). No test in the diff drives a real asset check into one of those refusals, and no line in the diff shows the production emitter (checkQAAssets / installobserve) producing those stage names. If the real stage strings differ, the inconclusive-stage case in qa run refusals do not identify the failing stage and the route note misreports the resolved route #374 S7 still falls through to assets_mismatch and the reported defect survives while the unit tests stay green. Please point to the production site that raises each stage (file:line) or add one integration case through the real check.
  • Docs claim relative qa setup roots are accepted; no code or test in this slice evidences it (docs/operating.md:290): The rewritten step-2 text states 'Relative and absolute roots are both accepted: the command resolves the path before it writes, so qa setup --catalog catalog and qa run --catalog catalog from the same directory address the same file (Bug: qa run silently ignores the route profile when the catalog path is not canonical-absolute #324)', replacing the earlier absolute-only instruction. The diff contains no path-resolution change and no test pinning relative-root acceptance for qa setup. Either this documents behavior landed in an earlier slice (name it and its test) or the operating doc now promises a capability the binary may refuse — docs are the operator's contract for qa run refusals do not identify the failing stage and the route note misreports the resolved route #374's usability complaint, so the claim needs an anchor.

Verdict: ready to merge

@barbatdev
barbatdev merged commit e19f021 into main Oct 31, 2026
3 checks passed
@barbatdev

Copy link
Copy Markdown
Contributor Author

Post-merge QA (glm)

Slice 8/8 of the #374 chain: doctor now names the routed pair its verdict answered about and discloses embedded-default-route scope; inconclusive admission checks map to assets_unverifiable instead of implying an unobserved digest mismatch. The diff matches the linked issue's doctor-related expectations (route naming, scope note, stage differentiation), the production probe now carries the whole AvailabilityVerdict, and the new tests pin both the naming and the no-invented-pair case. Consistent with #408's sanitizer. Nothing found that breaks what landed.

Suggestion (1)

  • qaAvailabilityToken renders an empty token if a verdict is unavailable with an empty Code (internal/cli/qabackend.go:240): qaAvailabilityToken returns string(verdict.Code) when Available is false. If a future probe ever returns Available=false with an empty Code (no production path today), the doctor line would print qa_availability= with an empty value instead of failing closed to a named token. A default token like unknown would keep the line well-formed under any verdict.

Verdict: clean

@barbatdev

Copy link
Copy Markdown
Contributor Author

Post-merge QA (deepseek)

Lens: evidence + test design. This doctor slice does what #374 S7 asks: the probe seam now carries the whole qapi.AvailabilityVerdict, qaRouteIdentity names the routed pair only when the verdict actually carried one, and the inconclusive admission stages get their own assets_unverifiable token instead of the assets_mismatch claim that was never observed. The paths I traced (ready verdict, empty provider/model, foreign catalog with expected+found, untyped failure) all behave as documented. The weakest evidence is the mapping table itself: install_root_invalid is added to the new switch but no test pins it, and the comment above the function still describes the old two-token vocabulary.

Suggestion (2)

  • install_root_invalid is mapped but never exercised (internal/cli/qabackend.go:132): The new case lists five stage tokens. TestQAAssetAvailabilityFromError pins binding_invalid, current_directory_invalid, actor_guidance_invalid and actor_shadow_unverified; install_root_invalid is the only one of the five with no test, and it is the token a non-canonical install root actually produces (internal/installobserve/admission.go:100). Nothing breaks today, but a later edit to the case list would not fail any test. Test condition to add: AdmissionUnavailableError{Stage: "install_root_invalid"} maps to token assets_unverifiable with diagnostic " qa_assets_stage=install_root_invalid".
  • The doc comment still says two availability tokens where there are now three (internal/cli/qabackend.go:109): qaAssetAvailabilityFromError's comment reads "Missing assets and mismatched assets are two tokens", but the function now returns assets_missing, assets_mismatch and assets_unverifiable (and the caller adds assets_check_failed). Inside the package this comment is the only place the token vocabulary is written down, so it now describes the pre-slice behaviour.

Verdict: clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant