fix: native module resolution breaks validation loop for ha:pdf#111
Merged
simongdavies merged 2 commits intohyperlight-dev:mainfrom May 7, 2026
Merged
Conversation
The module resolution loop checked only Object.keys(newSources) to decide whether to continue resolving. Native modules (like ha:ziplib) have no .js source — only module.json metadata — so the loop broke early with valid=false and an empty errors array, producing the cryptic 'Validation failed: •' message. Root cause: ha:pdf imports ha:ziplib (native). The resolution loop loaded ziplib.json but not ziplib.js (doesn't exist). Since newSources was empty, it broke out of the loop before passing the JSON metadata to the validator. The validator then couldn't confirm ziplib was resolved, returning valid=false with no errors. Fix: check all three sources (newSources, newModuleJsons, newDtsSources) before deciding nothing was found. This allows native module metadata to flow through and lets the validator recognise them as resolved. Applied to both register_handler and register_module validation loops. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an early-exit bug in the handler/module validation dependency-resolution loop so that native modules (which may only have module.json / .d.ts and no .js) are still treated as “newly resolved” and passed into the analysis guest for deep validation.
Changes:
- Update the “no progress” detection in the validation loop to consider
newModuleJsonsandnewDtsSourcesin addition tonewSources. - Apply the same “check all three” condition in both the shared
validateHandlerCode()path and theregister_handlertool’s local validation loop.
…wording - Changed 'no ha:/host: prefix' to 'missing ha: or host: prefix' to avoid confusion with the slash character - Note: registerModuleImpl loop doesn't have the early-break pattern so it was never affected by the bug (commit message corrected) Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
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.
The module resolution loop checked only Object.keys(newSources) to decide whether to continue resolving. Native modules (like ha:ziplib) have no .js source — only module.json metadata — so the loop broke early with valid=false and an empty errors array, producing the cryptic 'Validation failed: •' message.
Root cause: ha:pdf imports ha:ziplib (native). The resolution loop loaded ziplib.json but not ziplib.js (doesn't exist). Since newSources was empty, it broke out of the loop before passing the JSON metadata to the validator. The validator then couldn't confirm ziplib was resolved, returning valid=false with no errors.
Fix: check all three sources (newSources, newModuleJsons, newDtsSources) before deciding nothing was found. This allows native module metadata to flow through and lets the validator recognise them as resolved.
Applied to both register_handler and register_module validation loops.