Repository navigation
fix(#279): replace existing version marker instead of appending - #280
Merged
Merged
Conversation
|
🤖 Finished Review · ✅ Success · Started 8:32 PM UTC · Completed 8:44 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.06 |
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| ✅ GO | golangci-lint | yes | yes | no | no | 35.68s |
| markdownlint | 4 | 0 | 3 | 0 | 1.47s | |
| ✅ REPOSITORY | gitleaks | yes | no | no | 4.25s | |
| ✅ REPOSITORY | git_diff | yes | no | no | 0.36s | |
| ✅ YAML | yamllint | 1 | 0 | 0 | 0.8s |
Detailed Issues
⚠️ MARKDOWN / markdownlint - 3 errors
openspec/changes/fix-duplicate-scaffold-marker/design.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Context"]
openspec/changes/fix-duplicate-scaffold-marker/proposal.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Why"]
openspec/changes/fix-duplicate-scaffold-marker/tasks.md:6 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## 1. Idempotent Marker Insert..."]
See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff
|
Risk Assessment: low (1/5) DetailsMinimal-risk bug fix: 2 files changed (176 lines, half tests), bot author, no protected paths, no security-sensitive files, no CI or dependency changes. Excellent test ratio (0.50). Linked issue is well-scoped with clear repro steps. Rollback is trivial. |
|
Looks good to me |
insertMarkerAfterFrontmatter unconditionally inserted a new <!-- scaffolded by gaze ... --> marker without checking for an existing one. When gaze init ran again with a different version, both markers ended up in the file. Added removeExistingMarker helper that strips any existing "<!-- scaffolded by gaze ... -->" lines before inserting the new marker, making the function idempotent. Added unit tests for removeExistingMarker, table-driven regression tests for marker replacement scenarios (single, duplicate, no-frontmatter), and an end-to-end TestRun_ReScaffoldSingleMarker that runs gaze init twice with different versions and asserts exactly one marker per file. Closes #279
yvonnedevlinrh
force-pushed
the
agent/279-fix-duplicate-marker
branch
from
October 23, 2026 08:29
af26c54 to
73196a7
Compare
The embedded assets still contained hardcoded "<!-- scaffolded by gaze v1.8.0 -->" lines — root-cause data from #279. The insertMarkerAfterFrontmatter fix strips these lines at scaffold time, so they are inert at runtime, but they remain misleading provenance in source: assets claim v1.8.0 regardless of the actual build version. Removed from all seven scaffold assets, mirrored to .opencode/ (TestEmbeddedAssetsMatchSource), and applied to the aireport embedded prompt copy (TestEmbeddedPromptMatchesScaffold). Scaffold output is byte-identical since the lines were already stripped at scaffold time. Assisted-by: Qwen3.8-27B-FP8
TestRun_ReScaffoldNonForceSingleMarker covers the non-force re-init path from the issue repro: a second gaze init without --force updates tool-owned files on diff (replacing the old marker) and leaves user-owned files untouched, asserting exactly one marker in both cases. Assisted-by: Qwen3.8-27B-FP8
The MegaLinter auto-commit added 43 blank lines to the internal/ copies of three scaffold assets and the aireport prompt copy. Because .opencode/ is in the exclude regex while internal/ is linted, the byte-identical pairs drifted and TestEmbeddedAssetsMatchSource failed on the PR head. Embedded copies are generated mirrors of the .opencode/ source of truth (AGENTS.md File Sync Invariants). Linting only one side of a byte-identical pair means any future markdownlint rule change would re-break the invariant, so: - Add internal/scaffold/assets/ and internal/aireport/assets/ to MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE in .mega-linter.yml - Revert the 43 linter-added blank lines to restore byte-identity TestEmbeddedAssetsMatchSource and TestEmbeddedPromptMatchesScaffold pass; full short suite green under -race -count=1. Addresses review findings on PR #280. Assisted-by: Qwen3.8-27B-FP8 Signed-off-by: Yvonne Devlin <[email protected]>
PR #280 modified production code and embedded assets without a spec artifact (spec-first requirement). Record the change retroactively: idempotent marker insertion, stale v1.8.0 marker removal, and the embedded-asset markdownlint exclusion. Assisted-by: Qwen3.8-27B-FP8 Signed-off-by: Yvonne Devlin <[email protected]>
The AGENTS.md Recent Changes entry for fix-duplicate-scaffold-marker claims "4 new test functions (19 subtests)", but the branch ships 4 test functions with 9 subtests (4 + 5 table-driven; the two e2e re-scaffold tests use no t.Run subtests). Corrects the count to 9 so the changelog matches the shipped tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
insertMarkerAfterFrontmatterunconditionally inserted a new<!-- scaffolded by gaze ... -->marker without checking for an existing one, causing duplicate markers whengaze initran again with a different versionremoveExistingMarkerhelper that strips existing marker lines before insertion, making the function idempotentv1.8.0marker from all seven scaffold assets (root-cause provenance data), mirrored to.opencode/and the aireport embedded prompt copyinternal/scaffold/assets/andinternal/aireport/assets/from markdownlint (.mega-linter.yml): embedded copies are byte-identical mirrors of.opencode/sources and must never be reformatted independently — the linter had drifted three pairs, breakingTestEmbeddedAssetsMatchSourceremoveExistingMarker, table-driven tests for marker replacement scenarios, and end-to-end re-scaffold tests (force and non-force)Testing
go test -race -count=1 -short ./...passesgo vet ./...passesgolangci-lint runpassesCloses #279
Post-script verification
agent/279-fix-duplicate-marker)60758771eefb203b1d610d6032a85ec83fbca8fd..HEAD)