Repository navigation
feat(ncps): convert migrate-narinfo + migrate-nar-to-chunks queries to Ent - #1211
Conversation
1dc8605 to
5671b1f
Compare
d47eb48 to
c6241cf
Compare
5671b1f to
deba5d8
Compare
c6241cf to
26f6a50
Compare
deba5d8 to
0eb50cd
Compare
26f6a50 to
86fef06
Compare
0eb50cd to
b6594a4
Compare
86fef06 to
c94cf8c
Compare
b6594a4 to
58a5d8d
Compare
c94cf8c to
82672f6
Compare
58a5d8d to
c66e85f
Compare
82672f6 to
899306a
Compare
c66e85f to
7a1b13e
Compare
899306a to
d897714
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/ncps/migrate_narinfo.go (1)
3-19:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix import grouping/order to satisfy gci/goimports rules.
Line 14 introduces a local-module aliased import in the same group as third-party imports. Split import groups to match configured ordering (standard → default → alias → localmodule) so lint/format checks don’t fail.
As per coding guidelines, "Use gofumpt, goimports, and gci for import ordering (standard → default → alias → localmodule)".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/ncps/migrate_narinfo.go` around lines 3 - 19, Reorder the imports into the configured gci/goimports groups: put standard library imports (context, errors, fmt, sync/atomic, time) first, then third-party packages (github.com/rs/zerolog, github.com/urfave/cli/v3, golang.org/x/sync/errgroup, go.opentelemetry.io/otel/semconv/v1.40.0), then any aliased imports if applicable, and finally local-module imports (github.com/kalbasit/ncps/ent/narinfo as entnarinfo and other github.com/kalbasit/ncps/* packages like pkg/cache and pkg/otel), with a blank line separating each group; after reordering, run gofumpt/goimports or gci to format and validate the import grouping.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@pkg/ncps/migrate_narinfo.go`:
- Around line 3-19: Reorder the imports into the configured gci/goimports
groups: put standard library imports (context, errors, fmt, sync/atomic, time)
first, then third-party packages (github.com/rs/zerolog,
github.com/urfave/cli/v3, golang.org/x/sync/errgroup,
go.opentelemetry.io/otel/semconv/v1.40.0), then any aliased imports if
applicable, and finally local-module imports
(github.com/kalbasit/ncps/ent/narinfo as entnarinfo and other
github.com/kalbasit/ncps/* packages like pkg/cache and pkg/otel), with a blank
line separating each group; after reordering, run gofumpt/goimports or gci to
format and validate the import grouping.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 53e4eec2-80fc-4d11-b2a0-bb861dae47c0
📒 Files selected for processing (2)
pkg/ncps/migrate_nar_to_chunks.gopkg/ncps/migrate_narinfo.go
7a1b13e to
17d8b92
Compare
d897714 to
4b9eac2
Compare
17d8b92 to
6bf8aba
Compare
4b9eac2 to
2712c37
Compare
6bf8aba to
cc40f62
Compare
2712c37 to
947940c
Compare
…o Ent §11.6 second batch: migrate-narinfo: GetUnmigratedNarInfoHashes + GetMigratedNarInfoHashes are now NarInfo.Query() Where(URLIsNil/URLNotNil) with Select(FieldHash).Strings(). migrate-nar-to-chunks: GetNarInfoByHash (used for the per-walk staleness check) is now NarInfo.Query Where(HashEQ). GetNarFilesToChunkCount + GetNarFilesToChunk are NarFile.Query Where(TotalChunksEQ 0) Count()/All() with Select() limited to the columns the loop actually reads. Database not-found switches from database.IsNotFoundError to ent.IsNotFound; the nullable URL is now a *string checked via ni.URL == nil instead of sql.NullString.Valid. Co-Authored-By: Claude Opus 4.7 <[email protected]>
947940c to
232e371
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1211 +/- ##
=====================================
Coverage 5.68% 5.68%
=====================================
Files 6 6
Lines 387 387
=====================================
Hits 22 22
Misses 361 361
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
§11.6 second batch:
migrate-narinfo: GetUnmigratedNarInfoHashes + GetMigratedNarInfoHashes are now
NarInfo.Query() Where(URLIsNil/URLNotNil) with Select(FieldHash).Strings().
migrate-nar-to-chunks: GetNarInfoByHash (used for the per-walk staleness check)
is now NarInfo.Query Where(HashEQ). GetNarFilesToChunkCount + GetNarFilesToChunk
are NarFile.Query Where(TotalChunksEQ 0) Count()/All() with Select() limited to
the columns the loop actually reads. Database not-found switches from
database.IsNotFoundError to ent.IsNotFound; the nullable URL is now a *string
checked via ni.URL == nil instead of sql.NullString.Valid.
Co-Authored-By: Claude Opus 4.7 [email protected]