Skip to content

[CLI] Make the parity harnesses portable and self-contained - #4

Merged
qmarcelle merged 1 commit into
mainfrom
fix/meta-247-portable-parity-harnesses
Jul 26, 2026
Merged

[CLI] Make the parity harnesses portable and self-contained#4
qmarcelle merged 1 commit into
mainfrom
fix/meta-247-portable-parity-harnesses

Conversation

@qmarcelle

Copy link
Copy Markdown
Contributor

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:

Side Resolution
new this repository, from the script's own location
old clone of the frozen pre-migration source, pinned to the SHA 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, 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-adapter is removed — which META-248 will do — it says so and points at workspacejson/datahub-agent rather than failing obscurely.

Portability defects 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[@]}"}.

Both would have failed for anyone running /bin/bash on macOS.

Verified from a clean checkout, no cache present

runtime   27/29  — the two recorded META-236 vendor-notice differences, 33s total
shim      35/35
pack      runs; identity fields 11/11 identical

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/cli dependency, and @types/node.

Documentation

CONTRIBUTING.md now 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.

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.
Copilot AI review requested due to automatic review settings July 26, 2026 04:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qmarcelle
qmarcelle merged commit 022f5ad into main Jul 26, 2026
2 checks passed
@qmarcelle
qmarcelle deleted the fix/meta-247-portable-parity-harnesses branch July 27, 2026 03:41
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.

2 participants