Skip to content

scratch: measure #5849@97d47825 (before) perf rows on d7b9a2fb + #5843@a3c1bbd9 (do not merge) - #5855

Closed
Daniel Meppiel (danielmeppiel) wants to merge 246 commits into
mainfrom
pgm/5838-s8-measure-base
Closed

Daniel Meppiel (danielmeppiel) wants to merge 246 commits into
mainfrom
pgm/5838-s8-measure-base

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Measure-only scratch for #5849 step B. Composed tree: train-5 tip d7b9a2f + #5843a3c1bbd + #584997d4782 (before), with _MEASURE = True so the plugin journeys print every counter. Closed after the Lifecycle Smoke run reports. Do not merge. Refs #5838

…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>
A venv borrowed from another worktree runs that worktree's src/apm_cli, and subprocesses that drop PYTHONPATH import it too, so local results silently disagree with CI. tests/conftest.py now calls require_local_apm_cli before any conftest or test module imports apm_cli: a src/apm_cli outside this checkout fails the session with the uv sync recipe. Installed builds and in-checkout copies such as mutmut's mutants/src are allowed. A pytester case runs an inner session with a foreign apm_cli first on sys.path and checks the hint.

Fixes #5808

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>
Run the real tests/conftest.py in a subprocess with a foreign src/apm_cli first on PYTHONPATH; the session must fail with the hint. Replacing the require_local_apm_cli call in tests/conftest.py with pass turns this case red (QL C1 on #5809).

Refs #5808

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>
The pure foreign_source_root cases move to a unit-marked tests/unit module, and the two session cases that spawn pytest (pytester and the real-conftest wiring proof) move to tests/integration/test_source_tree_guard_session.py, keeping the component mark and P-INV-I7 (QL on #5809: tm006 process spawn in tests/unit, AQ003 on return-value-only component cases).

Refs #5808

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>
Refs #5746, #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5746, #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rows

Refs #5746, #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>
…eeps its teeth

Refs #5746, #5754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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>
The fs hook now steps over its own frames (at most four) to the first
Python caller instead of reading a fixed sys._getframe depth, and only
that caller decides: module code an import executes still counts.

Guard cell: a write a module makes at import time, and a program's
write into a __pycache__-named path, both still count in files_written;
the filter keys on the import system as caller, not on the path.

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>
Linux PR CI Lifecycle Smoke rows for every journey (#5847):
- fs.files_written re-measured without the import system's I/O: cold
  journeys drop most (install-cold 1337 -> 1119, install-50-skills
  419 -> 278, update 338 -> 220, install-noop 26 -> 8, outdated 22 -> 4);
  five rows measured 1-3 higher than their earlier rows and keep their
  existing budgets;
- fs.scandir_calls and fs.open_reads: first rows, the max of two runs
  (scandir is exact; reads vary by up to 2).

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Train-5 recipe (c): resolve tests/quality/promise-catalog.json as a sorted
union, keeping P-PERF-install-run-memos (#5841) and P-PERF-list-imports
(#5834). Nothing else changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The B3 count cell patched the owner's resolve_path (AQ004); it now
counts lstat calls on the root under the proof form. The path_home
rows take the values Linux PR CI measured at d8e0f0b (337 and 71).

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…st (#5838)

Every file of a sealed local plugin image is bound to its verified digest, and
write_seam.copy2 copies a bound member only from bytes that hash to it. The
unchanged-skip judges a bound member by that digest instead of re-reading the
image, so a deployment edited to match a swapped member is never adopted.
A closed-world rule keeps install reading apm.yml only through
read_manifest_text, the reader that serves a sealed image's verified manifest.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

# Conflicts:
#	tests/quality/promise-catalog.json
Train-5 recipe (c): resolve tests/quality/promise-catalog.json as a sorted
union, keeping P-PERF-install-run-memos (#5841) and P-PERF-list-imports
(#5834); the resolution is identical to #5841's. Nothing else changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…deterministically (#5838)

load_yaml and load_yaml_roundtrip serve a sealed image's verified bytes, so
every package-manifest reader, not only read_manifest_text, ignores a swap.
A copy of a synthesized file under a sealed root writes its sealed bytes. The
manifest-read rule now covers the package-image readers outside install with
a reasoned allowlist. The swap cells pin each branch: a swap seen at integrate
re-materializes from source, and a later swap fails closed.

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>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…5849)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Re-measured every fs.scandir_calls and fs.open_reads row on the composed
train-5 tip ace1dbb (Linux PR CI Lifecycle Smoke), budget = measured + 5%.
The earlier rows were measured on this PR's own base, which lacked the
train links underneath. Bisected per link:
- #5837 (train 3 B3) lists each deployed skill root once more:
  install-50-skills 654 -> 704 (+50), cold/warm installs +40,
  install-g-50-skills +50, plugin journeys +78 / +132;
- #5842 (train 5 B5) removes listings: install-g-50-skills -160,
  install-g-14-plugins -543, repass -1031; plugin reads -27 / -44;
- no other link moves these counters; other open_reads moves are
  run-to-run variation of up to 3.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
one single train t1203203 (3 links, mechanical merges only)

Stack-Base: 5804e68

Queue-Base: 641743f
Measured on Linux PR CI on train-5 tip d7b9a2f composed with this PR
(scratch #5853): install-g-14-plugins lstat 14,189; the 23-plugin
re-pass lstat 17,842 and realpath 1,405. Every other row held.

Refs #5838

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Measured; closing (scratch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant