Repository navigation
Treat undecodable git output as no answer when pinning the plugin - #178
Merged
Merged
Conversation
_git decodes git's output as text but caught only OSError and SubprocessError, so a remote whose URL is not UTF-8 raised UnicodeDecodeError out of plugin_pin. autoform init printed a traceback, and autoform project new refused to create the project with the generic "did not satisfy Autoform's project contracts" error. _git now returns None, as it does for other unreadable answers, so the remote is skipped like an unsafe one.
Deicyde
marked this pull request as ready for review
October 7, 2026 06:52
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 one-line fix in
autoform_cli/scaffold.py, plus one test (+15/-1).plugin_pinreads each remote's URL through_git, which decodes git's output as text but caught onlyOSErrorandSubprocessError. If a remote URL is not valid UTF-8 (for example a.git/configwithurl = https://example.test/\xff), the decode raisesUnicodeDecodeError, and nothing on the way up handles it as a git answer:autoform initprints a traceback, because_initcatches onlyScaffoldError.autoform project newrefuses with the generic "The generated project did not satisfy Autoform's project contracts." error, becauseautoform_cli/project/create.py:178catchesUnicodeErroraround the whole plan._gitnow also catchesUnicodeErrorand returnsNone. Every caller already treatsNoneas no answer, so_safe_remote_sourceskips such a remote in the same way it skips one with an unsafe URL. This matches the byte-level readers beside it:_select_remote_sourceand_remote_contains_refalready treat undecodable output as no answer.test_plugin_pin_skips_a_remote_whose_url_is_not_utf8gives a forkorigina non-UTF-8 URL next to the canonicalupstream, and expects the upstream pin. On main it fails with theUnicodeDecodeError; on this branch it passes.#75 edits both files, and #90 and #145 edit
tests/test_scaffold.py. Each merges with this branch without adding a conflict. All three already conflict with main, so none of them can be test-merged with this branch yet.Validation at exact head
e93fd5e8:ruff check autoform_cli servers testsis clean.tests/test_scaffold.py(106) andtests/test_project_create.py(257) pass.