Repository navigation
Split pages into slices; block fold parses before it applies - #154
Merged
Merged
Conversation
- pages.ts is now wiring only: Pages, HANDLES, pagesFold, PagesView, getPages and the re-exports. The public API is unchanged. - Block queries and commands move into blocks/queries.ts and blocks/commands.ts. linking moves out of reading, which breaks the blocks <-> reading cycle. - Shared pieces get their own modules (events/, titles/, journal/), so properties no longer imports blocks, and the block fold works on any state with blocks and titles. - Builders share build(); commands on existing blocks share onExisting(). Behaviour: a malformed block event from another writer is now skipped whole. Before, a null payload threw in the fold (the folder could not open), and non-string text broke every query. Blocks with no text or a missing/non-string id, which used to show but could not be edited, are now skipped too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Cleans up the inside of
@pbnotes/pagesalong the lines of thebunnyhugskill. The public interface is unchanged:pages.tsexports every name it did before.Structure
pages.tsis wiring only (514 → 155 lines):Pages,HANDLES,pagesFold,PagesView,getPages(the one read that needs both blocks and properties), and the re-exports.blocks/blocks.ts: schema, tree operations, the fold.blocks/queries.ts: the reads.linkingmoves here fromreading, which breaks theblocks↔readingimport cycle.blocks/commands.ts: the event builders and the commands.propertiesno longer importsblocks:events/:NAMESPACE,Named, payload helpers.titles/:spell,titleOf.journal/:DATE_PATTERN,today.blocksandtitles, soblocks.tsno longer knows properties exist.PagesViewis the commands'BlocksViewplus properties.build(), and commands on existing blocks shareonExisting().Behaviour change
The block fold now checks each event before applying it, like the property fold already did. A malformed block event, which only another program writing to the folder could produce, is skipped whole.
block.created/block.editedwithpayload: nullblock.createdwith non-stringtextblock.editedwith non-stringtextblock.createdwith notext, noid, or a numericidblock.createdwith nopageblock.createdwith non-stringafterOpen question: the "no text / numeric id" blocks could be coerced (
String(id),text ?? "") instead of skipped, so they stay visible.Testing
blocks.test.tspins the malformed-event behaviour. It fails onmainand passes here.pagestests: 58 pass. CLI tests pass. The 65 app tests that import@pbnotes/pagespass.tsc --noEmitpasses for the app, and forpageson its own under--strict.🤖 Generated with Claude Code