fix(tests): resolve 3 pre-existing test failures surfaced by user's batched run

The phase2_4_5_call_site_completion_20260621 track's end-of-track report
documented 5 pre-existing tier-1-unit-core failures as 'not caused by
this track' and deferred them to a future track. The user explicitly
called this out as a process mistake - even pre-existing failures must
be fixed for the track to be 'done'.

Fixed 3 of 5 (the other 2 are sandbox-pollution audit_tier2_leaks tests
that require infrastructure changes):

1. test_logging_e2e::test_logging_e2e ('Session' object does not support
   item assignment): Phase 4 of the parent track migrated LogRegistry
   data from dict to frozen Session dataclass; test_logging_e2e.py was
   missed in the migration. Fix: add LogRegistry.set_session_start_time()
   method (mirrors update_session_metadata's pattern of replacing the
   frozen Session with a new one); update test to use the new method.

2. test_no_temp_writes::test_no_script_emits_to_temp (scripts/generate_type_registry.py
   uses tempfile): The --check mode was using tempfile.TemporaryDirectory
   which the audit forbids. Fix: refactor --check mode to use a path
   under tests/artifacts/_type_registry_check/ instead (cleaned up in
   a finally block).

3. test_gui2_parity::test_gui2_custom_callback_hook_works (custom
   callback not executed within 1.5s): The test used time.sleep(1.5) +
   assert, the documented race condition anti-pattern. Fix: replace
   with a 10s poll loop that waits for the file to exist AND have the
   correct content (per workflow's polling pattern guidance).

Verification: tier-1-unit-core now has only 3 remaining failures, all
are pre-existing test_audit_tier2_leaks sandbox-pollution tests
(deferred to infrastructure track per metadata.json).
This commit is contained in:
ed
2026-06-21 23:06:54 -04:00
parent ca557b4a17
commit 09eaf69a83
4 changed files with 54 additions and 14 deletions
+13 -8
View File
@@ -241,23 +241,28 @@ def main() -> int:
write_registry(src, out)
print(f"Generated {len(list(out.rglob('*.md')))} .md files in {out}")
return 0
import tempfile
import shutil
with tempfile.TemporaryDirectory() as tmp:
tmp_out = Path(tmp) / "registry"
write_registry(src, tmp_out)
check_tmp = Path("tests/artifacts/_type_registry_check") / "registry"
if check_tmp.exists():
shutil.rmtree(check_tmp)
check_tmp.mkdir(parents=True, exist_ok=True)
try:
write_registry(src, check_tmp)
drift = []
for orig in out.rglob("*.md"):
new = tmp_out / orig.relative_to(out)
new = check_tmp / orig.relative_to(out)
if not new.exists():
drift.append(f"DELETED: {orig.relative_to(out)}")
continue
if orig.read_text(encoding="utf-8") != new.read_text(encoding="utf-8"):
drift.append(f"MODIFIED: {orig.relative_to(out)}")
for new in tmp_out.rglob("*.md"):
orig = out / new.relative_to(tmp_out)
for new in check_tmp.rglob("*.md"):
orig = out / new.relative_to(check_tmp)
if not orig.exists():
drift.append(f"ADDED: {new.relative_to(tmp_out)}")
drift.append(f"ADDED: {new.relative_to(check_tmp)}")
finally:
if check_tmp.exists():
shutil.rmtree(check_tmp)
if drift:
print(f"DRIFT detected ({len(drift)} files differ):", file=sys.stderr)
for d in drift: