Skip to content

fix: treat unset reusable AI-report thresholds as report-only - #459

Merged
jflowers merged 2 commits into
unbound-force:mainfrom
jflowers:opsx/ai-report-unset-thresholds
Dec 2, 2026
Merged

jflowers merged 2 commits into
unbound-force:mainfrom
jflowers:opsx/ai-report-unset-thresholds

Conversation

@jflowers

@jflowers jflowers commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #458.

Problem

GitHub passes an unset type: number input that has no default as 0, not as an empty string. So the [ -n "$MAX_CRAPLOAD" ] guards in reusable_gaze_ai_report.yml always fired. A caller that left the thresholds unset (which every gaze init --ci scaffold does) ran with --max-crapload=0 --max-gaze-crapload=0 --min-contract-coverage=0, and failed on almost any real project. That showed up on reading-stone's first main run (46526758887). Gaze's own dogfood job sets all three thresholds, so it never hit this.

Change

  • max-crapload, max-gaze-crapload and min-contract-coverage keep type: number and gain default: -1.
  • The report step skips a threshold whose value is negative or empty (case guard). An explicit 0 is still enforced.
  • TestCIWorkflow_ReusableThresholdGuards runs the step's real script with bash against a stub gaze, checking the flags it passes for the defaults, empty, negative, 0, positive and mixed values. It fails against the old guards on four of six rows.
  • TestCIWorkflow_ReusableExternalAnalyzerInputs pins the -1 defaults.
  • docs/guides/ci-integration.md documents the default and what a negative value means.
  • OpenSpec change: openspec/changes/ai-report-unset-thresholds/ (spec committed first, in a8c2575).

Callers that set thresholds see no change. The scaffold templates and golden files don't change.

Verification

  • go build ./..., golangci-lint run (0 issues), and the validate-ai-report-default / validate-workflow-floor script tests pass.
  • go test -race -count=1 -short ./...: everything passes except two timing benchmarks in internal/analysis (TestSC004, TestSC005). Those exceeded their 15s limit under full-suite load on my machine, and pass when re-run alone (28s). This PR doesn't touch that package.
  • markdownlint is clean on the changed doc, and openspec validate ai-report-unset-thresholds --strict passes.

Release plan: ship as v2.7.1. That needs the usual gaze-version default bump to v2.7.1 before dispatching release.yml.

🤖 Generated with Claude Code

jflowers and others added 2 commits December 2, 2026 14:59
…nd-force#458)

OpenSpec change ai-report-unset-thresholds: give the three threshold
inputs a -1 sentinel default and skip negative values, so an unset
input no longer arrives as a live threshold of 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-force#458)

An unset workflow_call input of type number with no default evaluates
to 0, so the [ -n ... ] guards always fired and every caller that left
the thresholds unset (every scaffolded workflow) ran with
--max-crapload=0 --max-gaze-crapload=0 --min-contract-coverage=0.

Give the three inputs default: -1 and skip negative or empty values in
a case guard; an explicit 0 stays a live threshold. A new test runs the
step's real script against a stub gaze and checks the flags it passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@uf-divisor uf-divisor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Council Review: fix: treat unset reusable AI-report thresholds as report-only

Verdict: APPROVE WITH ADVISORIES — 7/7 reviewer runs succeeded (divisor-adversary, divisor-architect, divisor-curator, divisor-gaze-testing, divisor-guard: APPROVE; divisor-sre, divisor-testing: APPROVE WITH ADVISORIES). All findings are LOW advisories; none block merge. CI is fully green (CI OK, both Go matrices' unit+integration and e2e legs, MegaLinter, Gaze AI Report).

The change gives max-crapload, max-gaze-crapload and min-contract-coverage a default: -1 sentinel and replaces the [ -n ... ] guards with case statements that skip negative or empty values, keeping an explicit 0 live — matching the OpenSpec delta spec's three scenarios and issue #458's acceptance criteria. TestCIWorkflow_ReusableThresholdGuards executes the real step script against a stub gaze, the right remedy for the substring-pinning failure class the design note documents.

Advisories (all LOW)

  1. upgrade-path (docs/guides/ci-integration.md:189, divisor-sre) — the consumer docs don't tell existing consumers the fix takes effect only after bumping their pinned uses: ref or re-running gaze init --ci; the proposal's impact line reads as if the fix reaches pinned callers automatically. See inline comment.
  2. assertion-depth (cmd/gaze/ci_workflow_test.go:696, divisor-testing) — the new test filters the stub argv to the three threshold flags; the script's other conditional args remain substring-pinned only; extending the assertion is nearly free. See inline comment.
  3. test-fidelity (cmd/gaze/ci_workflow_test.go:675, divisor-testing) — the harness runs bash -c while Actions runs bash -e (fail-fast); nothing depends on it today, but a future appended command could diverge. See inline comment.

This review was generated by /uf.review-pr (AI-assisted).

Comment thread docs/guides/ci-integration.md Resolved
Comment thread cmd/gaze/ci_workflow_test.go Resolved
Comment thread cmd/gaze/ci_workflow_test.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reusable AI-report workflow: unset threshold inputs become 0, so report-only callers fail

2 participants