Skip to content

test(prover): make #5891 path-resolution tests portable; pin #6058 staleness - #6249

Merged
jsboige merged 1 commit into
mainfrom
fix/prover-guards-portable-workspace-tests
Jul 12, 2026
Merged

jsboige merged 1 commit into
mainfrom
fix/prover-guards-portable-workspace-tests

Conversation

@jsboige

@jsboige jsboige commented Jul 12, 2026

Copy link
Copy Markdown
Owner

What

Makes the two #5891 path-resolution regression tests in test_prover_guards.py portable (they hardcoded the literal "CoursIA-2" and only passed from a CoursIA-2 physical checkout) and pins a second, real config.py regression the portability fix surfaced.

Why

#5889 (2026-07-10T11:20Z) added _workspace_root() — an ancestor walk over Path(__file__).parents that finds the MyIA.AI.Notebooks/ hosting config.py. The contract is layout-agnostic: the harness resolves into whichever checkout it ships in (CoursIA OR CoursIA-2), never a sibling. But the two regression tests asserted the value "CoursIA-2" rather than the contract, so they:

  • passed only when run from a C:\dev\CoursIA-2\ physical checkout,
  • failed from the canonical C:\dev\CoursIA\ tree (and any CI fresh clone).

This is exactly the kind of layout-coupling the harness rule (lean-merge-discipline) and G.1 want caught.

Changes

1. Portable contract assertions (both tests)

Before After
WRONG_TREE = re.compile(r"C:\\dev\\CoursIA\\") + REAL_TREE = re.compile(r"C:\\dev\\CoursIA-2\\") p.resolve().is_relative_to(_WORKSPACE_ROOT)
assert "CoursIA-2" in first first.resolve().is_relative_to(_WORKSPACE_ROOT)

is_relative_to does path-component comparison, avoiding the string-prefix pitfall (C:\dev\CoursIA is a string prefix of C:\dev\CoursIA-2). Equal regression-catching power: a CoursIA-2 invocation that leaks to the CoursIA sibling still fails the check.

2. Pin the #6058/#5913 absorption staleness (not weakness)

Making assert p.exists() actually run surfaced that VOTING_FILE and GALESHAPLEY_FILE resolve to non-existent paths — the files were moved into game_theory_lean by the #4365 absorption (#5913 StableMarriage, #6058 SocialChoice), but prover/config.py was never updated. Rather than weaken the existence check or conflate it with the #5891 contract, the test now pins the stale state:

STALE_POST_ABSORPTION = {"VOTING_FILE", "GALESHAPLEY_FILE"}
...
if name in STALE_POST_ABSORPTION:
    assert not p.exists(), (...)  # fails red the moment config.py is reconciled

The config.py fix is deferred to #6248 — it touches the prover's lake build-dir semantics (ai-01's BG-iter planning turf) and the demo line numbers/sorry targets also need rehabilitation (e.g. median_voter_theorem_strict was already proved 2026-05-13).

Verification (firsthand, G.1)

No code change, no Lean build impact. Test-only.

See #1453 (prover harness). Follow-up: #6248.

The two #5891 regression tests
(test_path_constants_resolve_to_active_workspace,
test_candidates_list_prefers_workspace_relative_entry) hardcoded the
literal "CoursIA-2" as the *expected* resolved tree. But the contract
landed by #5889 is layout-agnostic: _workspace_root() walks
Path(__file__).parents for the MyIA.AI.Notebooks ancestor, so the
harness resolves into whichever checkout it ships in (CoursIA OR
CoursIA-2). The tests passed only when run from a CoursIA-2 physical
checkout and failed from the canonical CoursIA tree (and from any CI
fresh clone).

Rewrite both tests to assert the contract via _WORKSPACE_ROOT
(p.resolve().is_relative_to(_WORKSPACE_ROOT)), using path-component
comparison to avoid the C:\dev\CoursIA / CoursIA-2 string-prefix
pitfall. Equal regression-catching power (a CoursIA-2 invocation
resolving to the CoursIA sibling still fails the check), now portable.

Making the existence assertion actually run surfaced a second, real
regression: VOTING_FILE and GALESHAPLEY_FILE were moved into
game_theory_lean by the #4365 anti-proliferation absorption (#5913
StableMarriage, #6058 SocialChoice, both 2026-07-10/11), but
prover/config.py still derives them from the now-gutted
social_choice_lean / stable_marriage_lean dirs — the prover cannot
target those demos post-absorption. Rather than weaken the existence
check or conflate it with the #5891 contract, pin the stale state
(not p.exists()) with an inline cross-ref so the follow-up config.py
fix flips it red and forces the test to drop the STALE_POST_ABSORPTION
entry. The fix to config.py is deferred to a follow-up because it
touches the prover's lake build-dir semantics (ai-01's BG-iter
planning turf) and the demo line numbers/sorry targets also need
rehabilitation.

Verified: 145/145 pass from the CoursIA tree (was 143/145, 2 layout
failures). No code change, no Lean build impact.

Co-Authored-By: Claude <noreply@anthropic.com>

@jsboige jsboige left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Hermes] ✅ Test portability fix solide. Switch des assertions hardcodées "CoursIA-2" → contract-based via _WORKSPACE_ROOT.is_relative_to() — évite bien le string-prefix pitfall (C:\\dev\\CoursIA est prefix de C:\\dev\\CoursIA-2). Pattern STALE_POST_ABSORPTION (fail-when-fixed) élégant pour pin #6058. Security: 0 token/secret. Self-review cap → COMMENT.

@myia-ai-01 myia-ai-01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ai-01 coordinator approve: worker-reviewed MERGEABLE, gates verified (H.4 exec-trailer / catalog byte-identity / CI-green build / scope=title). Batch drain of accumulated backlog.

@jsboige
jsboige merged commit a232ac7 into main Jul 12, 2026
9 checks passed
jsboige added a commit that referenced this pull request Jul 12, 2026
…6252)

SearchAgent._search_via_lsp ran `exact?` then `apply?` SEQUENTIALLY,
each a `lake env lean --stdin` subprocess. Per-call cost is dominated
by Mathlib import elaboration (~98 s on a heavy module), so the
sequential loop is ~196 s wall-clock — both calls routinely overrun
the 120 s per-call timeout on complex P4/P5 goals and return empty.
The SearchAgent then falls back to the LLM with zero Mathlib hints,
which is the root cause of the empty-LSP traces on the P4 mono-verrou
(p4_succ_membership) blocking the Hashlife N3/W3 track.

Run both tactics concurrently via ThreadPoolExecutor. Wall-clock
collapses to ~max(single call), so at least one tactic tends to land
before the timeout. The change is additive and local to _search_via_lsp:

- verifier.search_lean contract is UNCHANGED (one tactic per call,
  same parsing, same per-call attribution) — no verifier/test-protocol
  churn on ai-01's turf.
- suggestions are returned in fixed order (exact? first, apply? second)
  regardless of completion order, so downstream consumers see no
  behavioral diff beyond faster + more results.
- one tactic failing no longer poisons the other (the old loop
  short-circuited on exception via the outer try; now each future's
  exception is logged and the surviving tactic's results are kept).

Tests (test_prover_guards.py):
- test_search_via_lsp_runs_both_tactics_and_preserves_order
- test_search_via_lsp_resilient_to_one_tactic_failing
- test_search_via_lsp_empty_when_verifier_unavailable

Stacked on #6249 (both touch test_prover_guards.py). Verified locally:
3/3 new tests pass; full suite green on the stacked base (148/148).

Co-authored-by: Claude <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Jul 12, 2026
…theory_lean (#6274)

prover/config.py still derived VOTING_FILE, GALESHAPLEY_FILE (and siblings
GSSTATE_FILE, LEMMAS_FILE, LATTICE_FILE, SMOKE_TEST_FILE) from the
social_choice_lean / stable_marriage_lean dirs. Both lakes were gutted by
the #4365 anti-proliferation absorption:

- StableMarriage absorbed into game_theory_lean via #5904-#5913 (2026-07-10)
- SocialChoice (Arrow+Sen+Voting) absorbed into game_theory_lean via #6058
  (2026-07-11)

The legacy dirs survive as md-only (FORMAL_STATUS/README/NOTICE) — their
SocialChoice/*.lean and StableMarriage/*.lean are gone. Because the dir
itself still exists, SOCIAL_CHOICE_DIR.exists() returns True and resolves
to the legacy dir, but VOTING_FILE = legacy/SocialChoice/Voting.lean points
at a non-existent path. 11 demo references in config.py are dead.

Fix: prepend _workspace_relative('GameTheory/game_theory_lean') to both
_SOCIAL_CHOICE_CANDIDATES and _STABLE_MARRIAGE_CANDIDATES, so the canonical
post-absorption home wins. Verified firsthand: all 6 FILE constants now
resolve to existing paths under game_theory_lean/ (both DIRs resolve to
game_theory_lean, SocialChoice/Voting.lean + StableMarriage/{GSState,
GaleShapley,Lemmas,Lattice}.lean all exist).

Not ai-01 turf (despite the issue framing): G.1 verified the DIRs are
consumed ONLY in config.py itself to derive FILE paths — no lake build
uses them as cwd. lake build cwd is resolved via resolve_lake_module()
from the FILE path, which will correctly find the game_theory_lean lake
root. The legacy dirs remain in the candidate lists as fallbacks.

This is step 2 of the workflow pinned by #6249 (test_prover_guards
STALE_POST_ABSORPTION = {VOTING_FILE, GALESHAPLEY_FILE}): once this lands
the pin's follow-up can drop the set to re-assert full existence.

Co-authored-by: Claude-Code <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Jul 12, 2026
…d by concurrent-merge race, #6252) (#6297)

SearchAgent._search_via_lsp ran `exact?` then `apply?` SEQUENTIALLY,
each a `lake env lean --stdin` subprocess. Per-call cost is dominated
by Mathlib import elaboration (~98 s on a heavy module), so the
sequential loop is ~196 s wall-clock — both calls routinely overrun
the 120 s per-call timeout on complex P4/P5 goals and return empty.
The SearchAgent then falls back to the LLM with zero Mathlib hints,
which is the root cause of the empty-LSP traces on the P4 mono-verrou
(p4_succ_membership) blocking the Hashlife N3/W3 track.

Run both tactics concurrently via ThreadPoolExecutor. Wall-clock
collapses to ~max(single call), so at least one tactic tends to land
before the timeout. The change is additive and local to _search_via_lsp:

- verifier.search_lean contract is UNCHANGED (one tactic per call,
  same parsing, same per-call attribution) — no verifier/test-protocol
  churn on ai-01's turf.
- suggestions are returned in fixed order (exact? first, apply? second)
  regardless of completion order, so downstream consumers see no
  behavioral diff beyond faster + more results.
- one tactic failing no longer poisons the other (the old loop
  short-circuited on exception via the outer try; now each future's
  exception is logged and the surviving tactic's results are kept).

Tests (test_prover_guards.py):
- test_search_via_lsp_runs_both_tactics_and_preserves_order
- test_search_via_lsp_resilient_to_one_tactic_failing
- test_search_via_lsp_empty_when_verifier_unavailable

Stacked on #6249 (both touch test_prover_guards.py). Verified locally:
3/3 new tests pass; full suite green on the stacked base (148/148).

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants