feat(scan): add progress display and grouped warning output#31
Merged
Conversation
Print `Indexing <root>...` (or `Indexing <root> (with embeddings)...`) immediately when `sense scan` begins, before any file I/O. Gives users instant feedback that the command started and confirms the target directory. - Resolves root to absolute path for clarity - Placed early in Run, before config load or DB open
Add a \r-overwriting progress line during scan that shows the current phase, file counter, and warning tally. A background goroutine renders at 100ms intervals, fed by atomic counters from parallel parse workers. - Progress displays during scanning (N/M files), edge resolution, test association, and embedding phases - TTY detection via go-isatty: non-TTY (pipe, CI) and --quiet skip progress entirely - defer prog.stop() + sync.Once ensures the background goroutine is always cleaned up
Replace scattered fmt.Fprintf(warn, ...) calls with a structured warningCollector that groups warnings by category (parse failed, file too large, write failed, meta error). Warnings accumulate silently during the scan and are written to .sense/warnings.log at the end. - Introduce warningKind enum and warningCollector with thread-safe add/count/format/writeLog - Refactor warnf to addWarning(kind, format, args...) across harness and parseFileStandalone - Simplify parseFileStandalone from 9 to 7 parameters - Zero-warning scans produce no log file; stale log files are cleaned up - Wire collector into RunIncremental for compatibility
Print "N warnings — see .sense/warnings.log" in the scan summary when warnings are present. Omit the line entirely on zero warnings. Suppressed by --quiet to keep programmatic output clean.
There was a problem hiding this comment.
Council Review
Verdict: comment — 6 commented.
Agreements
- All 6 experts agree: comment.
Individual Perspectives
| Expert | Verdict | Key Concern |
|---|---|---|
| the-go-purist | comment | progress.start() launches a goroutine but the struct has no mechanism to guar... |
| the-tdd-advocate | comment | The new warnings.go has solid unit tests covering the four main behaviors: gr... |
| the-threat-modeler | comment | warnings.log is written with 0o644 permissions — world-readable. If warning... |
| the-flow-optimizer | comment | Flow positive: the --quiet flag and TTY detection mean CI pipelines get cle... |
| the-design-minimalist | comment | The warning system redesign earns its place — moving from inline stderr noi... |
| luc-perussault-diallo | comment | The structural move from a mutex+counter+writer to warningCollector+progress ... |
6 experts reviewed. 6 comment. Ship with comments.
Reviewed by Council · pack: go · 6 experts
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.
Problem
sense scanis silent while working and noisy when it finishes. On large repos, the user sees nothing for 10–30 seconds — no sign it started or is progressing. When it completes, individualwarn:lines scroll past the summary, burying the useful output.Summary
Add a live progress display during scan and replace per-file warning prints with grouped collection to
.sense/warnings.log.Changes
Instant banner
Indexing <root>...(with absolute path) immediately on scan start, before any file I/OLive progress
\r-overwriting progress line showing current phase, file counter (142/380 files), and warning tally--quietskip progress entirelydefer prog.stop()+sync.Onceensures cleanup on all exit pathsGrouped warnings
warningCollectorwith 4 categories: parse failed, file too large, write failed, meta error.sense/warnings.logat endparseFileStandalonesimplified from 9 to 7 parametersSummary output
N warnings — see .sense/warnings.loghint line when warnings present, omitted when clean--quietsuppresses hint line for programmatic callersTest Plan
TestScanOutputFormat— banner + summary pattern matchTestScanTolerantOfInvalidSource— warnings collected, hint line present, log file written withparse failedgroupTestScan_SizeCapSkipsLargeFiles—file too largecategory in log fileTestWarningCollector_GroupedFormat— 10 warnings across 4 categories, correct grouped outputTestWarningCollector_WriteLog— log file written with correct contentTestWarningCollector_ZeroWarnings_NoLogFile— no file created on clean scanTestWarningCollector_OverwritesStaleLog— stale log removed on clean rescango test ./...passesmake cipasses (tests + lint)sense scanshows banner and summary, no per-file warnings