Skip to content

fix(handlers): break the cycle between the entry and the handlers - #11

Merged
skjnldsv merged 1 commit into
mainfrom
fix/handler-import-cycle
Sep 9, 2026
Merged

fix(handlers): break the cycle between the entry and the handlers#11
skjnldsv merged 1 commit into
mainfrom
fix/handler-import-cycle

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

main is red: #8 and #10 were each green on their own branch and fail together.

Registering the built-in handlers on import (#8) made the entry call into lib/models, which imports registerHandler back from the entry. Entering the graph through a model rather than through the entry — which the preview-provider specs from #10 do — then reaches the entry mid-evaluation and calls a handler module whose body has not run:

Cannot access '__vite_ssr_import_2__' before initialization

The registry, the file actions and IHandler move to lib/handlers.ts, which the models import instead. The entry keeps every export it had and is now only what it does on import: offer this copy as a candidate, hold the service, register the defaults.

The regression test imports lib/models/images.ts first and registers from there; it throws the above without the split.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

Registering the built-in handlers on import made the entry call into
lib/models, which imports registerHandler back from the entry. Entering
the graph through a model rather than through the entry then reached the
entry mid-evaluation and called a handler module that had not run yet:

    Cannot access '__vite_ssr_import_2__' before initialization

The registry, the file actions and IHandler move to lib/handlers.ts,
which the models import instead. The entry keeps its exports and is now
only what it does on import: offer this copy, hold the service, register
the defaults.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.58333% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.37%. Comparing base (37e69a1) to head (f4a0980).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lib/handlers.ts 88.97% 14 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   72.03%   72.37%   +0.34%     
==========================================
  Files          33       34       +1     
  Lines        2285     2299      +14     
  Branches      377      380       +3     
==========================================
+ Hits         1646     1664      +18     
+ Misses        633      629       -4     
  Partials        6        6              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skjnldsv
skjnldsv merged commit f4a0980 into main Sep 9, 2026
18 checks passed
@skjnldsv
skjnldsv deleted the fix/handler-import-cycle branch September 9, 2026 09:49
@skjnldsv skjnldsv mentioned this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted status: review Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant