Skip to content

release: creact 0.5.0 + testing 0.2.0 (RTL API) + create-creact-app 0.1.1 - #18

Merged
drn1996 merged 12 commits into
releasefrom
develop
Jul 22, 2026
Merged

release: creact 0.5.0 + testing 0.2.0 (RTL API) + create-creact-app 0.1.1#18
drn1996 merged 12 commits into
releasefrom
develop

Conversation

@drn1996

@drn1996 drn1996 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Releases PR #17 — the counter fix, the RTL-style testing library, the key/h cleanup, and always-latest scaffolding. Merging pushes develop → release and triggers the Release workflow, which reconciles each package independently.

What this release publishes

Package npm now → this release
@creact-labs/creact 0.4.1 0.5.0 — key decoupled from resource identity; node.key/type/testId; wider JSX types
@creact-labs/testing 0.1.1 0.2.0 — React-Testing-Library-style render + queries (testId/key/type); h removed
create-creact-app 0.1.0 0.1.1 — single Count: 0, always-latest deps, testing-API showcase test

Each publishes to npm + gets a <name>@<version> tag and GitHub Release; already-released artifacts are skipped (idempotent).

Breaking notes

  • creact 0.5.0: the durable-state node id scheme changed (root no longer stamped with the stack name), so existing .state files won't map — resources re-deploy. A lone useAsyncOutput component no longer needs a key.
  • @creact-labs/testing 0.2.0: h, renderTest, and the low-level findNode/readOutput are gone; peer dependency is now @creact-labs/creact ^0.5.0. Use render() + getByTestId/getByType/getByKey.

Verified

creact 656 tests / 100% coverage; testing 22; create-creact-app 26; all fallow gates + the shared publish gate (isolated build + publint + attw) green; end-to-end scaffold → install 0.5.0/0.2.0npm test passes → app runs with a single Count: 0.

Summary by CodeRabbit

  • New Features

    • Introduced a runtime-backed render() testing API with node queries (by type/key/testId) and output accessors.
    • Added async waitFor() polling with configurable timeout and interval.
    • Added testId support for rendered nodes and improved ability to address components without requiring a key.
    • Broadened JSX child typings to include primitives, arrays, and lazy children.
  • Breaking Changes

    • Removed legacy testing helpers (including h, renderTest, and lower-level query/read utilities).
    • Updated waitFor to use callback polling instead of accessor-based waiting.
  • Releases

    • Updated package versions and refreshed generated app templates/tests to use the new TSX testing API.

drn1996 and others added 8 commits July 21, 2026 03:54
… creact/testing

The counter logged "Count: 0" twice at startup: the effect ran once on the
undefined initial output (shown as 0 via ?? 0) and again when the async handler
set count to 0. Wait for the first real value before logging, so it prints 0
once, then 1, 2, ...

Also pin the scaffolded deps to "latest" so a fresh app always gets the newest
@creact-labs/creact and @creact-labs/testing instead of an aging caret range.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the author fields and the LICENSE copyright line with the project org
(CReact Labs) so no personal name or email address remains in the codebase.

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

Previously `useAsyncOutput` forced a `key` on every component (and the root's
key was overwritten with the stack name), conflating React's reconciliation key
with the durable-state address. Now:

- A lone component addresses by its name (name-name); a `key` is required only to
  disambiguate colliding siblings (the existing collision check enforces that).
- `key` is once again just the React key; the root is no longer stamped with the
  stack name (injectRootKey removed).
- InstanceNode carries `key`, `type`, and `testId` (read off the element props),
  so tools can query nodes by any of them. `testId` is a universal JSX attribute.
- Widen JSX.Element / CReactNode to what the runtime actually accepts (arrays,
  text, booleans, accessors) — Solid-style — so components may return fragments.

BREAKING: node ids for previously-keyed roots change; components no longer need a
key when unambiguous. Bumped to 0.5.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rework @creact-labs/testing around RTL's philosophy — you observe deployed
nodes, their outputs, and testId/key/type instead of DOM:

- `render(ui, options?)` returns a view with getBy/queryBy/findBy queries by
  testId, key, and type (get throws on 0 or >1, query returns null, find waits),
  plus `nodes()`, `waitFor`, and ergonomic node handles with `output()`/`outputs()`.
- `waitFor(callback)` retries a callback until it returns truthy (RTL-style).
- Remove the nonsensical public `h` element factory and the low-level
  findNode/queryNodes/readOutput/renderTest surface; app authors write real JSX.
- peerDependency and tests track creact ^0.5.0.

BREAKING API change. Bumped to 0.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With `h` gone from @creact-labs/testing, the runtime's own tests use real JSX
(component elements) and plain object literals (raw string/Symbol element types
the pipeline tests build by hand). Components that read `props.key` as a
useAsyncOutput dependency — an artifact of the old h (which wrongly left key in
props) — now use real deps; identity comes from the element key. Coverage stays
at 100%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The generated index.test.tsx now teaches @creact-labs/testing's real API:
render() + getByTestId (with getByType/getByKey noted) + output(), no h. The app
renders a lone <Counter /> (no key needed) with a testId for querying.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- waitFor now awaits its callback, so an async predicate retries on its resolved
  value instead of returning immediately on the always-truthy pending promise;
  covered with an async test. TestView.waitFor accepts async callbacks too.
- the default-backend test spies NoopMemory.saveState to actually verify render's
  default (was tautological — the local memory was never passed to render).
- scaffold: fix the index.test.tsx comment and reword the README (the counter
  does start a real timer; the test just doesn't wait on it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix: counter double-0 + always-latest scaffold; RTL-style @creact-labs/testing; decouple key from identity; drop h
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 55352f57-1ebd-46f1-9844-85a1005bb412

📥 Commits

Reviewing files that changed from the base of the PR and between 1c842b6 and e49ae82.

📒 Files selected for processing (2)
  • packages/testing/src/__tests__/wait-for.test.ts
  • packages/testing/src/wait-for.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/testing/src/tests/wait-for.test.ts
  • packages/testing/src/wait-for.ts

📝 Walkthrough

Walkthrough

The PR introduces a runtime-backed testing render/query API, polling-based waitFor, JSX node typing and metadata, keyless resource addressing, broad JSX test migration, updated starter templates, and package metadata/version changes.

Changes

Testing and runtime update

Layer / File(s) Summary
Runtime node and JSX contracts
packages/creact/src/jsx/jsx-runtime.ts, packages/creact/src/runtime/instance.ts, packages/creact/src/runtime/run.ts
JSX nodes accept broader child values and testId; runtime nodes retain key, type, and test ID metadata, support keyless addressing, and no longer receive injected root keys.
Testing render and wait APIs
packages/testing/src/render.ts, packages/testing/src/wait-for.ts, packages/testing/src/index.ts, packages/testing/src/__tests__/*
Adds render, TestView, node selectors, output accessors, lifecycle helpers, memory coverage, and callback-based polling waits with configurable timeout and interval.
Runtime and flow test migration
packages/creact/src/flow/__tests__/*, packages/creact/src/runtime/__tests__/*, packages/creact/src/store/__tests__/*
Replaces hyperscript test construction with JSX, fragments, and object elements across flow, runtime, persistence, cascade, and context tests.
Scaffold and package release updates
LICENSE, package.json, packages/*/package.json, packages/create-creact-app/*, packages/creact/tsconfig.test.json
Updates authorship and versions, configures package-based JSX resolution, and generates TSX starter tests using the new render/query API.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Test
  participant TestingRender
  participant CoreRuntime
  participant TestView
  Test->>TestingRender: render(ui, options)
  TestingRender->>CoreRuntime: start render with memory and id
  CoreRuntime-->>TestingRender: lifecycle promises and instance nodes
  TestingRender-->>TestView: expose selectors and output accessors
  Test->>TestView: query or wait for a node
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the release and highlights the main package version bumps and testing API changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🤖 Grok fallow review — proceed

Zero-finding bar met across dead code, duplication, health thresholds, and audit; release may proceed.

  • HEALTH churn hotspots accelerating: packages/testing/src/wait-for.ts (72.5), packages/create-creact-app/src/index.ts (72.0), packages/creact/src/reactive/tracking.ts (52.5), packages/creact/src/reactive/owner.ts (44.2), packages/creact/src/reactive/signal.ts (42.5), packages/creact/src/reactive/array.ts (32.7), packages/creact/src/reactive/selector.ts (29.3), packages/creact/src/primitives/context.ts (24.6), packages/create-creact-app/src/templates.ts (7.7), packages/creact/src/jsx/jsx-runtime.ts (6.2), packages/creact/src/runtime/fiber.ts (1.6)
  • HEALTH overall score 82 B with deductions: hotspots -10.0, unit size -4.7, dead files -1.7, coupling -1.3 (activity/structure signals, not release gates)

Reviews the full fallow report — dead code, duplication, health, and audit. Re-runs edit this comment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/testing/src/wait-for.ts`:
- Around line 20-40: Update waitFor so each callback attempt is raced against
the configured timeout deadline rather than awaiting callback() indefinitely.
Ensure a slow or never-resolving callback causes waitFor to throw once timeout
elapses, while preserving retries, lastError handling, and immediate success for
truthy callback results.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 39b11da9-ee30-4f73-8a68-dfbbe18a444d

📥 Commits

Reviewing files that changed from the base of the PR and between 7056b7e and 1c842b6.

📒 Files selected for processing (31)
  • LICENSE
  • package.json
  • packages/creact/package.json
  • packages/creact/src/flow/__tests__/error-boundary.test.tsx
  • packages/creact/src/flow/__tests__/for.test.tsx
  • packages/creact/src/flow/__tests__/show.test.tsx
  • packages/creact/src/flow/__tests__/switch.test.tsx
  • packages/creact/src/jsx/jsx-runtime.ts
  • packages/creact/src/runtime/__tests__/create-runtime.test.tsx
  • packages/creact/src/runtime/__tests__/instance.test.tsx
  • packages/creact/src/runtime/__tests__/render.test.tsx
  • packages/creact/src/runtime/__tests__/run.test.tsx
  • packages/creact/src/runtime/instance.ts
  • packages/creact/src/runtime/run.ts
  • packages/creact/src/store/__tests__/store.test.tsx
  • packages/creact/tsconfig.test.json
  • packages/create-creact-app/package.json
  • packages/create-creact-app/src/__tests__/templates.test.ts
  • packages/create-creact-app/src/templates.ts
  • packages/testing/package.json
  • packages/testing/src/__tests__/memory.test.ts
  • packages/testing/src/__tests__/query.test.ts
  • packages/testing/src/__tests__/render-test.test.ts
  • packages/testing/src/__tests__/render.test.tsx
  • packages/testing/src/__tests__/wait-for.test.ts
  • packages/testing/src/index.ts
  • packages/testing/src/jsx.ts
  • packages/testing/src/query.ts
  • packages/testing/src/render-test.ts
  • packages/testing/src/render.ts
  • packages/testing/src/wait-for.ts
💤 Files with no reviewable changes (6)
  • packages/testing/src/jsx.ts
  • packages/testing/src/render-test.ts
  • packages/testing/src/tests/query.test.ts
  • packages/testing/src/tests/render-test.test.ts
  • packages/creact/src/runtime/run.ts
  • packages/testing/src/query.ts

Comment thread packages/testing/src/wait-for.ts
Each iteration awaited callback() before checking the clock, so a callback that
never settles blocked the loop forever regardless of the timeout. Race each
callback against the deadline (beforeDeadline) so waitFor always gives up near
its timeout. Covered with a hanging-callback test and an async-rejection test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
drn1996 and others added 2 commits July 22, 2026 03:43
The retry slept a full interval before re-checking the clock, so a large interval
(e.g. { timeout: 20, interval: 10_000 }) rejected long after the timeout. Sleep
only up to the deadline (min(interval, remaining)) and throw once it's reached.
Covered with an interval-larger-than-timeout test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fix(testing): bound waitFor by its timeout when a callback hangs
@drn1996
drn1996 merged commit 6a2b85e into release Jul 22, 2026
16 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.

1 participant