Skip to content

feat: add progress reporting to fsck command - #996

Merged
kalbasit merged 3 commits into
mainfrom
02-28-feat_add_progress_reporting_to_fsck_command
Mar 1, 2026
Merged

kalbasit merged 3 commits into
mainfrom
02-28-feat_add_progress_reporting_to_fsck_command

Conversation

@kalbasit

@kalbasit kalbasit commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Add background progress ticker and per-step logging to fsck command for long-running operations. Users can now track progress every 30 seconds during suspect collection (Phase 1) and re-verification (Phase 2).

Progress tracking includes:

  • Items checked and suspects found (updated every 30s)
  • Percentage complete when total is known
  • Check rate (items/second)
  • Per-step completion messages with counts

Phase 1 (suspect collection) now logs:

  • phase 1a: narinfos_without_nar_files found
  • phase 1c: walking NAR storage / indexed NARs / checking nar_files / done checking nar_files
  • phase 1d: checking storage NAR files / done checking storage NAR files
  • phase 1e-g: CDC-specific checks

Phase 2 (re-verification) logs start with total suspects and periodic progress updates.

Co-Authored-By: Claude Haiku 4.5 [email protected]

@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 Mar 1, 2026

kalbasit commented Mar 1, 2026 •

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience of the fsck command by introducing comprehensive progress reporting and detailed per-step logging. Users can now monitor the status of the fsck process in real-time, gaining visibility into the progress of suspect collection and re-verification, which is crucial for long-running operations.

Highlights

  • Progress Reporting: Implemented a background progress ticker for the fsck command, providing updates every 30 seconds during long-running operations like suspect collection (Phase 1) and re-verification (Phase 2).
  • Detailed Logging: Added per-step logging messages for various sub-phases within fsck, including specific messages for narinfos_without_nar_files, orphaned nar_files in DB, walking NAR storage, checking nar_files, checking storage NAR files, and CDC-specific checks.
  • Metrics Included: Progress updates now include the number of items checked, suspects found, percentage complete (when total is known), and the check rate (items/second).
  • Concurrency Safety: Utilized sync/atomic counters to safely track checked, total, suspects, and remaining items across concurrent operations.
Changelog
  • pkg/ncps/fsck.go
    • Imported the sync/atomic package to enable atomic operations for progress counters.
    • Introduced a background goroutine in collectFsckSuspects to periodically log progress updates for Phase 1, including checked items, total items, suspects, percentage, and rate.
    • Added specific logger.Info() calls to mark the start and completion of various sub-phases within collectFsckSuspects (e.g., 1a, 1b, 1c, 1d, 1e, 1f, 1g) with relevant counts.
    • Integrated atomic.Int64 counters (checked, total, suspects) to track progress during the suspect collection phase.
    • Introduced a background goroutine in reVerifyFsckSuspects to periodically log progress updates for Phase 2, including checked items, remaining items, total, percentage, and rate.
    • Incremented checked and decremented remaining atomic counters for each item processed during the re-verification of suspects in Phase 2.
Activity
  • No human activity detected on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@kalbasit kalbasit added the backport release-0.9 Backport PR automatically label Mar 1, 2026
Add background progress ticker and per-step logging to fsck command for long-running operations. Users can now track progress every 30 seconds during suspect collection (Phase 1) and re-verification (Phase 2).

Progress tracking includes:
- Items checked and suspects found (updated every 30s)
- Percentage complete when total is known
- Check rate (items/second)
- Per-step completion messages with counts

Phase 1 (suspect collection) now logs:
  - phase 1a: narinfos_without_nar_files found
  - phase 1c: walking NAR storage / indexed NARs / checking nar_files / done checking nar_files
  - phase 1d: checking storage NAR files / done checking storage NAR files
  - phase 1e-g: CDC-specific checks

Phase 2 (re-verification) logs start with total suspects and periodic progress updates.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@kalbasit
kalbasit force-pushed the 02-28-feat_add_progress_reporting_to_fsck_command branch from 73a28e8 to d0a31df Compare March 1, 2026 03:20

@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 effectively adds progress reporting to the fsck command, which is a great improvement for long-running operations. The use of atomic counters and background tickers is appropriate. My main feedback is to refactor the duplicated progress reporting logic into helper functions to improve code maintainability. I've provided specific suggestions for this.

Comment thread pkg/ncps/fsck.go Resolved
Comment thread pkg/ncps/fsck.go Resolved
@dosubot

dosubot Bot commented Mar 1, 2026

Copy link
Copy Markdown

Related Documentation

Checked 7 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@codecov

codecov Bot commented Mar 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.04%. Comparing base (736f3b7) to head (af43f25).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #996   +/-   ##
=====================================
  Coverage   5.04%   5.04%           
=====================================
  Files          6       6           
  Lines        436     436           
=====================================
  Hits          22      22           
  Misses       410     410           
  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 37d08fc into main Mar 1, 2026
21 of 23 checks passed
@kalbasit
kalbasit deleted the 02-28-feat_add_progress_reporting_to_fsck_command branch March 1, 2026 04:17
kalbasit added a commit that referenced this pull request Mar 1, 2026
Add background progress ticker and per-step logging to fsck command for
long-running operations. Users can now track progress every 30 seconds
during suspect collection (Phase 1) and re-verification (Phase 2).

Progress tracking includes:
- Items checked and suspects found (updated every 30s)
- Percentage complete when total is known
- Check rate (items/second)
- Per-step completion messages with counts

Phase 1 (suspect collection) now logs:
- phase 1a: narinfos_without_nar_files found
- phase 1c: walking NAR storage / indexed NARs / checking nar_files / done checking nar_files
- phase 1d: checking storage NAR files / done checking storage NAR files
- phase 1e-g: CDC-specific checks

Phase 2 (re-verification) logs start with total suspects and periodic
progress updates.

---------

Co-authored-by: Claude Haiku 4.5 <[email protected]>
(cherry picked from commit 37d08fc)
@kalbasit

kalbasit commented Mar 1, 2026

Copy link
Copy Markdown
Owner Author

Successfully created backport PR for release-0.9:

kalbasit added a commit that referenced this pull request Mar 1, 2026
Bot-based backport to `release-0.9`, triggered by a label in #996.

Add background progress ticker and per-step logging to fsck command for
long-running operations. Users can now track progress every 30 seconds
during suspect collection (Phase 1) and re-verification (Phase 2).

Progress tracking includes:
- Items checked and suspects found (updated every 30s)
- Percentage complete when total is known
- Check rate (items/second)
- Per-step completion messages with counts

Phase 1 (suspect collection) now logs:
  - phase 1a: narinfos_without_nar_files found
- phase 1c: walking NAR storage / indexed NARs / checking nar_files /
done checking nar_files
- phase 1d: checking storage NAR files / done checking storage NAR files
  - phase 1e-g: CDC-specific checks

Phase 2 (re-verification) logs start with total suspects and periodic
progress updates.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>

Co-authored-by: Claude Haiku 4.5 <[email protected]>
kalbasit added a commit that referenced this pull request Mar 1, 2026
Phase 1g (orphaned chunk files in storage) uses a storage walker to find
chunks that are not in the database. Since the total number of chunks in
storage is not known beforehand, we cannot accurately calculate a
percentage for this phase.

This change:
1. Removes the attempt to pre-calculate chunk count in phase 1g.
2. Updates logProgress to only show percentage when checked <= total,
   preventing misleading percentages when phase 1g is running.

Follow-up on #996
kalbasit added a commit that referenced this pull request Mar 1, 2026
Phase 1g (orphaned chunk files in storage) uses a storage walker to find
chunks that are not in the database. Since the total number of chunks in
storage is not known beforehand, we cannot accurately calculate a
percentage for this phase.

This change:
1. Removes the attempt to pre-calculate chunk count in phase 1g.
2. Updates logProgress to only show percentage when checked <= total,
   preventing misleading percentages when phase 1g is running.

Follow-up on #996

(cherry picked from commit 4e267c5)
kalbasit added a commit that referenced this pull request Mar 1, 2026
#1000] (#1002)

Bot-based backport to `release-0.9`, triggered by a label in #1000.

Phase 1g (orphaned chunk files in storage) uses a storage walker to find
chunks that are not in the database. Since the total number of chunks in
storage is not known beforehand, we cannot accurately calculate a
percentage for this phase.

This change:
1. Removes the attempt to pre-calculate chunk count in phase 1g.
2. Updates logProgress to only show percentage when checked <= total,
   preventing misleading percentages when phase 1g is running.

Follow-up on #996
kalbasit added a commit that referenced this pull request Jun 8, 2026
## Summary

The `[Unreleased]` section was populated in #1309 but skewed toward the
recent CDC-drain, in-flight-staging, and Ent-migration work, omitting
several user-facing features and fixes that also landed since v0.9.4.
This backfills the missing notable changes, each cross-referenced by PR.

**Added**
- `ncps fsck` command + Helm fsck CronJob (#975, #996, #998, #999,
#1000, #1004, #1006, #1176)
- Closure pinning HTTP endpoints `POST`/`DELETE /pin/{hash}.narinfo`,
`GET /pins` (#1108)
- pprof server via `--pprof-addr` (#1063)
- CDC lazy chunking as a feature + `--cache-cdc-lazy-cleanup-schedule` +
recovery cron (#1082, #1083, #1089, #1096)
- Helm: auto `GOMEMLIMIT` (#1061), configurable temp volume /
`volumeClaimTemplate` (#1074, #1077), SQLite `Recreate` strategy (#1012)
- Startup storage reporting + deprecated-narinfo warning (#959, #961)
- `docker-dev` image (#1097)

**Fixed**
- `store/tmp` no longer wiped on startup (#1313)
- `nix-hash` NAR verification (#1101)
- Prometheus counters primed at startup (#1337, #1343)
- 404 on un-reassemblable chunked NARs (#1319), purged narinfo no longer
500 (#1318), fail-fast tmp validation (#1086)
- Further CDC/cache reliability fixes (#1317, #1346, #1341, #1342,
#1331, #1347)

**Changed**
- CDC config now persisted in the DB config table (#971)

Dependency bumps, CI/test-only changes, and the internal Ent-conversion
PRs are intentionally excluded; the existing Ent-migration entry already
covers that work.

## Test plan

- [x] `nix fmt` reports no changes (docs-only edit)
- [x] CHANGELOG section structure intact
(Added/Fixed/Changed/Removed/Migration/CI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release-0.9 Backport PR automatically enhancement New feature or request go Pull requests that update go code 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