forked from Rockachopa/Timmy-time-dashboard
* fix: remove invalid show_tool_calls kwarg crashing Agent init (regression) show_tool_calls was removed inf95c960(Feb 26) because agno 2.5.x doesn't accept it, then reintroduced infd0ede0(Mar 8) without runtime testing — mocked tests hid the breakage. Replace the bogus assertion with a regression guard and an allowlist test that catches unknown kwargs before they reach production. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: auto-install git hooks, add black/isort to dev deps - Add .githooks/ with portable pre-commit hook (macOS + Linux) - make install now auto-activates hooks via core.hooksPath - Add black and isort to poetry dev group (were only in CI via raw pip) - Fix black formatting on 2 files flagged by CI - Fix test_autoresearch_perplexity patching wrong module path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Trip T <trip@local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-commit hook: lint + test with a wall-clock limit.
|
|
# Blocks the commit if formatting, imports, or tests fail.
|
|
# Current baseline: ~18s wall-clock. Limit set to 30s for headroom.
|
|
#
|
|
# Auto-activated by `make install` via git core.hooksPath.
|
|
|
|
set -e
|
|
|
|
echo "Auto-formatting (black + isort)..."
|
|
poetry run black --line-length 100 src/ tests/ --quiet
|
|
poetry run isort --profile black --line-length 100 src/ tests/ --quiet 2>/dev/null
|
|
git add -u
|
|
|
|
MAX_SECONDS=30
|
|
|
|
echo "Running tests (${MAX_SECONDS}s limit)..."
|
|
|
|
# macOS lacks GNU timeout; use perl as a portable fallback.
|
|
if command -v timeout &>/dev/null; then
|
|
timeout "${MAX_SECONDS}" poetry run pytest tests -q --tb=short --timeout=10
|
|
else
|
|
perl -e "alarm ${MAX_SECONDS}; exec @ARGV" -- poetry run pytest tests -q --tb=short --timeout=10
|
|
fi
|
|
exit_code=$?
|
|
|
|
if [ "$exit_code" -eq 142 ] || [ "$exit_code" -eq 124 ]; then
|
|
echo ""
|
|
echo "BLOCKED: tests exceeded ${MAX_SECONDS}s wall-clock limit."
|
|
echo "Speed up slow tests before committing."
|
|
exit 1
|
|
elif [ "$exit_code" -ne 0 ]; then
|
|
echo ""
|
|
echo "BLOCKED: tests failed."
|
|
exit 1
|
|
fi
|