Repository navigation
feat(config,ncps): convert pkg/config to Ent and thread *database.Client through callers - #1210
Merged
Merged
Conversation
This was referenced May 21, 2026
Owner
Author
This was referenced May 21, 2026
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 22, 2026 23:28
deba5d8 to
0eb50cd
Compare
kalbasit
force-pushed
the
feat-cache-pinned-orphan-narinfocdc-ent
branch
from
May 22, 2026 23:54
46a0899 to
c666a31
Compare
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 22, 2026 23:54
0eb50cd to
b6594a4
Compare
kalbasit
force-pushed
the
feat-cache-pinned-orphan-narinfocdc-ent
branch
from
May 23, 2026 00:07
c666a31 to
e5ed9c3
Compare
kalbasit
force-pushed
the
feat-config-to-ent
branch
2 times, most recently
from
May 23, 2026 00:07
b6594a4 to
58a5d8d
Compare
kalbasit
force-pushed
the
feat-cache-pinned-orphan-narinfocdc-ent
branch
from
May 23, 2026 00:35
e5ed9c3 to
3c96983
Compare
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 23, 2026 00:35
58a5d8d to
c66e85f
Compare
kalbasit
force-pushed
the
feat-cache-pinned-orphan-narinfocdc-ent
branch
from
May 23, 2026 03:30
3c96983 to
b08e715
Compare
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 23, 2026 03:30
c66e85f to
7a1b13e
Compare
kalbasit
force-pushed
the
feat-cache-pinned-orphan-narinfocdc-ent
branch
from
May 23, 2026 03:45
b08e715 to
4c96e3a
Compare
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 23, 2026 03:45
7a1b13e to
17d8b92
Compare
kalbasit
force-pushed
the
feat-cache-pinned-orphan-narinfocdc-ent
branch
from
May 23, 2026 03:57
4c96e3a to
c87577e
Compare
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 23, 2026 03:57
17d8b92 to
6bf8aba
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pkg/ncps/fsck_test.go`:
- Line 35: The type alias fsckSetupFn has a long single-line return signature
that violates the lll rule; update its declaration (and the other long
signatures referenced around the file) to break the tuple return across multiple
lines for readability and linter compliance—for example, place each return type
on its own line and align the closing parenthesis and function type, adjusting
any matching function literals or usages (e.g., the implementations referenced
at lines around 490, 515, 530) so they use the same multiline signature
formatting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 25d089ea-06a1-49ad-846c-378e4408a2dd
📒 Files selected for processing (9)
pkg/cache/cache.gopkg/config/config.gopkg/config/config_test.gopkg/ncps/fsck.gopkg/ncps/fsck_test.gopkg/ncps/migrate_nar_to_chunks.gopkg/ncps/migrate_nar_to_chunks_test.gopkg/ncps/migrate_narinfo.gopkg/ncps/serve.go
…ent through callers §11.6 first batch: pkg/config now wraps *database.Client (Ent-backed) instead of the legacy database.Querier. GetConfigByKey + SetConfig switch to the Ent fluent API (ConfigEntry.Query/Create with OnConflictColumns upsert), and ErrConfigNotFound is now derived from ent.IsNotFound. All callers in pkg/ncps (serve.go, migrate_narinfo.go, migrate_nar_to_chunks.go, fsck.go) are updated to pass *database.Client into config.New and through getOrSetClusterUUID + detectExtraResourceAttrs. Test factories in pkg/config and pkg/ncps now expose *database.Client so configureCDCInDatabase / configureFsckCDCInDatabase can build a real config service. config_test.go switches its raw config-row helpers to the Ent client API as well. Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-config-to-ent
branch
from
May 23, 2026 04:10
6bf8aba to
cc40f62
Compare
kalbasit
enabled auto-merge (squash)
May 23, 2026 04:11
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pkg/config/config.go`:
- Around line 12-15: The import grouping is incorrect: keep all
github.com/kalbasit/ncps/... imports in a single local-module group by moving
the entconfigentry alias import next to the other local imports (ent and
database) and remove the blank line separating them; update the import block in
pkg/config/config.go so entconfigentry, github.com/kalbasit/ncps/ent, and
github.com/kalbasit/ncps/pkg/database are contiguous, then run gofumpt/goimports
(or gci) to reformat and validate the import ordering.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4c552570-375b-4831-8f42-866d45bf78c7
📒 Files selected for processing (9)
pkg/cache/cache.gopkg/config/config.gopkg/config/config_test.gopkg/ncps/fsck.gopkg/ncps/fsck_test.gopkg/ncps/migrate_nar_to_chunks.gopkg/ncps/migrate_nar_to_chunks_test.gopkg/ncps/migrate_narinfo.gopkg/ncps/serve.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1210 +/- ##
=====================================
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:
|
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.
§11.6 first batch: pkg/config now wraps *database.Client (Ent-backed) instead
of the legacy database.Querier. GetConfigByKey + SetConfig switch to the Ent
fluent API (ConfigEntry.Query/Create with OnConflictColumns upsert), and
ErrConfigNotFound is now derived from ent.IsNotFound.
All callers in pkg/ncps (serve.go, migrate_narinfo.go, migrate_nar_to_chunks.go,
fsck.go) are updated to pass *database.Client into config.New and through
getOrSetClusterUUID + detectExtraResourceAttrs.
Test factories in pkg/config and pkg/ncps now expose *database.Client so
configureCDCInDatabase / configureFsckCDCInDatabase can build a real config
service. config_test.go switches its raw config-row helpers to the Ent client
API as well.
Co-Authored-By: Claude Opus 4.7 [email protected]