Skip to content

fix(ci): stage Node coverage under $RUNNER_TEMP outside hidden path - #450

Merged
jflowers merged 16 commits into
unbound-force:mainfrom
jflowers:opsx/gaze-init-ci-node-scaffolded-workflow-up
Dec 1, 2026
Merged

jflowers merged 16 commits into
unbound-force:mainfrom
jflowers:opsx/gaze-init-ci-node-scaffolded-workflow-up

Conversation

@jflowers

@jflowers jflowers commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixed the Node variant of gaze init --ci so the scaffolded workflow passes as-is. The staging/upload steps now use $RUNNER_TEMP/gaze-artifact (outside the workspace and outside any hidden path) instead of the hidden .gaze-artifact directory that actions/upload-artifact v4.4.0+ excludes by default. Updated the Node golden file, test pins, docs Node bullets with staging root and v2.7.0 remediation, and added an executed staging guard (red/green verified) that asserts staged files land at the resolved upload path with no hidden components. Go/Python templates, Go golden file, version floor, and internal/quality/quality.go untouched per epic rules.

Closes #446

Epic: #449 — non-Go (external analyzer) follow-ups after v2.7.0. Website gate: unbound-force/website#495.

How to Test

  1. npm run coverage && ls "$RUNNER_TEMP/gaze-artifact/coverage/coverage-final.json" — after running coverage in a Node workspace, the scaffolded mkdir -p "$RUNNER_TEMP/gaze-artifact" && cp -r coverage "$RUNNER_TEMP/gaze-artifact/" places files where path: ${{ runner.temp }}/gaze-artifact uploads with no hidden components.
  2. go test -run TestNodeWorkflow_StagedUploadContract ./internal/scaffold -count=1 -v — the executed staging guard (proves staging lands at upload path, asserts workspace cleanliness, guards hidden components on template-controlled portion).
  3. go test -run TestRenderCIWorkflowTemplate_VariantYAMLStructure -count=1 ./internal/scaffold — stageRun/uploadPath pins.
  4. Compare the generated coverage-out artifact — it still carries coverage/ at its root.

How to Demo

Run gaze init --ci in a Node repository (with package.json, no go.mod) and inspect .github/workflows/gaze-ai-report.yml:

  • The "Stage coverage for upload" step runs mkdir -p "$RUNNER_TEMP/gaze-artifact" && cp -r coverage "$RUNNER_TEMP/gaze-artifact/"
  • The "Upload coverage" step uses path: ${{ runner.temp }}/gaze-artifact with if-no-files-found: error
  • No .gaze-artifact directory appears in the workspace; the artifact coverage-out still contains coverage/coverage-final.json at its root.

Alternatively: go test -run TestNodeWorkflow_StagedUploadContract -count=1 -v ./internal/scaffold — the guard executes the scaffolded staging command against a synthetic workspace.

Key Files Changed

  • internal/scaffold/assets/ci/gaze-ai-report-node.yml — staging/upload moved to $RUNNER_TEMP/gaze-artifact / ${{ runner.temp }}/gaze-artifact
  • internal/scaffold/testdata/golden-gaze-ai-report-node.yml — regenerated golden file
  • internal/scaffold/ci_test.go — updated Node variant pins + added TestNodeWorkflow_StagedUploadContract executed staging guard (workspace cleanliness + hidden-component check on template portion)
  • docs/guides/ci-integration.md — Node bullet names $RUNNER_TEMP staging root and v2.7.0 remediation
  • docs/reference/cli/init.md — Node bullet names $RUNNER_TEMP staging root
  • openspec/changes/gaze-init-ci-node-scaffolded-workflow-up/ — spec, tasks, proposal, design

No changes to Go/Python templates, Go golden file, minWorkflowTag, validate-workflow-floor.sh, or internal/quality/quality.go per epic rules.

Known Issues

None — spec review (APPROVE WITH ADVISORIES, 1 iteration, 3 advisories) and code review (APPROVE WITH ADVISORIES, 1 iteration, 2 LOW advisories) both applied at 7587e27. All 13/13 tasks complete across 5 phases. CI replicated locally: go build, go test -race -count=1 -short 22/22, golangci-lint 0, gaze report thresholds (CRAPload 23/38, GazeCRAPload 6/6), e2e TestRunSelfCheck 7/7, markdownlint 0.

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

@jflowers
jflowers enabled auto-merge (rebase) December 1, 2026 06:52
@jflowers jflowers changed the title fix(ci): stage Node coverage under outside hidden path fix(ci): stage Node coverage under $RUNNER_TEMP outside hidden path Dec 1, 2026
@jflowers
jflowers disabled auto-merge December 1, 2026 06:57
@jflowers
jflowers enabled auto-merge (rebase) December 1, 2026 06:57

@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.

Review: fix(ci): stage Node coverage under $RUNNER_TEMP outside hidden path

Council verdict: APPROVE WITH ADVISORIES — 6 of 7 reviewers returned APPROVE; divisor-gaze-testing returned APPROVE WITH ADVISORIES carrying two LOW test-quality advisories (inline below). No CRITICAL or HIGH findings. CI is fully green (Unit + Integration ×2, E2E ×2, MegaLinter, Gaze AI Report, CI OK), and pre-flight passed with every local tool category covered by passing CI.

The change moves the Node scaffold's coverage staging to $RUNNER_TEMP/gaze-artifact and the upload to ${{ runner.temp }}/gaze-artifact, which resolves the actions/upload-artifact v4.4.0+ hidden-path exclusion that left the v2.7.0 Node scaffold uploading nothing (#446). The artifact layout contract (coverage/ at the root of the coverage-out artifact) is preserved, the Go and Python scaffolds are untouched, and the new TestNodeWorkflow_StagedUploadContract executes the rendered staging step end-to-end against the resolved upload path. The OpenSpec change record, the regenerated golden file, and the consumer docs (including the v2.7.0 remediation) are all in place.

Two non-blocking advisories on the new guard follow inline.

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

// component, which the template can neither cause nor fix. No
// template-controlled component may begin with ".".
templateControlledPath := strings.TrimPrefix(resolvedUploadPath, runnerTemp)
for _, component := range strings.Split(templateControlledPath, string(filepath.Separator)) {

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 · test-quality] TestNodeWorkflow_StagedUploadContract asserts the staged file's existence (os.Stat on the resolved upload path) but not its content, so a truncation or corruption of coverage-final.json during staging would still pass the guard. The staging step's observable contract is location and content preservation. Reading the staged bytes back and comparing them against the synthetic source (e.g. os.ReadFile + bytes.Equal) would cover the other half of that contract.

jobs, ok := doc["jobs"].(map[string]any)
if !ok {
t.Fatalf("jobs missing or not a mapping: %v", doc["jobs"])
}

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 · test-quality] The hidden-component invariant is asserted only positively: the test scans the resolved upload path below the runner root for dot-prefixed components, but no automated case feeds a synthetic hidden path — the pre-fix .gaze-artifact shape — and asserts the guard rejects it. Task 3.2's red/green check exercised this manually, and the result is argued in comments rather than retained as a regression case. A subtest that constructs a hidden candidate path and asserts the scan flags it would pin the guard's negative detection capability against future reintroduction.

@jflowers
jflowers merged commit fa042e1 into unbound-force:main Dec 1, 2026
11 checks passed
@jflowers
jflowers deleted the opsx/gaze-init-ci-node-scaffolded-workflow-up branch December 1, 2026 11:30
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 (Node): scaffolded workflow uploads no coverage, because .gaze-artifact is a hidden directory

2 participants