feat: Abort on no changes

This commit is contained in:
Brennan Wilkes (Text Groove) 2026-01-22 14:08:02 -08:00
parent 66d50474f5
commit aebc442880
2 changed files with 26 additions and 0 deletions

View file

@ -61,7 +61,20 @@ TRACKER_ARGS=()
if [[ -n "${STORES:-}" ]]; then
TRACKER_ARGS+=(--stores "${STORES}")
fi
set +e
"$NODE_BIN" bin/tracker.js "${TRACKER_ARGS[@]}"
rc=$?
set -e
if [[ $rc -eq 3 ]]; then
echo "No meaningful changes; resetting worktree and skipping commit." >&2
git reset --hard -q
git clean -fdq -- reports data/db viz/data
exit 0
fi
if [[ $rc -ne 0 ]]; then
exit $rc
fi
# Build viz artifacts on the data branch
"$NODE_BIN" tools/build_viz_index.js

View file

@ -156,12 +156,25 @@ async function main() {
const report = await runAllStores(storesToRun, { config, logger, http });
const meaningful =
(report?.totals?.newCount || 0) +
(report?.totals?.updatedCount || 0) +
(report?.totals?.removedCount || 0) +
(report?.totals?.restoredCount || 0) >
0;
const reportTextColor = renderFinalReport(report, {
dbDir: config.dbDir,
colorize: logger.colorize,
});
process.stdout.write(reportTextColor);
if (!meaningful) {
logger.ok("No meaningful changes; skipping report write.");
process.exitCode = 3; // special "no-op" code
return;
}
const reportTextPlain = renderFinalReport(report, {
dbDir: config.dbDir,
colorize: false,