Skip to content

Add integration-tests CI and fix harness CLI resolution - #5

Merged
BboyAkers merged 6 commits into
mainfrom
verify-harper-v5
Aug 21, 2026
Merged

Add integration-tests CI and fix harness CLI resolution#5
BboyAkers merged 6 commits into
mainfrom
verify-harper-v5

Conversation

@BboyAkers

Copy link
Copy Markdown
Member

Summary

Verification of the v5 reference repo (Path B). The repo was already correctly on harper@^5.0.11 with @harperfast/integration-testing, an integrationTests/ suite, and a test:integration script. No v5 migration patterns remain (wasLoadedFromSource, blob.save, harperdb imports/globals all absent). However two gaps would prevent the integration tests from ever running, so this PR fills them:

  1. Missing CI workflow — there was no .github/workflows/integration-tests.yml (and no CI runs in the repo at all). Added the standard workflow: Node matrix 22, 24, 26, actions pinned to commit hashes (checkout v6.0.3, setup-node v6.4.0, upload-artifact v7.0.1).

  2. Harness CLI resolution would breakintegrationTests/app.test.ts did not pass harperBinPath. harper's exports map only exposes ".", so the harness's default auto-resolution require.resolve('harper/dist/bin/harper.js') throws ERR_PACKAGE_PATH_NOT_EXPORTED; the cwd-ancestor fallback also finds no dist/bin/harper.js, so getHarperScript() throws "Harper CLI script not found" before Harper ever starts. Verified empirically against harper@5.0.11 + integration-testing@0.3.1. Fixed by resolving the CLI from harper's exported main entry and passing it via the documented harperBinPath escape hatch.

Verification

  • Confirmed no v5 migration footprint remains in source.
  • Ran npm run test:integration locally. With the fix, the harness now gets past CLI resolution (no ERR_PACKAGE_PATH_NOT_EXPORTED, no "CLI script not found") and proceeds to Harper startup, where it fails only at the macOS loopback bind (EADDRNOTAVAIL on 127.0.0.2+). That is a known environmental limitation of this dev machine (loopback aliases not configured, requires interactive sudo) — not a code bug. On ubuntu-latest CI the full 127.0.0.0/8 range is available, so the gate runs without aliasing.
  • Tests are therefore validated-by-CI; the workflow on this PR is the real gate.

Notes

  • PR Updated the Claude Model and Google Vertex Commented Out #4 (env-fix, Claude-model tweak) is unrelated and untouched.
  • Upstream issue worth flagging: harper should export its bin path (or the harness should resolve via the package root) so the harperBinPath workaround isn't needed in every consumer repo.

🤖 Generated with Claude Code

The reference repo was already on harper@^5 with @harperfast/integration-testing
and an integrationTests/ suite, but two gaps would prevent its tests from ever
running:

- No .github/workflows/integration-tests.yml existed, so integration tests had
  no CI gate. Added the standard workflow (Node 22/24/26, actions pinned to
  commit hashes).
- The test did not pass `harperBinPath`. harper's `exports` map only exposes
  ".", so the harness's default `require.resolve('harper/dist/bin/harper.js')`
  throws ERR_PACKAGE_PATH_NOT_EXPORTED and the cwd-ancestor fallback finds no
  dist/bin/harper.js, so getHarperScript() throws "Harper CLI script not found"
  before Harper ever starts. Resolve the CLI from harper's exported main entry
  and pass it via the documented `harperBinPath` escape hatch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the integration tests to explicitly resolve the harper binary path and pass it to setupHarperWithFixture, which prevents an ERR_PACKAGE_PATH_NOT_EXPORTED error. Feedback suggests using the native import.meta.resolve instead of creating a CommonJS require helper via createRequire to simplify the ESM resolution.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread integrationTests/app.test.ts Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Comment thread .github/workflows/integration-tests.yml
Comment thread .github/workflows/integration-tests.yml
Comment thread integrationTests/app.test.ts Outdated
Comment thread integrationTests/app.test.ts Outdated
- Add timeout-minutes: 15 to integration-tests job (prevents 6-hour
  default CI burn if a test or teardown hangs)
- Move harperBinPath computation inside before() hook (a top-level
  throw causes a silent module crash with no TAP output; inside the
  hook it surfaces as a proper test failure)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@BboyAkers

Copy link
Copy Markdown
Member Author

Review follow-up (autonomous agent): Fixed both blocking findings: added timeout-minutes: 15 to the integration-tests job and moved harperBinPath computation inside the before() hook so a resolution failure surfaces as a proper test failure rather than a silent module crash.

Comment thread .github/workflows/integration-tests.yml
Comment thread .github/workflows/integration-tests.yml Outdated
Comment thread .github/workflows/integration-tests.yml
Comment thread integrationTests/app.test.ts
BboyAkers and others added 3 commits August 10, 2026 12:33
Bump the harper dependency to ^5.2.1 and regenerate the lockfile.
Regenerated in full so the optional native deps (bufferutil,
utf-8-validate, segfault-handler) stay in the tree for Linux CI.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The previous lockfile was generated with npm 11, which does not
auto-install the peer dependencies of an optional dependency. harper
5.2.1 pulls alasql, which optionally depends on react-native-fs, whose
peers (react-native, react) npm 12 installs and npm 11 does not. CI runs
npm 12 on Node 24/26, so npm ci failed there with those packages
"missing from lock file" while Node 22 (npm 11) passed.

Regenerated with npm 12 so the lockfile carries the full tree.
lockfileVersion stays 3; npm ci verified under both npm 11 and npm 12.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolves the conflict with main and closes the remaining review threads
on #5.

Merge: main had bumped harper to ^5.1.13 while this branch went to
^5.2.1; kept ^5.2.1. main's dot-env.example update comes across
unchanged. Lockfile regenerated with npm 12 (the npm CI runs) and
npm ci verified.

The conflict is also why this PR reported no CI. The workflow is
registered and active, and ran on this branch until 2026-06-11 — GitHub
cannot construct the pull_request merge ref for a conflicting PR, so no
runs were queued after main diverged. It is not a missing or malformed
workflow; merging should bring checks back.

Workflow:
- top-level `permissions: contents: read` (was inheriting the repo/org
  default, which can be read-write; these jobs only read)
- `cache: 'npm'` on setup-node, so three matrix legs stop re-downloading
  the whole tree
- dropped the checkout from generate-node-version-matrix, which never
  reads repository content
- bound the workflow_dispatch input to an env var instead of
  interpolating it into the run block. Not raised on this PR, but it is
  the same shell-injection sink the sibling repos fixed: `type: choice`
  constrains the UI, not the workflow_dispatch API.

timeout-minutes: 15 was already in place from an earlier round.

app.test.ts: the harperBinPath resolution already sits inside before()
so a failure surfaces as a named test failure rather than a silent
module-load crash. Expanded the comment to record that it is a tracked
workaround rather than an oversight — what it assumes about harper's
dist/ layout, that the harness's own existsSync check makes the failure
loud rather than silent, and that the real fix is upstream (harper
exporting its bin path, or the harness resolving from a package name).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/integration-tests.yml
@BboyAkers
BboyAkers merged commit a0ad954 into main Aug 21, 2026
4 checks passed
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.

3 participants