ENG-00000: Make generated code and paths.yaml deterministic - #103
Merged
Conversation
Generated artifacts differed between machines and between runs, so regenerating produced large spurious diffs. Fix each source of non-determinism where the unordered data enters the pipeline. - codegen: run emitted code through go/format and correct the EmbedFS snippet indentation. On a format error the unformatted result is kept. - column discovery: sort information_schema columns by ordinal position. Those queries carry no ORDER BY, so driver ordering leaked into generated struct field order. Columns inferred from a result set carry no position and are left untouched, preserving the projection order the query already established. - route listing: sort paths.yaml entries by URL. The recursive listing reflected directory enumeration order, which varies by filesystem and shifts whenever route files are rewritten, so partial regeneration reshuffled thousands of lines. Route lookup is order independent: the matcher builds a trie and prefers exact matches. Adds unit tests covering each sort and the gofmt stability of generated output. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
and-bezzir
force-pushed
the
ENG-00000-do-not-change-unrelated-files
branch
from
August 3, 2026 23:26
5229dea to
3bbe151
Compare
and-bezzir
requested review from
Vidhan and
adranwit
and removed request for
Vidhan
August 4, 2026 11:21
adranwit
approved these changes
Aug 5, 2026
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
Three sources of non-determinism made generated artifacts differ between machines and between runs, producing spurious diffs. Each is fixed at the point where the unordered data enters the pipeline.
repository/codegen.go— run generated output throughgo/formatand fix theEmbedFS()snippet's indentation, so emitted code is canonically formatted regardless of how the builder assembled it. A formatting failure leaves the unformatted result untouched.view/column/discover.go— sortinformation_schemacolumns by ordinal position. Those queries carry noORDER BY, so driver-dependent ordering was leaking into generated struct field order. Columns inferred from a result set carry no position and are left alone, preserving the query's own projection order.repository/path/service.go— sortpaths.yamlcandidates by URL. The recursive listing reflected directory enumeration order, which varies by filesystem and shifts when route files are rewritten, so partial regeneration reshuffled thousands of lines. Route lookup is order-independent (the matcher builds a trie and prefers exact matches), so this is safe.Test plan
Added focused unit tests alongside each change:
repository/codegen_embedfs_test.go— verifies the embed snippet and overall gofmt-stability of generated outputview/column/discover_sort_test.go— covers position-ordered sorting and the no-position passthrough caserepository/path/sort_test.go— covers URL ordering and stability🤖 Generated with Claude Code