Skip to content

03 Custom Resource v5 Upgrades - #3

Merged
BboyAkers merged 9 commits into
03-custom-resourcefrom
03-custom-resource-v5-upgrade
Aug 21, 2026
Merged

03 Custom Resource v5 Upgrades#3
BboyAkers merged 9 commits into
03-custom-resourcefrom
03-custom-resource-v5-upgrade

Conversation

@BboyAkers

@BboyAkers BboyAkers commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

Completes the Harper v4 -> v5 upgrade for the 03-custom-resource tutorial step of the "Create Your First Application" Learn guide.

This guide repo has one progressive app captured across step branches (01-create-table -> 02-rest-api -> 03-custom-resource -> 04-logger). This PR upgrades the 03-custom-resource step (base branch: 03-custom-resource). The sibling PR #2 upgrades the next step (04-logger); see "Two-PR structure" below.

Changes

  • Dependency: harper ^5.0.11 -> ^5.0.28; @harperfast/integration-testing ^0.3.1 -> ^0.4.0.
  • Migration (item Difference with https://github.com/harperfast/application-template/ #1, import/package rename): resources.js imports { tables } from harper and drops the v4-only static loadAsInstance = false. (Applied in the original commit; confirmed correct.)
  • Tests: integrationTests/dog.test.ts covers Dog REST CRUD (PUT/GET/PUT-update/DELETE/404) and the DogWithHumanAge custom resource (humanAge for ages 1/2/3). Added the mandatory harperBinPath escape hatch so the harness resolves the CLI past harper's restricted exports map.
  • Test script: standardized to test:integration (harper-integration-test-run "integrationTests/**/*.test.ts"), matching the CI workflow.
  • CI: added .github/workflows/integration-tests.yml (Node 22/24/26; actions pinned to commit hashes).
  • TypeScript: added typescript devDependency for tsconfig.json / editor support.
  • Branding: package.json author "HarperDB Inc." -> "Harper Inc.". Live docs.harperdb.io URLs left intact.

Migration items N/A

This is a minimal tutorial app (a single custom resource that reads via super.get(target) and returns a fresh spread object). The following v5 changes do not apply: Table.get() return shape (#2), frozen/immutable records (#3 — already returns a new object), implicit transaction context (#4), child-process spawn allowlist (#5), blob storage (#6), install scripts (#7), VM module loader config (#8).

Tests

  • Local: blocked at the macOS loopback bind (EADDRNOTAVAIL on 127.0.0.2+) — environmental, not a code issue. The harperBinPath fix is confirmed working: the run progresses past CLI resolution to the loopback-pool stage before failing.
  • CI: runs on ubuntu-latest, which supports the full 127.0.0.0/8 range and needs no loopback aliasing. This is the authoritative test gate for this PR.

Known issue (upstream, flagged)

The harper package's exports map only exposes ".", so the harness's default require.resolve('harper/dist/bin/harper.js') throws ERR_PACKAGE_PATH_NOT_EXPORTED (harper 5.0.11–5.0.28, integration-testing 0.3.1–0.4.0). Worked around via the documented harperBinPath option. Upstream fix: harper should export its bin path, or the harness should resolve via the package root.

Two-PR structure

  • PR 03 Custom Resource v5 Upgrades #3 (this one) -> base 03-custom-resource: fully completed (deps, migration, tests, CI, branding).
  • PR 04 Logger v5 Upgrades #2 -> base 04-logger: upgrades the next tutorial step (adds logger + console.log). It applies the same import/rename migration but has no integration tests, no tsconfig, no CI, and still pins harper@^5.0.11. Recommend mirroring this PR onto 04 Logger v5 Upgrades #2 (bump versions, add a test asserting the logger path still returns correct data, add the same CI workflow, harperBinPath fix). Not changed here to avoid clobbering that PR.

Manual follow-up

  • npm scope: if this package should move to the current Harper npm scope, that is a manual decision for a maintainer (out of scope for this automated upgrade).

🤖 Generated with Claude Code

BboyAkers and others added 5 commits May 8, 2026 16:15
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Bump harper ^5.0.11 -> ^5.0.28 and @harperfast/integration-testing
  ^0.3.1 -> ^0.4.0
- Add the harperBinPath escape hatch in integrationTests/dog.test.ts so
  the harness resolves the CLI past harper's restricted exports map
  (ERR_PACKAGE_PATH_NOT_EXPORTED)
- Use the standard test:integration script and add the pinned-hash
  Integration Tests CI workflow (Node 22/24/26)
- Add typescript devDependency for editor/tsconfig support
- Branding: package.json author "HarperDB Inc." -> "Harper Inc."

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The previous lockfile omitted ws's optional native deps (bufferutil,
utf-8-validate, node-gyp-build), causing `npm ci` to fail with EUSAGE on
Node 24/26 in CI (Node 22 happened to resolve). Regenerated from a clean
install so all optional dependencies are recorded and the lockfile is in
sync across Node versions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move github.event.inputs.node-version into an env var (NODE_VER) so the
shell comparisons operate on a safe variable rather than a raw expression
interpolated directly into the run script.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/integration-tests.yml
Comment thread integrationTests/dog.test.ts Outdated
Comment thread integrationTests/dog.test.ts
Comment thread integrationTests/dog.test.ts Outdated
Comment thread integrationTests/dog.test.ts Outdated
Comment thread integrationTests/dog.test.ts Outdated
- Add 03-custom-resource to push branches filter so CI fires after merge
- Assert setup PUT succeeds in DELETE test to prevent false positives
- Add strictEqual(getRes.status, 200) in update test before reading body
- Add round-trip GET after PUT in creates test to verify persistence

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 all 4 blocking findings: added 03-custom-resource to push branches filter, asserted setup PUT succeeds in DELETE test, added status check before getRes.json() in update test, and added round-trip GET after PUT in creates test to verify persistence.

BboyAkers and others added 3 commits August 10, 2026 12:34
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>
Four of the six threads on #3 were already fixed on-branch in ef1d84b
(push-trigger branch filter, DELETE setup status check, create-test
round-trip, status check before the post-update JSON parse). The two
cleanups were still open; both are done here.

Hoisted the per-test boilerplate: httpURL and auth are resolved once in
before() and closed over, instead of being re-derived in all seven tests.

Table-driven the three DogWithHumanAge tests. They were copy-paste with
different values; adding a mapping is now one row. Generated test names
match the previous ones exactly, so CI output is unchanged.

Also extended the silent-setup-failure fix beyond the DELETE test. The
review flagged it there, but the same unchecked seed PUT appeared in five
other tests. All seeding now goes through one putDog() helper that
asserts the write succeeded, so a failed seed reports "setup PUT failed"
instead of surfacing as a confusing downstream assertion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@BboyAkers
BboyAkers merged commit c231eeb into 03-custom-resource 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.

2 participants