Skip to content

feat(nix-checks): add atlas-sum-check derivation + binary - #1222

Merged
kalbasit merged 5 commits into
mainfrom
feat-nix-checks-atlas-sum
May 23, 2026
Merged

kalbasit merged 5 commits into
mainfrom
feat-nix-checks-atlas-sum

Conversation

@kalbasit

Copy link
Copy Markdown
Owner

Adds a new cmd/atlas-sum-check Go binary that opens each
migrations/<dialect>/ directory via Atlas sqltool.NewGooseDir,
recomputes the checksum, and compares against the on-disk atlas.sum.
Any drift fails the build with a diagnostic pointing at
go run ./cmd/generate-migrations as the remediation.

Wires the binary into nix flake check via a new atlas-sum-check
derivation in nix/checks/flake-module.nix. The derivation reuses the
ncps Go module setup but runs the new binary instead of the full build.

Marks task 13.3 complete in the migrate-to-ent-and-atlas change.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request go Pull requests that update go code labels May 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Go tool, atlas-sum-check, which verifies the integrity of atlas.sum files across multiple database dialects (sqlite, postgres, and mysql) to ensure migration consistency. Additionally, it integrates this check into the Nix CI pipeline and updates the project task list. Feedback was provided to align the tool's documentation with its implementation, specifically noting that the binary reports all failures across dialects before exiting rather than stopping at the first mismatch.

Comment thread cmd/atlas-sum-check/main.go Resolved
This was referenced May 21, 2026
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from 2a5b056 to b58ba2f Compare May 22, 2026 23:02
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from 99c0299 to c199666 Compare May 22, 2026 23:02
kalbasit added a commit that referenced this pull request May 22, 2026
The package doc claimed the binary exits non-zero on the first mismatch.
The implementation actually iterates every dialect and only exits at the
end, reporting all offending directories at once. Update the doc to
match.

Addresses gemini-code-assist comment on PR #1222 (PRRT_kwDONV6tZs6D31Je).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from b58ba2f to 03b777f Compare May 22, 2026 23:16
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from c199666 to 5132a2b Compare May 22, 2026 23:16
kalbasit added a commit that referenced this pull request May 22, 2026
The package doc claimed the binary exits non-zero on the first mismatch.
The implementation actually iterates every dialect and only exits at the
end, reporting all offending directories at once. Update the doc to
match.

Addresses gemini-code-assist comment on PR #1222 (PRRT_kwDONV6tZs6D31Je).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from 03b777f to 7cf61e7 Compare May 22, 2026 23:28
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from 5132a2b to 8913971 Compare May 22, 2026 23:28
kalbasit added a commit that referenced this pull request May 22, 2026
The package doc claimed the binary exits non-zero on the first mismatch.
The implementation actually iterates every dialect and only exits at the
end, reporting all offending directories at once. Update the doc to
match.

Addresses gemini-code-assist comment on PR #1222 (PRRT_kwDONV6tZs6D31Je).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from 7cf61e7 to 56eadca Compare May 22, 2026 23:54
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from 8913971 to eb26bb2 Compare May 22, 2026 23:54
kalbasit added a commit that referenced this pull request May 22, 2026
The package doc claimed the binary exits non-zero on the first mismatch.
The implementation actually iterates every dialect and only exits at the
end, reporting all offending directories at once. Update the doc to
match.

Addresses gemini-code-assist comment on PR #1222 (PRRT_kwDONV6tZs6D31Je).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from 56eadca to b262a7c Compare May 23, 2026 00:07
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from eb26bb2 to 3a60ea9 Compare May 23, 2026 00:07
kalbasit added a commit that referenced this pull request May 23, 2026
The package doc claimed the binary exits non-zero on the first mismatch.
The implementation actually iterates every dialect and only exits at the
end, reporting all offending directories at once. Update the doc to
match.

Addresses gemini-code-assist comment on PR #1222 (PRRT_kwDONV6tZs6D31Je).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from b262a7c to 3c2e869 Compare May 23, 2026 00:36
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from 3a60ea9 to 0c17a85 Compare May 23, 2026 00:36
kalbasit added a commit that referenced this pull request May 23, 2026
The package doc claimed the binary exits non-zero on the first mismatch.
The implementation actually iterates every dialect and only exits at the
end, reporting all offending directories at once. Update the doc to
match.

Addresses gemini-code-assist comment on PR #1222 (PRRT_kwDONV6tZs6D31Je).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-ent-codegen-drift-lint branch from 3c2e869 to e5890cd Compare May 23, 2026 03:31
@kalbasit
kalbasit force-pushed the feat-nix-checks-atlas-sum branch from 0c17a85 to 3c9e1b6 Compare May 23, 2026 03:31
@kalbasit

Copy link
Copy Markdown
Owner Author

Automated stack merge failed during the rebase step. The merge-stack label has been removed from all PRs in the stack. Please resolve conflicts locally, push, and re-apply the label on the top-most PR to retry. Run: https://github.com/kalbasit/ncps/actions/runs/26326665317

kalbasit and others added 5 commits May 23, 2026 07:54
Adds a new `cmd/atlas-sum-check` Go binary that opens each
`migrations/<dialect>/` directory via Atlas `sqltool.NewGooseDir`,
recomputes the checksum, and compares against the on-disk `atlas.sum`.
Any drift fails the build with a diagnostic pointing at
`go run ./cmd/generate-migrations` as the remediation.

Wires the binary into `nix flake check` via a new `atlas-sum-check`
derivation in `nix/checks/flake-module.nix`. The derivation reuses the
ncps Go module setup but runs the new binary instead of the full build.

Marks task 13.3 complete in the migrate-to-ent-and-atlas change.
The parent atlas-sum-check commit upgrades ariga.io/atlas in
go.mod from v0.36.2 to v0.38.0 (needed for the new check
binary). The vendor tree shrinks/grows accordingly, so the FOD
hash changes. Bump vendorHash to match — without this,
golangci-lint-check fails with "inconsistent vendoring:
ariga.io/[email protected] ... but not marked as explicit in
vendor/modules.txt".
The parent atlas-sum-check commit upgrades ariga.io/atlas in
go.mod from v0.36.2 to v0.38.0. ent-codegen-drift-check uses
proxyVendor=true with its own vendorHash, so the bump on
ncps.goModules isn't enough — the drift check's GOPROXY cache
also needs to be re-populated for the new atlas version.
Without this, the check fails with:
  ariga.io/[email protected]: reading file://.../v0.38.0.zip:
  no such file or directory
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.50%. Comparing base (30b1e8a) to head (467ad3f).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1222   +/-   ##
=====================================
  Coverage   5.50%   5.50%           
=====================================
  Files          6       6           
  Lines        400     400           
=====================================
  Hits          22      22           
  Misses       374     374           
  Partials       4       4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code merge-stack size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant