Skip to content

docs(agents): wpm package contracts and install-path invariants - #1191

Merged
caomengxuan666 merged 1 commit into
mainfrom
docs/agents-wpm-contracts
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
docs/agents-wpm-contracts

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Adds an agent guide section to AGENTS.md covering the contracts that today's packaging work kept tripping over:

  • layouts: shim (payload under opt/<pkg>, dispatcher hardlinks in usr/bin) vs flat (the binary is the entry); when to pick which, with the measured 12.7 ms vs 32.2 ms cost of a link vs a forwarding launcher;
  • PATH directories: the standalone setup adds <root>\usr\bin (packaging/winuxcmd.iss) and the niubash layout has <root>\bin on PATH — so neither is a private place, private DLLs must never land in either (a flat OpenSSH dropped libcrypto.dll into a PATH directory), and wpm materializes <root>/bin/<cmd>.exe as a hardlink to the real binary, recorded in the receipt so install/update/links rebuild/uninstall keep the set in sync ([design][installer] PATH entry dir: hardlinks only, usr\bin stays off PATH, and the entry set must include sh niubash#376 rule 5);
  • install-path invariants: never materialize a file mapping from .wpm/staging ([bug] niugit payload duplicated: usr/bin/git.exe links into .wpm/staging while the manifest declares opt/niugit #1188), refuse an install that cannot replace every destination (a held file cannot be replaced on Windows at all — the old path left packages half-updated), prune the extraction tree, and what the reconcile may and may not delete;
  • versions: ordered comparison plus the Debian-style packaging revision (5.4.1-unixwin2 > 5.4.1-unixwin1 > 5.4.1) and the index-as-contract rule;
  • release flow and machine traps: stale tags aborting a fetch, lagging local index caches.

Documentation only. The user-facing counterpart lives in #1192.

Recording the rules that were learned by shipping packages that broke, so a
future agent does not have to rediscover them:

- layouts and where payloads live, and why <root>/bin - not <root>/usr/bin -
  is the PATH entry directory;
- every package command gets <root>/bin/<cmd>.exe as a hardlink to the payload
  (never a launcher, never a link into .wpm/staging), recorded in the receipt
  so install/update/uninstall keep the set in sync (unixwin/niubash#376);
- install-path invariants: source file mappings from the payload, replace
  files through a POSIX unlink, prune the staging tree;
- version ordering including the Debian-style packaging revision;
- release-flow and machine traps (stale tags, lagging index caches).
@caomengxuan666
caomengxuan666 force-pushed the docs/agents-wpm-contracts branch from 101e247 to 6d2284b Compare October 16, 2026 09:49
@caomengxuan666
caomengxuan666 merged commit b13d4a4 into main Oct 16, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the docs/agents-wpm-contracts branch October 16, 2026 10:13
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