Skip to content

feat(ncps): convert migrate-narinfo + migrate-nar-to-chunks queries to Ent - #1211

Merged
kalbasit merged 1 commit into
mainfrom
feat-ncps-migrate-queries-to-ent
May 23, 2026
Merged

kalbasit merged 1 commit into
mainfrom
feat-ncps-migrate-queries-to-ent

Conversation

@kalbasit

Copy link
Copy Markdown
Owner

§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]

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request go Pull requests that update go code labels May 21, 2026
This was referenced May 21, 2026
@kalbasit

kalbasit commented May 21, 2026 •

Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 1dc8605 to 5671b1f Compare May 22, 2026 23:02
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from d47eb48 to c6241cf Compare May 22, 2026 23:02
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 5671b1f to deba5d8 Compare May 22, 2026 23:15
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from c6241cf to 26f6a50 Compare May 22, 2026 23:16
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from deba5d8 to 0eb50cd Compare May 22, 2026 23:28
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from 26f6a50 to 86fef06 Compare May 22, 2026 23:28
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 0eb50cd to b6594a4 Compare May 22, 2026 23:54
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch 2 times, most recently from 86fef06 to c94cf8c Compare May 22, 2026 23:54
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from b6594a4 to 58a5d8d Compare May 23, 2026 00:07
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from c94cf8c to 82672f6 Compare May 23, 2026 00:07
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 58a5d8d to c66e85f Compare May 23, 2026 00:35
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from 82672f6 to 899306a Compare May 23, 2026 00:35
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from c66e85f to 7a1b13e Compare May 23, 2026 03:30
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from 899306a to d897714 Compare May 23, 2026 03:30

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 win

Fix 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7a1b13e and d897714.

📒 Files selected for processing (2)
  • pkg/ncps/migrate_nar_to_chunks.go
  • pkg/ncps/migrate_narinfo.go

@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 7a1b13e to 17d8b92 Compare May 23, 2026 03:45
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from d897714 to 4b9eac2 Compare May 23, 2026 03:45
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 17d8b92 to 6bf8aba Compare May 23, 2026 03:57
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from 4b9eac2 to 2712c37 Compare May 23, 2026 03:57
@kalbasit
kalbasit force-pushed the feat-config-to-ent branch from 6bf8aba to cc40f62 Compare May 23, 2026 04:10
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from 2712c37 to 947940c Compare May 23, 2026 04:10
Base automatically changed from feat-config-to-ent to main May 23, 2026 04:22
…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]>
@kalbasit
kalbasit force-pushed the feat-ncps-migrate-queries-to-ent branch from 947940c to 232e371 Compare May 23, 2026 04:22
@kalbasit
kalbasit enabled auto-merge (squash) May 23, 2026 04:22
@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.68%. Comparing base (650b46c) to head (232e371).
⚠️ Report is 1 commits behind head on main.

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.
📢 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.

@kalbasit
kalbasit merged commit 727d46c into main May 23, 2026
16 checks passed
@kalbasit
kalbasit deleted the feat-ncps-migrate-queries-to-ent branch May 23, 2026 04:33
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:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant