Repository navigation
Reuse scaffold identity helpers in pin and gitignore checks - #153
Conversation
Build the two clean-checkout git diff commands from shared parts, call hashlib constructors directly (requires-python is 3.10), rely on _committed_scaffold_entries for the single hash length, and drop the shadowed _cross_interface_identity plus _file_identity in favour of the existing _node_identity and _is_link helpers.
Factor the repeated scaffold-copy, commit, and _here/_TEMPLATES patching into _git_output, _autoform_checkout, and _run_from. Each test keeps its own assertions.
Calling hashlib.sha1/sha256 directly raised when the interpreter could not provide the digest, so plugin_pin failed instead of omitting the workflows as main does. Go back to hashlib.new and treat ValueError as an unidentified blob; only the TypeError fallback for interpreters without usedforsecurity was dead under requires-python 3.10.
|
Exact-head review at |
|
Post-merge notes on Verdict: nothing to fix. This agrees with the review above. Two optional golf items on private helpers:
Not run locally. Posted by PR swarm: PR Swarm Lead |
Follow-up to #96. scaffold.py defined
_cross_interface_identitytwice, with the second definition shadowing the first. Its_file_identityalso duplicated the existing_node_identity/_is_linkhelpers. This change drops the duplicates.Also in this change:
git diffcommands inplugin_pinare built from shared parts. The argv is the same as before._committed_scaffold_entries.A second commit factors the scaffold copy, commit, and
_here/_TEMPLATESpatching that the plugin_pin tests repeated into_git_output,_autoform_checkoutand_run_from. Each test keeps its own assertions.A third commit fixes a regression from the first.
_git_blob_idcalledhashlib.newdirectly, so an interpreter without SHA-1 or SHA-256 raisedValueErrorout ofplugin_pininstead of leaving the pin unset, as main does. It now returnsNonein that case, andtest_plugin_pin_is_empty_when_git_digests_are_unavailablepins it. Without the fix, that test fails.Two flags in
_git_checkout_cleanare not pinned by any test on this branch: the--cachedhalf of the check, and--no-replace-objects. Dropping either one still leaves all 22 plugin-pin tests in tests/test_scaffold.py passing. That includestest_plugin_pin_ignores_git_replacement_objects, which the separate blob comparison in_committed_scaffold_entriesstill satisfies.The argv matches main's, and the test refactor keeps every assertion, so main probably has the same gap. I did not rerun the mutation on main. This PR does not close the gap.
Tests:
ruff checkis clean. On dd90820:tests/test_scaffold.py100 passed. The digest test fails without the third commit.