Skip to content

fix(install): preserve unchanged manifest requests - #3346

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-ci-manifest-idempotence
Oct 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-ci-manifest-idempotence

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

fix(install): preserve unchanged manifest requests

Description

TL;DR

Keep a repeated positional apm install from treating serialization output as a request to modify apm.yml. Unchanged declarations retain their bytes, pinned refs and metadata, while genuine ref, skill, alias, repository-boundary, explicit HTTPS and marketplace-routing changes still apply. A separate test-only commit binds real resolver/persistence round trips to existing req-cf-001.

Important

Candidate: beda4bb1028dd37854fff7d5244d58705101d408, composed with actual public 2f1587b51382f2d27464aeda13ef34cabc1cfda8 after #3345 landed. Actual hosted CI and the PR gate passed at this head; full-main nonpublishing validation remains outstanding. No private #3344 changes are included.

Problem (WHY)

  • Ordinary serialized entries entered the same map used to classify explicit update intent. A repeated package could therefore be reported as updated and replace an unchanged declaration.
  • Reusing that map across positional arguments also let the first argument's output change the next argument's classification.
  • Returning “an update was requested” instead of whether the canonical merge owner actually changed an entry allowed unnecessary persistence.

The regression evidence below applies the Agent Skills validation loop: “do the work, run a validator (a script, a reference checklist, or a self-check), fix any issues, and repeat until validation passes.” Reinstating the exact public-baseline functions makes all four new manifest-byte oracles fail; restoring this candidate passes them.

Approach (WHAT)

  • Create a fresh explicit-intent map for each argument; populate aggregate serialization output only after successful classification.
  • Keep the existing merge owner authoritative: compare effective entries, aliases and explicit repository boundaries before replacing an entry.
  • Preserve real changes, registry-to-Git refusal, explicit skill resets and structured GitLab repository/path boundaries.
  • Compare effective default-registry routing through its existing owner; preserve metadata when an explicit HTTPS request upgrades an HTTP declaration.
  • Exercise the actual resolver and persistence helper, including two real serialization/reparse rounds into fresh files.

Implementation (HOW)

File Intent and boundary
src/apm_cli/commands/install.py Separate per-argument update intent from successful aggregate output and forward existing default-registry context; validation and rejection routes remain intact.
src/apm_cli/install/package_resolution.py Return actual mutation status; compare effective routing through the existing registry owner and preserve explicit HTTPS upgrades without losing stored metadata.
tests/unit/commands/test_install_resolve_refs.py Cover single/duplicate requests across five declaration forms and their existing-versus-updated diagnostics.
tests/unit/install/test_package_resolution_persistence.py Cover equivalent forms, real ref/skill/reset/target/version/alias changes, repository boundaries and unchanged-manifest write suppression; add eight real persistence/reparse cases for routing, HTTPS and unchanged controls.
tests/spec_conformance/test_round_trip.py Four real cross-module round trips preserve pinned or structured declarations and top-level nested x-* metadata. Only remote-existence validation is patched.
CONFORMANCE.json Add four existing-requirement test bindings; req-cf-001 count changes from 6 to 10.
CONFORMANCE.md Regenerate the matching count, with no other statement change.
docs/src/content/docs/reference/cli/install.md Document repeated positional installs and distinguish genuine updates.
packages/apm-guide/.apm/skills/apm-usage/commands.md Keep the agent-facing command guidance aligned with that behavior.

Diagram

For an existing dependency, dashed nodes show the corrected intent/classification path; aggregate serialization is output, never the next argument's intent.

flowchart LR
    subgraph Request["_resolve_package_references"]
        A["Fresh requested_entries<br/>for each positional argument"]
    end
    subgraph Decide["package_resolution.py"]
        B{"Same effective declaration<br/>and required repository boundary?"}
        C["Keep current_deps<br/>return false"]
        D["Replace current_deps<br/>return true"]
    end
    subgraph Persist["Install output"]
        E["_apm_yml_entries populated<br/>after successful classification"]
        F["persist_dependency_list_if_changed<br/>writes apm.yml only when changed"]
    end
    A --> B
    B -->|Yes| C
    B -->|No| D
    C --> E
    D --> E
    E --> F
    classDef changed stroke-dasharray: 5 5;
    class A,B,C,D,E changed;
Loading

Trade-offs

  • Preserve declared representation rather than eagerly canonicalizing an unchanged manifest. Explicit changes still reach the existing canonical merge owner.
  • Treat aliases and repository/path splits as meaningful, rather than comparing only flattened display strings.
  • Use hermetic remote-existence validation, not live hosts. Parsing, identity classification, mutation decisions and filesystem serialization are real; this is not an installed-binary/network claim.
  • Inherit fix(ci): shard lifecycle smoke without weakening its gate #3345 only through its real public merge; do not change its time budget, selectors or gates. Receipt recovery and broader pre-existing positional/default-registry probing behavior remain outside this correction.

Benefits

  1. Single and duplicate unchanged requests retain the original declaration and report it as already present.
  2. Four real round-trip cases detect byte loss under the old implementation, including pinned refs and structured metadata.
  3. Existing positive controls still apply real changes, including alias, explicit repository boundaries, HTTPS upgrades and marketplace resolver selection.

Issue and approved scope

Issue: None — separately attributable CI recovery under the maintainer's task-specific issue/approval exception; related umbrella #3341.

Human scope-approval comment: No public approval-comment link is asserted. The maintainer's direct instruction was: “you do it, and do not mandate for these fixes to require an issue and approval, it's not needed. get CI working ASAP”. This is a bounded CI-recovery exception, not an accepted label or a fabricated public approval record.

Does this PR complete the issue, or what remains? It completes only the unchanged-manifest classification correction and its conformance coverage. #3341, #2070 and #1882 remain open. Actual hosted qualification, legitimate landing and complete nonpublishing release validation remain separate; no release, tag, version bump, deployment, permission or credential change is requested.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Validation

Current committed candidate beda4bb: 391 passed, zero failures/errors/skips in 86.97s. This bounded affected/quality/round-trip run includes all three actual-command witnesses for the one detected canonical owner, Install command scope selection. The complete current-main-composed lint/static/ratchet chain passed. The entire repository/release suite is not claimed green; actual current-head PR results follow.

Actual hosted evidence at beda Result
CI and required PR gate Both terminal SUCCESS.
Lifecycle shard 1 / shard 2 200 passed / 5 skipped and 196 passed / 8 skipped; whole jobs 464s / 352s, both SUCCESS; strict aggregate SUCCESS.
Spec conformance 525 passed / 2 existing skips, 262.50s; job SUCCESS.
Raw check inventory 26 terminal: 23 SUCCESS, 2 NEUTRAL, 1 SKIPPED. All Windows, lint, architecture and actual CodeQL analysis jobs passed; docs deployment skipped.

Neutral CodeQL is not a passing imposed-native check. The existing user exception is unchanged; no security setting, permission, credential or release action was changed.

Historical evidence: b404c0f had 641 passes and two existing conformance skips: 525 conformance, 48 affected-module and 68 quality passes. The skips are the existing publisher-timestamp SHOULD and absolute-source-path harness waivers, not new exclusions or a Mode B waiver. Its hosted spec job passed 525/2; its unsharded lifecycle job was cancelled after 617s at the ten-minute maximum, not a passing terminal suite.

The sealed production commit 7a10fa6c532051b7ab25edc1e6a0fcaa582a2a0a had 533 passes, 65 restored focused passes and cache/alias negatives. Its six files were byte-identical in the test/derived-only b404c0f descendant. The later five-file review correction intentionally changes that source; no old execution is promoted to beda.

Exact current-head qualification and review regressions

Artifact-directory paths are abbreviated to $EVIDENCE; behavioral execution used the shared two-slot gate.

uv run --frozen --extra dev python -m pytest tests/unit/install/test_package_resolution_persistence.py tests/unit/commands/test_install_resolve_refs.py tests/unit/install/test_registry_wiring.py tests/unit/install/test_architecture_invariants.py tests/unit/commands/test_install_skill_subset.py tests/unit/commands/test_install_context_and_resolution.py tests/unit/test_install_command.py tests/spec_conformance/test_round_trip.py tests/unit/regressions/test_issue_2549_global_dry_run.py tests/quality -p no:randomly -p no:cacheprovider -q --basetemp="$EVIDENCE/3346-review-qualified-tmp" --junitxml="$EVIDENCE/3346-review-qualified.xml"
391 passed in 86.97s (0:01:26)

At unchanged b404, the bounded new matrix produced 3 intended failures / 5 passing controls: marketplace source routing and plain/metadata-bearing HTTPS upgrades. The restored two affected modules passed 56 cases before freezing, then the committed-head run above passed all 391. Real parsing, persistence and reparse are exercised; serialization is not mocked. A broader initial draft also exposed pre-existing direct-positional/default-registry probing behavior and a fixture expectation error; that discarded draft is not counted as the bounded regression proof.

Independent bounded review of the exact five-file correction found no high-confidence issue. No reviewer execution, new panel or unchanged 641-case rerun is counted. Both inline findings are replied to and resolved.

Historical conformance proof and current canonical lint

The following conformance commands ran at b404, not beda. Artifact paths are abbreviated to $EVIDENCE; selectors, flags and results are unchanged.

uv run --frozen --extra dev python -m pytest tests/spec_conformance tests/unit/commands/test_install_resolve_refs.py tests/unit/install/test_package_resolution_persistence.py tests/quality -p no:randomly -p no:cacheprovider -q --basetemp="$EVIDENCE/i5-conformance-qualified-tmp" --junitxml="$EVIDENCE/i5-conformance-qualified.xml"
# Actual result:
641 passed, 2 skipped in 442.08s (0:07:22)
uv run --frozen --extra dev python -m tests.spec_conformance.orphan_check
[+] orphan_check OK: 136 requirements aligned across anchors / manifest / Appendix C / pytest markers
uv run --frozen --extra dev python -m pytest tests/spec_conformance --collect-only -q -p no:randomly -p no:cacheprovider --no-header
# Exit 0; full collection immediately preceded generation:
uv run --frozen --extra dev python -m tests.spec_conformance.gen_statement
[+] wrote CONFORMANCE.json and CONFORMANCE.md
env -u MODE_B_THRESHOLD BASE_REF=origin/main GH_PR_BODY= GITHUB_ACTIONS=true bash tests/spec_conformance/mode_b_detector.sh
[+] mode_b: spec-concurrent edit detected; orphan_check owns this PR

The same actual Mode B command at parent 7a10fa6 exited 1 for 27 substantive critical-path additions against threshold 20. The descendant exits 0 through a real existing-requirement binding; no normative change or waiver was added.

All following canonical lint/static commands were rerun at exact beda after composing public main 2f1587b:

uv run --frozen --extra dev ruff check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
# Exit 0: All checks passed!
uv run --frozen --extra dev ruff format --check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
# Exit 0: 2087 files already formatted
uv run --frozen --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py
# Exit 0: Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
bash scripts/lint-auth-signals.sh
# Exit 0: [+] auth-signal lint clean
bash scripts/lint-architecture-boundaries.sh
# Exit 0
uv run --frozen python scripts/check_test_assertions.py
# Exit 0: [+] assertion-quality ratchet clean: AQ001=4, AQ002=12
uv run --frozen python scripts/check_exact_test_duplicates.py
# Exit 0: [+] exact test duplicate ratchet clean: 1411 files, 0 allowed duplicate group(s)

The YAML-I/O, portable-relative-path and 2100-line guards also passed using the CI regex equivalents (macOS grep lacks -P). Actual public main was 2f1587b and is an ancestor of beda.

Original conformance negative proof: a session-only plugin reinstated exactly the three changed production functions from public 75bfa523 in memory. The unchanged round-trip module produced 4 failed, 5 passed in 0.34s; all four failures were at assert manifest.read_bytes() == canonical. No source files were reverted or modified during that run. Both the historical b404 full run and the current beda bounded run pass all four.

The first test draft's unsupported dependency-level extension field produced 2 failures/7 passes; that fixture was narrowed to declared Git fields and top-level extension metadata. This did not change the production field vocabulary or remove a previously passing regression test.

Independent read-only reviews found no high-confidence issue in the sealed production correction or the separate three-file conformance delta. No reviewer execution is counted as validation. mmdc validated the diagram. No changelog/version change or release validation was performed.

Scenario Evidence

# Scenario (user promise) Principle(s) Test(s) proving it Type
1 Repeating a package once or twice preserves its existing declaration and does not claim an update. DevX (pragmatic as npm) tests/unit/commands/test_install_resolve_refs.py::TestResolvePackageReferencesDuplicateDetection::test_existing_dependency_without_new_intent_is_not_updated (regression trap for this CI repair) unit
2 Repeated installs preserve pinned refs, structured metadata and top-level extensions through real manifest writes. Portability by manifest; DevX (pragmatic as npm) tests/spec_conformance/test_round_trip.py::test_existing_install_manifest_round_trip_preserves_declared_metadata (four byte-failure regression traps) integration (in-process)
3 Explicit ref, skill/reset, target, registry-version and alias changes still take effect. Governed by policy; DevX (pragmatic as npm) tests/unit/install/test_package_resolution_persistence.py::test_effective_manifest_changes_are_still_applied unit
4 Explicit repository/path boundaries remain meaningful, and a Git-shaped request cannot silently replace a registry declaration. Vendor-neutral; Governed by policy tests/unit/install/test_package_resolution_persistence.py::test_effective_manifest_changes_are_still_applied; test_merge_structured_entry_refuses_to_convert_registry_dep_to_git in the same module unit
5 Explicit marketplace Git routing and HTTPS upgrades persist; transport-only upgrades retain metadata and subsequent repeats preserve bytes. Secure by default; DevX (pragmatic as npm) test_marketplace_explicit_git_routing_is_preserved; test_explicit_https_upgrade_preserves_metadata_and_repeats_without_writes in tests/unit/install/test_package_resolution_persistence.py unit

How to test

  • Run the current-head bounded pytest command with a fresh artifact directory: expect 391 passes and zero skips; include both explicit-intent regression functions.
  • Inspect the four new conformance cases: both request counts must preserve bytes and successfully create both round-trip destinations without mocking serialization.
  • Run full conformance collection immediately before generation, then git diff --exit-code CONFORMANCE.json CONFORMANCE.md: expect no changes.
  • Run the Mode B command and canonical lint chain above: expect exit 0 without a waiver.

Spec conformance (OpenAPM v0.1)

If this PR changes behaviour that an OpenAPM v0.1 req-XXX covers,
confirm the three-step ritual in the
development guide:

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

This corrects behavior already covered by req-cf-001. No spec/schema/manifest requirement or ID changed. The unchecked spec/manifest boxes are deliberate; only genuine test bindings and derived counts changed. Install reference and agent-guide prose are updated; corpus assessment accompanies publication.

Co-authored-by: Copilot [email protected]

Separate each positional request's explicit update intent from accumulated serialization output. Preserve no-op manifest bytes, pinned refs, metadata and duplicate inputs while retaining alias changes and explicit marketplace repository boundaries.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 067b35fc-52fb-4db4-b316-c606d23b4b34
Exercise real resolution and manifest persistence for unchanged pinned and structured declarations, including duplicate inputs and top-level extension metadata. Bind four cases to existing req-cf-001 and regenerate only its derived coverage count and node list.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 067b35fc-52fb-4db4-b316-c606d23b4b34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Explicit Git resolver selection and HTTP-to-HTTPS upgrades can be discarded as unchanged requests.

2 open issues
What changed in this PR

This PR fixes repeated positional apm install requests so unchanged declarations retain their representation and avoid unnecessary manifest writes. It addresses install behavior separately from the CI scheduling repair in #3345.

Changes:

  • Separate per-argument update intent from aggregate serialization output.
  • Report actual manifest mutations and preserve equivalent declarations.
  • Add regression and conformance coverage, update derived counts, and document unchanged-install behavior.
File Description
tests/​unit/​install/​test_package_resolution_persistence.py Tests equivalent entries, genuine changes, and write suppression.
tests/​unit/​commands/​test_install_resolve_refs.py Tests single and duplicate unchanged requests and diagnostics.
tests/​spec_conformance/​test_round_trip.py Adds four real resolver/persistence round-trip cases.
src/​apm_cli/​install/​package_resolution.py Compares effective declarations and returns actual mutation status.
src/​apm_cli/​commands/​install.py Separates request intent from serialization output.
packages/​apm-guide/​.apm/​skills/​apm-usage/​commands.md Aligns agent guidance with repeated-install behavior.
docs/​src/​content/​docs/​reference/​cli/​install.md Documents preservation of unchanged declarations.
CONFORMANCE.md Updates the req-cf-001 test count.
CONFORMANCE.json Records four additional conformance test bindings.

Review effort: Balanced

Comment thread src/apm_cli/commands/install.py Resolved
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 067b35fc-52fb-4db4-b316-c606d23b4b34
Compare effective default-registry routing through the existing owner and preserve explicit HTTP-to-HTTPS changes with existing pins and selections. Add real persistence/reparse regressions and unchanged-request controls.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 067b35fc-52fb-4db4-b316-c606d23b4b34
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Merge Master delivery assessment: ship_now

Qualified beda4bb1028dd37854fff7d5244d58705101d408 against actual public main 2f1587b51382f2d27464aeda13ef34cabc1cfda8. This is a separate Merge Master delivery assessment under the maintainer's bounded CI-recovery mandate, not a persona-panel verdict or human-approval record. The source owner released all PR write, evidence, process and validation-slot surfaces.

The bounded correction preserves unchanged install declarations while retaining genuine updates. Both reported routing/HTTPS defects have causal regression evidence, corrected behavior and resolved inline replies. Existing independent bounded reviews are retained; no additional panel is claimed.

  • Verified all 46 sealed artifacts, the complete nine-path source/diff binding, full completion schema, and strict terminal owner-v2 evidence: one owner, three executed command witnesses individually matched to passing exact-head XML. The current-head run contains 391 passing cases, no failures/errors/skips. The separate negative run records three intended assertion failures and five controls; its restoration passes. Historical 533/7a10 and 641/b404 results are not promoted to this head.
  • Observed the exact-head CI run, required gate, and spec run completed successfully. All 27 current checks are terminal: 24 success, two neutral, one skipped. Lifecycle jobs succeeded in 464s/352s and their strict aggregate succeeded. This head's architecture-ratchet job succeeded in 292s; other heads' cancellations remain separate, real recovery work.
  • Actual Python/actions analysis succeeded; the current PR alert query returned no open alerts. Missing imposed-native CodeQL evidence remains missing/undetermined, not a passing scan. Only the maintainer's existing narrow exception applies.
  • Fresh access shows ADMIN and active ruleset9294522 bypass eligibility always. The PR is MERGEABLE/BLOCKED, with its required gate successful. Ordinary review/policy blocking is handled only under the standing authorized admin-merge route; no substantive failure is waived.

The failed publication guard remains explicitly FAILED: a shell-control-flow mistake allowed an already-authorized push after a stale-base assertion. Independent REST/ref reconciliation verified exact beda/2f afterward; this does not retroactively pass the guard or justify another push.

This is the unique issue-less carrier under the existing bounded human exception. Closing references are empty; #3341, #2070 and #1882 remain open. No private sibling changes are included. Final fresh guards still precede the exact-head normal merge.

Full actual-main nonpublishing platform/integration/release validation remains outstanding with its existing CI owner. This assessment does not authorize a tag, release, publication, deployment, credential/policy change or new dispatch.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit fe2cfad into main Oct 22, 2026
27 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-ci-manifest-idempotence branch October 22, 2026 11:21
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Oct 22, 2026
Compose landed #3346 and #3347; preserve receipt source and both conformance bindings.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
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.

2 participants