Skip to content

fix: unbreak unit suite — stale persist stubs and expression-index drift flapping - #2

Open
Eliebibs wants to merge 1 commit into
aneym:mainfrom
Eliebibs:fix/stale-persist-stubs-and-expression-index-drift
Open

fix: unbreak unit suite — stale persist stubs and expression-index drift flapping#2
Eliebibs wants to merge 1 commit into
aneym:mainfrom
Eliebibs:fix/stale-persist-stubs-and-expression-index-drift

Conversation

@Eliebibs

Copy link
Copy Markdown

Running make test-unit on a fresh clone at ba3d4c2c (macOS, Python 3.13.11, locked deps) fails: 3 schema-drift tests fail, and the LB-refresh concurrency tests TypeError/hang so hard that faulthandler kills the run before pytest prints a summary. Two independent causes, both introduced around the 2026-07-15 session-time index work:

1. Stale _persist_selection_state stubs. The method grew a skip_account_ids kwarg that callers pass unconditionally, but seven monkeypatched stubs in test_proxy_load_balancer_refresh.py kept the old signature. Every affected test raised TypeError inside select_account; the two event-synchronized ones (test_select_account_does_not_clobber_concurrent_error_state, test_select_account_retries_no_accounts_after_runtime_recovery) then deadlocked the suite waiting on events the dead task never set. Stubs now accept/forward the kwarg and return the stale-id set like the real method.

2. Expression-index drift flapping. idx_logs_session_time uses requested_at DESC, which alembic 1.18.4 reflects on SQLite with an approximate signature (alembic.ddl.impl warning) rather than skipping, so check_schema_drift reports a phantom remove_index/add_index pair and the three drift tests fail their == () assertions. Fixed following the repo's existing convention: the index is registered in _MANUAL_DRIFT_INDEX_REQUIREMENTS (so its presence is still asserted manually) and autogen index diffs for manually-verified indexes are ignored in _is_ignored_schema_drift.

After this change make test-unit reaches the end: 3114 passed, 39 skipped. The only remaining failures are the two test_public_release_docs gates over in-flight openspec/changes/ content (add-rate-limit-reset-redemption, fix-usage-summary-log-hydration, add-stall-forensics-loop-lag missing spec deltas / PR-head-gate task lines) — that's maintainer-side content I didn't want to invent, so it's left alone.

🤖 Generated with Claude Code

https://claude.ai/code/session_011WtCWRvgq9Vivf3UJLaNsn

…ift flapping

The 20260715 session-time index migration broke the unit slice two ways:

1. LoadBalancer._persist_selection_state grew a skip_account_ids kwarg, but
   seven monkeypatched stubs in test_proxy_load_balancer_refresh.py kept the
   old signature. Callers pass the kwarg unconditionally, so every affected
   test raised TypeError inside select_account — and two (the event-
   synchronized ones) hung the whole suite waiting on events the dead task
   never set, killing the run via faulthandler before pytest could even
   print a summary. Stubs now accept and forward the kwarg and return the
   stale-id set like the real method.

2. idx_logs_session_time is expression-based (requested_at DESC), which
   alembic 1.18.4 reflects with an "approximate signature" on SQLite instead
   of skipping, so check_schema_drift flapped a phantom remove/add_index
   pair. The index is now registered in _MANUAL_DRIFT_INDEX_REQUIREMENTS
   (same convention as the other expression indexes, so presence is still
   asserted) and autogen index diffs for manually-verified indexes are
   ignored.

make test-unit: 3114 passed. The two remaining failures
(test_public_release_docs) are release-docs gates over in-flight
openspec/changes content, left to the maintainer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011WtCWRvgq9Vivf3UJLaNsn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant