Skip to content

refactor: PR-44 audit follow-up — shared applyPhaseGuarded, select throw routing, doc consistency - #45

Merged
Mgrdich merged 1 commit into
masterfrom
forms-pr44-audit-followup
Jul 6, 2026
Merged

Mgrdich merged 1 commit into
masterfrom
forms-pr44-audit-followup

Conversation

@Mgrdich

@Mgrdich Mgrdich commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Post-merge follow-up on top of spec 039 (PR #44). Small, self-contained cleanup — no new features, no behavior change except the one select fix noted below.

  • Extract shared applyPhaseGuarded helper (src/compiler/apply-phase-guarded.ts) for the $$phase-guarded $apply / $evalAsync dispatch that four call sites had each duplicated. The spec-026 event directives, forms applyDuringEvent (input-types.ts), the form submit handler, and select's applyChange now all funnel through it, each passing its own cause token ('eventListener' for events, '$compile' for forms).
  • Fix select throw routing — applyChange previously had no try/catch, so a throwing $parser during the native change commit escaped the listener without ever reaching $exceptionHandler. It now injects $exceptionHandler and routes via '$compile'. Adds a regression test.
  • De-duplicate stashController — drop the local copy in compile.ts, import the shared one from element-slots.ts.
  • Rename runControllerSeam-widening.test.ts → run-controller-seam-widening.test.ts (kebab-case file-naming convention).
  • eslint justifications added to the three eslint-disable comments in core/utils.ts.
  • Doc consistency — refresh the stale EXCEPTION_HANDLER_CAUSES stays at 10 comments (the tuple is 13 since spec 037) across the compiler/controller/bootstrap error files, plus CLAUDE.md and roadmap.md touch-ups.

Test plan

  • pnpm typecheck clean
  • pnpm lint clean
  • pnpm test — 4243 passed, 26 skipped
  • New regression test: a throwing $parser during a select change commit reports via $exceptionHandler instead of escaping the listener.

🤖 Generated with Claude Code

…row routing, doc consistency

Post-merge cleanup on top of spec 039 (PR #44):

- Extract the `$$phase`-guarded `$apply`/`$evalAsync` dispatch into a
  single shared `src/compiler/apply-phase-guarded.ts` helper. The
  spec-026 event directives, forms `applyDuringEvent` (input-types),
  `form` submit, and `select`'s `applyChange` now all route through it
  with their own cause token instead of duplicating the try/catch.
- Fix `select`: `applyChange` previously lacked the try/catch, so a
  throwing `$parser` during the native change commit escaped the
  listener without reaching `$exceptionHandler`. It now injects
  `$exceptionHandler` and routes via `'$compile'`. Adds a regression
  test in select.test.ts.
- De-duplicate `stashController` — remove the local copy in compile.ts
  and import the shared one from element-slots.ts.
- Rename runControllerSeam-widening.test.ts → kebab-case
  run-controller-seam-widening.test.ts (file-naming convention).
- Add inline justifications to the eslint-disable comments in
  core/utils.ts (isFunction, TypedArray copy cast, dynamic delete).
- Doc consistency: update the stale "EXCEPTION_HANDLER_CAUSES stays at
  10" comments across compiler/controller/bootstrap error files (the
  tuple is now 13 after spec 037) and refresh CLAUDE.md + roadmap.md.

typecheck + lint clean; 4243 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Mgrdich
Mgrdich force-pushed the forms-pr44-audit-followup branch from a59e0e3 to cfaaf1d Compare July 6, 2026 18:08
@Mgrdich
Mgrdich merged commit 1c5bd81 into master Jul 6, 2026
2 checks passed
@Mgrdich
Mgrdich deleted the forms-pr44-audit-followup branch July 6, 2026 18:15
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