[CLI] Make the parity harnesses portable and self-contained - #4
Merged
Conversation
The harnesses carried absolute paths into a session-scoped scratchpad:
SCRATCH="/private/tmp/claude-502/.../scratchpad"
They ran correctly where they were written, but they could not run from a
checkout, and the directory they pointed at is temporary. They also assumed
someone had already cloned the frozen source, built both sides, and packed
candidates by hand — none of which was written down. As the compatibility gate
for every downstream producer change, that made them effectively unrunnable.
Every path is now derived:
- new side = this repository, resolved from the script's own location
- old side = a clone of the frozen pre-migration source, pinned to the SHA
recorded in migration/PROVENANCE.md
- output = .parity-cache/ (gitignored)
New migration/parity-lib.sh resolves, clones, pins, builds and packs both sides.
First run clones and builds the frozen source; the clone is cached, so later
runs take ~30s. It refuses to proceed if the old checkout is at any commit other
than the frozen SHA — comparing against a different commit measures drift, not
migration fidelity.
Overridable: WORKSPACEJSON_OLD_CHECKOUT, WORKSPACEJSON_PARITY_OUT,
WORKSPACEJSON_PARITY_CACHE, WORKSPACEJSON_SKIP_BUILD.
The Node harness reuses the same cache convention and, when the old side is
missing or unbuilt, prints the exact command to fix it instead of throwing a
path error. If packages/datahub-adapter is gone — which META-248 will do — it
says so and points at workspacejson/datahub-agent rather than failing obscurely.
Portability fixes found while testing against the system shell:
- `declare -A` needs bash 4+; macOS ships 3.2. Replaced with a plain branch.
- empty-array expansion under `set -u` errors on bash 3.2. Guarded with
${arr[@]+"${arr[@]}"}.
Verified from a clean checkout with no cache present:
runtime 27/29 (the two recorded META-236 vendor-notice differences), 33s
shim 35/35
pack runs; identity fields 11/11 identical. Its remaining differences are
all expected META-247 consequences: the content-hashed tsup chunk
name, the description, repository/bugs URLs, the added
@workspacejson/cli dependency and @types/node.
CONTRIBUTING now documents how to run them and what results to expect, so a
third difference reads as a regression rather than as noise.
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The parity harnesses are the compatibility gate for
agents-audit— and they could not be run from a checkout.The problem
All three carried absolute paths into a session-scoped scratchpad:
SCRATCH="/private/tmp/claude-502/.../scratchpad"They ran correctly where they were written, but that directory is temporary, and they additionally assumed someone had already cloned the frozen source, built both sides and packed candidates by hand — none of it written down. For the gate that every downstream producer change (META-195, META-235, META-203) has to pass, that is effectively unrunnable.
The fix
Every path is now derived:
migration/PROVENANCE.md.parity-cache/(gitignored)New
migration/parity-lib.shresolves, clones, pins, builds and packs both sides. First run clones and builds the frozen source; the clone is cached, so later runs take ~30s.It refuses to proceed if the old checkout is at any commit other than the frozen SHA — comparing against a different commit measures drift, not migration fidelity, and would silently produce a meaningless green.
Overridable:
WORKSPACEJSON_OLD_CHECKOUT,WORKSPACEJSON_PARITY_OUT,WORKSPACEJSON_PARITY_CACHE,WORKSPACEJSON_SKIP_BUILD.The Node harness reuses the same cache convention and prints the exact fix command when the old side is missing or unbuilt, instead of throwing a path error. When
packages/datahub-adapteris removed — which META-248 will do — it says so and points atworkspacejson/datahub-agentrather than failing obscurely.Portability defects found while testing against the system shell
declare -Aneeds bash 4+; macOS ships 3.2. Replaced with a plain branch.set -uerrors on bash 3.2. Guarded with${arr[@]+"${arr[@]}"}.Both would have failed for anyone running
/bin/bashon macOS.Verified from a clean checkout, no cache present
The pack harness's remaining differences are all expected META-247 consequences and are now visible rather than hidden: the content-hashed tsup chunk name, the description, repository/bugs URLs, the added
@workspacejson/clidependency, and@types/node.Documentation
CONTRIBUTING.mdnow records how to run them and what results to expect, so a third difference reads as a regression rather than as noise.Scope
Harness plumbing and docs only. No package, producer or guard behavior changed; no parity assertion was weakened or removed.