Repository navigation
test(lifecycle): I1-X2, a declared user write is the user's and APM must keep it - #4617
Merged
Daniel Meppiel (danielmeppiel) merged 9 commits intoNov 21, 2026
Merged
Conversation
…ust keep it A scenario that edits a deployed file, or writes its own file at a package path, declares those bytes with Scenario.user_write. I1 exempts the path from lock==disk only while disk holds exactly the declared bytes; changing or removing them fails I1, and an exempted step earns no I1 receipt. Negative controls in tests/quality keep the exception narrow. Refs #4564 #4565 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 12:37
…t a deployment Scenario.deployed() leaves a path holding the user's declared bytes to the user when no lock row records it (a user file at a package path, or an edited file left after its package was removed), so I4 does not count it as a deployed surface. An edited file the lock still records stays its package's deployment. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
User writes and edit releases fail to invalidate convergence, producing incorrect I2 idempotence checks, while filesystem-accessing tests are incorrectly marked as unit tests.
3 open issues
What changed in this PR
Adds I1-X2 to the shared lifecycle oracle, allowing scenarios to declare user-owned bytes that APM must preserve. This supports the ownership scenarios planned under #4564 without changing production behavior.
Changes:
- Adds helpers to declare user writes and release protection for authorized replacement.
- Exempts matching user bytes from lock/disk agreement checks, rejects changes or removal, and withholds I1 receipts for exempted steps.
- Adds focused tests for declared and undeclared edits and unowned files.
| File | Description |
|---|---|
| tests/quality/test_oracle_user_writes.py | Tests preservation, exemption boundaries, and receipt suppression. |
| tests/lifecycle/scenarios/_kit.py | Tracks declared user writes and passes their hashes into observations. |
| tests/lifecycle/oracles.py | Defines and enforces the I1-X2 preservation exception. |
Review effort: Balanced
#4597 fixed #4572 (a git -> registry switch now drops the stale .apm-pin) but left the strict KnownCell registry-source-switch-stale-pin in test_m_source.py. The cell no longer fails, so the source spine (test_source_spine_covers_every_form_and_op, lifecycle_smoke shard 4) fails strict on every PR. Drop the cell and its KNOWN_CELLS_BY_ID entry; the regenerated pair X|install|pkg-registry|UPDATE=on moves from known-failing to required. Refs #4572, #4565 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The shape is the declared target set before the step; narrowed drops at least one previously declared target (a switch counts), widened adds at least one and drops none. factors.py and covering.py now say so. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…iel-i1-x2-user-bytes
…nly if announced and detected Ruling #5 (Q&L lead): I4 exempts a gate surface whose every deployed path holds exactly declared user bytes (Scenario.user_write) only when the step announces the keep AND audit --ci fails naming the path; an exempted surface earns no I4 receipt. The scenario kit records each cell's paths (Observation.cell_paths) and runs audit --ci once after a step that left such a surface (Observation.audit_ci). Four negative controls: undeclared bytes, an unannounced keep and an undetected keep fail I4; an announced, detected keep is exempt with no receipt. Review: user_write and release_user_write are input edits, so they now mark the model unconverged (source_moved). Refs #4564 #4565 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-i1-x2-user-bytes
branch
November 21, 2026 15:23
Merged
3 of 10 tasks
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
Adds I1-X2, a narrow, explicit exception to the lifecycle I1 law (lock and deployed files agree), as ruled by the Q&L lead.
A scenario that edits a deployed file (DEPLOYED=edited), or writes its own file at a package's path (DEPLOYED=unowned), now declares those bytes with
Scenario.user_write(path, text).Observation.user_bytescarries the path and the sha256 of those bytes into the oracle.Scenario.release_user_write(path)handles the case where the user asks APM to replace the file (install --force).ORACLE_LAWS["I1"]names I1-X2, alongside I7-X1._native_plugin_recorded) is keyed on lock records, not user bytes, so it does not fit this case and is left unchanged.This unblocks the T-6b ownership scenario suite: all 141 DEPLOYED x {edited, unowned, present-provenance-unknown} pair obligations currently fail I1 by construction, not because of the product. Per the ruling, it ships on its own because
oracles.pyis shared by every lane.Issue and approved scope
Issue: Refs #4564 (0.38 lifecycle burn-down), Refs #4565 (epic)
Human scope-approval comment: #4564 (comment)
Does this PR complete the issue, or what remains? Partial: the oracle exception only. The T-6b suite that uses it rides corpus train 2.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
pytest tests/quality/test_oracle_user_writes.py-> 5 passed. The negative controls: an undeclared edit still fails I1; a declared edit the CLI changed fails I1; a declared user file the CLI removed fails I1; a kept declared edit is exempt and earns no receipt; an undeclared user file at a package path still fails I1.pytest tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py-> passed (54 with the new module).Lint contract: ruff 0.15.12 check/format, taxonomy --changed, assertion-quality ratchet -> clean.
Changelog
## [Unreleased]inCHANGELOG.mdSpec conformance (OpenAPM v0.1)
Added: I4-X2 (ruling #5)
I4-X2: a gate surface whose every deployed path holds exactly declared user bytes (Scenario.user_write) is exempt from I4 only if the step announces the keep AND audit --ci fails naming the path; it earns no I4 receipt.Observation.cell_paths(each deployed cell's paths) andObservation.audit_ci(the kit runsaudit --cionce after a step that left such a surface).tests/quality/test_oracle_user_writes.py: undeclared bytes fail I4; an unannounced keep fails I4; an undetected keep fails I4; an announced, detected keep is exempt with no receipt.user_write/release_user_writemark the model unconverged (source_moved).