Skip to content

🐛 fix(ci): clear govulncheck, golangci-lint and touch fuzz failures on next - #12

Merged
LGuichet merged 5 commits into
nextfrom
fix/ci-next
Oct 30, 2026
Merged

LGuichet merged 5 commits into
nextfrom
fix/ci-next

Conversation

@LGuichet

@LGuichet LGuichet commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Turns CI on next green again by clearing the three checks that failed on LGuichet/okfctl#11, none of which that PR caused: a stdlib vulnerability, golangci-lint findings, and a real round-trip bug the touch fuzzer found.

build-test (govulncheck)

  • Go toolchain 1.26.9 → 1.26.10: clears GO-2026-6809 in crypto/x509, reached through the atomic writer's temp-file naming (fsutil.createTemp → rand.Read). It is pinned in every workflow and in go.mod, the same way the 1.26.9 bump was done.

lint (golangci-lint v2.12.2)

  • Error wrapping: ResolveInRoot now wraps the underlying cause with %w beside ErrEscapesRoot. errors.Is(err, ErrEscapesRoot) still holds, and no caller tests these errors for not-exist.
  • Separator trim: leading separators are trimmed with TrimLeftFunc, since on Unix the old cutset repeated / (SA1024). The behaviour is unchanged.
  • De Morgan: the double-s guard in plural folding gets the QF1001 rewrite, with the same logic.

fuzz (FuzzTouchModifiedRoundTrip)

  • okfctl touch no longer invents a key: a frontmatter key written as an empty explicit key (? ) is a null key, which a map decode drops. The modified refresh round-trips the block through yaml.v3, and its encoder wrote that key back as a quoted empty string, so the refreshed node gained a "" key it never had. Such keys are now written as ~ (the same null), at every depth.
  • Touch refuses invalid frontmatter: this PR's first CI run had the fuzzer find a second case. With a duplicate key (ype: 0 then ype:), the parser rejects the block, but the yaml.Node round-trip skips that check, so the touch rewrote the invalid block instead of refusing it. The touch now runs the frontmatter parser first, returns its error, and leaves the file byte-identical, as the fuzz contract requires.

CI pins (.github/workflows/)

Docs (docs/guides/)

Lint fixes (internal/)

  • fsutil/confine.go: %w wrapping and the separator trim
  • okf/tagfold.go: De Morgan rewrite

Touch round-trip (internal/okf/)

  • frontmatter_edit.go: the parser runs first and an invalid block is refused, then keepEmptyNullKeysNull runs before the frontmatter is re-encoded
  • Tests: frontmatter_edit_test.go adds TestTouchModifiedFileKeepsEmptyNullKeyNull, with positive controls (a top-level and a nested ? key stay null) and a negative control (a real '': x key keeps its quotes). writepath_fuzz_test.go seeds both failing inputs (? and the duplicate key). The duplicate-key seed went red (touched frontmatter does not parse) and then green.

Evidence

  • Before: on #11's run, build-test stops at govulncheck (GO-2026-6809 … Fixed in: crypto/x509@go1.26.10), lint reports four issues in confine.go/tagfold.go, and fuzz fails with touch added keys: [] -> [ modified] (the blank is the "" key).
    After: CI on this PR.

The touch fix went red to green locally:

--- FAIL: TestTouchModifiedFileKeepsEmptyNullKeyNull/null_key_stays_null
    frontmatter_edit_test.go:132: got 2 keys ["" "modified"], want 1:
--- FAIL: TestTouchModifiedFileKeepsEmptyNullKeyNull/nested_null_key_stays_null

After the fix, every TestTouchModified* test and FuzzTouchModifiedRoundTrip (seed corpus) pass. gofmt -l . is empty, go vet ./... is clean, and the spec-conformance suite passes. All packages pass apart from the tests that fail identically on next on this Windows host (plugin and editor exec, true missing from PATH, CRLF git clones). -race and golangci-lint were not run locally (no C compiler, no golangci-lint on the host), so CI covers both.

Merge Danger

Door: two-way

Blast Radius: CI toolchain

  • okfctl node touch and every edit that refreshes modified now write an empty null key as ~: instead of '':. Before, that changed the node's data, so this is a correction. A node without such a key is byte-identical.
  • Contributors need Go ≥ 1.26.10 (go.mod minimum). Go downloads that toolchain automatically under the default GOTOOLCHAIN=auto.
  • ResolveInRoot errors now also wrap their cause, and their message text is unchanged.

Not in this PR: the dated design records, and any change to how a node with a non-string key (!!int : 1) parses. Those already fail to parse, and the fuzz test skips them.

🤖 Generated with Claude Code

LGuichet and others added 5 commits October 30, 2026 18:50
govulncheck in CI fails on GO-2026-6809 (crypto/x509), reached through the
atomic writer's temp-file naming (fsutil.createTemp -> rand.Read). The fix
ships in go1.26.10; bump every workflow pin and go.mod together, as the
1.26.9 bump did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- confine.go: wrap the underlying cause with %w beside ErrEscapesRoot, so
  errors.Is still matches ErrEscapesRoot and now also sees the cause.
- confine.go: trim leading separators with TrimLeftFunc; on Unix the cutset
  `string(filepath.Separator)+"/"` repeated '/' (SA1024).
- tagfold.go: apply De Morgan to the double-s guard (QF1001); same logic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An explicit empty key (`? `) is a null key, which a map decode drops. The
`modified` refresh round-trips the block through yaml.v3, whose encoder
writes that empty plain scalar back as a quoted empty string, so the touched
node gained a "" key it never had. FuzzTouchModifiedRoundTrip caught it in CI
(`touch added keys: [] -> [ modified]`).

Rewrite such keys as `~` before encoding, at every depth. A key that already
is a quoted empty string is real data and keeps its quotes (negative control).
The failing input joins the fuzz seeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fix

The index guide and the changelog describe the link form index build writes since the merge of #11, how an older index migrates, and the empty-null-key fix in this PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decoding into a yaml.Node skips map-level checks such as a duplicate key, so the modified refresh rewrote an invalid block (`ype: 0` then `ype:`) instead of refusing it and leaving the file byte-identical. FuzzTouchModifiedRoundTrip caught it in CI on #12. Run the frontmatter parser first and return its error; the input joins the fuzz seeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LGuichet
LGuichet merged commit 8038e14 into next Oct 30, 2026
8 checks passed
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.

1 participant