Repository navigation
Pin that selected verification calls back through a plain function - #323
Merged
Merged
Conversation
#307 passes verify_recorded to _recheck_scanned_directory as a callback. Its review history found two ways a wrapper costs capture depth: a lambda adds a Python frame per folder level (pinned by test_selected_verification_recurses_in_three_frames_per_folder), and a C-implemented callable such as functools.partial adds no Python frame but spends CPython's separate C recursion budget per level, so a deep Lean tree fails with "nested too deeply" where main captured it. fd731bd removed the partial, but nothing caught putting it back: the frame count cannot see it. The new test records the type of every verify_kept callback in a Lean capture and requires a plain Python function. It fails with functools.partial(verify_recorded) restored and passes on main.
Contributor
Author
|
Merge readiness: ready to merge (reviewed at e82523d)
Optional: the body says a C-implemented wrapper makes deep trees fail. That only happens on CPython 3.12 and later, with a raised recursion limit or little C budget left at the call site. It is a draft, so it needs to be marked ready before merging. |
Deicyde
marked this pull request as ready for review
October 15, 2026 17:20
Deicyde
added a commit
that referenced
this pull request
Oct 15, 2026
Main brings #331, #332, #335, #341, #338, #336, #323, #343 and #337. lean.py, render.py and tests/test_render.py conflicted, and four changes were needed outside the conflicts: - lean.py: snapshot_project_sources and _open_stable_project_sources lose the opaque_markers parameter #336 removed and keep this branch's names= keyword. The publication constants #336 moved here take this branch's autoform-publication/v3, and _REPLACEABLE_SCHEMAS moves with _is_complete_publication, since lean.py cannot import render.py. Every Lean capture skips a complete v1, v2 or v3 site; with main's v2 alone it would index this branch's sites and their mkdocs copies. - render.py: imports the constants and _REPLACEABLE_SCHEMAS from lean.py, drops its own _is_complete_publication, and its Lean capture passes names= and relies on the marker every capture now has. - tests/test_render.py: keeps both sides' tests. #336's audit test forwards the names= keyword audit passes, and this branch's revision test builds TreeSnapshot without root_identity and placeholders, which #341 deleted. - graph.py: _catalog_has_local_ledger takes #337's guards (a link urlsplit rejects is skipped, RuntimeError from resolve is caught, os.path.isfile replaces Path.is_file), so a catalog's Sources link can no longer crash load_graph. A new test in tests/test_graph.py covers an invalid URL, an over-long name and a symlink loop.
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up from the post-merge review of #307 (#307 (comment)): one small test, no code change.
verify_recordedto_recheck_scanned_directoryas a callback. A lambda there adds a Python frame per folder level, whichtest_selected_verification_recurses_in_three_frames_per_folderalready pins. A C-implemented wrapper such asfunctools.partialadds no Python frame but spends CPython's C recursion budget at every level, so deep Lean trees fail with "nested too deeply" where main captured them. fd731bd removed the partial; nothing caught putting it back.test_selected_verification_calls_back_through_a_plain_functionrecords the type of everyverify_keptcallback in a Lean capture and requires a plain Python function.Tests
verify_kept=functools.partial(verify_recorded)restored and passes on main; the frame test passes either way, which is the gap.tests/test_lean_sources.pyandtests/test_tree_snapshot_limits.pypass on Python 3.13; the new test passes on 3.10.ruff checkis clean.