Repository navigation
fix(op): slice accessors return copies; drop a gen group member the generator retired - #640
Merged
David-Noble-at-work merged 1 commit intoAug 24, 2026
Conversation
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.
Two verified defects from the epic audit. Closes #532 and #572.
#532 — slice accessors aliased the graph's internal storage
Graph.Edges,Subgraph.Edges, andSubgraph.Childrenreturned the graph's own slices, so a calleroutside
pkg/opcould rewrite which edges and children the graph records — leaving the constructionchecksum describing contents that no longer exist.
Subgraph.Edgesdocumented the defect rather thanfixing it: "The returned slice aliases the underlying storage; callers must not mutate it directly."
All three now
slices.Clone. External mutation becomes impossible rather than discouraged, and theelements inside stay shared — exactly the sharing the rule permits. The three "must not mutate" comments
are gone because they are no longer true.
Pinned as the issue's exit asks: each accessor is written through with a deliberately wrong value and the
graph is asserted unmoved, plus a check that the units themselves are still shared so only the slice
header is defended.
#572 — a grouped-target member the generator can never emit
Every provider's grouped generation target listed
gen/node_builder.gen_test.go, whose emission wasretired with NodeBuilder in phase 5. Under GNU Make 4.4.1's grouped-target (
&:) semantics a member thatcan never appear leaves the whole group permanently stale, so codegen re-ran on every single build.
Removed from all 16 groups, and the comment block above them corrected to describe what is actually
emitted — with the reason recorded, so the next member added is checked against the generator.
Verified rather than assumed: a second consecutive
make buildnow runs zero codegen invocations.Before the fix every group was stale, so it ran them all, every time.
The issue's second half — "the groups are also missing a member in the other direction" — is already
correct in the tree: all 19 providers that emit
gen/module.gen_test.golist it. Only thenode_builderhalf was live.What this does not fix
GOOS=linux make buildstill fails, and it is a separate defect, now filed as #639:GOOS/GOARCHare ambient, so cross-compiling the product also cross-compiles the build tools —
go run ./cmd/devlore-inventoryproduces a Linux binary and then tries to execute it on the host. The standingcross-platform gate never caught it because
make vetcompiles without running anything.Gate:
make test103 ok / 0 fail;make vetclean under darwin, windows, and linux;gofmt -lclean.