Upgrade Harper to v5 and add integration tests - #8
Conversation
- Add harper@5.0.28 as an explicit dependency (was runtime-provided global)
- Add @harperfast/integration-testing@0.4.0 + typescript devDeps
- Replace non-standard table.update({where,data}) with v5 put+spread in ModelFetchJobs retry handler
- Add integrationTests/data-layer.test.ts covering Harper table CRUD and REST resource endpoints (data layer only; AI inference skipped — requires external model files not available in CI)
- Add .github/workflows/integration-tests.yml with Node 22/24/26 matrix on ubuntu-latest
- Add tsconfig.json for TypeScript integration test compilation
- Regenerate package-lock.json with --os=linux --cpu=x64 --include=optional to include bufferutil/utf-8-validate/node-gyp-build for CI
- Update test:integration script to use harper-integration-test-run
- Bump engines.node to >=22.0.0 to match @harperfast/integration-testing requirement
- Branding: HarperDB → Harper in README, CONTRIBUTING.md, ROADMAP.md, package.json
- Fix repository URL and GitHub clone URL to HarperFast/edge-ai-ops
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the project for Harper v5, renaming references from HarperDB to Harper, bumping the minimum Node.js version to 22, adding a new integration test suite, and refactoring the model fetch job reset logic to avoid frozen-record mutations. Key feedback includes correcting a non-existent TypeScript version in package.json, utilizing native import.meta.resolve in tests, adding defensive checks for the test context, and strengthening test assertions for the /ModelList endpoint.
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.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Coerce ISO-8601 date strings to integer timestamps before retry put in ModelFetchJobs.post, matching the pattern in ModelFetchWorker.updateJobStatus, to prevent FIFO sort failures and schema violations on Harper v5 - Guard teardownHarper in data-layer.test.ts after() so a startup failure surfaces the real HarperStartupError instead of a secondary TypeError - Add test:integration:legacy script for tests/integration/**/*.test.js and include it in test:all to prevent those 9 files from being silently orphaned Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Review follow-up (autonomous agent): Fixed all 3 blocking findings: coerce ISO-8601 date strings to integer timestamps before retry |
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>
- Use the native import.meta.resolve('harper') instead of a createRequire
shim (package requires Node >=22, where it is stable).
- authFetch: throw a named error when ctx.harper.admin is missing, so a failed
setupHarperWithFixture surfaces as a startup failure rather than as
'Cannot read properties of undefined' in every test.
- GET /ModelList: assert the body is an array when the endpoint answers 200.
- Drop the unused deepStrictEqual import.
- Workflow: build the Node matrix into a variable and fail loudly if it ever
resolves to []. An empty matrix would make fromJSON() yield zero jobs and
report CI green having run no tests; the empty-NODE_VER path (every
push/pull_request run) is now documented at the branch.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Migration item 1 (package/CLI rename) had been applied to the code and package.json but not to the deploy tooling or docs, which still told users to `npm install -g harperdb` and invoked `harperdb deploy/restart/status/logs/ system_information`. That binary does not exist in v5. Renamed across deploy.sh, verify.sh, docs/DEPLOYMENT.md and docs/SCRIPTS.md (15 sites). Deliberately untouched: the @harperdb/ npm scope, harperdb.io / docs.harperdb.io URLs, and harperdb-config.yaml (v5 keeps that filename). Shell syntax re-checked with bash -n. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
harper@^5.0.28as an explicit dependency (was runtime-provided global).harperdbwas never listed inpackage.json— this repo relied on the global being injected.table.update({ where, data })call in theModelFetchJobsretry handler with a v5-compatibletable.put({ ...job, ...updates })(frozen-record-safe spread).integrationTests/data-layer.test.tsusing@harperfast/integration-testing@0.4.0. Tests cover the Harper data layer (Model, InferenceEvent, BenchmarkResult, Feature, ModelFetchJob table CRUD + REST resource endpoints + Status health check). AI inference endpoints (Predict/Personalize/Benchmark) require external model files, GPU, or running Ollama — these are exercised only for their data-path error handling in CI..github/workflows/integration-tests.ymlwith Node 22/24/26 matrix onubuntu-latest. SetsMODEL_FETCH_WORKER=falseto disable the background model-fetch worker during tests (avoids download attempts).package-lock.jsonwith--os=linux --cpu=x64 --include=optionalto includebufferutil,utf-8-validate, andnode-gyp-buildfor Linux CI.tsconfig.jsontargetingNodeNextwitherasableSyntaxOnlyfor the integration test suite.HarperDB→HarperinREADME.md,CONTRIBUTING.md,ROADMAP.md,package.jsondescription/author/keywords. Clone URL updated toHarperFast/edge-ai-ops.engines.nodeto>=22.0.0(required by@harperfast/integration-testing).Migration items applied
harperdb→harperimport/depwasLoadedFromSource()blob.save()table.update({where,data})replaced withput({ ...job, ...updates })getContext())Table.get()return shape.wasLoadedFromSource()not calledallowedSpawnCommands)child_processspawn callsAI inference note
TensorFlow.js, ONNX Runtime, Transformers.js, and Ollama backends require external model files (hundreds of MB) or a running Ollama service. These are not available in CI. The integration tests cover the Harper data layer only, exercising:
Known issues / flagged items
package.jsonis namedharper-edge-ai-example(unscoped). If this should move to the@harperfast/npm scope, that migration is manual — flagged for human review per org process §11.1.EADDRNOTAVAILon macOS (loopback aliases not configured). CI onubuntu-latestis the test gate.scripts/andexamples/are not introduced by this PR. ESLint is not blocking (errors are in scripts, not the Harper app code).Test results
EADDRNOTAVAIL(macOS loopback — environmental, not a code bug)🤖 Generated with Claude Code