Skip to content

feat(wpm): expose/unexpose subcommands for bin/ entry links — A-side split of #1844 - #2012

Merged
caomengxuan666 merged 1 commit into
mainfrom
captain/1835-wpm-expose-unexpose
Dec 1, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
captain/1835-wpm-expose-unexpose

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

wpm expose/unexpose for already-installed packages (Refs #1835)

The A-side split of #1844, relayed by the captain per the owner's
2026-12-01 direction. #1844 carried two features in one PR; this PR
lands only the #1835 feature and leaves the declared-links subsystem
in #1844, re-scoped (see below).

What this does

  • wpm expose <package>... materializes an installed package's declared
    commands as entry links in <root>/bin - the same
    hardlink-or-copy materialization install uses, idempotent like
    links rebuild. Works for bundled packages that ship a payload but
    no .wpm receipt (the niugit shape, niubash#1052): installation is
    proven by the payload destinations on disk.
  • wpm unexpose <package>... revokes those entry links without
    uninstalling; the payload, the usr/bin shims and the rest of .wpm
    stay, so the package remains installed.
  • Receipt destinations are kept in sync (sync_receipt_entry_links):
    materialized links are recorded, revoked links are dropped, or the
    receipt-records check would read a revoked package as uninstalled.
  • Alias entries expose the provider's commands; --force, --dry-run
    and --json are supported throughout.

Unexpose ownership guard (captain ruling on the #1844 review)

unexpose deletes a bin name only when it is verifiably this package's
entry link: file identity with the payload package_entry_links
resolves for the command (same_file / files_equal; forwarder-routed
commands resolve to the shim source), or - when the payload itself is
gone and identity cannot be checked - the install receipt recording
the path as a destination. A same-named foreign file is skipped and
reported (warning on stderr; "status": "skipped_not_package_link"
per command under --json), never deleted. Receipt sync drops only
the records of links actually removed (or already gone).

Tests

The end-to-end test from #1844, plus six pins for the review's A-side
gaps: bundled no-receipt expose/unexpose, idempotency, --force
overwrite of a foreign target, alias expose, the unexpose ownership
guard (foreign file survives, reported skipped), and the
receipt-proved revocation when the payload is missing.

Deletions

None against main (+923/-0). Nothing is superseded in-tree: the
declared-links (links.json) subsystem is not deleted - it was never
in main; it remains in #1844 only.

Out of scope

The declared intra-package links subsystem from #1844
(links.json reconcile, the receipt links field, install/uninstall/
rebuild declared-set handling, the hardlink-fallback warning) stays
with #1844, to be re-reviewed there with its own pins.

UNVERIFIED-BY-CAPTAIN - relayed code-only; MSVC build and test verdicts
are this PR's CI.

@caomengxuan666

Copy link
Copy Markdown
Member Author

CAPTAIN 复核——合入

代码面全绿。 CI(run 46570304996):27 个 job 通过,含 build-windows 四条腿全绿——wpm 单元测试(含本 PR 新增 7 钉:随包无 receipt 暴露/收回、幂等、--force、别名、unexpose 守卫两支)在 MSVC 下编译并通过。

唯一红 = rust2-gate 聚合步,与本 PR 无关:UNCOVERED case tables (shard list is stale): cat, uniq,FAIL rows (0): none,各 shard 的 oracle 全 OK。这是主干在基线提交 8f767d0f 上已有的覆盖红(cat/uniq 两张用例表无 shard 认领),与 #2009 合入时的裁决口径一致:陈旧 shard 名单,不是测试失败。cat/uniq 的 text-lines 认领修复另行跟进(主干红同源)。

unexpose 守卫按 r1 复核的队长裁决实现并已钉:payload 可解析时只认文件身份,receipt 记录仅作 payload 缺失时兜底;同名异物跳过并报告(skipped_not_package_link),不删。

结论:squash 合入。#1835 由队长在合入后手动关闭(本 PR 为 Refs)。

@caomengxuan666
caomengxuan666 merged commit 1504526 into main Dec 1, 2026
31 of 32 checks passed
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