fix(handlers): break the cycle between the entry and the handlers - #11
Merged
Conversation
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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 importsregisterHandlerback 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:The registry, the file actions and
IHandlermove tolib/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.tsfirst and registers from there; it throws the above without the split.👾 This pull request was assisted by Claude Code, commits carry an
Assisted-bytrailer.