Repository navigation
A file with a repeated or missing group frame id opens the same way every time - #654
Merged
Merged
Conversation
…very time readSavedFrames replaces a repeated id x with x_2, x_3, and a missing id with frame_<position>, skipping every id the file's frames carry, a later one included. It was frame_<time>_<counter>, new on every read, so two opens of one file disagreed and a revision without a content digest opened already changed. Part of #619.
Deploying cozy-loop-studio with
|
| Latest commit: |
a9e9195
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c06d6bde.cozy-loop-studio.pages.dev |
| Branch Preview URL: | https://frame-id-derived-on-read.cozy-loop-studio.pages.dev |
5 of 6 tasks
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.
Part of #619 (item 4 only; items 1 and 5 stay for their own scopes).
What was wrong
A file whose saved frames repeat an id, or miss one (hand-edited or damaged; Loop Studio never writes one), was read by
readSavedFrames, which gave that frameframe_<time>_<counter>, new on every read. Measured on maindca35c0bbefore this change:canonicalContenton the raw file) differed on every call;contentDigest(which the project reader accepts) is read once to verify and once to load, so it opened already changed;No bundled example or Template has such a file: the 11 bundled JSON files with saved frames all have unique ids.
The change (
src/model/serialize.ts,readSavedFrames)xbecomesx_2,x_3, …frame_<p>,pthe entry's 1-based position in the file'sframesarray, thenframe_<p>_2, …A file with unique ids reads as before, and so does every file Loop Studio has written, since those hold unique ids.
Specs
The two specs disagreed.
docs/large-graph-readability-saved-frames.mdasked that a file with clashing ids "still loads deterministically".docs/specs/SEMANTICS-R5.md§R5-1.1 said "a fresh session id is assigned on read". Both now state the derived rule:SEMANTICS-R5.md: the §R5-1.1 row and R5-D5.large-graph-readability-saved-frames.md: the read rule and the SF9 test list.Tests, written first
On main's code, 7 of the new tests fail; with the change all pass.
src/model/serialize.test.ts:frame_dup,frame_dup_2,frame_dup_3on both reads.frame_one,frame_2on both reads.a, a, (missing), a_2, frame_3: main gives time-based ids; the change givesa, a_3, frame_3_2, a_2, frame_3, the same on both reads.src/store/frameIdOnRead.test.ts:importFile), with a repeated and with a missing id: main gives different ids per open; the change gives the same ids. The first step isa 3, b 1both times, before and after.contentDigest, viarouteImportthenrefreshDirty: changed on main, unchanged with the change.proposedGraph), read twice: different frame ids on main, the same with the change. This is the only proposal check: the proposal path itself is not changed, as agreed.Checks
npx tsc -b: clean.npm run lint: 88 warnings, the baseline.check:*scripts: pass.What it touches