Skip to content

Document per-owner capabilities and lint conditional none branches - #236

Merged
SandroMaglione merged 5 commits into
mainfrom
react-guide-capabilities-and-none-branch-lint
Oct 22, 2026
Merged

SandroMaglione merged 5 commits into
mainfrom
react-guide-capabilities-and-none-branch-lint

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

Summary

  • React guide (packages/effect-machine/docs/effect-atom-react.md):
    • Query concrete event acceptance: a { none: true } branch selected by a resolver still counts as accepted for can. Shows the before/after resolver (guard, or declinable: true with decline()), and says render-time acceptance should use AtomMachine.can(event)(machine), not Effect.runSync(Machine.can(...)).
    • New Per-owner capabilities section: a router or component callback is a Context.Service that a state invokes. The React owner provides it with AtomMachine.bind(Atom.runtime(Layer.merge(AppLayer, ownerLayer))) inside the useMachineAtom factory. The section covers snapshot encoding, Layer.mock, sharing the app layer through the registry memo map, and the compile error when the machine is bound without the service.
    • New Keep workflow effects out of emissions section: emissions are not replayed, Atom.make(stream) re-publishes the last emission when the machine completes, and useAtomSubscribe needs { immediate: true }.
  • machine-review.md and agent-guide.md: review checks and guidance for none versus declinable, capability services instead of function-valued schema fields, and keeping navigation out of emissions.
  • Oxlint plugin: new recommended rule effect-machine/no-conditional-none-branch. It reports a resolver that conditionally selects a branch declared { none: true } in the same module's Machine.make({ branches }) when the transition lacks declinable: true. It recognises select.<key>(), destructured selectors, context-parameter selectors, nested ternaries, logical expressions and if/switch returns. README, recommended config and pack check are updated. The plugin README's nondeterminism example now uses declinable so it passes the new recommended rule.

Changeset

  • Added or updated for a library or package-metadata change (minor for @typeonce/oxlint-plugin-effect-machine; documentation-only files need no changeset)
  • Not required because this PR does not change a publishable package

Validation

  • pnpm check: every step passed locally except format:check, which could not download dprint plugins in the sandbox, so CI runs it. One devtools StaticSite test hit a 5s timeout under load and passed when rerun alone. The guide snippets (per-owner runtime, missing-service compile error, before/after resolvers) were typechecked in a scratch tstyche file that is not committed.
  • Automated type-performance measurement passed or was not required (not required: docs and lint plugin only)
  • Automated runtime- and memory-performance measurement passed or was not required (not required: no runtime change)

Generated by Claude Code

Add React guide sections on `none` versus declinable acceptance, per-owner
capability services, and emissions, plus review and agent guide notes.
Add the recommended `effect-machine/no-conditional-none-branch` Oxlint rule.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHnF2EL6ReDTKwoM9TVH7L
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHnF2EL6ReDTKwoM9TVH7L
…ies-and-none-branch-lint

# Conflicts:
#	packages/effect-machine/docs/effect-atom-react.md
@SandroMaglione
SandroMaglione merged commit 14e1f39 into main Oct 22, 2026
9 checks passed
@SandroMaglione
SandroMaglione deleted the react-guide-capabilities-and-none-branch-lint branch October 22, 2026 10:24
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