Repository navigation
feat(ncps): convert fsck.go to Ent - #1212
Merged
Merged
Conversation
This was referenced May 21, 2026
Owner
Author
This was referenced May 21, 2026
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 21:29
4ef99f1 to
5312379
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 21:29
4a1c647 to
aa76a92
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 21:42
5312379 to
41fd989
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 21:42
aa76a92 to
78e574c
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 21:54
41fd989 to
d47eb48
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 21:54
78e574c to
f7e7636
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 23:02
d47eb48 to
c6241cf
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 23:02
f7e7636 to
1b54800
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 23:16
c6241cf to
26f6a50
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 23:16
1b54800 to
4f7b9a1
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 23:28
26f6a50 to
86fef06
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 23:28
4f7b9a1 to
38fdd71
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 22, 2026 23:54
86fef06 to
c94cf8c
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 22, 2026 23:54
38fdd71 to
dd18472
Compare
kalbasit
added a commit
that referenced
this pull request
May 22, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 23, 2026 00:07
c94cf8c to
82672f6
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 23, 2026 00:07
dd18472 to
c83722c
Compare
kalbasit
added a commit
that referenced
this pull request
May 23, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
kalbasit
force-pushed
the
feat-ncps-migrate-queries-to-ent
branch
from
May 23, 2026 00:35
82672f6 to
899306a
Compare
kalbasit
force-pushed
the
feat-ncps-fsck-to-ent
branch
from
May 23, 2026 00:35
c83722c to
a519808
Compare
kalbasit
added a commit
that referenced
this pull request
May 23, 2026
queryCDCNarFilesWithSizeMismatch's `seen` map was redundant: Ent's All(ctx) returns one row per NarFile, and the inner loop already breaks after recording the first mismatch, so each NarFile can only be appended to mismatched once. Addresses gemini-code-assist comment on PR #1212 (PRRT_kwDONV6tZs6D3P8r). Co-Authored-By: Claude Opus 4.7 <[email protected]>
§11.6 third batch: rewrite pkg/ncps/fsck.go to use the Ent fluent API on *database.Client for every direct query, update, and delete. The legacy database.Querier parameter is preserved on each helper signature so CLI plumbing keeps compiling; only the call sites change. Notable changes: * fsckResults now holds *ent.NarInfo, *ent.NarFile, *ent.Chunk slices. * "Narinfos without nar_files" / "Orphaned nar_files" / "Orphaned chunks" use Not(HasXxx())/HasXxx() predicates over the junction edges. * CDC size-mismatch (file_size != nar_size where total_chunks > 0) eager- loads NarInfoNarFiles -> Narinfo and compares in-memory because Ent has no cross-table column comparison in the predicate API. * GetChunksByNarFileID is replaced by a small helper that queries NarFileChunk ordered by chunk_index and projects the WithChunk edge. * UpdateNarFileVerifiedAt -> NarFile.UpdateOneID(...).SetVerifiedAt(now). Co-Authored-By: Claude Opus 4.7 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1212 +/- ##
=====================================
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 third batch: rewrite pkg/ncps/fsck.go to use the Ent fluent API on
*database.Client for every direct query, update, and delete. The legacy
database.Querier parameter is preserved on each helper signature so CLI
plumbing keeps compiling; only the call sites change.
Notable changes:
use Not(HasXxx())/HasXxx() predicates over the junction edges.
loads NarInfoNarFiles -> Narinfo and compares in-memory because Ent has
no cross-table column comparison in the predicate API.
NarFileChunk ordered by chunk_index and projects the WithChunk edge.
Co-Authored-By: Claude Opus 4.7 [email protected]