Repository navigation
Name the fix in compile errors for targets, sources, owners, and final states - #269
Merged
Merged
Conversation
…l states Report a misspelled target, source, or owner by listing what is declared, where these used to surface as `never`. Run validation before the handler shape so its message wins, and read the whole diagnostic chain in a test, as an agent does. Reject a target below a state that is certainly inactive and has a value, which used to fail while planning. This found a devtools example that would have thrown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Type performanceMeasured with TypeScript 6.0.3 and
Marginal instantiations are measured against the matching setup without that API call:
Check times (informational)
Type instantiations are the comparison metric. Check time varies with runner load and is informational only. |
Contributor
Runtime performanceMedian of 5 independent benchmark processes on Pull request baseline
Process runtime reference points
Effect Machine change from base
Process runtime reference change from base
Regression guardNo large, noise-adjusted throughput or heap regressions detected. Versions and interpretation
Higher throughput is better; lower heap is better. Variability is the median absolute deviation across independent processes, relative to their median. Small differences on shared GitHub-hosted hardware remain informational; the required guard rejects only large changes beyond the measured noise allowance. |
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
Machine.handleused to answer most mistakes withType 'string' is not assignable to type 'never'. It now names the fix:Unknown target "Archivd". Declared: Editing, Checkout, ArchivedCannot target "root". Reconstruct it with initialize, or update it with update: { root: ... }"Checkout.recent" is a history state. Restore it with: { history: "Checkout.recent" }dataTarget "Checkout" requires dataUnknown source. Registered: loadCannot update "Typo". Updatable here: Editing, rootonon a final stateFinal state "Archived" cannot declare on. A final state has no outgoing workonon a choiceChoice state "Checkout.Route" cannot declare on. Declare one transition in choiceOne addition beyond the plan: a target below a certainly inactive valued state, such as
{ target: "Checkout.Paid" }from outsideCheckout, used to compile and then fail while planning. It is now a compile error. It found a real bug inhierarchy-routing-example, whoseonFailurewould have thrown, and that example is fixed here. The check stays conservative: anything below the source or a parallel state may already be active, so those remain runtime checks.How the messages reach the user:
handle's parameter, so its message is reported first.never. A fallback alone would have let a known target omit requireddata, soValidateTargetDatacloses that gap. The member also lists the declared paths, which keeps editor completion working.scripts/invoke-autocomplete.test.mjscaught both of these while I built it.HandlerShapereplaces an invocation that has an unknown source with the message, so valid invocations keep their contextual typing.scripts/type-errors.test.mjscompiles each mistake and reads the whole diagnostic chain, as an agent readingtscoutput does. tstyche only exposes the top line, which doesn't always contain the message.Type-performance tradeoff:
machine.handle (3 states, 2 transitions)rises about 14% andatomic constructionabout 11%, with smaller rises elsewhere, because each transition now also validates its target by path. This is deliberate, perAGENTS.md. Union print order in messages comes from TypeScript and isn't stable, so tests match the message and not the list order.Changeset
Validation
pnpm check🤖 Generated with Claude Code