feat: live-node hook integration tests + useAsyncResource staleness guard#38
feat: live-node hook integration tests + useAsyncResource staleness guard#38rtb-12 wants to merge 3 commits into
Conversation
…uard Stand up real-node integration tests for the hooks (the prior suites only mocked mero-js) and fix the recurring stale-data bug class they target. Integration harness + tests - boot a real merod, render hooks through MeroContext with an authenticated MeroJs, assert against the live wire (vitest.e2e.config.ts + tests/e2e/**) - 22 tests across read hooks, mutations, and execute round-trips - e2e CI job mirroring mero-js (released merod + vacuous-pass guard + logs) - unit run scoped to exclude e2e (vitest.config.ts) - bump mero-js dep to 6.1.0 (node_modules was stale at 3.0.0) useAsyncResource (kills the stale-data race) - one hook owning loading/error/data + a latest-request-wins token + synchronous reset-on-deps; ~14 read hooks migrated to it - useGroupCapabilities keeps an inline guard (read+write hybrid); useMemberMetadata (abort-signal guarded) and useContextDiscovery (imperative) left as-is - deterministic race test (single-object + mapped-list) proves the fix - hooks/index.ts 1952 -> 1540 LOC The group-metadata round-trip is skipped pending the mero-js getGroupMetadata over-unwrap fix; re-enable after that publishes + a dep bump. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
There was a problem hiding this comment.
🤖 AI Code Reviewer
Reviewed by 3 agents | Quality score: 69% | Review time: 171.1s
🟡 4 warnings, 💡 1 suggestions. See inline comments.
🤖 Generated by AI Code Reviewer | Review ID: review-8706b8cf
Documentation ReviewThe following documentation may need updates based on the changes in this PR:
|
Drop the `as any` casts in hooks.read.test.tsx so a hook field rename can't pass vacuously — settle()'s generic already infers each hook's real return type. Wire tests/** into `pnpm typecheck` (tsconfig.typecheck.json, no rootDir/emit) so this is enforced in CI; add @types/node for the harness. Typing immediately caught a latent harness bug: createNamespace was passed `alias` (not a CreateNamespaceRequest field — core silently dropped it); corrected to `name`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🤖 AI Code Reviewer
Reviewed by 3 agents | Quality score: 42% | Review time: 191.0s
🟡 10 warnings, 💡 2 suggestions. See inline comments.
🤖 Generated by AI Code Reviewer | Review ID: review-39c1ebf3
…ment - type the createGroupInNamespace mutation result (no `any`) - render.tsx: nodeUrl is unused by hooks, set null instead of reaching into MeroJs private internals via a double cast - correct the useAsyncResource ref comment: initialRef is captured once (constant per hook), only fetcherRef is refreshed Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🤖 AI Code Reviewer
Reviewed by 3 agents | Quality score: 64% | Review time: 173.4s
🟡 5 warnings, 💡 3 suggestions. See inline comments.
🤖 Generated by AI Code Reviewer | Review ID: review-1ac9b26d
Brings mero-react under live-node integration testing (the existing suites only mock mero-js) and fixes the recurring stale-data bug class those tests target.
Integration harness + tests (Phase 0/1/4)
MeroContextwith a real authenticatedMeroJsagainst a booted merod, asserting the live wire —tests/e2e/**,vitest.e2e.config.ts.executeset→get.test:e2ewith a vacuous-pass guard + log artifacts.vitest.config.ts); bumped mero-js dep 3.0.0 → 6.1.0 (node_modules was stale).useAsyncResource — kills the stale-data race (Phase 2)
useGroupCapabilitieskeeps an inline guard (read+write hybrid);useMemberMetadata(already abort-signal-guarded) anduseContextDiscovery(imperative poll) left as-is.hooks/index.ts: 1952 → 1540 LOC.What surfaced
The group-metadata round-trip is skipped, referencing an upstream mero-js
getGroupMetadataover-unwrap (returns the bare data map, not theMetadataRecord) — fixed in calimero-network/mero-js#65. Re-enable here after that publishes + a dep bump.Verification
typecheck · lint · unit (101, incl. race test) · e2e (21 + 1 skip vs a live merod 0.11.0-rc.8) · build — all green locally.
🤖 Generated with Claude Code