Record a bundled mesh server as one tarball, and install it by its integrity #170
Loading…
Reference in a new issue
No description provided.
Delete branch "pluto/168-bundled-tarball"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (product): martha records a bundled mesh server as its one tarball and installs it by the integrity the forge's registry publishes, so a member's mesh server comes from the forge with npmjs unreachable (martha-ai/martha#168). Approach: the issue's own section, with the Supervisor's ruling that the file list stays (the integrity covers transit, the file list covers the placed tree).
RecordedMeshTree.lockis now optional andtarball(the URL the recorded registry serves) is added;integritypins the tarball itself.recordMeshTreeunpacks the tarball once into a tree's shape, and branches torecordBundledTreewhen the manifest declaresbundleDependencies: the URL, the integrity npm publishes for those bytes, every file the tarball carries, and what each of its packages reads.environment_readsof a bundled tree are attributed from the tarball's ownnode_moduleslayout (packageOfBundledFile), so a read belongs to the package that makes it rather than to the server's directory, andknown_environment_readsmeans what it meant. A locked tree's attribution is unchanged.installBundledfetches that one URL (npm pack, isolated home), refuses a URL outside the recorded registry, checks the bytes against the recorded integrity before using any of them, unpacks them intonode_modules/<server>/, and then goes through the same tree comparison as a locked tree, so a file changed, removed or added after the place still refuses the next one.registryishttps://git.macula.io/api/packages/macula-pub/npm/. 0.51.6 is recorded from the tarball the forge publishes: no lock (bundled), 4513 files, 15 packages with reads, 23 settings, 35 tools, 7 bins. 0.51.0 and 0.51.2 retire from both recordings in the same commit, because their locks name registry.npmjs.org andrefusalOfLockedrefuses them once the registry is the forge's. The recordings that name those versions for other reasons (petnames, answer shapes, ring results) are records of server behaviour and stay.record:mesh-toolsread the tree the old recorder left atextracted/package, which the new one does not write, so it died with ENOENT; and it then walked the bundled dependencies, where an@modelcontextprotocol/sdkexample registers a tool by a computed name. The recording, the launch and the script now unpack a tarball through one rule (unpackServerTarball, whichinstallBundled,recordMeshTreeand the script call) and read a server's own files by one rule (ownCodeOf).A locked server's path is unchanged: its lock, its install and its tests run as before.
Five new tests, each with its mutant, in the recorder's test file (34 there, 92 across the three affected files):
installBundled, 33/34);Proof, run here with npmjs dead: in a mount namespace (
/etc/hostsnaming only the forge, an emptyresolv.conf,hosts: filesinnsswitch.conf) npmjs answershttp=000and the forgehttp=200.theRecordedNodeIdOf(whatmartha upreads its roster's node ids with, which startsmacula-mcp-node-idthroughstartOfARecordedBin) printed a 64-hex node id;startOfARecordedBinformacula-mcp-node-idran status 0 and printed the same id;startOfARecordedBinformacula-mcpstarted the recorded bin under the launcher's confining hook, and oneinitializeansweredserverInfo {"name":"macula-mcp","version":"0.51.6"}. The tree root was empty before the run, so this installed the one tarball.Gates here:
tsc --noEmitclean, eslint clean on the touched files,check:restated-valuesgreen,check:privateover the range nothing private, and the parallel stage ofnpm testgreen. The 17 recorded-host runs and the installer job are CI's (the installer's own dependencies would be fetched from npmjs, which we no longer do).Review r=1 fold-in (fable), commit
fcac4483, on top of the merge with mainThe required finding:
record_ring_results.tsandrecord_mesh_answers.tsread trees the recorder no longer writes, so the ring recorder died ENOENT for any server and neither could record a bundled version. One rule now decides where a recording leaves the tree with its dependencies,treeWithItsDependencies(the bundled tarball's own tree, or the lock's install), withpackageDirInTreefor the server's package inside it. The launch, the unpack, the recorder and both scripts use them, and no layout literal is left outside the install module. A new test pins the rule for both shapes, and it fails when the rule names the wrong tree.The smaller points, all taken: the fake registry can publish a
distit does not serve, which givespublishedTarballOf's two guards tests (a tarball URL on another host, an integrity that is no sha512); a file added inside a bundled tree and a link planted in it are tested refusals by name;unpackServerTarballnames tar when it cannot be run instead of reading null; theinstallBundledcomment now says npm pack reads the manifest before the check; and the plugin-dirs rationale restates no version.The recorder test file holds 38 tests on this tree, 96 across the three affected files, 6 in the npm-alone file. Mutants, each planted alone on this tree: record-time check dropped, 36/37; install-time check dropped, 36/37; tree comparison skipped for a lockless tree, 35/37 (two tests); URL guard dropped, 36/37; and the new tree rule naming the lock's install for a bundled server, 0/1.
Not in this change: 0.51.6 recorded for the answer shapes, ring result keys, host ring answers and petnames. Both recorders join the live mesh, which is a fleet act on the DEV realm and wants one round covering all four, so it is filed as martha-ai/martha#176 and the reason is on the issue.
Refs martha-ai/martha#168
🤖 Generated with Claude Code