Seven comments name errors.As where the code now calls errors.AsType, plus formatting litter from the modernizer sweep
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 9
- Forks
- 0
- Avg merge
- 3h 3m
- Merged PRs (30d)
- 509
Description
Follow-up carrying the advisory findings from the exact-head review of #1979. None is a defect; all are naming or formatting drift left by a mechanical rewrite. Filed rather than fixed in that PR because fixing them would have cut another head on a change whose code was already reviewed clean.
Problem or observed behavior
1. Seven comments name a function the code no longer calls. The errorsastype fixer converted errors.As(err, &x) to errors.AsType[T](err) at ~60 sites. Seven comments and one test-failure message adjacent to converted bodies still say errors.As:
cmd/flow/execute.go:319cmd/flow/diagnostics.go:106pkg/flowstate/embed/compile_test.go:57, and its assertion message at:60("err does not wrap Diagnostics via errors.As")pkg/flowstate/v1/netpolicy/ratelimit_test.go:240pkg/flowstate/v1/engine/execute.go:1344— names "[recordedStepError]and[recordedStepKind]'s own errors.As calls"; both were convertedpkg/flowstate/v1/engine/workflow.go:341
None of these is wrong in substance. errors.AsType[T] performs the identical unwrap walk, so every claim they make — "a wrap anywhere in the chain is still found", "errors.As can still reach the stale ApplicationError", "matched on type rather than text" — remains true. They name a spelling the file no longer uses, which costs a reader a lookup.
This is the weaker sibling of the defect #1979 did have to fix: a helper in celreserved_test.go whose comment documented the opposite of its rewritten body. That one was a contradiction; these are stale names. The distinction is worth keeping, because it is the difference between "must fix before merge" and "tidy later".
2. Formatting litter. Stray blank lines left where a fixer removed a loop body: pkg/flowstate/v1/flowfile/lsp/completion.go:774 and :863, pkg/flowstate/v1/flowfile/lsp/testfile_test.go:229, :255, :270, :292, pkg/flowstate/v1/flowfile/fixretire.go, and pkg/flowstate/v1/server/webhook_test.go (from waitgroupgo). gofmt accepts all of them.
3. A loop variable shadowing a type. pkg/flowstate/v1/internal/conformance/examples.go:903 — for _, binding := range slices.Backward(bindings) shadows the type binding, which is used as binding{} two lines below. It compiles because the return sits outside the loop; it becomes a confusing error if that code ever moves inward.
4. Closing brace folded onto the last field, which gofmt accepts but the surrounding tree does not write: cmd/flow/mcp.go:238, pkg/flowstate/v1/flowdebug/inspect.go:784, pkg/flowstate/v1/netpolicy/rules_test.go:660.
Evidence
All four groups were found by the independent exact-head review of #1979 at b487d88093544587c27c08e2af8f357d7907bad4, which checked the errors.As naming class exhaustively rather than by grep — the grep in that PR's own commit message could not have surfaced it, since it searched for phrases like "spelled out" and "rather than import".
Desired outcome
A reader who greps for errors.As to find the assertions gets the sites that do it, and a reader of these comments is not sent looking for a call that is not there. The formatting litter matches how the rest of the tree is written.
Acceptance criteria
- No comment or test message in the tree names
errors.Aswhere the adjacent code callserrors.AsType, except where the sentence is genuinely abouterrors.Asthe API. - The listed blank lines and folded braces match surrounding style.
examples.go:903no longer shadows thebindingtype.go test -short ./...green;gofmtclean; no behavior change in the diff.
Constraints and dependencies
Comments and whitespace only — no behavior should change, which makes this a good candidate for a single small PR that is easy to review by reading the diff alone. Depends on #1979 having landed.
Generated by Claude Code
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the named locations in cmd/flow, pkg/flowstate/embed, pkg/flowstate/v1, and pkg/flowstate/v1/internal/conformance/examples.go; inspect the adjacent converted calls and surrounding formatting. Update only stale names, whitespace, and the shadowing variable, then run gofmt and go test -short ./.... Done means the listed style issues are resolved with no behavior change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100