Repository navigation
ci(desktop): keep native-release git calls and their tests from forking - #2279
Conversation
native_release.py now owns the git helper, and its three git calls and the git calls in tests/test_native_release.py go through it. The fork guard moves to conftest.py and covers both release test modules. The helper also holds descriptors 0, 1 and 2 open for the length of a call when the process was started with one closed, because Python otherwise falls back to fork.
…dows Since #2277 the test helper returns git output without text-mode newline translation. Two tests wrote a CRLF blob back with write_text, which on Windows turned each CRLF into CR CR LF, so the reversion was no longer exact and the feature commit stayed in the release intent. The tests now write the blob's bytes back, and the helper normalizes line endings as the text-mode call did.
…ows-newlines' into ci/desktop-native-release-no-fork
Independent adversarial review: APPROVEFrom: Grok This closes both P3s from my #2277 review. I found nothing blocking. Head: the coordinator asked for 757161f. The head is now cf55f73, a merge of #2281's branch (d3b20c4) into it. I checked that its tree equals a clean Tests at this head (Linux x86_64, locked desktop env)
The things to attack
P3 (scope, not for this PR): other Desktop scripts still start git or other tools through plain CI: 22 pass, 29 skipped by the path filter, and one pending ( Generality gate: generic release-tooling and test-harness changes with no app- or customer-specific terms. Pass. Limits: Linux only. I couldn't run anything on macOS or Windows. |
Follow-up to #2277, covering the two findings from its review and one check.
Closed standard descriptors
Python starts a child with
posix_spawnonly when the child's pipes are numbered above 2. When the process was itself started with descriptor 0, 1 or 2 closed, a pipe gets one of those numbers and Python falls back toforkwithout saying so.run_gitnow holds any closed standard descriptor open on the null device for the length of the call and closes it again afterwards, so the process is left as it was found.A scratch check with descriptor 0 closed counts 1 fork without the hold and 0 with it.
test_git_does_not_fork_when_standard_input_is_closedcovers this under the fork guard.native_release.py and its tests
tests/test_native_release.pyruns in the same pytest process as the release-intent tests, and its git calls still forked.run_git,GitTimeout,GIT_TIMEOUT) moves fromprepare_release.pytonative_release.py, becauseprepare_release.pyalready importsnative_release.pyand the reverse import would be circular.prepare_release.run_gitandprepare_release.GitTimeoutremain as names for the same objects.native_release.py(_resolve_commit,_git_bytes, and the diff in the version-transform check) go throughrun_git. A missingrootnow makes git exit non-zero, which these functions already turn intoValueError._gitand therev-parsecall intests/test_native_release.pygo throughrun_git.tests/conftest.pyas theno_subprocess_forkfixture. Both release test modules apply it withpytestmark, so a subprocess that would fork pytest fails in either one.The two test_engine failures seen locally
test_learns_the_binding_a_person_would_type_from_the_read_after_the_saveandtest_complete_dry_evidence_projects_codes_without_valuesdo not fail in CI. Both passed in the macOS py3.11 and Linux py3.12 jobs of run 44554323294. They failed locally becauseuv sync --lockedinstalls the released Flow 2.4.1, which has norecords_completefield, whiledesktop-test.ymlinstalls the in-treepackages/flowover it before running the tests. No change is needed.Release intent
The commit type is
ci, so no version bump.python scripts/check_release_intent.py --base origin/main --head HEADreports "Desktop release intent is consistent."Testing
tests/test_native_release.pyandtests/test_release_publication.pypass (76 passed). The whole oftests/test_release_intent.pypasses too (390 passed).