Skip to content

[FEATURE] Single owners for deployed-hash path keys and the unclaimed-skill-directory skip #3725

Done

Description

Proposals are welcome before implementation. For substantive changes, wait
for a responsible human maintainer to approve the scope and identify a review
contact. An automated recommendation, label alone, or silence is not approval.
See Contributing.

Is your feature request related to a problem? Please describe.
#3723 repaired two 0.36.0 release-gate regressions with local fixes. The review panel (#3723 (comment)) and a Copilot review comment found that each local fix copies a decision that should have a single owner:

  1. Deployed-hash path keys. remove_stale_deployed_files (src/apm_cli/integration/cleanup.py) now converts backslash recorded_hashes keys to forward slashes, because Windows callers passed native-separator keys, the hash check never matched, and hook cleanup removed nothing. About 30 other call sites already do their own .replace("\\", "/"). Nothing guarantees that deployed_file_hashes keys are POSIX where they are written and read, so each new caller can bring the bug back.
  2. Skipping an unclaimed, populated skill directory. find_unmanaged_conflicts (src/apm_cli/integration/skill_preflight.py, user_skill_dir) copies the guard in skill_integrator.py (~line 1248) that stops materialization writing into such a directory. The native and sub-skill routes use different ownership rules (session ownership, the managed set used for collision checks, and cases where the same package owns the skill name under another target), and the copy does not follow them exactly. Preflight can therefore still refuse a claimed file in a directory that materialization would skip. This fails closed, with no data loss, but it is a false refusal.

Describe the solution you'd like

  • A posix_path_key() helper, or the equivalent, in utils/paths.py beside portable_relpath, used wherever deployed_file_hashes is written and read. Callers drop their own conversions, and a boundary lint flags new ad-hoc .replace("\\", "/") calls on path keys.
  • A route-aware decision such as is_unclaimed_user_skill_dir(...) in skill_support.py, called by both preflight and materialization. It must handle the lockfile root and same-run ownership correctly. Add tests that the two callers agree in user scope and across targets, and a check that both delegate to the shared decision.

Done when each decision has one owner, guarded by a regression test and a static boundary check, per .github/instructions/architecture.instructions.md.

Describe alternatives you've considered
Keep the local fixes from #3723. They are correct for the release, but they leave both decisions in two places each.

Additional context
Follow-up from #3723 (release-gate repair for 0.36.0). Related: #3672, #3709, #3649.

Activity

  1. added
    type/feature
    on Nov 13, 2026
  2. added
    type/refactor
    area/lockfile
    pillar/foundations
    and removed
    type/feature
    on Nov 21, 2026
  3. danielmeppiel commented on Nov 21, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: Give two decisions a single owner. (1) Add a posix_path_key() helper in src/apm_cli/utils/paths.py beside portable_relpath, use it wherever deployed_file_hashes keys are written and read (including remove_stale_deployed_files in src/apm_cli/integration/cleanup.py), drop the callers' ad-hoc .replace("\", "/") conversions on those keys, and add a boundary check that flags new ad-hoc conversions on hash path keys. (2) Add one route-aware unclaimed-user-skill-directory decision in src/apm_cli/integration/skill_support.py, called by both find_unmanaged_conflicts in src/apm_cli/integration/skill_preflight.py and the guard in src/apm_cli/integration/skill_integrator.py, handling the lockfile root and same-run ownership.
    Done when: each decision has one owner guarded by a regression test and a static boundary check per .github/instructions/architecture.instructions.md (with a MutationCase in tests/integration/test_architecture_owner_rule_mutations.py); tests show preflight and materialization agree in user scope and across targets; lockfiles written before and after the change are byte-identical on POSIX and Windows.
    Out of scope: any change to the lockfile schema or recorded key format; any widening of where materialization writes; changes to deletion authority or receipt rules (req-lk-024); unrelated .replace calls that are not hash path keys.
    Review contact: Daniel Meppiel (@danielmeppiel)

  4. added
    status/accepted
    on Nov 21, 2026
  5. danielmeppiel commented on Nov 24, 2026

    @danielmeppiel
    CollaboratorAuthor

    Thanks for filing this. To keep follow-up work in one place, this item is now tracked in the area backlog list #5315, which links back here, and its scope notes stay readable on this issue. Closing this issue as a duplicate of that list.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/lockfilepillar/foundationsstatus/acceptedtype/refactor

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions