Repository navigation
Fill every probe's records-file contract in one lean_probe helper - #511
Merged
Merged
Conversation
The skeleton, impact and library index probes each loaded their template from probes/ and filled `output_env` and `output_limit` by hand. Those two fields are the probe's half of the records-file contract that run_probe and _read_probe_records hold on the Python side, so three copies could drift apart. lean_probe.render_probe_template(name, **fields) now loads `probes/<name>` and adds both fields. It reads PROBE_OUTPUT_ENV and DEFAULT_PROBE_OUTPUT_LIMIT when called, not as default arguments, so tests that patch the limit still reach the rendered program. It replaces _probe_template and impact's _impact_template, and generate.py's inline load. The template header comments now name the helper; they spell the field names without braces, since the templates are format strings. The new test renders all three probes with the limit patched to 1234 and checks each reads the records-file variable and declares the patched limit. Rendered output is unchanged apart from the header comments.
Deicyde
marked this pull request as ready for review
October 30, 2026 06:44
This was referenced Oct 30, 2026
Contributor
Author
|
Review at 0e1b812: merge. Nothing blocks merge, and there are no notes.
Checks
Posted by Claude Code (session jackmccarthy-eb). |
This was referenced Oct 31, 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.
A follow-up to #482: the skeleton, impact and library index probes get their records-file contract from one
lean_probehelper instead of filling it in three places.Change
lean_probe.render_probe_template(name, **fields)loadsprobes/<name>, fillsfields, and adds the two contract fields every probe template uses:output_env(the variable naming the records file, whichrun_probesets) andoutput_limit(the byte cap_read_probe_recordsenforces). It is inlean_probe.__all__, sinceimpactandlibrary.generateimport it.PROBE_OUTPUT_ENVandDEFAULT_PROBE_OUTPUT_LIMITwhen it runs, not as default arguments, so tests that patchautoform_cli.lean_probe.DEFAULT_PROBE_OUTPUT_LIMITstill reach the rendered program. A caller that passes either field itself gets aTypeError._render_probe_helper,render_impact_probeandrender_library_probecall the helper and drop their two contract lines.lean_probe._probe_template,impact._impact_templateandgenerate.py's inline template load are deleted.skeleton_probe.lean,impact_probe.leanandlibrary_probe.leannow say the fields are filled throughlean_probe.render_probe_template, which addsoutput_envandoutput_limit. The templates are format strings, so the comments spell the field names without braces.test_every_probe_template_gets_the_records_file_contractrenders all three probes with the limit patched to 1234 and checks that each reads the records-file variable and declaresprobeOutputLimitas 1234. It passes on main too, since main's three renderers already read the limit at call time; it is there to fail if the helper ever binds the limit as a default argument.No command, flag, JSON key or message changes, so there is no CHANGELOG entry.
Net: +45/−22 across 7 files.
Verification
diff -ushows only the edited header comment lines; every other line is identical.probeOutputLimitline intests/test_lean_probe.py, the records-file variable intests/test_impact.py, and no unfilledoutput_limitfield intests/test_library_generate.py. So does the fake-Lean records-file limit test; the real-Lean one skips there.checkpasses on the touched Python files.ruff format --checkreports the same findings on them as on the base; CI does not run the formatter._probe_templateor_impact_template.test(Python 3.10 and 3.13) runsruff check autoform_cli servers testsandpytest -q, which runs the new test and the render pins; none needs Lean.real-leanrunstests/test_impact.pyandtests/test_library_generate.pyagainst real Lean, so the rendered impact and library probes, header comments included, are run by Lean.real-lean-skeletonrunstests/test_lean_probe.pyagainst real Lean.test_probe_stops_before_its_records_file_exceeds_the_limitpatches the limit to 1024, builds the helper module from the rendered skeleton template, and checks that the probe stops before its records file passes that size.windows-hardeningruns only the node IDs it lists, none of which this branch changes.Overlap
tests/test_lean_probe.py, where the new test goes) and Refuse a lean_lib that is not an array of named tables, and tidy lean_probe #505 merged; it merges cleanly with current main.lean_probe.py(including__all__) andimpact.py, Give the managed-output helpers their own module #501 changeslean_probe.pyandlibrary/generate.py, Name files by path in input and output errors, and correct the path-free claim #506 changeslean_probe.py's snapshot messages, and Import impact own helpers #492 changesimpact.py. At their current heads, each merges with this branch without conflict, andruff checkpasses on the touched files of each merged tree.