Skip to content

chore: use Effect Console in nesting validator#47

Merged
jonlaing merged 1 commit into
mainfrom
chore/nesting-effect-console
Jul 24, 2026
Merged

chore: use Effect Console in nesting validator#47
jonlaing merged 1 commit into
mainfrom
chore/nesting-effect-console

Conversation

@jonlaing

Copy link
Copy Markdown
Owner

Summary

Follow-up on the merged PR #42 (invalid HTML nesting warnings) — swap raw `console.warn` for Effect's `Console.warn`.

Why

Same rationale as the equivalent change in `@effex/platform` (#46) and `@effex/dom`'s `subscribeReconcile` (#45). Every log site is inside an `Effect` chain via the renderer's `appendChild`, so Effect's `Console` is the idiomatic choice: runs inside the fiber, no `Effect.sync` wrapping, and Layer-swappable for tests.

Changes

  • `warnIfInvalidNesting` now returns `Effect` (was `void`). Callers `yield*` it.
  • `DOMRenderer.appendChild` and SSR `StringRenderer.appendChild` switched from `Effect.sync(() => {...})` to `Effect.gen(function* () {...})` so they can yield the warn helper.
  • Test file adds a small sync wrapper (`Effect.runSync(warnIfInvalidNesting(...))`) so the existing spy-based assertions stay unchanged in structure — but the underlying call is now going through Effect's Console service.

Test plan

  • `npx tsc --noEmit` clean
  • Full suite: 744 pass / 2 skipped (unchanged)

🤖 Generated with Claude Code

warnIfInvalidNesting now returns Effect<void> and uses Console.warn instead of raw console.warn. Both renderers' appendChild yield* the warning inside Effect.gen. Consistent with the equivalent changes in @effex/platform and @effex/dom's subscribeReconcile — Effect Console goes through a Layer-swappable service and matches the codebase's overall paradigm.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying effex with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3700f21
Status: ✅  Deploy successful!
Preview URL: https://2560d993.effex.pages.dev
Branch Preview URL: https://chore-nesting-effect-console.effex.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying effex-api with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3700f21
Status: ✅  Deploy successful!
Preview URL: https://f347be7f.effex-api.pages.dev
Branch Preview URL: https://chore-nesting-effect-console.effex-api.pages.dev

View logs

@jonlaing
jonlaing merged commit 4d7290c into main Jul 24, 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.

1 participant