Skip to content

feat(scan): add progress display and grouped warning output#31

Merged
luuuc merged 4 commits intomainfrom
feat/scan-progress-ux
May 1, 2026
Merged

feat(scan): add progress display and grouped warning output#31
luuuc merged 4 commits intomainfrom
feat/scan-progress-ux

Conversation

@luuuc
Copy link
Copy Markdown
Owner

@luuuc luuuc commented May 1, 2026

Problem

sense scan is 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, individual warn: 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

  • Print Indexing <root>... (with absolute path) immediately on scan start, before any file I/O

Live progress

  • \r-overwriting progress line showing current phase, file counter (142/380 files), and warning tally
  • Background goroutine renders at 100ms intervals; parse workers feed it via atomic counters
  • TTY detection via go-isatty: non-TTY (pipe, CI) and --quiet skip progress entirely
  • defer prog.stop() + sync.Once ensures cleanup on all exit paths

Grouped warnings

  • warningCollector with 4 categories: parse failed, file too large, write failed, meta error
  • Warnings accumulate silently during scan, written to .sense/warnings.log at end
  • Zero-warning scans produce no log file; stale log files are cleaned up
  • parseFileStandalone simplified from 9 to 7 parameters

Summary output

  • N warnings — see .sense/warnings.log hint line when warnings present, omitted when clean
  • --quiet suppresses hint line for programmatic callers

Test Plan

  • TestScanOutputFormat — banner + summary pattern match
  • TestScanTolerantOfInvalidSource — warnings collected, hint line present, log file written with parse failed group
  • TestScan_SizeCapSkipsLargeFilesfile too large category in log file
  • TestWarningCollector_GroupedFormat — 10 warnings across 4 categories, correct grouped output
  • TestWarningCollector_WriteLog — log file written with correct content
  • TestWarningCollector_ZeroWarnings_NoLogFile — no file created on clean scan
  • TestWarningCollector_OverwritesStaleLog — stale log removed on clean rescan
  • go test ./... passes
  • make ci passes (tests + lint)
  • Manual smoke test: sense scan shows banner and summary, no per-file warnings

luuuc added 4 commits May 1, 2026 14:55
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.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

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

@luuuc luuuc self-assigned this May 1, 2026
@luuuc luuuc added enhancement New feature or request labels May 1, 2026
@luuuc luuuc merged commit 45cc937 into main May 1, 2026
7 checks passed
@luuuc luuuc deleted the feat/scan-progress-ux branch May 1, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant