Skip to content

feat(#306): gaze init --ci scaffolds the reusable AI-report caller workflow - #308

Merged
jflowers merged 6 commits into
unbound-force:mainfrom
jflowers:opsx/init-ci-scaffold
Nov 1, 2026
Merged

jflowers merged 6 commits into
unbound-force:mainfrom
jflowers:opsx/init-ci-scaffold

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

gaze init --ci — an additive flag that scaffolds a self-contained starter CI workflow for the provider-agnostic reusable AI-report pipeline, collapsing adoption of reusable_gaze_ai_report.yml (PR #300) to one command plus one secret. The generated .github/workflows/gaze-ai-report.yml owns its own test+upload job (SHA-pinned checkout → setup-go → go test -race -count=1 -short -coverprofile=coverage.out ./... → upload-artifact coverage-out) and a gaze-ai-report job (needs: test, permissions: contents: read) calling unbound-force/gaze/.github/workflows/reusable_gaze_ai_report.yml@<version> with coverage-artifact: coverage-out, gaze-version at the same resolved pin, and secrets: opencode-config: ${{ secrets.OPENCODE_CONFIG_CONTENT }}.

The starter is report-only by default — threshold inputs are emitted commented-out with TODO markers, so governance gates stay human decisions. The uses: pin resolves from the build-time gaze version and is validated >= v2.3.0 (the first workflow-shipping tag); dev builds, pre-floor, and malformed versions fail closed before any file is written; --gaze-version overrides with identical validation (rejected without --ci). Skip-if-present idempotency — the CI file is user-owned after first write, --force is the only overwrite path. setup-go's Go version is read from the consumer's own go.mod directive (grammar-validated, 1.25 fallback with warning); a missing go.mod warns and skips CI scaffolding while .opencode/ scaffolding proceeds. Console output gains a CI next-steps section (the gh secret set OPENCODE_CONFIG_CONTENT one-liner, jq -c minify tip, second-secret masking pointer, paste-able threshold-guidance prompt). Plain gaze init is byte-identical to before.

OpenSpec change: openspec/changes/init-ci-scaffold/. Website documentation gate: unbound-force/website#352.

Closes #306

How to Test

  1. Build: go build ./cmd/gaze
  2. Scaffold tests: go test -race -count=1 -short ./internal/scaffold/... ./cmd/gaze/...
  3. Smoke run in a throwaway module (dev builds fail closed by design — exercise both paths):
    • go build -o /tmp/gaze-bin ./cmd/gaze
    • mkdir -p /tmp/gaze-ci-demo && cd /tmp/gaze-ci-demo && printf 'module demo\n\ngo 1.24\n' > go.mod
    • /tmp/gaze-bin init --ci → expect the fail-closed version error naming the v2.3.0 floor
    • /tmp/gaze-bin init --ci --gaze-version v2.4.0 → expect .github/workflows/gaze-ai-report.yml written with go-version: "1.24" substituted from go.mod, uses: and gaze-version pins at v2.4.0, threshold inputs commented out, and the CI next-steps section printed
  4. Idempotency: rerun the same command → workflow reported "skipped (exists)", file byte-identical; add --force to regenerate.
  5. Flag gating: /tmp/gaze-bin init (no --ci) writes no workflow file; --gaze-version without --ci is rejected; --gaze-version v2.2.0 (below floor) is rejected with guidance.
  6. Full CI parity: go test -race -count=1 -short ./..., golangci-lint run, yamllint over internal/scaffold/assets/ci/gaze-ai-report.yml.

All green at the phase checkpoints (HEAD unchanged since): unit + integration suite PASS, dogfood gaze-ai-report gate PASS (GazeCRAPload met the max-6 ceiling after the phase-3 fix loop decomposed scaffold.Run), golangci-lint and yamllint PASS, openspec validate init-ci-scaffold valid. Review council: APPROVE WITH ADVISORIES (8/8 runs, 0 HIGH/CRITICAL).

How to Demo

The throwaway-module smoke run above is the demo — it exercises the full fail-closed → scaffold → idempotent loop in under a minute.

Key Files Changed

28 files, +2,724 / −44.

Core implementation

  • internal/scaffold/scaffold.go (+523) — CI write path: writeCIWorkflow, version resolution/validation, parseGoModVersion, CI next-steps output
  • cmd/gaze/main.go (+52) — --ci / --gaze-version flag wiring
  • go.mod — golang.org/x/mod promoted indirect→direct (already in the module graph through x/tools)

Embedded template + golden fixture

  • internal/scaffold/assets/ci/gaze-ai-report.yml (+78) — __GAZE_VERSION__/__GO_VERSION__ template (excluded from the .opencode/ mirror sync; 9-file manifest unchanged)
  • internal/scaffold/testdata/golden-gaze-ai-report.yml (+78)

Tests

  • internal/scaffold/ci_test.go (+645) — version-resolution matrix, go.mod parser matrix, golden-file + YAML-parse validation, skip-if-present, flag-gating, next-steps assertions
  • internal/scaffold/scaffold_test.go (+32), cmd/gaze/main_test.go (+65)

Docs

  • README.md, docs/reference/cli/init.md, docs/guides/ci-integration.md, AGENTS.md

Spec + knowledge artifacts

  • openspec/changes/init-ci-scaffold/ — proposal, design, specs, tasks
  • .uf/dewey/learnings/ — 11 retrospective learnings across the pipeline

Known Issues

Review council returned APPROVE WITH ADVISORIES (8/8 runs, 0 CRITICAL/HIGH). All findings are non-blocking and recorded for follow-up; the two LOW bookkeeping advisories (missing AGENTS.md Recent Changes entry; website issue number unrecorded at task 5.5) were resolved in 4644d79. Remaining MEDIUM advisories:

  • Stale Package Map row — the docs/architecture package-map entry for internal/scaffold/ predates this change (omits CI-workflow generation responsibility; lists no dependencies despite the x/mod/semver edge added here and the pre-existing yaml.v3 edge).
  • Missing blog issue — no blog-labeled issue in unbound-force/website for this flagship adoption-path feature (docs gate chore(toolkit): re-scaffold with gaze 2.4.0 #352 doesn't cover the blog angle).
  • Dangling doc pointer in console output — the CI next-steps section prints docs/guides/ci-integration.md as a bare repo-relative path, unresolvable in the consumer's repo; the emitted workflow file already uses the absolute URL form.
  • No drift enforcement for duplicated CI values — the template's action SHA pins and 1.25 Go fallback duplicate gaze's own CI config with only merge-time verification (the anti-drift test pins the uses: path and version floor only).

Plus 10 further LOW advisories recorded in the dispatch artifact.


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

…via gaze init --ci

Additive --ci flag for gaze init: validates the reusable-workflow version
pin (>= v2.3.0, dev builds fail closed), resolves setup-go's version from
the go.mod directive (grammar-validated, 1.25 fallback with warning), and
writes the user-owned, report-only-by-default caller workflow from an
embedded template excluded from the .opencode/ mirror sync. CI wiring is
decomposed out of scaffold.Run (resolveCIPin, checkGoMod,
completeCIContext, appendActionResult, appendCIWorkflowResult) keeping
Run at CC 11 and GazeCRAPload within the protected 6 gate. Console gains
a CI next-steps section; --gaze-version override requires --ci.

Closes unbound-force#306. Website docs: unbound-force/website#352.
…e PR

Resolves the two LOW council advisories and preserves the completed
unleash pipeline's knowledge artifacts:

- AGENTS.md: add init-ci-scaffold Recent Changes entry so the repo
  conventions ledger reflects the new --ci scaffold
- openspec/changes/init-ci-scaffold/tasks.md: record website docs
  issue unbound-force/website#352 at task 5.5 and flip 5.6 (review
  council APPROVE WITH ADVISORIES adopted from dispatch artifact
  ecba6bf6 pinned to HEAD 71d1065)
- .uf/dewey/learnings/: three retrospective learnings (uf-workflow,
  review-dispatch, gaze-scaffold) from the pipeline run

Assisted-by: glm-5
Generated with AI assistance (glm-5)
@jflowers jflowers self-assigned this Oct 31, 2026
…clusions for CI

gitleaks fingerprints went stale when PR unbound-force#301's branch was squashed to main (9c1b472 -> c74846c), breaking MegaLinter on every full-history scan including pushes to main. Correct the two .gitleaksignore entries to the post-merge introducing commit, completing the intent of fa87795.

Extend the markdownlint exclusion to .uf/ and openspec/changes/ per the existing machine-generated-content precedent (5 dirs already excluded): Dewey learnings regenerate on every retrospective and openspec/changes/ artifacts embed workflow template text — hand-fixing is not durable.

MegaLinter's fork-PR auto-fix push is 403'd, so these land here.

@jflowers jflowers left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review Verdict: APPROVE WITH ADVISORIES

8 reviewers dispatched, 8 completed (adversary, architect, curator, entropy, gaze-testing, guard, sre, testing). Aggregate: 0 CRITICAL, 0 HIGH, 5 MEDIUM, 13 LOW. None block the merge — the MEDIUM findings document trade-offs, coverage gaps, and bookkeeping, not defects.

gaze init --ci writes a .github/workflows/gaze-ai-report.yml caller for the reusable AI-report workflow, validated offline against a release-tag grammar and a semver floor, with a byte-stable golden fixture. The council verified the template's action SHAs, go-version default, and uses: path against gaze's own CI — in sync today — and confirmed idempotent re-runs.

MEDIUM advisories (3 of 5 posted inline):

  • Supply-chain — the scaffolded caller pins the reusable workflow by release tag rather than commit SHA, a documented CI-001 divergence; the generated header tells consumers how to harden to the tag's commit SHA (inline at internal/scaffold/assets/ci/gaze-ai-report.yml:63).
  • Test coverage — the CI write-failure contract (design D7) has zero forced-failure coverage; a swallowed error inside writeCIWorkflow or a reordering of the write before the asset walk both pass the existing suite (inline at internal/scaffold/scaffold.go:643).
  • Scope discipline — the .mega-linter.yml markdownlint exclusion, the .gitleaksignore SHA re-point, and 11 committed .uf/dewey/learnings/ files are absent from the change's recorded footprint; substance verified benign, not gate tampering (inline at .mega-linter.yml:22).

The remaining two MEDIUM advisories target files outside this diff, so they are recorded here in full:

Documentation gap (MEDIUM) — docs/architecture/overview.md is stale for internal/scaffold in three places. The Package Map row (line 21) omits the CI workflow generation this PR adds and lists "None (uses embed.FS)" for Key Dependencies, falsified by the golang.org/x/mod/semver import this diff adds alongside the go.mod promotion. The dependency diagram (line 195) still annotates scaffold as "leaf — uses embed.FS only". The Key Observations (line 212) frame scaffold as an isolated embed.FS-only utility. Tasks 4.1–4.4 swept README, docs/reference/cli/init.md, docs/guides/ci-integration.md, and AGENTS.md but never docs/architecture/ — the same blind spot PR #305's review caught in docs/architecture/extending.md. A docs-only sweep fits the /uf.finale commit.

Content pipeline (MEDIUM) — no blog-labeled issue tracks gaze init --ci in unbound-force/website (verified 2026-10-31 against the open blog backlog and an all-state "init --ci" title search). Org convention treats significant new flags as blog-significant — precedent #150 for gaze crap --baseline, #51 for multi-platform uf init — and this PR's own docs call init --ci "the preferred adoption path". The review cannot file issues; to track manually:

gh issue create --repo unbound-force/website --title "blog: gaze init --ci — one command from go test to AI quality reports in CI" --label blog --body "<topic, PR reference: unbound-force/gaze#306>"

Not posted inline (LOW, 16th of 17 file-specific findings) — Operational guidance on internal/scaffold/assets/ci/gaze-ai-report.yml:17: the generated workflow filters on: push to branches: [main]; a repository whose default branch is master or trunk gets a silent no-op adoption. The header comment inside the generated file covers this, but printCINextSteps — the adopter's immediate post-scaffold guidance, which already covers secret setup, masking, and threshold selection — omits the branch assumption. One added line closes the silent-failure gap at the moment of adoption.

The remaining 13 findings are posted as inline comments (error-path reporting on the CI write failure, anti-drift guard coverage for copied action SHAs, go.mod trailing-comment parsing, a duplicated action-mapping switch, structural coupling notes, golden-regeneration guidance, assertion depth, release-pipeline pinning, and template drift guards).

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

# only downgrade them, never elevate them.
permissions:
contents: read
uses: unbound-force/gaze/.github/workflows/reusable_gaze_ai_report.yml@__GAZE_VERSION__

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

MEDIUM · supply-chain — from divisor-adversary

The scaffolded consumer workflow pins the reusable-workflow reference by mutable release tag (reusable_gaze_ai_report.yml@GAZE_VERSION, e.g. @v2.4.0) instead of a 40-character commit SHA — a CI-001 divergence in the emitted artifact. The uses: reference is name-addressed: GitHub resolves the tag at run time, so a moved or re-pointed release tag in unbound-force/gaze would silently change the code the gaze-ai-report job executes, and that job receives the opencode-config secret carrying the consumer's literal API key. The three action pins in the same file are SHA-pinned and verified identical to gaze's own CI (checkout v4.2.2, setup-go v5.6.0, upload-artifact v4.6.2 — cross-checked against .github/workflows/reusable_gaze_ai_report.yml and test.yml); only the reusable-workflow call is tag-addressed. This is a documented, deliberate trade-off (design Risks: offline validation cannot resolve tag→SHA; trust assumption that release tags are never force-moved; the emitted header comment tells consumers they can harden to the tag's commit SHA) matching the repo's documented consumer contract, so it is advisory, not blocking. Future hardening: when network access is available, optionally resolve the tag to its commit SHA (git ls-remote / GitHub API) and emit uses: ...@<sha> while keeping the gaze-version: input on the tag — the go install module@tag path is content-cached by the Go module proxy, so the tag input is comparatively immutable and the asymmetry is specifically the workflow-file fetch.

Root cause: The scaffold validates versions offline and lexically (strict release-tag form + semver.IsValid + floor comparison), which proves ordinal position but not content identity; emitting a commit SHA for an arbitrary --gaze-version value would require network resolution the design explicitly excludes, and mixing a SHA uses: pin with a tag gaze-version input would break the deliberate pin-equality property (Constitution III comparability).

// scaffolding completes even when the CI write fails. The workflow is
// user-owned and reported through the standard result fields, so
// printSummary needs no new plumbing.
func appendCIWorkflowResult(result *Result, opts Options, ci ciContext) error {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

MEDIUM · test-coverage — from divisor-gaze-testing

The CI workflow write-failure contract has zero test coverage. appendCIWorkflowResult propagates writeCIWorkflow errors (stat failure on the output path, template read failure, writeNewFile/MkdirAll failure) by making Run return (nil, err) after the .opencode/ asset walk has already completed — and design D7 plus three code comments (appendCIWorkflowResult, its Run call site, and Run's doc comment) document this as a deliberate ordering decision: "the core scaffolding completes even when the CI write fails." No test forces the CI write to fail: all 14 ci_test.go test functions and both main_test.go additions exercise only successful writes, skip-if-present, the missing-go.mod skip, and fail-closed version validation. Two silent regression modes are therefore unlocked: (1) swallowing the error inside appendCIWorkflowResult/writeCIWorkflow — silent partial scaffolding reported as success, the exact bug class this repo fixed in ci-gate-integrity (#101, #108, #116); (2) reordering the CI write before the asset walk — breaking the documented D7 contract. Either regression passes the full existing suite. Recommendation: add a failure-injection test following the package's established pattern (ufconfig_test.go creates .uf as a regular file to force stat/MkdirAll failures, and chmods files 0o444 with a deferred restore): in a temp dir with a valid go.mod and release version, create .github as a regular file (forcing MkdirAll(".github/workflows") to fail) or the workflow path as a directory (forcing WriteFile EISDIR), run with CI=true, and assert (a) Run returns a non-nil error with a nil result, and (b) the nine .opencode/ files exist on disk — locking both the error propagation and the D7 write-after-walk ordering.

Root cause: The new test matrix covers every success, skip, and version-validation-failure path of the CI write path but omits the forced-write-failure path, leaving writeCIWorkflow/appendCIWorkflowResult's error-propagation branches and the documented write-after-walk ordering untested despite design D7 stating them as a contract.

Comment thread .mega-linter.yml
# reformatted independently. Dewey learnings (.uf/) regenerate on every
# retrospective and openspec/changes/ artifacts embed workflow template
# text — both are machine-generated, so hand-fixing is not durable.
MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE: '(\.specify/|\.opencode/|specs/|\.uf/|openspec/changes/|internal/scaffold/assets/|internal/aireport/assets/)'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

MEDIUM · scope-discipline — from divisor-guard

The PR bundles three groups of auxiliary changes that the change's recorded scope (openspec/changes/init-ci-scaffold/ proposal Impact list, tasks.md, and the AGENTS.md Recent Changes entry) does not mention: (1) the markdownlint exclusion widened to cover .uf/ and openspec/changes/; (2) the .gitleaksignore commit-SHA re-point for internal/aireport/subprocess_test.go:107,168; (3) eleven new committed .uf/dewey/learnings/ files. The substance is verified benign — the exclusion governs only machine-generated bookkeeping paths (consistent with the repo's existing exclusion of .specify/, specs/, and the embedded asset mirrors), and the gitleaks re-point re-asserts the pre-existing suppression of the same two fake test secrets (test-secret-api-key-xyz123, test-secret-straddling-the-truncation-boundary-...) rather than suppressing anything new, and the feature code passes lint independently — so this is NOT assessed as gate tampering. But linter configuration is a spec-first category in this repo (AGENTS.md: CI workflow modifications require a spec; gatekeeping category 4 lists linter configuration), and the precedent change (fix-duplicate-scaffold-marker) explicitly spec'd its equivalent markdownlint exclusion. The change record should match the PR's actual footprint.

Root cause: The uf pipeline's retrospective and finale mechanics generate file changes (committed dewey learnings under .uf/dewey/learnings/, the markdownlint exclusions those regenerated files require, post-squash gitleaks SHA re-points) outside the feature spec's Impact list, and no pipeline step records them in the change's documentation trail (the AGENTS.md Recent Changes entry for init-ci-scaffold lists docs touched but omits all three groups).

@@ -363,6 +780,15 @@ func Run(opts Options) (*Result, error) {
result.Removed = append(result.Removed, cleanupOrphanedTestingReviewer(opts)...)

printSummary(opts.Stdout, result)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · error-handling — from divisor-adversary

When the CI workflow write fails (permission error on .github/, disk full, MkdirAll failure), Run returns nil, err from the appendCIWorkflowResult call site: the .opencode/ files are already on disk, but the populated Result is discarded, the .uf registration and reviewer-testing orphan cleanup never run, and no summary is printed — the user sees a bare error over a partially scaffolded tree. The adjacent code comment ("the core scaffolding completes even when the CI write fails") is true only of the file writes, not of the command's post-walk steps. A rerun heals idempotently (skip-if-present semantics), so impact is limited to error-path clarity rather than data loss. Consider sequencing the CI write after the .uf registration/cleanup, or printing the summary and returning the partial Result alongside the error.

Root cause: The CI write is sequenced before the .uf registration, orphan cleanup, and summary steps, and its error short-circuits Run with nil, err — discarding the completed Result instead of surfacing partial success.

"actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02",
"go test -race -count=1 -short -coverprofile=coverage.out ./...",
"# max-crapload: <N>",
"# max-gaze-crapload: <N>",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · sync-invariant-coverage — from divisor-architect

TestCIWorkflowTemplate_AntiDrift guards only two of the values the template duplicates from gaze's canonical CI files: the reusable-workflow uses: path and the v2.3.0 floor constant. The three action SHA pins (actions/checkout@11bd719, actions/setup-go@40f1582, actions/upload-artifact@ea165f8 — copied from .github/workflows/reusable_gaze_ai_report.yml and test.yml per design D3) and the 1.25 Go-version fallback (echoing the reusable workflow's go-version default per design D5) have no drift guard: a future SHA bump in gaze's own CI leaves new scaffolds emitting stale pins with no failing test. Design D3's 'no drift between gaze's CI and what it scaffolds' claim holds only at merge time. This matches the prior advisory recorded as learning ci-scaffolding-20261031T233508; the values are verified in-sync today, so this is hardening of an existing guard, not a present defect.

Root cause: Task 3.2 scoped the anti-drift assertion to the uses: path and floor constant only, so the guard's coverage is narrower than the set of values the template duplicates from the canonical workflow files.

if !strings.Contains(output, "Warning: no go.mod found") {
t.Errorf("expected generic missing-go.mod warning, got:\n%s", output)
}
if !strings.Contains(output, "Warning: skipping CI scaffolding") {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · assertion-depth — from divisor-gaze-testing

TestRun_CI_MissingGoMod_SkipsCI asserts the CI-skip warning via the prefix substring "Warning: skipping CI scaffolding" only. The delta spec's requirement 8 scenario requires that "a warning explains that CI scaffolding requires a Go module at the repository root", and printCISkipWarning's value is precisely its explanation (the ./...-from-repository-root requirement plus the go mod init remedy). A regression that keeps the prefix but drops the explanation — e.g. truncating printCISkipWarning to a bare one-line warning — passes the test while violating the spec scenario and destroying the warning's actionability (Constitution III). Recommendation: also assert a substantive fragment of the explanation, e.g. "requires a Go module" (printCISkipWarning's phrasing) or "go mod init".

Root cause: The warning assertion verifies the warning's existence rather than its spec-required explanatory content; the distinguishing payload of the design-D6 warning is unverified, so the regression protection for that scenario is partial.

// matches the reusable AI-report workflow's own go-version input
// default, so a fallback workflow still runs the Go version the
// reusable workflow would have chosen for itself (design D5).
const defaultGoVersion = "1.25"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · drift-guard — from divisor-sre

Template constants duplicate values that live in gaze's own workflow files with no automated parity check. defaultGoVersion = "1.25" (scaffold.go:309) mirrors reusable_gaze_ai_report.yml's go-version input default (verified equal today), and the template's three action SHA pins were copied verbatim from gaze's own CI per design D3 (verified: checkout/setup-go match reusable_gaze_ai_report.yml:86,93; upload-artifact matches test.yml:64). TestCIWorkflowTemplate_AntiDrift pins only the uses: path and the v2.3.0 floor constant — not these couplings. If the reusable workflow's go-version default is later bumped or an action pin is rotated in gaze's CI, the template silently diverges: future scaffolds emit a stale fallback Go version (creating test-job vs report-job toolchain skew within one consumer run) and stale action SHAs. The golden file pins the template's current bytes, not the coupling to the source files. Recommendation: extend TestCIWorkflowTemplate_AntiDrift to parse .github/workflows/reusable_gaze_ai_report.yml (assert its go-version default equals defaultGoVersion and its checkout/setup-go SHAs match the template) and test.yml (assert the upload-artifact SHA matches).

Root cause: Constants copied from live configuration files are tied to their sources only by comments; no test parses the source-of-truth workflows to assert the copied values still match, so the coupling is unguarded against future updates to gaze's own CI.

if err != nil {
return err
}
switch action {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · dry — from divisor-architect

appendActionResult and appendCIWorkflowResult each map action strings to Result slice appends via an identical switch statement (created/overwritten/skipped; the walk variant adds updated). The only difference between the two switches is the display path joined to the appended value. Non-blocking: the duplication sits at exactly two sites, below the CS-004 extraction threshold, and follows the existing processAssetFile action-string convention.

Root cause: The CI result-recording path was written as a structural parallel of the walk's recording switch instead of extracting the shared action-to-field mapping; the display-path computation is the only per-caller variation.


// Generate the AI-report caller workflow (design D7) after the
// .opencode/ walk so the core scaffolding completes even when the
// CI write fails.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · observability — from divisor-sre

When the CI workflow write fails after the .opencode/ asset walk (a stat error other than fs.ErrNotExist, or a MkdirAll/WriteFile failure — e.g. .github existing as a regular file, disk full, permission denied), Run returns (nil, err) at the appendCIWorkflowResult call site: the .opencode/ files are already on disk, but printSummary never runs (no record of what was created), and the post-walk .uf registration (syncUFReviewConfig) plus orphan cleanup are skipped. The design comment claims "the core scaffolding completes even when the CI write fails" — true for disk state, not for reporting. Re-runs are idempotent (skip-if-present), so recovery is safe, but the operator's only signal is the CI error with no account of the half-completed scaffold, and a consumer with a pre-existing .uf/ directory silently misses persona registration until a successful re-run. Recommendation: print the accumulated result summary (or wrap the error with the created/skipped paths) before propagating the CI-write failure.

Root cause: The CI-write error path discards the accumulated Result instead of reporting it alongside the error, and the .uf registration steps are sequenced after the CI write so a CI-write failure also skips them.

# only downgrade them, never elevate them.
permissions:
contents: read
uses: unbound-force/gaze/.github/workflows/reusable_gaze_ai_report.yml@__GAZE_VERSION__

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

LOW · ci-convention-divergence — from divisor-architect

The scaffolded caller's reusable-workflow reference — uses: unbound-force/gaze/.github/workflows/reusable_gaze_ai_report.yml@GAZE_VERSION — resolves to a release tag, while CI-001 [MUST] requires reusable-workflow uses: references to be pinned to a full 40-character commit SHA. The divergence is inherent to the feature (the pin is derived offline from the running binary's version, which cannot yield a commit SHA) and is documented twice: design D9's Risks section records the name-addressed-pin trade-off, and the template's own header (lines 13-14) tells consumers how to harden the reference to the tag's commit SHA. Filed at LOW so the accepted divergence is traceable in the review record rather than silent; no change requested.

Root cause: Version resolution is offline and lexical by design (design D4), so the generated pin is necessarily name-addressed; content-addressed pinning is delegated to the consumer via the documented hardening note.

@jflowers
jflowers merged commit 4ae9126 into unbound-force:main Nov 1, 2026
6 checks passed
@jflowers
jflowers deleted the opsx/init-ci-scaffold branch November 15, 2026 21:35
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.

feat: gaze init --ci scaffolds the reusable AI-report caller workflow

1 participant