Handle _.context syntax/import failures without crashing startup#1920
Merged
pmcelhaney merged 4 commits intomainfrom Apr 16, 2026
Merged
Handle _.context syntax/import failures without crashing startup#1920pmcelhaney merged 4 commits intomainfrom
_.context syntax/import failures without crashing startup#1920pmcelhaney merged 4 commits intomainfrom
Conversation
Copilot
AI
changed the title
[WIP] Fix app crash caused by syntax error in _.context.ts
Handle Apr 16, 2026
_.context syntax/import failures without crashing startup
pmcelhaney
approved these changes
Apr 16, 2026
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.
Summary
A broken
_.context.ts(syntax/import error) previously bubbled into startup failure paths. This change makes context-module load failures non-fatal: Counterfact now warns and skips that context module, while continuing to load routes.ModuleLoader.loadEndpoint, context files (_.context.*) now take a dedicated error path on import failure._.context.tsis skipped with a warning.Original Prompt
Issue title: App should not crash due to syntax error in _.context.ts
Issue description: A syntax error in _.context.ts should not cause the app to crash. Instead it should print a warning and not load the context module.
Manual acceptance tests
routes/_.context.tscontains invalid syntax; verify startup continues and a warning is printed mentioning the context file._.context.ts, call a normal route module in that tree and verify it still responds (app remains operational)._.context.ts) and verify existing route-error behavior is unchanged (generated 500 response path still applies).Tasks
src/server/module-loader.tsto warn + skip for_.context.*.test/server/module-loader.test.tsfor invalid_.context.jsbehavior (warning emitted, route still loaded, context not registered).docs/features/state.mdto document warning-and-skip behavior for invalid context files..changeset/free-numbers-relate.md.