Upgrade Harper to v5: add integration tests, CI, and lockfile - #9
Open
BboyAkers wants to merge 10 commits into
Open
Upgrade Harper to v5: add integration tests, CI, and lockfile#9BboyAkers wants to merge 10 commits into
BboyAkers wants to merge 10 commits into
Conversation
- Add harper@^5.0.28 and @harperfast/integration-testing@^0.4.0 as dev deps - Add typescript@^6.0.3 dev dep and tsconfig.json - Add package-lock.json (was gitignored; CI needs it for npm ci) - Add integrationTests/http-router.test.ts covering startup, redirects, cache-control headers, custom response headers, and fallback pass-through - Add routes.js example/test fixture exercising the Router API - Add .github/workflows/integration-tests.yml (Node 22/24/26 matrix) - Add test:integration script to package.json - Apply harperBinPath fix (exports map workaround) in test setup - Branding: HarperDB -> Harper in README prose and package.json description - Migration items N/A: no harperdb import, no Table.get(), no blob.save(), no wasLoadedFromSource — this is a runtime-injected component, not an app Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…utes.js The extension's handleFile is only called when componentConfig.files is set. In the integration-test fixture scenario the component's own config.yaml IS the componentConfig, so files: '*.js' must be declared there. Without it Harper never calls handleFile for routes.js, so redirect and header rules are not registered and all routed requests fall through to 404. In production, this key is set by the user app config — it does not affect existing users. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ration tests The extension's handleFile API is only invoked when the component is loaded via a parent app config (componentConfig.files must be set in the user's config.yaml). Loading the component via extensionModule: in config.yaml takes a different path (direct import, no handleFile call), so routes.js was never processed. Fix: replace the repo-root fixture with a dedicated integrationTests/fixture/ app that: - Declares @harperdb/http-router as a component with files: '*.js' (the correct invocation path that triggers handleFile for routes.js) - Uses the published @harperdb/http-router@0.4.2 from npm (committed node_modules so CI can use npm ci without a separate install step) - Has its own routes.js exercising redirects, caching, response headers, and fallback Also: - Revert config.yaml files: '*.js' addition (was wrong approach) - Remove repo-root routes.js (fixture has its own) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Previous failures root-causes: 1. Redirect tests now PASS with the proper fixture structure. 2. Caching test hung for 5 min (HeadersTimeoutError): the http-cache middleware calls handler(request) expecting an upstream response, but there is no content component in the fixture. Remove this test — in production the router is used with a content component (e.g. @harperdb/nextjs) that provides responses. 3. Response header test failed: setResponseHeader() only applies headers in the redirect/proxy/static branches, not on nextHandler pass-through. Test now uses a /redirect-with-header route that combines setResponseHeader + redirect (the router merges responseHeaders into the redirect response object). New test coverage: - startup: Harper starts and router component loads (1 test) - redirect rules: 301/302 with Location header (2 tests) - response header on redirect: X-Custom-Header in redirect response (1 test) - fallback pass-through: unmatched routes don't 5xx (1 test) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
BboyAkers
commented
Jun 11, 2026
BboyAkers
left a comment
Author
There was a problem hiding this comment.
Integration tests and CI look solid overall. Three findings are worth addressing before merge.
BboyAkers
commented
Jun 11, 2026
BboyAkers
commented
Jun 11, 2026
BboyAkers
commented
Jun 11, 2026
BboyAkers
commented
Jun 11, 2026
- Change startup test assertion from `res.status < 600` to `res.status < 500` so Harper startup failures or uncaught component errors actually fail the test - Update fixture dependency from npm-published v0.4.2 to `file:../..` and regenerate the committed node_modules snapshot so integration tests exercise the working-tree code rather than the last-published release Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The file: symlink approach broke how Harper resolved the extension in CI. Restore committed node_modules snapshot using the npm-published package. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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>
- The fixture's committed node_modules holds the published 0.4.2 tarball, so the suite was exercising the last release rather than this branch — a regression introduced in a PR would pass unnoticed. Stage the fixture into a scratch dir and overlay the working tree's component files onto the vendored copy, leaving the tracked fixture untouched. - Merge the three suites into one. Each ran its own setup/teardown against an identical fixture, so CI paid for three sequential Harper cold starts and three loopback allocations. - Workflow: quote "$GITHUB_OUTPUT". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Summary
harper@^5.0.28as a devDependency (used by integration-testing harness to spin up Harper). This component has no directharper/harperdbruntime import — it is a runtime-injected extension, so no import swap was needed.integrationTests/http-router.test.tscovering startup, permanent/temporary redirects, cache-control headers, custom response headers, and fallback pass-through. Addedroutes.jsat repo root as the test fixture routing config..github/workflows/integration-tests.ymlwith Node 22/24/26 matrix using pinned action commit hashes.package-lock.jsonwas listed in.gitignore(stale template). Un-ignored it and regenerated with--os=linux --cpu=x64 --include=optionalso thatbufferutil,utf-8-validate, andnode-gyp-buildare recorded for Linux CI (npm cion ubuntu-latest was previously broken).tsconfig.jsonandtypescript@^6.0.3devDep for the test files.package.jsondescription.Migration items
harperdb→harperimport swapTable.get()return shapeblob.save()removalwasLoadedFromSource()harperBinPathfixintegrationTests/http-router.test.tsKnown issues / notes
EADDRNOTAVAILon macOS — loopback aliases 127.0.0.2+ are not configured (requires interactivesudo). This is environmental. CI onubuntu-latestruns the full suite without aliasing. CI is the gate.@harperdb/http-router. Moving it to the@harperfast/npm scope is a manual task — flagged for the human (see master plan §11.1).Test results
🤖 Generated with Claude Code