Repository navigation
fix(install): refuse any staging-slot substring; key command roots on absolute paths (#5838) - #5850
Closed
Daniel Meppiel (danielmeppiel) wants to merge 125 commits into
Closed
Daniel Meppiel (danielmeppiel) wants to merge 125 commits into
Daniel Meppiel (danielmeppiel) wants to merge 125 commits into
Conversation
…t collected fails A required cell in tests/quality/harness_conformance.json must earn a passing receipt. Until now ReceiptWitnessPlugin only checked witnesses that passed, so a skipped witness left its required cell unproven without failing anything. - ReceiptWitnessPlugin fails a skipped or xfailed witness of a required cell (setup or call phase), naming every cell and the skip reason. A cell that no longer applies leaves through the contract (applies()), not a run-time skip. Skips of nodes that witness no required cell stay skips. - harness_ratchet.uncollected_witnesses(): every required witness node must be collected (pytest --collect-only over the witness modules), so a renamed or unparametrized witness is refused. - Mutation tests: a required witness that skips fails the gate (pytester), a skip outside required cells stays a skip, and a dropped node is named as not collected. Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…easured; plain skips and untracked xfails fail Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…quired cells A required cell's witness passes with a receipt, or is a strict KnownFailure listed in required_known_failing whose tracking equals the ledger issue, whose issue is open (closed-issue gate), and whose failure matches. Any other xfail, a skip in any phase, an uncollected node or a strict XPASS fails. The ledger only shrinks against the merge-base; a base without the section compares against the frozen 8-cell #5797 set. Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds src/apm_cli/lens/: model.py, the stdlib-only interface contract of the apm list inventory (frozen dataclasses Source, Evidence, HarnessRef, Location, Item, CoverageCell, NotVisible, Inventory), and verdict.py, the only evidence -> state judgment (state, folder_content, item_state). Registers the lens-observation owner with guard registry-delegation-lens-observation: model.py imports only the standard library, only verdict.py writes an APM health state, and no lens module writes, deletes, spawns or opens a socket. One mutation case proves it. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
J13 step 1 now runs 'apm run --list' against an O1 golden captured from today's 'apm list' (the 0.39 scripts table), and asserts it runs nothing. Step 4's diagnose advice moves to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' prints the 'apm list' scripts table or the No scripts found panel byte-for-byte, exits 0 and runs nothing, so bare 'apm list' can switch to the agent-config inventory. The script-not-found hint and the docs now point to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds the test-only R0 layer of the apm list test plan: structured oracles, pending-witness promises, laws, schema, mutations and static guards. No committed cells: every HC-LIST promise stays pending-witness, so the harness ratchet is untouched. - oracles.Evidence gains json_equal and rows_equal (parsed path plus expected value), checked inside check_obligation; a mismatch or an unparseable output fails with no receipt. - tests/lifecycle/list_oracle.py is the one parser of apm list output (schema-validated JSON views; text rows by header column spans; summary and footer by exact clause and line). - HC-LIST-01..15 and HC-LIST-03.targets appended to harness_contract.py as pending-witness; HC-LIST-07 carries scopes=(user,) with a citation. - P-LAW-list.* laws in the property catalog as forward laws citing #5745; the ledger guard accepts a law only when bug-referenced or forward with a cited issue. - JSON Schema plus 4 outcome fixtures; S137 AST guard; C6 clone proof; tests/lifecycle/mutations/list.yaml. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lens/apm_layers.py reads one scope's lockfile once and turns its deployment ledger rows into logical items: kind and name come from the target layout, rows for one physical path are deduped (targets kept apart), and projections of one package item collapse into one item with several locations. Each unique physical file is classified once through deps/file_provenance.classify_file (made public at its owner). Folder items get a bounded recursive name walk without link following: a file outside the record makes the folder modified, a partial walk leaves it unverifiable. Recorded values that escape their root are rejected lexically, before any filesystem call. 'orphaned' is not produced in 0.40 (declared is 'yes' for every locked owner). Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' no longer imports from list_cmd, whose scripts body goes away when bare 'apm list' switches to the inventory. The renderer lives in run.py (a new module would need an architecture owner); output stays byte-identical. The list_cmd unit cases are ported to test_run_list.py. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lens/inventory.build(ctx) reads each requested scope's APM layer once, asks the reader package for native observations (an empty scan until the readers land) and joins them: a native observation at or inside a path an APM item lists is dropped, so one physical path is one location; a scope whose lockfile is unreadable turns its native items into not-checked. APM locations take HARNESSES from the reader records and keep ledger targets apart. --target and NAME selection run before states are summarised, and under exactly one --target same-name copies get the documented ORDER (higher/lower with order_rank, coexist, or unknown; a missing copy is never ranked). The context carries the keys the renderer needs. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…es detection The build input key for the --target selection is 'harnesses' (the target vocabulary guard rejects a raw targets read in src). build() resolves the detected harnesses (signal folders at the project and home roots, apm.yml targets and ledger targets, kept to harness reader records) and passes the selection and the detected set to the readers' scan. ORDER under one target now uses the readers' tier_of and the record's ranked/coexist/unknown rule: copies in one tier tie, and a copy whose tier cannot be read is unknown. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MCP ledger rows (uri locators under target mcp, one per runtime) become MCP claims instead of file items. The inventory joins each claim to the readers' observation of that server name for that runtime at that scope: the location takes the observed config path and entry pointer, the observation is claimed (not listed again as unrecorded), and the entry is compared with the recorded fingerprint through the ownership owner's mcp_native_hash, imported only when an entry is compared. Entry values are read only for that comparison and never returned; the item carries the readers' keys-only shape. An entry not observed is unverifiable. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mark test_run_list.py as component (it writes apm.yml and drives Click), and keep the docs truthful while bare 'apm list' still lists scripts. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Run tests/quality/test_list_{conformance_guards,oracle}.py in the
ratchet contracts job (ci.yml and merge-train.yml, kept identical).
- P-LAW-list.* forward laws are phase 0: no spine transition covers them
until the list observation invariant lands.
- list_oracle: the command kind and Commands section; an empty inventory
summary has no clause; rows() refuses -v detail lines, and details()
attaches them to the row above.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
User-scope APM items now say they are declared in the $APM_HOME manifest, shown as ~/.apm/apm.yml when it sits under the home root; project items keep apm.yml. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The oracle unit test credited a pending-witness cell id; use a neutral cell id so the pending-witness leak guard stays clean. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Under -g the project scope has no root, so context.roots values may be null. Reader order rules name the item kind (skill), unlike sources (skills); HC-LIST-10 now applies where a skill rule is recorded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…paths
- Item names drop any extension the registry gives the primitive, so one
instruction deployed as name.instructions.md and name.md is one item.
- ORDER ranks each copy by the tier of its best location the target reads;
only copies sharing a best tier tie.
- Recorded paths that map to no primitive layout, and paths not confined to
their root, are coverage cells, never a made-up 'file' item; 'canvas'
joins the kind vocabulary.
- User-scope rows under $HOME are matched under the target root install
resolves (root variables such as CLAUDE_CONFIG_DIR honoured).
- Path dedupe and the ancestor manifest hint are separator-agnostic
('../apm.yml' on every OS).
- The folder walk cap is a read_layer parameter, so tests pass it instead
of patching the owner.
Refs #5754
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Link ownership through path_security.user_owned_link, native activation keys from native_plugins.settings, no target-vocabulary reads, records.py counted as registry data by the harness-literal guard, and a vendor file name is not the removed plugin-lifecycle symbol. Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…olders by descriptor Folds AUD F1-F3: the managed-settings ownership gate is re-checked on fstat, subfolders below a root are opened O_NOFOLLOW and listed by descriptor, and the tombstone exemption applies only to the quoted installed_plugins.json name. Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… evidence not_visible[].os and record OS rows use linux, macos and windows (sys.platform mapped once). A plugin activation entry in a settings file now sets configured and evidence_source on the install record with the same plugin id (narrowest scope, then the file read last); an entry with no install record is one plugin item with present no. Install records carry plugin@marketplace ids. Tests are Windows-safe (bytes for frontmatter, absolute tmp system paths). Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ine bypass Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The -g write walk reads HOME once per path component per harness root, 46,456 times for the fresh 14-plugin install. The calls table now counts Path.home(), and the perf worlds use a link-free temp root: on macOS /tmp is a link that defeats resolve_path's per-command proofs. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The foreign-link walk asked _on_root_path about every component of the written path, and each ask read Path.home() once per harness root. The walk now reads HOME once per call and passes the prefix down. Every component under HOME is still lstat'd at write time, and the per-link verdict memo is unchanged. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Windows CI showed stat signatures cannot tell a same-size in-place rewrite apart: NTFS mtime ticks are 100 ns and os.stat's st_ctime is the creation time there; Linux's coarse kernel clock leaves the same gap within a tick. Per AUD (K1-K4): - LockFile._read_document reads the text through read_lockfile_text on every read (its link and regular-file refusals included) and recalls only when the full text is identical; only parse, validation, build and adoption are memoized; - the key also carries adoption's other inputs: whether the path is the user scope root, and the home directory; - the registry YAML memo reads the file each call and reparses only when its text changed; - staged-entry identity, the forget on commit/remove/restore, pickled independent copies and the clear at pipeline start are kept. The plugin journeys' fs.lockfile_reads rows return to #5839's values: every read now reads the file, and the saving is the build (19 reads build 5 LockFile objects on the 14-plugin world, 19 on #5839). cost: one raw read per LockFile.read, as before #5838; no stat calls. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve normalizes a local plugin in a staging directory with an opaque name. Normalization names a root-declared skill, and a manifest without a name, after the directory it runs in, so reusing that image deployed the root skill a second time under the staging name. Reuse now refuses an image whose synthesized paths or metadata carry the staging name; integrate normalizes it at its destination as before. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve normalizes a local plugin in an opaque staging slot. A root-declared skill installed at user and project scope deploys once, under the plugin's name, and is normalized again at its destination. Red at bcd7a45 (the slot name deployed as a second skill). Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The staging-name check read only apm.yml and the top-level .apm metadata. It now reads every file normalization added, by path and by content; a file that cannot be read as text still refuses reuse. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
APM_E2E_TESTS=1 turns the update notice off, so these cells failed in any session that set it for the serve_offline perf modules. They now clear it for themselves. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…irst) Resolve walks every component of a path into directories not created yet, even below a directory this command already proved link-free: on the 14-plugin world that is about 470 full walks before the writes. The cells expect one lstat for the first missing component, the same answer as Path.resolve(), and no proof past a link, a file or a volatile component. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A path whose directory is not proven yet was resolved by a full walk. Below this command's deepest proven ancestor, each component now costs one lstat: an existing plain directory is proven, the first missing component ends the walk (nothing below it exists, so the path resolves to itself), and a link, a file, a volatile name or an error takes the full resolve as before. Linux keeps its kernel form. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… (red-first) Each recorded path resolved the project root again: 20 locators, 20 root resolves. The cells expect one per command, and a root that an APM rename released and a link replaced to be resolved afresh. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The locator resolved the project root, and an external deploy root, for every path it encoded. realpath.resolve_root keeps a root's answer for the command and drops it with the link-free proofs, so any rename, delete or recreate APM performs resolves it afresh. File paths are still resolved on every call. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A regular file, a volatile directory and an unreadable component below a proven directory each fall back to the full resolve and prove nothing; a link later swapped into the volatile directory is refused. A root resolve parked across a forget and a swap is never recalled. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reuse must refuse a synthesized path that merely contains the staging slot (for example "<slot>-skill"), and the per-command root memo must not share an answer between two spellings of a relative root after a chdir. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reuse now refuses a synthesized path that contains the staging slot anywhere, not only as a whole segment, and resolve_root keys its memo on the absolute path so two spellings of a relative root never share an answer. Both are AUD review nits, cost 0. Refs #5838 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
6 of 14 tasks
Collaborator
Author
|
Carried by #5852. |
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
ceb3b8ae971fee71a6e546651f953e23c614b50b↑ Local plugin image units, realpath proof cells and the plugins14 cost module: 45 passed.
↓ CI on this head is not observed yet.
Description
Two AUD review nits from #5839 and #5843, deferred so the train heads stayed frozen. Stacked on #5843.
install/local_plugin_image._names_stagingrefuses a synthesized path that contains the staging slot anywhere (for example<slot>-skill/), not only as a whole path segment.utils/realpath.resolve_rootkeys its per-command memo on the absolute path, so two spellings of a relative root (after a chdir) never share an answer.cost: 0 (a substring test instead of a split;
os.path.abspathon the memo key).Issue and approved scope
Issue: Refs #5838
Human scope-approval comment: #5838 (comment)
Does this PR complete the issue, or what remains? It does not; later floor-plan slices remain.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Red-first:
test_a_synthesized_name_containing_the_staging_slot_refuses_reuseandtest_a_relative_root_is_not_recalled_after_a_chdirfail on the parent commit and pass after the fix.pytest tests/unit/install/test_local_plugin_image.py tests/unit/utils/test_realpath_proof_lifetime.py tests/integration/test_local_plugin_install_cost.py: 45 passed (throughlocal-test.sh,APM_E2E_TESTS=1).Lint mirror clean:
ruff@0.15.12check and format; pylint R0801;lint-auth-signals.sh; complexity ratchet; architecture boundaries.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.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.