Skip to content

Commit 90b3141

Browse files
committed
chore(test): remove time log, keep only baseline
Time log adds noise to git history without practical benefit. The baseline file alone is sufficient for the pre-commit time guard. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent c8046f1 commit 90b3141

2 files changed

Lines changed: 7 additions & 21 deletions

File tree

.githooks/checks/02-unit-tests.sh

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
#!/bin/sh
22
# L1: unit tests — fast, no external deps, no Docker.
33
#
4-
# Time guard: each successful run is appended to .test-time-log and the
5-
# elapsed time is compared against .test-time-baseline. Both files are
6-
# committed so the history is visible and shared.
4+
# Time guard: elapsed seconds are compared against .test-time-baseline.
5+
# The baseline file is committed so the reference survives machine changes.
76
#
8-
# .test-time-baseline — last recorded elapsed time (seconds), updated on
9-
# every pass. Fail if current > baseline * 1.5.
10-
# .test-time-log — append-only history: one line per run, format:
11-
# ISO8601 elapsed_s git_sha branch
7+
# .test-time-baseline — last recorded elapsed time (seconds). Updated on
8+
# every passing run. Fail if current > baseline * 1.5.
129
#
13-
# To reset the baseline after intentional perf change:
10+
# To reset after an intentional perf change:
1411
# echo <new_seconds> > .test-time-baseline
15-
# git add .test-time-baseline .test-time-log && git commit -m "perf: reset test baseline"
12+
# git add .test-time-baseline && git commit -m "perf: reset test baseline"
1613

1714
REPO="$(git rev-parse --show-toplevel)"
1815
LOG_FILE="${REPO}/.test-fail.log"
1916
BASELINE_FILE="${REPO}/.test-time-baseline"
20-
TIMELOG_FILE="${REPO}/.test-time-log"
2117
rm -f "$LOG_FILE"
2218

2319
echo "pre-commit: running unit tests..."
@@ -36,12 +32,6 @@ END=$(date +%s)
3632
ELAPSED=$((END - START))
3733
rm -f "$LOG_FILE"
3834

39-
# Append to time log.
40-
SHA=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
41-
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
42-
TS=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
43-
printf "%s\t%ss\t%s\t%s\n" "$TS" "$ELAPSED" "$SHA" "$BRANCH" >> "$TIMELOG_FILE"
44-
4535
# Time guard: compare against last successful run.
4636
if [ -f "$BASELINE_FILE" ]; then
4737
BASELINE=$(cat "$BASELINE_FILE")
@@ -52,14 +42,11 @@ if [ -f "$BASELINE_FILE" ]; then
5242
echo " Current: ${ELAPSED}s" >&2
5343
echo " Baseline: ${BASELINE}s (limit: ${THRESHOLD}s = baseline × 1.5)" >&2
5444
echo "" >&2
55-
tail -10 "$TIMELOG_FILE" | awk -F'\t' '{printf " %s\t%s\n", $1, $2}' >&2
56-
echo "" >&2
5745
echo "To reset: echo ${ELAPSED} > .test-time-baseline" >&2
5846
exit 1
5947
fi
6048
fi
6149

62-
# Update baseline to the current run so the guard tracks recent history.
50+
# Update baseline to current run time.
6351
echo "$ELAPSED" > "$BASELINE_FILE"
64-
6552
echo "pre-commit: unit tests passed (${ELAPSED}s)."

.test-time-log

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)