Repository navigation
fix(tests): allow retained lifecycle lock in generated state-machine write set - #3566
Merged
Daniel Meppiel (danielmeppiel) merged 1 commit intoNov 11, 2026
Conversation
…write set filelock 4 (adopted for Python >= 3.11 in #3465) no longer unlinks the lock file on release, so a project-scope install now leaves the OS-user lifecycle lock ~/.apm/.apm-lifecycle.lock on disk. The generated lifecycle state-machine test rejected it as a write outside the declared user-root write set, failing the release dry run on macOS (run 43039615994). Declare the lock in _USER_WRITE_PATHS, matching test_brownfield_lifecycle.py. Re-adding an unlink in product code would reintroduce the lock-file race filelock 4 removed. Refs #3565 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 11, 2026 15:38
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test-only allow-list update permitting the retained lifecycle lock file.
No open issues 🎉
What changed in this PR
This test-only fix addresses #3565 by allowing the retained lifecycle lock file introduced by filelock 4 behavior. It updates the generated lifecycle state-machine test without changing production locking behavior.
Changes:
- Adds
.apm/.apm-lifecycle.lockto the user-root write allow-list. - Documents why the lock file may remain after release; its presence is permitted, not required.
| File | Description |
|---|---|
tests/integration/test_generated_lifecycle_state_machine.py |
Allows the retained user lifecycle lock in the declared write set. |
Review effort: Balanced
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-lifecycle-lock-write-set
branch
November 11, 2026 18:01
This was referenced Nov 11, 2026
Merged
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.
Description
Release dry run 43039615994 fails
Build & Validate (macOS x86_64)on 5[project]cases oftests/integration/test_generated_lifecycle_state_machine.py:Artifact root 'user' wrote outside its declared write set: ['.apm/.apm-lifecycle.lock'].Since #3465, Python >= 3.11 uses filelock 4, which no longer unlinks lock files on
release. The OS-user lifecycle lock
~/.apm/.apm-lifecycle.locktherefore persistsafter a project-scope install. This PR declares it in the test's
_USER_WRITE_PATHS(the write set is an allow-list, so this also holds on filelock 3.x / Windows where
the file may be removed).
tests/integration/test_brownfield_lifecycle.pyalreadydeclares the same path. Re-adding an unlink in product code would reintroduce the
lock-file race filelock 4 removed, so no product change. Test-only.
The Linux integration legs were skipped in that dry run (blocked by #3560) and would
hit the same failure; this module does not run in PR or push-to-main CI.
Issue and approved scope
Issue: Fixes #3565
Human scope-approval comment: scope approved by Daniel Meppiel (@danielmeppiel)'s explicit
session mandate ("loop until the CI pipelines in main are fixed, and that the
release pipeline is passing on a dry run"), recorded in #3565. Review contact:
Daniel Meppiel (@danielmeppiel).
Does this PR complete the issue, or what remains? Completes it.
Type of change
Testing
On macOS, Python 3.12, APM from the editable install:
APM_E2E_TESTS=1 APM_BINARY_PATH=$PWD/.venv/bin/apm .venv/bin/pytest "tests/integration/test_generated_lifecycle_state_machine.py::test_generated_identity_write_scope_is_exact" -q-> failed with the CI assertion.APM_E2E_TESTS=1 APM_BINARY_PATH=$PWD/.venv/bin/apm .venv/bin/pytest tests/integration/test_generated_lifecycle_state_machine.py -q -n 4-> 14 passed.test_ssh_semver_transport_contract.pybinary-provenance preflight, which needs a native PyInstaller binary (environment-only, unrelated).ruff check/ruff format --checkon the CI-mirror paths -> clean.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.