Repository navigation
Add a Relevant to Expected step to state errors - #495
Open
CatarinaGamboa wants to merge 2 commits into
Open
CatarinaGamboa wants to merge 2 commits into
CatarinaGamboa wants to merge 2 commits into
Conversation
The last step of a state error's Found keeps only the facts that share a ghost function application or a value with Expected, directly or through other facts. Facts about other state sets, or earlier versions not linked to the expected one, are left out. Objects compared as values, or passed to an alias or unknown function, are never split. No step is added when every fact or none is relevant. The VC and the verdict do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Codex review, round 1 ( |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 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.
Fixes #297
A state error's Found now ends with a step called Relevant to Expected. This step keeps only the facts that the expected state depends on. The full Found is still the step before it. This is a display change only: the VC sent to the solver, the verdict, the hints and the category are all unchanged.
When a fact is left out (established independence)
Each fact (a conjunct of a Found row) is reduced to the solver terms it constrains:
f(x). A state stands for its state set function, soopen(x)andstate1(x) == state1(y)both constrainstate1(x).mode,#canRedo_result, orxinx == y.A fact is kept if it shares a term with Expected, either directly or through other kept facts. All other facts are left out. Different ghost functions, or the same function over different objects, are different solver terms, so a fact that shares no term with this group is independent of Expected.
To keep this safe, an object is never split into its ghost functions when any fact constrains it as a value (
x == y) or passes it to an alias or an unknown function. In that case, all of its facts stay together. Conditions are not split either: facts under the samec ? … : …sharecand stay together. No step is added when every fact or no fact is relevant. The pass works on expressions and ghost declarations, not on rendered names.Before / after (CLI message, which uses the last step)
startTiling(preview@53) && state2(preview@53) == state2(preview@52) && compressionSet(preview) && state1(preview) == state1(preview@53)startTiling(preview@53) && state1(preview) == state1(preview@53)tilingNotExplicit(wParam) && compressionNotExplicit(wParam)compressionNotExplicit(wParam)startCompression(iwparam) && state1(iwparam) == 0startCompression(iwparam)ErrorTrafficLightRGBgreen(tl@48) && red(tl) && r(tl) == r(tl@48) && g(tl) == g(tl@48) && b(tl) == b(tl@48)red(tl)ErrorArgumentPicksTheStateEarliertilingOff(param@24) && uncompressed(param@24) && tilingOff(param@25) && state2(param@25) == state2(param@24) && compressed(param) && state1(param) == state1(param@25)tilingOff(param@25) && state1(param) == state1(param@25)Expected is unchanged in every row. Across the 98 state-error cases in
testSuite, 15 messages in 10 cases change. Only the Found text changes; other examples areresultset_forward_error,ErrorIteratorReturnHasNext,ErrorStateHintJoinsandErrorStateHintMultipleSets. The CLI output of the other 88 cases is byte-identical.The six study exercises (proposal D): all report the same verdicts and lines. A1_01 gets the step, as shown above. A1_38 (
open(buffered) && unmarked(buffered), where both state sets are in Expected), A1_09 (one conditional fact), and A1_56 (no Found, "could not prove it") have nothing safe to remove, so they get no step. A2_04 and A2_10 are refinement errors and are unaffected. In the A1_56 partial-fix variant (onlyredo()guarded), every fact sits under the shared#canRedo_resultcondition, so it also gets no step. Much of that noise comes from switch cases not being modelled (see the comment on #297).Webview
The server already sends the whole history, so the extra step reaches the panel without any server change, and the back arrow returns to the full Found. However,
vc-implications.tslabels the newest step "Simplified" and never shows its pass name. For the label "Relevant to Expected" to appear, vscode-liquidjava needs a one-line change: usesimplificationfor index 0 when it is set. That change is not part of this PR.Tests
TestStateErrorContext#foundEndsWithTheFactsRelevantToTheExpectedStateSet: the message, the step name, and that stepping back shows the compression state set (existing fixture).VCSimplificationTest: two conservative cases where nothing may be left out: an object compared as a value, and an object passed to an unknown function. Each one fails if its rule is removed.Full suite: 715 tests pass locally.
🤖 Generated with Claude Code