Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Recovery #1462

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9d8be07
Starting work on error recovery
wycats Aug 16, 2023
c3056db
Revert "Starting work on error recovery"
wycats Oct 11, 2023
164e52a
Added error recovery machine infrastructure
wycats Oct 16, 2023
2ad715e
Consolidate stack internals
wycats Oct 16, 2023
df1f01b
Make the tests work with trace logging on
wycats Oct 17, 2023
2d87f07
Remove fetchValue(machine register)
wycats Oct 17, 2023
f37e1e6
Clean up stack and debug logging
wycats Oct 17, 2023
e5fbcf4
In progress updating stack checks
wycats Oct 20, 2023
f162c71
Finish overhauling debug logging
wycats Oct 21, 2023
9a14393
Cleanup
wycats Oct 23, 2023
44262f1
Tweak stack checks
wycats Oct 23, 2023
e557a58
chore(package.json): update devDependencies versions to latest
wycats Oct 24, 2023
ed47021
Update qunit
wycats Oct 24, 2023
7637009
chore(vscode): update editor.codeActionsOnSave settings to prioritize…
wycats Oct 24, 2023
a2d876f
editor(vscode): Add commit message editor to vscode
wycats Oct 24, 2023
6bd4205
refactor(debug): Make nulls and arrays in stack verification more acc…
wycats Oct 24, 2023
099cbc9
chore: Clean up unused code
wycats Oct 24, 2023
4670f73
infra(debugger): Improve and restore the debug tracing infra
wycats Oct 24, 2023
ae8f46d
infra(debugger): Significant improvement to stack checks and trace lo…
wycats Oct 24, 2023
fac3d89
style: Style tweaks
wycats Oct 24, 2023
acd251d
infra(opcodes): Generate opcode types and values
wycats Oct 25, 2023
2d5c4d1
style: Style changes
wycats Oct 25, 2023
570ee41
refactor(typescript): Replace ContentType and CurriedType enums
wycats Oct 25, 2023
a5f2fbf
feat(error-boundary): Basic stack error recovery works
wycats Oct 26, 2023
2d044f5
refactor(opcodes): Nail down opcode behavior
wycats Oct 29, 2023
2d8d30a
refactor(tests): Prepare for error recovery tests
wycats Oct 30, 2023
e393dc2
refactor(tests): Further trim down render delegate
wycats Oct 30, 2023
8b862b2
refactor(tests): Further trim down render delegate
wycats Oct 30, 2023
463efc7
chore(checkpoint): Tests pass
wycats Oct 31, 2023
14cc692
fix(tests): Support else blocks in glimmer tests
wycats Oct 31, 2023
4fa1a67
refactor(tests): Separate invoke & template styles
wycats Oct 31, 2023
1fd0f61
test(error-recovery): Add error recovery suites
wycats Nov 1, 2023
24a5fd9
chore(eslint): Turn on stricter testing lints
wycats Nov 1, 2023
ecbabd2
feat(error-boundary): DOM clearing works
wycats Nov 2, 2023
37cdc0e
refactor(references): Bake errors in more deeply
wycats Nov 3, 2023
e6b7543
refactor(test-infra): Restructure matrix tests
wycats Nov 3, 2023
1bffa26
feat(error-recovery): Recover more VM getErrorMessage
wycats Nov 4, 2023
b12092d
feat(error): Better rationalize unwindable state
wycats Nov 5, 2023
5f1653b
feat(errors): Added checkpointing to `Stack`
wycats Nov 5, 2023
dd8d40d
feat(errors): Closing in!
wycats Nov 6, 2023
c11ab6d
feat(errors): Test and clarify references
wycats Nov 6, 2023
82f4135
feat(references): More fully test ref API
wycats Nov 7, 2023
bb08649
feat(debug): Better descriptions/devmode values
wycats Nov 8, 2023
3aa570b
feat(errors): Support error recovery
wycats Nov 8, 2023
2e21994
chore(imports): Strengthen and apply import sort rules
wycats Nov 8, 2023
9bfa6f4
feat(errors): Get closer to final naming
wycats Nov 9, 2023
dd562d5
docs(reactive): Document the new reactivity APIs
wycats Nov 9, 2023
8cfa580
feat(errors): Make recover() work
wycats Nov 9, 2023
5a7e790
feat(errors): Finish error recovery + tests
wycats Nov 10, 2023
8536a36
refactor(vm): Refactor and document VM
wycats Nov 10, 2023
50e24f2
feat(errors): Handle errors in more cases
wycats Nov 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ root = true


[*]
max_line_length = 100
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand All @@ -21,3 +22,4 @@ insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
max_line_length = 80
52 changes: 26 additions & 26 deletions .eslintrc.cjs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this diff?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

– and, in general, now that this is in (from what I understand) a ready for merge/review state, can you back out all these unrelated config/workflow changes into a separate PR and land them first or separately later? Don't want to merge a big experimental new feature (which has a non-zero chance of needed to be reverted later) with a lot of unrelated changes.

Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ module.exports = {
'**/fixtures',
'!**/.eslintrc.cjs',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
project: [],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.js', '.cjs', '.mjs', '.mts', '.ts', '.d.ts'],
},
'import/resolver': {
typescript: {},
},
node: {
allowModules: ['@glimmer/debug', '@glimmer/local-debug-flags'],
tryExtensions: ['.js', '.ts', '.d.ts', '.json'],
},
},
plugins: [
'@typescript-eslint',
'prettier',
'qunit',
'simple-import-sort',
'unused-imports',
'prettier',
'n',
],
// parser: '@typescript-eslint/parser',
// parserOptions: {
// ecmaVersion: 'latest',
// project: [],
// },
// settings: {
// 'import/parsers': {
// '@typescript-eslint/parser': ['.js', '.cjs', '.mjs', '.mts', '.ts', '.d.ts'],
// },
// 'import/resolver': {
// typescript: {},
// },
// node: {
// allowModules: ['@glimmer/debug', '@glimmer/local-debug-flags'],
// tryExtensions: ['.js', '.ts', '.d.ts', '.json'],
// },
// },
// plugins: [
// '@typescript-eslint',
// 'prettier',
// 'qunit',
// 'simple-import-sort',
// 'unused-imports',
// 'prettier',
// 'n',
// ],

rules: {},
overrides: [
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100
"printWidth": 100,
"plugins": []
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["foxundermoon.shell-format"]
}
194 changes: 186 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
"[javascript][typescript]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"]
"editor.codeActionsOnSave": {
"source.unusedImports": "explicit",
"source.fixAll": "explicit",
"source.formatDocument": "always"
}
},
"editor.formatOnSave": true,
"eslint.enable": true,
"eslint.packageManager": "npm",
"eslint.codeAction.showDocumentation": {
"enable": true
},
Expand All @@ -25,7 +28,7 @@
"mode": "auto"
}
],
"explorer.excludeGitIgnore": false,
"explorer.excludeGitIgnore": true,
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
Expand All @@ -41,15 +44,190 @@
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",

"typescript.preferences.importModuleSpecifier": "project-relative",
"javascript.preferences.importModuleSpecifier": "project-relative",
"typescript.preferences.importModuleSpecifier": "project-relative",

"typescript.preferences.importModuleSpecifierEnding": "minimal",
"typescript.preferences.importModuleSpecifierEnding": "index",
"typescript.preferences.useAliasesForRenames": false,

"typescript.tsc.autoDetect": "on",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.tsserver.experimental.enableProjectDiagnostics": false,
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"typescript.workspaceSymbols.scope": "currentProject",
"eslint.problems.shortenToSingleLine": true
"eslint.problems.shortenToSingleLine": true,
"inline-bookmarks.expert.custom.words.mapping": {
"warn": ["@premerge(\\s|$)"],
"active": ["@active(\\s|$)"],
"fixme": ["@fixme(\\s|$)"]
},
"inline-bookmarks.expert.custom.styles": {
"active": {
// teal
"gutterIconColor": "#009999",
"overviewRulerColor": "rgba(0, 150, 150, 0.7)",
"light": {
"fontWeight": "bold",
"color": "#009999"
},
"dark": {
"fontWeight": "bold",
"color": "#00ffff"
}
},
"fixme": {
// yellow
"gutterIconColor": "#990000",
"overviewRulerColor": "rgba(150, 0, 0, 0.7)",
"light": {
"fontWeight": "bold",
"color": "#990000"
},
"dark": {
"fontWeight": "bold",
"color": "#ff0000"
}
},
"warn": {
// yellow
"gutterIconColor": "#999900",
"overviewRulerColor": "rgba(150, 150, 0, 0.7)",
"light": {
"fontWeight": "bold",
"color": "#999900"
},
"dark": {
"fontWeight": "bold",
"color": "#ffff00"
}
}
},
"inline-bookmarks.view.showVisibleFilesOnly": true,
"commit-message-editor.staticTemplate": [
"feat: Short description",
"",
"Message body",
"",
"Message footer"
],
"commit-message-editor.dynamicTemplate": [
"{type}{scope}: {description}",
"",
"{body}",
"",
"{breaking_change}{footer}"
],
"commit-message-editor.tokens": [
{
"label": "Type",
"name": "type",
"type": "enum",
"options": [
{
"label": "---",
"value": ""
},
{
"label": "build",
"description": "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
},
{
"label": "chore",
"description": "Updating grunt tasks etc; no production code change"
},
{
"label": "ci",
"description": "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
},
{
"label": "docs",
"description": "Documentation only changes"
},
{
"label": "feat",
"description": "A new feature"
},
{
"label": "fix",
"description": "A bug fix"
},
{
"label": "editor",
"description": "A change to editor/IDE support"
},
{
"label": "infra",
"description": "A change to the build, test or CI infrastructure"
},
{
"label": "perf",
"description": "A code change that improves performance"
},
{
"label": "refactor",
"description": "A code change that neither fixes a bug nor adds a feature"
},
{
"label": "revert"
},
{
"label": "style",
"description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
},
{
"label": "test",
"description": "Adding missing tests or correcting existing tests"
}
],
"description": "Type of changes"
},
{
"label": "Scope",
"name": "scope",
"description": "A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g., \"feat(parser): add ability to parse arrays\".",
"type": "text",
"multiline": false,
"prefix": "(",
"suffix": ")"
},
{
"label": "Short description",
"name": "description",
"description": "Short description in the subject line.",
"type": "text",
"multiline": false
},
{
"label": "Body",
"name": "body",
"description": "Optional body",
"type": "text",
"multiline": true,
"lines": 5,
"maxLines": 10
},
{
"label": "Breaking change",
"name": "breaking_change",
"type": "boolean",
"value": "BREAKING CHANGE: ",
"default": false
},
{
"label": "Footer",
"name": "footer",
"description": "Optional footer",
"type": "text",
"multiline": true
}
],
"surround.custom": {
"register": {
"label": "register helper",
"snippet": "{ ${1:helper}: $TM_SELECTED_TEXT }"
}
},
"rewrap.wrappingColumn": 100,
"rewrap.onSave": false,
"rewrap.autoWrap.enabled": true,
"rewrap.reformat": true,
"rewrap.wholeComment": false
}
13 changes: 13 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- [ ] Implement `#try` that takes handler
- [ ] internal `{{#if isClear}}{{!-- actual code --}}{{/if}}`
- [ ] if an error is encountered, unwind as-if isClear was false
during the render pass
- [ ] when you encounter the enter of the try, insert a marker in
every VM stack.
- [ ] every stack in the VM needs "unwind to nearest marker"
- [ ] when a render error is encountered, unwind all the stacks
- [ ] call the handler with the error
- [ ] no catch
- [ ] the handler has a way to clear the error
- [ ] deal with user destructors that should run even during render errors
- [ ] maintain the invariant that constructors and destructors are paired
1 change: 0 additions & 1 deletion bin/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
root: false,
env: {
es6: true,
node: true,
},
overrides: [
{
Expand Down
7 changes: 7 additions & 0 deletions bin/codemods/devmode.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[devmode]
match = "devmode({ :[block] })"
rewrite = "devmode(() => ({ :[block] }))"

[devmode2]
match = "if (import.meta.env.DEV) { :[[name]].description = :[description]; }"
rewrite = "setDescription(:[name], devmode(() => :[description]));"
21 changes: 21 additions & 0 deletions bin/codemods/new-spec-suite.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[test]
match = """
export class :[class] extends :[extends] {
static suiteName = :[suite];
:[block]
}
"""
rewrite = """
import { matrix } from "@glimmer-workspace/integration-tests";
matrix(:[suite], (spec) => { :[block] }).client();
"""
rule = """
where
rewrite :[block] { "this" -> "ctx" },
rewrite :[block] {
"@render(:[type]) :[string]() { :[body] }" -> "spec({ type: :[type] }, :[string], (ctx) => { :[body] })"
},
rewrite :[block] {
"@render :[string]() { :[body] }" -> "spec(:[string], (ctx) => { :[body] })"
}
"""
Loading