executor: split native.go into cic_* files by concern - #110
Conversation
Separate concurrent-index errors, budgets, build execution, invalid-index handling, and backend classification into focused files. Split the white-box tests along the same concern boundaries while retaining build-centric public and integration suites. This is a pure code move with no behavior or identifier changes. Amp-Thread-ID: https://ampcode.com/threads/T-01a07fb2-9632-732b-bd7b-2f143a81bc06 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a07fb2-9632-732b-bd7b-2f143a81bc06 Co-authored-by: Amp <amp@ampcode.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Moving declarations out of native.go by declaration boundary left seven doc comments behind at the previous file's tail, and shifted two test comments onto the neighbouring test. Each block now sits directly above the declaration it describes; an AST comparison of every top-level declaration's doc against the pre-split files shows no remaining mismatch. Amp-Thread-ID: https://ampcode.com/threads/T-01a07fb2-9632-732b-bd7b-2f143a81bc06 Co-authored-by: Amp <amp@ampcode.com>
|
🤖 Adversarial review 1/2 — is the move actually pure? A pure-move PR can't be reviewed by reading the diff — GitHub shows 1967 added lines and every one of them looks new. So I reviewed it by mechanically proving equivalence instead: strip The four claims in the body all hold.
Also checked and clean: no The line multiset is not quite equal, and the three differences are all real. 1.
|
|
🤖 Review 2/2 — two lenses: OSS adoption, and integration ease for importers. Lens 1: OSS adoptionA 1232-line file holding five distinct mechanisms is a real barrier for anyone evaluating pg-sprite from the outside, and this split removes it. Someone landing on the repo to answer "how does this do CREATE INDEX CONCURRENTLY safely?" can now read One thing this PR should fix before merge, because it is public-facing rather than internal. The So the first paragraph an evaluator reads on pkg.go.dev will point at a file that does not exist in the tree. This is the same defect as finding 2 in 1/2, but its blast radius is the published documentation rather than an in-repo comment, which is why it is worth pulling out separately. Point it at the symbol — "( A smaller adoption note: Lens 2: integration ease for schemabot and other orchestratorsThe exported API surface is byte-identical. I rendered Worth making concrete, because it shows the split actually serves the consumer contract rather than merely not breaking it. An orchestrator consuming this package uses, from the files this PR touches, 17 symbols — and 12 of the 17 are That distribution is the argument for The coupling this loosens, worth one sentence of vigilance. Proximity used to enforce something: a sentinel and the code returning it were in the same file, so adding one meant seeing its call site. Now a sentinel can be added to Timing is clean and that is not permanent. No other open PR in the repo touches Approving. The three findings in 1/2 plus the package-doc reference above are all comment-only, none blocks, and all four are two-line fixes worth a follow-up commit before merge — the package-doc one most of all, since it is the copy that ships to pkg.go.dev. This review was generated by Claude Code (claude-opus-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approved. The move is genuinely pure where it matters: the declaration set, the 169 test names, and the stripped line multiset all match before and after, both git mv files are 0-line renames, there is no init() to reorder, and build/vet/gofmt/tests are clean. Three findings in the review comments, all comments rather than code — the buildMinConns doc comment was cut in half across the file boundary and its constant now has none, two files still point readers at the deleted native.go, and the white-box header was duplicated into two files where it is now half wrong in each. Worth a follow-up commit before merge; none of them blocks. The invariants registry survives untouched because it cites symbols rather than file paths, which is the pattern those two broken comments should adopt.
This stamp was left by Claude Code (claude-opus-5).
The package synopsis and the recovery file header named native.go, which no longer exists; both now name the symbol (BuildIndexConcurrently, InvalidIndexError), which survives further splits and links on pkg.go.dev. The synopsis also expands the cic_ prefix so a reader meeting cic_budget.go beside optimistic.go knows it is the concurrent index creation path. Each white-box test file now opens with a header naming its own subject instead of two files sharing a header that described half of each. Amp-Thread-ID: https://ampcode.com/threads/T-01a07fb2-9632-732b-bd7b-2f143a81bc06 Co-authored-by: Amp <amp@ampcode.com>
|
🤖 Adversarial review response — created by Kiran's code review agent (Amp, Claude) — block/pg-sprite pull/110, follow-up commit All three findings are fixed across two follow-up commits; the move is now doc-comment-pure as well as code-pure, and no comment in the package refers to a file that no longer exists.
Source: block/pg-sprite#110, review comments 5643746422 and 5643746666 and review 5185396043 at head |
Why
pkg/executor/native.goheld everything about concurrent index creation (CIC) in one 1232-line file: the error sentinels, the lock and statement budgets, the build itself, invalid-index inspection, and backend-state classification. Any CIC change, whatever its subject, touched this one file. That made concurrent work collide in merges, and made a reader (or an agent) load the whole file to reason about one mechanism.What
The file is split into five files, one per concern, and the three
native*_test.gofiles follow the same split. Nothing is renamed or reworded; the set of top-level declarations and the count of test functions (169) are identical before and after.cic_errors.goErr*sentinelscic_budget.goConcurrentBudget, min-connection rules, budgeted session acquisition, cancellation classificationcic_build.goBuildIndexConcurrently[WithProgress], the build report and verdicts, target resolutioncic_invalid_index.goInvalidIndexError, builder facts, invalid-index inspection and classificationcic_backend.goA second commit adds one bullet to
AGENTS.mdunder Conventions: one file per concern, split past a few hundred lines or when a file serves more than one feature, move with rename-sized diffs so history follows.How
git mvfor the two test files that map whole to one bucket (native_test.go→cic_build_test.go,native_integration_test.go→cic_build_integration_test.go), so history follows them unchanged. The other files are carved out by cut and paste with only thepackageandimportblocks added. Files outside the package that use these symbols (recover.go,sequence.go,code.go) are untouched.Risk
Low. Pure file move inside a core package; the compiler,
go vet, lint, and the full executor test package (unit and integration) all pass.Testing
Beyond CI: the declaration set was hashed before and after the move (
rg '^(func|type|var|const)' pkg/executor/*.go, sorted) and matched,254abb88…. The Docker-backed integration slice ran locally:go test ./pkg/executor/ -run 'BuildIndexConcurrently|InvalidIndex|Recover|Backend' -count=1→ok … 55.1s.Bigger picture
Other large files in the repo can follow the same pattern when they are next touched; this PR does not move anything else.
Generated with Amp (Claude)