Skip to content

test(repo): verify packed consumers#2149

Merged
jrusso1020 merged 1 commit into
mainfrom
07-10-test_repo_verify_packed_consumers
Jul 13, 2026
Merged

test(repo): verify packed consumers#2149
jrusso1020 merged 1 commit into
mainfrom
07-10-test_repo_verify_packed_consumers

Conversation

@jrusso1020

@jrusso1020 jrusso1020 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

Verify publish artifacts as clean consumers instead of only scanning tarball manifests.

Why

A package can contain all declared files and still fail when installed or imported by Node, TypeScript, or a browser bundler.

How

Pack workspaces, install them into isolated fixtures, validate relative imports, and execute representative consumer entry points.

Test plan

  • packed-manifest unit tests; clean packed install and consumer smoke
  • Stack-wide lint, format, build, typecheck, and relevant integration gates

jrusso1020 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from 41b6a67 to d0cdb3c Compare July 11, 2026 17:05
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch from cc4229e to 46f7f01 Compare July 11, 2026 17:30
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch 2 times, most recently from 47513d8 to c6e0a39 Compare July 11, 2026 17:38
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch 2 times, most recently from a78b47e to d1b91ee Compare July 11, 2026 18:04
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from c6e0a39 to 0d78a2a Compare July 11, 2026 18:04
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch from d1b91ee to cdbd58a Compare July 11, 2026 18:11
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from 0d78a2a to 5911119 Compare July 11, 2026 18:11
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch from cdbd58a to b765b0b Compare July 11, 2026 18:16
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from 5911119 to 11159b7 Compare July 11, 2026 18:16
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch from b765b0b to 68b3a7a Compare July 11, 2026 18:21
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch 2 times, most recently from 3a725e6 to c33f69e Compare July 12, 2026 04:01
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch from 77827bd to b089fff Compare July 12, 2026 04:32
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from c33f69e to 7b7e4b3 Compare July 12, 2026 04:32
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_enforce_workspace_contracts branch from b089fff to 83db364 Compare July 12, 2026 04:58
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from 7b7e4b3 to 03acdb3 Compare July 12, 2026 04:58

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review — test(repo): verify packed consumers

SSOT check: clean. The verification pipeline is a single linear chain: pack → verify manifest → install as consumer → typecheck → runtime smoke → CLI startup. No decision duplication.

packageExportSpecifier / listPackedExportContracts: correctly derive consumer specifiers from the export map. The typechecked flag (Boolean(target?.types)) gates which specifiers go into the TS consumer fixture vs. the runtime-only smoke. Clean separation.

Consumer fixture: installs packed tarballs via file: references (not workspace links — genuine "install as a consumer" simulation), pulls typescript and @types/node from the root devDeps (no version drift). The tsconfig.json uses moduleResolution: "NodeNext" — matches real consumer environments.

Runtime smoke: import.meta.resolve for all specifiers (fast, no side effects), then dynamic import() for specific SDK entry points with typeof assertions. Good — catches broken export maps without running heavy initialization.

CLI startup: hyperframes --help with telemetry disabled. Catches missing bin entry / unresolvable CLI entry point.

Refactoring: verifyWorkspacepackAndVerifyWorkspace returns { workspace, filename, packedPackage } or null for private packages; main() orchestrates pack-all → consumer-verify. The shared packDir is created once and cleaned up in a finally. Clean.

Tests: packageExportSpecifier and listPackedExportContracts unit-tested with the types-present/absent distinction. Good.

LGTM — no issues found.

— Miga

Base automatically changed from 07-10-test_repo_enforce_workspace_contracts to main July 12, 2026 08:51

@james-russo-rames-d-jusso james-russo-rames-d-jusso 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.

Reviewed at 03acdb3.

Solid infra addition. This lifts the pack-verify script from "pack and inspect manifests" to "pack, install into a real consumer fixture, typecheck + smoke-import + CLI-help." That's exactly the layer that catches the shape of bugs where the packed manifest lists an export but the packed tarball is missing the .d.ts (which the R1-flavor assertPublishedExportsMatchSource alone can't catch — it verifies source correctness, not packed availability).

Structural notes:

  • writeConsumerFixture — reasonable shape. Pins typescript + @types/node from root's devDependencies (verified: ^5.0.0 / ^25.0.10, semver ranges — bun install will resolve from npm, not a workspace:* protocol issue). The fixture's consumer.ts bulk-imports every types-carrying export, and consumer-smoke.mjs runtime-imports every declared export + spot-checks four public function names (openComposition, createMemoryAdapter, createFsAdapter, plus the four core/parsers/lint/studio-server round-trips). Good coverage of both TS surface and runtime surface.

  • listPackedExportContracts + packageExportSpecifier — clean extract, unit-tested. typechecked: Boolean(target?.types) correctly handles both string exports (untyped) and object exports with a types field.

Two small observations, non-blocking:

  • packages/cli/utils/verify-packed-manifests.mjs:116 — the CLI-help assertion is cliOutput.toLowerCase().includes("hyperframes"). Since execFileSync throws on non-zero exit, the throw path covers CLI failure. The .includes("hyperframes") catches the "ran but printed something unexpected" case, but "hyperframes" is broad enough that error output like hyperframes: command not found (though that would exit non-zero) or a stub help would still pass. A slightly stronger check for a known subcommand token (e.g., "render" or "snapshot") would tighten this. Not important for correctness, just makes the assert more descriptive of what it's actually checking.

  • packages/cli/utils/verify-packed-manifests.mjs:107 + :113 — mixed process.execPath (for tsc) vs bare "node" (for consumer-smoke.mjs). Both work; the process.execPath path is more robust to weird PATH configurations. Cosmetic — probably not worth changing on this PR.

What I didn't verify

  • Behavior on packages with wildcard/pattern exports ("./adapters/*": …) — didn't check whether Object.entries(packedPackage.exports) handles those cleanly. If HF workspaces don't use wildcard exports today, this is moot.

LGTM.

Review by Rames D Jusso

@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from 03acdb3 to 9762677 Compare July 12, 2026 08:54
@jrusso1020 jrusso1020 requested a review from miguel-heygen July 12, 2026 08:55
@jrusso1020 jrusso1020 force-pushed the 07-10-test_repo_verify_packed_consumers branch from 9762677 to 979e9d0 Compare July 13, 2026 15:52

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review at 979e9d09 after the stack restack. The stable patch-id is identical to the previously reviewed 03acdb38 change, so the own boundary is unchanged.

  • scripts/verify-packed-manifests.mjs:296-389 builds a genuine tarball-backed consumer, then verifies NodeNext type resolution, runtime imports, and CLI startup.
  • scripts/verify-packed-manifests.mjs:404-413 keeps the shared temporary pack directory behind a single finally cleanup.
  • All eight required checks are green, including Build, Test, runtime contract, Windows tests/render, and Typecheck.

— Magi / deepwork

Verdict: APPROVE
Reasoning: The exact reviewed patch survived the restack unchanged, the consumer verification boundary is sound, and required CI is green.

jrusso1020 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Jul 13, 5:27 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 13, 5:27 PM UTC: @jrusso1020 merged this pull request with Graphite.

@jrusso1020 jrusso1020 merged commit 95fa14b into main Jul 13, 2026
41 checks passed
@jrusso1020 jrusso1020 deleted the 07-10-test_repo_verify_packed_consumers branch July 13, 2026 17:27
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.

4 participants