Skip to content

feat(init): enforce per-variant --gaze-version floor for Node/Python (v2.7.0) - #453

Merged
jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:opsx/gaze-init-ci-gaze-version-floor-is-v2-3
Dec 1, 2026
Merged

jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:opsx/gaze-init-ci-gaze-version-floor-is-v2-3

Conversation

@jflowers

@jflowers jflowers commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Per-variant --gaze-version floor validation in gaze init --ci (v2.3.0 Go, v2.7.0 Node/Python via minAnalyzerWorkflowTag + minWorkflowTagForVariant + detectCIWorkflowVariant hoisting before resolveCIPin), variant-aware error messages, and release gate update to parse every floor declaration (validate-workflow-floor.sh + test-validate-workflow-floor.sh multi-floor cases). Docs updated: --gaze-version help text, init CLI reference, CI integration guide, AGENTS.md gate description. Website docs issue unbound-force/website#496 filed. Spec review APPROVE with 10 findings adjudicated (3 applied, 7 overridden).

Per-variant floor validation keeps the Go template at v2.3.0 while Node/Python templates (whose reusable-workflow inputs analyzer/packages/setup/node-version/python-version first ship in v2.7.0 via #375) now require >= v2.7.0 — preventing gaze init --ci --gaze-version v2.6.0 in a Node repo from scaffolding a caller that GitHub rejects at load time.

Closes #447

How to Test

  • In a Node directory (package.json present):
    • gaze init --ci --gaze-version v2.6.0 → fails naming v2.7.0 and writes nothing (no .github/, no .opencode/)
    • gaze init --ci --gaze-version v2.7.0 → writes Node workflow with analyzer inputs
  • In a Python directory (pyproject.toml present):
    • gaze init --ci --gaze-version v2.6.0 → fails naming v2.7.0
    • gaze init --ci --gaze-version v2.7.0 → writes Python workflow
  • In a Go directory (go.mod): gaze init --ci --gaze-version v2.6.0 still succeeds (asymmetry pin — Go floor unchanged)
  • CI parity gate: go test -race -count=1 -short ./... (22 packages), .github/scripts/test-validate-workflow-floor.sh (22 cases), .github/scripts/validate-workflow-floor.sh (v2.6.9 exits 1 naming minAnalyzerWorkflowTag), go test -race -count=1 -run TestRunSelfCheck -timeout 30m ./cmd/gaze/..., golangci-lint run

How to Demo

Run gaze init --ci in Node/Python checkouts at varying --gaze-version thresholds to observe the variant-aware floor error, then inspect the generated .github/workflows/gaze-ai-report.yml for analyzer inputs. Demo the release gate by invoking validate-workflow-floor.sh against a below-floor tag — it exits 1 naming the constant that blocks the release.

Key Files Changed

  • internal/scaffold/scaffold.go — minAnalyzerWorkflowTag (v2.7.0), minWorkflowTagForVariant selector, hoisted detectCIWorkflowVariant before resolveCIPin
  • internal/scaffold/ci_test.go — variant matrix rows, anti-drift pin for analyzer floor, dev-build and analyzer-floor Run cases; Node/Python subtests bumped to v2.7.0
  • .github/scripts/validate-workflow-floor.sh + test-validate-workflow-floor.sh — multi-floor discovery (min*Tag convention), analyzer-inputs proof, 22-case matrix
  • cmd/gaze/main.go — --gaze-version help text names per-variant floors
  • docs/guides/ci-integration.md, docs/reference/cli/init.md, AGENTS.md — docs and gate description
  • openspec/changes/gaze-init-ci-gaze-version-floor-is-v2-3/ — proposal, design, specs, tasks (14 files, +1856/-169)

Known Issues

None — spec review APPROVE (2 iterations, 10 findings adjudicated: 3 applied, 7 overridden). Code review pending after PR creation.

This PR was generated by /uf.finale (AI-assisted).

…(v2.7.0)

Per-variant --gaze-version floor validation in `gaze init --ci` — v2.3.0
remains the floor for the Go template while Node and Python templates
(whose reusable-workflow inputs analyzer/packages/setup/node-version/
python-version first ship in v2.7.0 via unbound-force#375) now require >= v2.7.0.
Enforced once the variant marker is known, with an error naming the
variant's floor (minAnalyzerWorkflowTag + minWorkflowTagForVariant +
detectCIWorkflowVariant hoisting before resolveCIPin).

- Add minAnalyzerWorkflowTag (v2.7.0) and minWorkflowTagForVariant
  selector beside minWorkflowTag; hoist variant detection ahead of
  version validation in scaffold.Run
- Variant-aware error messages from resolveGazeVersion (Go message
  byte-identical; Node/Python name the analyzer floor)
- Extend scaffold tests (variant matrix, anti-drift, dev-build,
  analyzer-floor Run cases) and bump Node/Python subtest pins to v2.7.0
- Rework validate-workflow-floor.sh to discover every min*Tag floor and
  prove analyzer inputs exist; update its test to 22 cases
- Refresh --gaze-version help, docs/reference/cli/init.md,
  docs/guides/ci-integration.md, AGENTS.md; website docs filed as
  unbound-force/website#496

Closes unbound-force#447

Assisted-by: Muse-Spark-Open-816B-A42B-NVFP4
Generated with AI assistance (Muse-Spark-Open-816B-A42B-NVFP4)

@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: per-variant --gaze-version floor

Verdict: APPROVE — with six LOW advisories inline.

The council ran seven reviewers (adversary, architect, curator, entropy, gaze-testing, guard, testing); five returned APPROVE and two returned APPROVE WITH ADVISORIES. All CI checks pass, and the ci-aware local pre-flight passed at head e7a55062 with every detected tool already covered by a green CI check.

The change fixes #447: it replaces the single minWorkflowTag (v2.3.0) floor with a per-variant floor — Go v2.3.0, Node/Python v2.7.0 — detected exactly once per Run and threaded through resolveCIPin and completeCIContext without re-detection. Version failures stay fail-closed (no workflow file, no .opencode/ output, no output before the error) and name the detected variant's floor. The release gate now validates every min…Tag declaration, and the CI test matrix pins both constants against the reusable workflow, with analyzer-inputs proof at the analyzer floor tag.

All six findings are LOW-severity advisories — test-traceability polish and minor structural consistency — posted inline below. None block merge.

Area Result
CI All checks pass
Local gates PASS (ci-aware; head e7a5506)
Findings 6 LOW (0 CRITICAL / HIGH / MEDIUM)
Reviewers 7/7 succeeded

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

}

// detectCIWorkflowVariant reports which CI workflow template the run
// will render: go.mod present → Go; otherwise package.json → Node,

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.

LOW — structural-integrity (divisor-architect): Run stats go.mod twice per invocation — once in detectCIWorkflowVariant (silent detection, here) and once in checkGoMod (warning path). The two call sites duplicate the "absent vs present" logic, so a future change to stat error handling (e.g., a permission-error fallback) must land in both. The design doc records this as an accepted trade-off; the coupling is the residual cost.


// Node and Python mirror the same four delta cases at the
// analyzer floor; only the variant label the error names
// differs, and TestResolveGazeVersion_VariantErrorMessages

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.

LOW — coverage-traceability (divisor-testing): the ci-scaffolding delta spec enumerates "Scenario: Go override at the Go floor is accepted" (gaze init --ci --gaze-version=v2.3.0 → pin @v2.3.0), but no test sets GazeVersion to exactly the Go floor value. The resolver matrix covers the inclusive boundary at build-time Version: "v2.3.0" and override precedence with v2.5.0/banana, and TestRun_CI_AnalyzerFloor covers a Run-level Go override at v2.6.0 (between the floors) — the exact combination the scenario names exists only compositionally. A one-row addition (GazeVersion: "v2.3.0", variant go, no error) would close the gap.

if opts.GazeVersion != "" {
v = opts.GazeVersion
}
floor := minWorkflowTagForVariant(variant)

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.

LOW — convention-compliance (divisor-architect): versionPinError selects its error wording by comparing the resolved floor value against minAnalyzerWorkflowTag rather than by variant identity. The string-equality proxy is correct for the current two-floor mapping but couples the message selector to floor values: a third floor with a distinct value forces a selector update. Branching on the variant (ciVariantNode/ciVariantPython) would keep the selector stable as floors are added.

// go.mod stat error other than fs.ErrNotExist is treated as
// presence, matching checkGoMod, and the single detection result is
// threaded through resolveCIPin and completeCIContext so the variant
// is detected exactly once per run.

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.

LOW — coverage-gap (divisor-testing): the stat-error branch of detectCIWorkflowVariant — any go.mod stat error other than fs.ErrNotExist returns ciVariantGo — is unreached by any test; every Run-level and detection test uses directories where the stat succeeds or cleanly returns ErrNotExist. The branch mirrors checkGoMod's documented collapse of stat errors to presence, and reaching it needs a permission-denied fixture (e.g., a chmod-0000 parent on POSIX). Design D6's "both marker paths reached" claim holds for the two marker paths but not this third path.

write_workflow_with_analyzer_inputs
commit_repo
git -C "$repo" tag v2.7.0
dual_floor_repo="$repo"

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.

LOW — assertion-depth (divisor-testing): the eight new multi-floor cases assert exit status only — run_case discards output to /dev/null. Design D5 makes "errors name the offending constant" part of the validator's contract, and task 3.3 verified it once manually, but no automated case asserts the failing floor constant appears in the error message (e.g., minAnalyzerWorkflowTag in the below-analyzer-floor or second-floor-below-tag cases). The fixtures isolate causality structurally — each case satisfies every other floor's requirements — so the exit status proves which check failed, but an error-message regression would pass. One case capturing stderr and grepping for the constant name would pin the contract.

result, err := Run(Options{TargetDir: dir, Version: "v2.4.0", CI: true, Stdout: &buf})
result, err := Run(Options{TargetDir: dir, Version: "v2.7.0", CI: true, Stdout: &buf})
if err != nil {
t.Fatalf("Run() returned error: %v", err)

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.

LOW — coverage-consistency (divisor-testing): the python subtest of TestRun_CI_VariantScaffolding asserts only analyzer/python-version/setup/pytest strings in its wantIn list, while the node subtest asserts the rendered uses-pin ([email protected]). The pin assertion was never mirrored to the python subtest. Compensating coverage exists in TestRun_CI_AnalyzerFloor's python at-floor row (asserts both the uses-pin and the gaze-version input), so this is a consistency gap within the older test rather than a coverage hole. Mirroring the node subtest's pin assertion would make the pair symmetric.

@jflowers
jflowers merged commit fc0953d into unbound-force:main Dec 1, 2026
11 checks passed
@jflowers
jflowers deleted the opsx/gaze-init-ci-gaze-version-floor-is-v2-3 branch December 1, 2026 18:05
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.

gaze init --ci: --gaze-version floor is v2.3.0 for every variant, but Node/Python callers need v2.7.0

2 participants