Skip to content

chore: remove dead code and finish the incomplete fixes - #89

Merged
pixincreate merged 1 commit into
masterfrom
chore/cleanup
Sep 2, 2026
Merged

chore: remove dead code and finish the incomplete fixes#89
pixincreate merged 1 commit into
masterfrom
chore/cleanup

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Stacked on #88.

Summary

Dead code, duplicated work, and two fixes from earlier PRs that only covered part of their surface.

Changes

  • Dead public API removed: Shell::as_str, OutputFormat::as_str, ExitMode::as_str and KeywatchConfig::load had zero call sites in src/ or tests/.
  • Baseline::load ran twice per --update-baseline — once to filter, once to update — reparsing the same JSON.
  • is_baseline_file did a realpath(2) on every scanned file now that baseline discovery is the default. It compares file names first, so only real candidates pay for the syscall.
  • The broken-pipe fix was incomplete: it covered only the scan summary, so key-watch hook install pre-commit | head and key-watch init bash | head still panicked. The writer moved to utils and every command uses it.
  • Baselines could only grow. update_with_findings appends, and findings are filtered against the baseline before the update, so entries for deleted files and rotated credentials suppressed forever — meaning the update-baseline workflow could only ever produce additive diffs. New --prune-baseline rebuilds from what the scan actually found.

Tests

187 pass. New: --prune-baseline drops an entry for a deleted file while a plain --update-baseline keeps it.

@pixincreate
pixincreate force-pushed the fix/scan-mode-consistency branch from 2eccaf5 to 9798514 Compare August 26, 2026 17:32
@pixincreate
pixincreate marked this pull request as ready for review September 1, 2026 17:57
@pixincreate
pixincreate force-pushed the fix/scan-mode-consistency branch 2 times, most recently from a0a09fd to 36ecd37 Compare September 1, 2026 18:28
Base automatically changed from fix/scan-mode-consistency to master September 2, 2026 16:45
Shell::as_str, OutputFormat::as_str, ExitMode::as_str and
KeywatchConfig::load had no call sites anywhere in src/ or tests/.

--update-baseline loaded and parsed the same baseline file twice per
run, once to filter and once to update.

is_baseline_file ran realpath(2) on every scanned file now that baseline
discovery is the default; it compares file names first, so only
candidates that could possibly be the baseline pay for the syscall.

The broken-pipe fix only covered the scan summary, so 'hook install |
head' and 'init | head' still panicked. The writer moved to utils and is
used by every command.

update_with_findings only ever appends, so entries for deleted files and
rotated credentials suppressed findings forever, and the update-baseline
workflow could only produce additive diffs. --prune-baseline rebuilds
from what the scan actually found.
@pixincreate
pixincreate merged commit b3fbc7d into master Sep 2, 2026
6 checks passed
@pixincreate
pixincreate deleted the chore/cleanup branch September 2, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant