Repository navigation
refactor: decide what the data check holds in one place - #1091
Merged
Merged
Conversation
The invalid data policy's parts were in the domain (deckSetAside, arrangementSetAside), but how they combine into "may this be written" was in a ui hook, useDataCheck's readOnly, and only a rendered test could reach it. holdOf takes the check's state and what is written to (the instance, the catalog, a list of decks or one deck) and says why the write waits, or null. It is tested once, for every policy, status and target, and readOnly now answers from it. Refs: #1090
Each Studio container combined readOnly with arrangementSetAside or isSetAside itself, in three ways for the same three targets. A new screen copied one of the expressions, and nothing checked it picked the right one. useDataCheck now offers hold(target), answered by holdOf, in place of readOnly. The containers ask it about the catalog, their list of decks or one deck, and the notice's subject is that target's kind. What each screen holds is as before. Refs: #1090
Home's move lock still read arrangementSetAside itself, the one Studio write decision left outside the data check's hold. It was safe only because nothing can be selected while the check holds the decks. The lock now asks hold about the catalog, beside the newer-version lock, so it says why for every reason the catalog waits: the check being made, one that could not be made or blocks the instance, and the arrangement set aside. Refs: #1090
DeckListScreen held no deck unless told to, so Solid Memo's deck list let a set-aside deck be renamed, paused and deleted only because it left deckHeld out, while the Studio's Groups holds them. The difference was intended, but could only be seen by comparing the two containers. deckHeld is now required: the deck list passes a choice that holds none, with the reason beside it, and the invalid data policy's page says what a set-aside deck still offers there. Closes: #1090
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.
What and why
Each Studio screen worked out for itself whether the data check holds its writes. It combined
useDataCheck'sreadOnlywitharrangementSetAsideorisSetAside, in three different ways for the same three kinds of target. A new screen copied one of those expressions, and nothing checked that it picked the right one. The rule itself sat in a ui hook, where only a rendered test could reach it. Solid Memo's deck list and the Studio's Groups also differ, on purpose, in what they hold for a set-aside deck, but that difference only showed when you compared the two containers.Four commits:
holdOfin the domain (validation.ts, next todeckSetAsideandarrangementSetAside). It takes the check's state (the policy, and whether the check is pending, failed or has a report) and a target: the instance's own documents, the catalog, a list of decks or one deck. It returns why a write to that target waits (checking,unchecked,blockedorsetAside), or null. It's tested once, for every policy, status and target.readOnlyalready answers from it in this commit.hold(target)replacesreadOnlyonDataCheck. The 13 Studio containers ask it about what they write, and none combines the parts itself any more.ReadOnlySubject(what a held screen's notice names) is now taken from the target's kind, so a notice can't name one target while the rule asks about another. What each screen holds is the same as before.arrangementSetAsidedirectly. That was safe only because nothing can be selected while the check holds the decks.DeckListScreen'sdeckHeldis required, so each deck list states which decks it holds. Solid Memo's deck list passes one that holds none, with the reason in a comment. The invalid data policy's section indocs/validation.mdnow says a set-aside deck can still be renamed, paused and deleted there, and that the Studio holds those actions.Choices the issue left open:
instancetarget, which the issue's sketch didn't have. It covers what nothing sets aside one by one: a draft, and Groups' wait while the check runs."catalogue", because the Studio's messages are keyed by it (studio.readOnly.catalogue). The docs say "catalog" in their prose, as cspell requires.Unchanged:
isSetAsideandarrangementSetAsidestay onDataCheckfor the notices and hints that name what is set aside. They no longer decide a write in the Studio.Docs:
docs/validation.mdanddocs/studio.md(sections "Data set aside" and "Groups") describeholdOfandhold.Nothing the app writes to a pod or to localStorage changes.
npm run checkpasses on each commit.Closes: #1090