Repository navigation
Describe commit changes by sprite, with saved state kept apart from edits - #80
Merged
Merged
Conversation
…dits GET /v1/projects/:id/commits/:sha/changes and pulls/:index/diff?view=changes split each sprite's fractch file into scripts, declarations and saved state. Scripts are matched by content and hat, so moving or reordering them is not an edit, and hidden values under reporters and older snake_case spellings no longer count as changes. Variable values, sprite position, size, layer and visibility, the current costume, monitors and script positions are reported as state. Costumes are matched by their asset file, so renames and redraws are named.
Rename matching uses an index, same-hat pairing falls back to order past a work budget, and hidden-value stripping skips text nested deeper than 64 parentheses, so adversarial files stay linear. Each sprite folder's region files are compared together, so a script moved between regions is reported as moved. Statements may end without a semicolon, free comments stay apart from the next script, costume and sound order changes are reported, redrawn costumes are named even when the sprite file is unchanged, and totals report stateOnly instead of codeChanged.
…olders Hidden-value stripping trims in place instead of copying its output, the statement reader skips a whitespace run once, and region files are grouped by folder in one pass. Only a script's own body ends at a closing brace, so object values keep their id. A comment trailing a statement on the same line stays a free note instead of joining the next script.
This was referenced Nov 21, 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.
Commit diffs on MistWarp are hard to read because every save rewrites each sprite's fractch file. Most of what changes is saved runtime state, and much of the rest is older fractch spellings or hidden values. This adds a view that describes a commit by sprite instead of by file:
GET /v1/projects/:id/commits/:sha/changesGET /v1/projects/:id/pulls/:index/diff?view=changes(the same shape, ininspection)Each changed sprite folder (all its region files together) comes back with its sprite
nameand:added,removed,changedormovedto another region file, with the hat, text and canvas positions.edited(image or audio changed) orreordered.totalscounts everything, andtotals.stateOnlyis true when saved state is all that changed.These are not reported as edits:
wait_untilversuswaitUntil), including inside${...}in template strings;(reporter ?? value));Costumes are matched by their asset file, so renames and redraws are named. Existing history gets this straight away and nothing is rewritten. Results go through the existing inspection cache and access checks (
canSeeInsideProject,canInspectPull).Real data
I ran every commit of 5 public production projects (141 commits) through the new view with no failures. Examples:
stop otherScriptsInSpritewhere it used to writestop other_scripts_in_sprite.Limits
This runs on uploaded data, so every pass is linear and bounded:
There are timing tests for each case that used to blow up (20,000 renamed costumes, 30,000 scripts with the same hat, 500,000 nested brackets, 80,000 hidden values, a million blank lines, 5,000 sprite folders), plus a fuzz target (1.9M runs, no crashes).
Known gaps
pen.setPenColorToColor(...)versussetPenColoris a change of call form, not a rename, so that change still shows.Size
About 1,900 added lines, most of it the Go parser, comparison and tests. Splitting it would leave unused code in one PR.
Checks
With OSL 6.1.1 (the CI pin
aeb83e39):osl test62 passed;osl lsp check main.oslhas no errors, and the warnings were already there;osl compileworks;scripts/check_conventions.pypasses;scripts/e2e_smoke.py: 333 steps, 0 server errors, including new steps for both views;go test ./...andgo vetpass innative/gitinspection;GET /v1/projects/:id/commits/:sha/changes(and its/apitwin).It had two independent reviews; every must-fix and should-fix finding is fixed on this branch.
Version
1.1.1 → 1.2.0 (new backwards-compatible endpoint).
Screenshots
None: this is API only. The commit and pull request pages start using this view in a follow-up scratch-gui PR.
Docs: MistWarp/docs
commit-changes-endpoint.