Repository navigation
fix: gaze init treats commands/gaze.md as tool-owned (gaze-local.md escape hatch) - #356
Conversation
…scape hatch) commands/gaze.md was the only embedded .opencode/ asset on the user-owned/skip-if-present side, which froze the flagship /gaze command at whatever release first scaffolded it (issue unbound-force#353). A 10-repo consumer survey found zero customized copies; every observed diff against the v2.4.0 asset was undelivered upstream change. All nine embedded .opencode/ assets are now tool-owned, so the first gaze init after upgrading delivers accumulated upstream changes and heals the duplicate dev/v1.8.0 version markers; the CI workflow remains the only user-owned scaffold output. - Flip commands/gaze.md into the isToolOwned exact-match list (overwrite-on-diff without --force, like commands/gaze-fix.md) - Escape hatch: a separately named commands/gaze-local.md is structurally never written, even under --force; OpenCode exposes it as /gaze-local - printSummary prints a one-line tip naming the escape hatch only when gaze.md lands in Updated (never on creation, identical skip, or force-overwrite) - Plain re-runs no longer print the --force hint (no user-owned .opencode/ file can be skipped); the CI-workflow skip keeps it, now pinned by a test - Tests: isToolOwned table flip, customized-copy overwrite, duplicate-marker healing regression, escape-hatch byte-identity, tip-printing matrix, restructured re-scaffold coverage - Docs: docs/guides/opencode-integration.md, docs/reference/cli/init.md, AGENTS.md Recent Changes; website docs issue unbound-force/website#425 File Sync Invariants untouched: no asset content changed; the nine-file manifest and embedded-mirror byte-identity hold (TestEmbeddedAssetsMatchSource green). Closes unbound-force#353 Assisted-by: glm-5 Generated with AI assistance (glm-5)
uf-divisor
left a comment
There was a problem hiding this comment.
Council Review: #356 — gaze init treats commands/gaze.md as tool-owned
Council verdict: APPROVE WITH ADVISORIES — posted as APPROVE (no CRITICAL or HIGH findings).
Council Panel
| Persona | Verdict |
|---|---|
| divisor-adversary | APPROVE |
| divisor-architect | APPROVE |
| divisor-curator | APPROVE |
| divisor-entropy | APPROVE |
| divisor-gaze-testing | APPROVE |
| divisor-guard | APPROVE |
| divisor-testing | APPROVE WITH ADVISORIES (2 LOW) |
Assessment
gaze init now classifies commands/gaze.md as tool-owned (issue #353): overwrite-on-diff without --force, duplicate-marker healing via the wholesale rewrite, a structurally untouchable commands/gaze-local.md escape hatch, and an update-time tip gated on Updated only. The implementation adds one isToolOwned list entry and moves tip detection into printSummary, keeping Run branch-free at the dogfood GazeCRAPload ceiling. All spec scenarios are pinned by dedicated regression tests, File Sync Invariants are untouched, and all 6 CI checks pass including the dogfood thresholds (38/6/8).
Advisories (2 LOW — both already recorded in the PR body Known Issues for follow-up)
- LOW (test-coverage) —
internal/scaffold/scaffold.go:841: the tip detection compares the forward-slash literal"commands/gaze.md"against a path trimmed usingfilepath.Separator; on Windows the comparison never matches (tip does not print,userSkippedover-counts). Gaze ships no Windows binaries and the CI matrix is Linux-only, which is why this is LOW. If Windows support is added, normalize separators before comparison or add a platform-matrix test. - LOW (test-coverage) —
internal/scaffold/scaffold_test.go:1527:TestRun_ReScaffoldNonForceSingleMarkerdrives the production-realistic multi-file version-bump path but never asserts the escape-hatch tip printed; the tip matrix (TestRun_GazeCommandUpdateTip) covers only the single-file-update case. The gating flag is set inside the sameResult.Updatedloop in both cases, so logical risk stays low.
Details are attached as inline comments. No CRITICAL or HIGH findings; no PR-caused CI failures.
This review was generated by /uf.review-pr (AI-assisted).
| var gazeCmdUpdated bool | ||
| for _, f := range r.Updated { | ||
| _, _ = fmt.Fprintf(w, " updated: %s (content changed)\n", f) | ||
| rel := strings.TrimPrefix(f, filepath.Join(".opencode")+string(filepath.Separator)) |
There was a problem hiding this comment.
The tip detection compares the forward-slash literal "commands/gaze.md" against a path trimmed using filepath.Separator (scaffold.go:841-842), replicating the pre-existing userSkipped idiom (lines 861-862). On a Windows filesystem the trimmed rel path uses backslashes, so the comparison never matches: the tip does not print and userSkipped over-counts. TestRun_GazeCommandUpdateTip "prints on update" locks down the correct behavior and would fail on Windows, but the CI matrix runs Linux only and gaze ships no Windows binaries, so the divergence is never exercised by any test execution. LOW severity for exactly that reason — this confirms the advisory already recorded in the PR body Known Issues. If Windows support is ever added, normalize separators before comparison or add a platform-matrix test.
| // non-force re-run: the eight Markdown files were updated on | ||
| // diff, commands/gaze.md included (the pre-flip user-owned | ||
| // exception), and the byte-identical dcp.jsonc was skipped. | ||
| if len(result.Updated) != 8 { |
There was a problem hiding this comment.
TestRun_ReScaffoldNonForceSingleMarker drives the production-realistic multi-file version-bump path — the exact scenario the #353 survey shows is how consumers actually receive updates (8 files updated on diff, commands/gaze.md among them, dcp.jsonc skipped) — but never asserts that the escape-hatch tip printed in buf2's output. The tip matrix (TestRun_GazeCommandUpdateTip, line 977) covers the tip only in the single-file-update case (Updated == 1). The gating flag is set inside the same Result.Updated loop in both cases, so the logical risk stays low. The one assertion that would tie the multi-file path to the tip contract is absent — this confirms the advisory already listed in the PR body Known Issues; no new work is required beyond the planned follow-up.
Summary
gaze initnow treatscommands/gaze.mdas tool-owned (issue #353): overwrite-on-diff without--force, exactly likecommands/gaze-fix.md, so the flagship/gazecommand stops going stale in consumer projects on every gaze release. The firstgaze initafter upgrading delivers the accumulated upstream changes (the #221<protect>block, the spec 040 rendered-report description, analyzer/language detection) and heals the duplicatedev/v1.8.0version markers the 10-repo survey found. All nine embedded.opencode/assets are now tool-owned; the CI workflow remains the only user-owned scaffold output.Custom
/gazeescape hatch: a separately namedcommands/gaze-local.mdis structurally never written — even by--force— and OpenCode exposes it as/gaze-local. When init updates gaze.md, the summary prints a one-line tip naming the hatch (never on creation, identical-skip, or force-overwrite). Plain re-runs no longer print the--forcehint (no user-owned.opencode/file can be skipped), while the CI-workflow skip keeps it — now pinned by a test.Embedded asset content and the 9-file manifest are byte-identical/unchanged (
TestEmbeddedAssetsMatchSourcegreen);scaffold.Runstays branch-free at the GazeCRAPload ceiling.Closes #353
How to Test
Run the scaffold test suite:
The ownership behaviors are pinned by:
TestRun_OverwritesCustomizedGazeCommand— customized gaze.md restored without--forceTestRun_HealsDuplicateGazeCommandMarkers—dev+v1.8.0duplicate markers healed to one current markerTestRun_GazeLocalEscapeHatch— non-embeddedcommands/gaze-local.mdnever written, even under--forceTestRun_GazeCommandUpdateTip— tip prints only on update, not creation/skip/forceTestRun_SkipsExisting— plain re-run prints no--forcehintTestRun_CI_SkipIfPresent— the CI-workflow skip still prints the hint (its only surviving trigger)Manual scenario: in a temp dir with a
go.mod, rungaze init, edit.opencode/commands/gaze.md, re-rungaze init— the file is reportedupdated:, restored to the embedded copy with a single current marker, and the summary prints the gaze-local.md tip; a siblingcommands/gaze-local.mdis untouched.Full CI parity (all green on the final tree):
go build ./...;go test -race -count=1 -short -timeout 15m -coverprofile=coverage.out ./...(22/22 packages; cmd/gaze 79.0%, internal/scaffold 89.7% coverage); gaze dogfood thresholds (CRAPload 23/38, GazeCRAPload 6/6 at ceiling, AvgContractCoverage 39/8);golangci-lint run(0 issues); markdownlint on changed docs (0 issues); e2eTestRunSelfCheck(591.6s).How to Demo
In a scratch project:
gaze init→ edit.opencode/commands/gaze.md→gaze initagain. The summary reportsupdated: .opencode/commands/gaze.md (content changed)plus the one-linegaze-local.mdtip, and the file is restored to the embedded asset with exactly one current version marker. Acommands/gaze-local.mdplaced alongside is never touched — with or without--force.Key Files Changed
Known Issues
Code review council returned APPROVE WITH ADVISORIES — 4 LOW advisories recorded for follow-up:
printSummarydetects gaze.md updates viastrings.TrimPrefixwithfilepath.Joinseparators but compares against the forward-slash literalcommands/gaze.md; on Windows the relative path contains backslashes and never matches, so the escape-hatch tip (and theuserSkippedcount) misbehaves per-OS.versionMarkerembedsopts.Versionverbatim into the<!-- scaffolded by gaze %s -->marker without sanitization; a custom-ldflags version containing-->or newlines could break the comment and inject Markdown into the scaffolded.mdfiles.TestRun_ReScaffoldNonForceSingleMarkerexercises the multi-file version-bump path (the release-upgrade shape that motivated this change) but never asserts the escape-hatch tip printed; the tip requirement is pinned only byTestRun_GazeCommandUpdateTip's single-file-diff configuration..mdfiles carry the single new marker and thatdcp.jsoncis skipped as byte-identical (it never carries an HTML marker).Spec review council also returned APPROVE WITH ADVISORIES (all MEDIUM + LOW advisories remediated before code review).
This PR was generated by /uf.finale (AI-assisted).