The editor's note lookup reads through its block lookup - #682
Merged
Merged
Conversation
block_note/2 in the editor found its block with its own
Enum.find over Document.blocks/1, the same lookup block_by_id/2 in the
module already does. It now reads through block_by_id/2. Every caller
passes the socket's document, which block_by_id/2's %Document{} match
accepts, so what the note reads is unchanged: the block's note, the
empty string for a stored block with no note key, nil for an id the
document no longer holds.
Internal refactor; no changelog fragment. Sabotaged: making the found
block's note read as empty turned four note field tests red.
Gate: full mix quality green on this staged tree (3,951 of 3,951
tests, 95.3% coverage, dialyzer clean, ADR cites green).
Refs: sb-n3ue
johnnyt
force-pushed
the
sb-n3ue-note-lookup-dedupe
branch
from
September 30, 2026 11:18
1e0c36c to
c3560ce
Compare
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
block_note/2inlib/statifier_blocks/editor.exfound its block with its ownEnum.find(Document.blocks(document), &(&1.id == id)), the lookupblock_by_id/2in the same module already does. It now reads throughblock_by_id/2; the rest of the function is unchanged.Behaviour is unchanged. Both callers of
block_note/2,selected_note/2and the"note-change"event handler, pass the socket's document, a%Document{}, which is whatblock_by_id/2matches. For an id the document holds, the block's note is read as before (the empty string for a stored block with no:notekey); for an id it no longer holds,nilas before. No public function changes what it answers.Internal refactor: no changelog fragment (
changelog.d/README.mdexcludes internal refactors).Sabotage
Not a new test; a check that the existing note tests reach the note read on its new path. Mutation:
block_note/2answering the empty string for any found block.StatifierBlocks.Editor.NoteFieldTestwent red on four tests, among them "the note textarea a change applies the command, and undo and redo move the note" (assertion). Reverted from a copy, byte-equal, recompiled.Gate
Full
mix qualitygreen on the committed tree: 3,951 of 3,951 tests, 95.3% coverage, dialyzer clean, ADR cites green.Review
In-turn review: re-read the diff against the bead. The acceptance asks that
block_note/2read throughblock_by_id/2, behaviour unchanged; the one-line change does that, and the two lookups were the sameEnum.findoverDocument.blocks/1by id. The separateblock_by_idinlib/statifier_blocks/core/deadline_recipe.exis a different module's private helper and is untouched.Refs: sb-n3ue