Skip to content

Commit b38395d

Browse files
author
miranov25
committed
PHASE 13.34.DF FIX2 — BUG-011: run_tests.sh pre-bundle staging check
Catches the class of bugs where new test files in tests/ are created in the working tree but never staged. pytest finds them and reports a green gate; the bundle ships with that gate; reviewers read it as trustworthy; but the commit has fewer tests than the gate claims. Real incident: Phase 13.34.DF FIX1 BUG-010 (commit 879a083 pre-amend contained drawer.py only; tests/test_phase_13_34_df_fix1_bug010.py was untracked but pytest ran it, producing 822/0/0 gate over a 817- test commit). Cost: 1 review cycle. Patch: ~35 lines inserted in run_tests.sh between the test-summary section and the bundle-packaging section. Blocks bundle (exit 1) when 'git status --porcelain tests/ | grep ^?? | grep .py$' is non-empty. Override: DFDRAW_SKIP_STAGING_CHECK=1 bash run_tests.sh. Test results from the blocked run are still saved to test_logs/ — only the reviewer.zip artifact is prevented. Discovered by Sonet50 in PHASE_13_34_DF_FIX1_BUG010 review. Validated by manual reproduction of 5 scenarios (clean, untracked, override, non-py untracked, modified-tracked).
1 parent 14851d4 commit b38395d

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

UTILS/dfextensions/AliasDataFrame/examples/time_series/time_series_TroubleShooting.py

Whitespace-only changes.

UTILS/dfextensions/dfdraw/run_tests.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,50 @@ fi
325325
echo "========================================"
326326
} | tee "$SUMMARY_FILE"
327327

328+
# =============================================================================
329+
# Pre-bundle staging check (Phase 13.34.DF FIX2 / BUG-011)
330+
# =============================================================================
331+
# Catches a class of bugs where new test files are created in the working tree,
332+
# pytest finds them and reports "all tests pass", but the file is untracked and
333+
# never enters the commit. The bundle then ships a gate (e.g., 822/0/0) that
334+
# doesn't match the committed test count (e.g., 817).
335+
#
336+
# Discovered: Phase 13.34.DF FIX1 BUG-010 (2026-05-18). Sonet50 caught it in
337+
# review by inspecting git_status_*.txt in the reviewer bundle. The cost was
338+
# 1 lost review cycle.
339+
#
340+
# This check blocks BUNDLE creation when any *.py file in tests/ is untracked.
341+
# Test results are still saved to test_logs/ (already written above) — only
342+
# the .zip artifact is prevented. That's the artifact reviewers consume.
343+
#
344+
# Override: DFDRAW_SKIP_STAGING_CHECK=1 bash run_tests.sh
345+
# (for development runs where untracked test files are intentional).
346+
347+
if git rev-parse --is-inside-work-tree &>/dev/null; then
348+
UNTRACKED_TESTS=$(git status --porcelain tests/ 2>/dev/null | grep "^?? " | grep "\.py$" || true)
349+
if [[ -n "$UNTRACKED_TESTS" ]] && [[ -z "$DFDRAW_SKIP_STAGING_CHECK" ]]; then
350+
echo ""
351+
echo "${RED}${BOLD}❌ BUNDLE BLOCKED — untracked Python files in tests/:${RESET}"
352+
echo "$UNTRACKED_TESTS" | sed 's/^/ /'
353+
echo ""
354+
echo "${YELLOW}These files exist in the working tree but are NOT in any commit.${RESET}"
355+
echo "${YELLOW}pytest found and ran them (gate above), but the committed test count${RESET}"
356+
echo "${YELLOW}does not include them. Shipping this bundle is a false positive.${RESET}"
357+
echo ""
358+
echo "Stage them before bundling:"
359+
echo " git add tests/<file>.py"
360+
echo ""
361+
echo "Or, if intentionally local for development, add to .gitignore."
362+
echo ""
363+
echo "Override (development only): DFDRAW_SKIP_STAGING_CHECK=1 bash run_tests.sh"
364+
echo ""
365+
echo "Test results from this run are saved to:"
366+
echo " $LOG_DIR/"
367+
echo "Bundle .zip was NOT created."
368+
exit 1
369+
fi
370+
fi
371+
328372
# =============================================================================
329373
# Package reviewer.zip
330374
# =============================================================================

0 commit comments

Comments
 (0)