Skip to content

PT-4763: Report p as the block marker in an implied paragraph - #56

Merged
katherinejensen00 merged 8 commits into
mainfrom
pt-4763-char-style-implied-para
Nov 14, 2026
Merged

katherinejensen00 merged 8 commits into
mainfrom
pt-4763-char-style-implied-para

Conversation

@katherinejensen00

@katherinejensen00 katherinejensen00 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When the caret is in verses outside any paragraph marker (an implied paragraph), StateChangePlugin emitted no state change. Hosts kept the previous block's blockMarker, usually id. Platform.Bible scopes its character-marker menu by blockMarker, so in those verses the menu offered \id's markers (ior) instead of body-text ones (nd, wj, …).

The plugin now counts an implied paragraph as a paragraph and reports p, which ImpliedParaNode.getMarker() already returns. The fix is a predicate change, $isParaNode → $isSomeParaNode, at three sites: two in StateChangePlugin, and the sibling walk in formatPara's \id path, which reporting p now makes reachable. The rest of the PR is tests, TSDoc, the changelog, and the rebuilt dist.

Jira: PT-4763. The paranext-core half (the character-marker bar follows the caret into these verses) is a separate PR, opened after this merges and is staged into core.

Review guide

File What to look at
libs/shared-react/src/plugins/usj/StateChangePlugin.tsx The fix. $isParaNode → $isSomeParaNode at both the verse-block resolution and the reporting guard, plus TSDoc on StateChangeSnapshot.blockMarker: the reported p is not in the file, and accepting it as a style writes an explicit \p.
libs/shared-react/src/plugins/usj/StateChangePlugin.test.tsx 5 new tests in an implied paragraph: reports p; replaces a previous block's id; reports a character marker (nd) as contextMarker; inside a verse block; empty document.
packages/platform/src/editor/Editor.tsx formatPara's \id path: the walk over root siblings after the split guards with $isSomeParaNode, so a selection from \id that ends in an implied paragraph retags it. The \c chapter is still skipped.
packages/platform/src/editor/Editor.test.tsx 3 new tests. formatPara("q1") turns an implied paragraph into a real \q1 that keeps its verses, with undo (passes on main too; it pins the retag path). formatPara on a selection from \id into an implied paragraph retags the verses, with undo. <Editor> with hasExternalUI reports blockMarker id, then p, as the caret moves from \id into an implied paragraph.
packages/platform/CHANGELOG.md Two Fixed entries.
packages/platform/dist/* Rebuilt with pnpm rebuild-committed-output. Skip index.js / .map: the diff is minifier renaming. index.d.ts changes only the TSDoc.

Details

  • Why both plugin sites change together. In the block verse layout, the plugin resolves through the verse block to the paragraph holding the caret, then a guard decides whether to report it. If the two use different predicates, resolution can land on a node the guard rejects, and nothing is emitted. A comment in the code says to keep them in step, and the verse-block test enforces it.
  • Why p, not undefined or a new field. With undefined, the host's character-marker menu has no parent marker, so it is empty and its button is disabled exactly where the user is typing. An isImpliedPara flag on StateChangeSnapshot would grow the public API for one consumer, when p is already what the node reports.
  • Trade-off. A host that shows the paragraph style will show p for text that has no \p, and a host that pre-highlights it lets one Enter write a new \p. In Platform.Bible that is Power mode only, since Simple mode is structure-protected. The TSDoc says so, and the core PR's ADR records it.

Testing

  • pnpm nx run-many -t lint typecheck passes for all 9 projects, and so does test, except two platform files (markerMenuHarness, blockVersePositions) that failed under the full parallel run at about 6× their normal duration and pass when run on their own.
  • The 5 new StateChangePlugin tests fail on main ("expected undefined to be 'p'") and pass here. The verse-block test fails even with only the verse-block lookup reverted.
  • The \id-to-implied-paragraph formatPara test fails on main (the verses keep no paragraph marker). The <Editor> onStateChange test fails with StateChangePlugin reverted.
  • The Editor.test retag test goes red if the formatPara call or the undo is removed.
  • scripts/verify-committed-dist.mjs: committed build output is current.
  • In paranext-core, a contract test that renders the real Editorial from this build sees onStateChange report blockMarker: 'p' in an implied paragraph. It fails against the build currently staged in core.

🤖 Generated with Claude Code


This change is Reviewable

@irahopkinson irahopkinson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irahopkinson+AI made 5 comments.
Reviewable status: 0 of 7 files reviewed, 5 unresolved discussions (waiting on katherinejensen00).


a discussion (no related file):
I thought the editor used to do this, but there probably weren't tests, so it could have been changed. Thanks for fixing this.

I reviewed the implied-paragraph blockMarker change and the tests and changelog around it, and have 5 findings, all minor. Each comment shows the severity I settled on; checked and confirmed means the finding was verified against the code, and needs a human call means it could not be settled either way and is yours to judge.

Findings that could not be attached to a line in this diff

#6 (low · checked and confirmed) packages/platform/src/editor/Editor.tsx:1450 - Changing the paragraph style of a selection that runs from the \id line into verses outside any paragraph marker splits the \id line but leaves those verses' paragraph unchanged.

What happens: on the book path, formatPara calls $splitParagraphWithMarker (Editor.tsx:1419), then walks the root siblings after the new paragraph and retags only those where $isParaNode(sibling) holds (Editor.tsx:1450). An ImpliedParaNode fails $isParaNode, so when the selection ends in one, the walk reaches it as isEndBlock (Editor.tsx:1446) and breaks without retagging it.

Why it matters: the behavior predates this PR (Editor.tsx is unchanged), but the \id, \c, bare-verses layout is the one this change makes the paragraph menu usable in. Reaching it takes a drag from the book line across the chapter into the verses; the result is a partial retag, with no text lost.

Fix: At Editor.tsx:1450, change $isParaNode(sibling) to $isSomeParaNode(sibling) (import it from shared next to $isParaNode) so an implied paragraph reached as the end block is retagged too. The \c chapter node must stay excluded, which $isSomeParaNode does. Add a formatPara test in Editor.test.tsx for a selection anchored in the \id line and ending in an implied paragraph, asserting both the split and that the verses end up in a paragraph with the picked marker, and that undo restores the original USJ. Add a ### Fixed entry under ## [Unreleased] in packages/platform/CHANGELOG.md and rebuild dist/ and etc/ with pnpm rebuild-committed-output.

Not attached to a line: this finding is in a file the pull request does not change, so the review has no file to attach a comment to

(AI-assisted, with my guidance)


packages/platform/src/editor/Editor.test.tsx line 2082 at r1 (raw file):

  });

  // Verses outside any paragraph marker load as an implied paragraph, which reports `p` as its

#4 - low · checked and confirmed

The comment above the new retag test says the reported p is what lets the menu offer the retag, but the test neither reads the reported marker nor goes through a menu.

What happens: the comment at Editor.test.tsx:2082-2083 ties the test to the implied paragraph reporting p as its block marker. The test body places the caret with lexicalEditor.update and calls formatPara("q1") directly, and never passes or reads onStateChange; formatPara (Editor.tsx:1355) is unchanged by this PR, so the test passes on the merge base too.

Why it matters: maintenance only - a reader takes the test as covering the new reporting when it covers only the retag path.

Fix: reword the comment at Editor.test.tsx:2082-2083 to say the test pins that formatPara retags an implied paragraph, a path hosts reach once the block marker is reported, without claiming the test checks the report.

How this was checked: The comment at Editor.test.tsx:2082-2083 (added by this PR) says the implied paragraph "reports p as its block marker, so the paragraph menu offers to retag it". The test body (about 2084-2125) mounts via mountEditorForUndo, places the caret with lexicalEditor.update, calls getEditorRef(ref).formatPara("q1") directly and asserts getUsj() content. It never passes or reads onStateChange and never renders a menu, so it checks only the retag path, which the PR leaves unchanged. The comment therefore attributes coverage of the reporting to a test that does not cover it. Maintenance-only impact.

Other findings in this file: #5


packages/platform/src/editor/Editor.test.tsx line 2084 at r1 (raw file):

  // Verses outside any paragraph marker load as an implied paragraph, which reports `p` as its
  // block marker, so the paragraph menu offers to retag it like any other paragraph.
  it("retags an implied paragraph into a real paragraph that keeps its verses", async () => {

#5 - low · checked and confirmed

No test checks that the platform <Editor> reports blockMarker: "p" to its host's onStateChange in verses outside any paragraph marker.

What happens: the new reporting is tested only at plugin level, in StateChangePlugin.test.tsx:142-228 through baseTestEnvironment. The one new <Editor>-level test (Editor.test.tsx:2084) exercises formatPara and never passes onStateChange, the prop hosts consume (packages/platform/src/editor/editor.model.ts:1057).

Why it matters: test-only, with no behavior effect today. paraMarkerSelection.test.tsx:214-222 already covers the onStateChange wiring for an explicit paragraph, so the gap is only the implied-paragraph case end to end through <Editor>.

Fix: add an <Editor>-level test in packages/platform/src/editor/ that passes onStateChange, places the caret in an implied paragraph via <EditorRefPlugin editorRef={ref} />, and expects blockMarker: "p", following packages/platform/src/editor/paraMarkerSelection.test.tsx:221.

How this was checked: The new implied-paragraph behavior ($isSomeParaNode in libs/shared-react/src/plugins/usj/StateChangePlugin.tsx) is pinned only by StateChangePlugin.test.tsx. The one new Editor.test.tsx test (about 2084) never passes onStateChange and asserts getUsj() content after formatPara. No Editor-level test asserts blockMarker "p" for an implied paragraph; grep of Editor.test.tsx finds no blockMarker or onStateChange assertion at all. paraMarkerSelection.test.tsx:214-222 covers the onStateChange wiring generically (blockMarker "li2"), and Editor.tsx handleStateChange (about 2012) forwards the snapshot unchanged, so the wiring itself is already covered and the remaining gap is small: only the implied-paragraph case through the full Editor.

Other findings in this file: #4


libs/shared-react/src/plugins/usj/StateChangePlugin.test.tsx line 142 at r1 (raw file):

// character-marker menus by the reported block marker, so an implied paragraph must report one -
// the default paragraph marker - or the host stays on whichever block it last heard about.
describe("StateChangePlugin in an implied paragraph", () => {

#1 - low · checked and confirmed

Reverting the verse-block lookup at StateChangePlugin.tsx:102 to $isParaNode leaves StateChangePlugin.test.tsx passing, though the block-verse view then reports no block marker for verses outside any paragraph marker.

What happens: in the block-verse layout a verse block can hold an implied paragraph (packages/platform/src/editor/adaptors/verse-block-utils.test.ts:292), and StateChangePlugin.tsx:102 resolves through it with $isSomeParaNode. The four tests under describe("StateChangePlugin in an implied paragraph") (StateChangePlugin.test.tsx:142-228) all place the implied paragraph at the root, never inside $createVerseBlockNode, and the helper $textInBlockPara throws on anything that is not a ParaNode (line 56).

Why it matters: test-only, with no behavior effect today; the source comment says to keep both sites on the same predicate, and no test enforces it. The PR description notes this case as not separately tested, but gives no reason to leave it that way, and the test below is small enough to add here.

Fix: add a test that builds $createVerseBlockNode("1") holding a $createImpliedParaNode() with the block-verse node set and expects blockMarker "p", and widen $textInBlockPara at StateChangePlugin.test.tsx:56 to accept $isSomeParaNode.

How this was checked: In a separate worktree I reverted StateChangePlugin.tsx:102 to $isParaNode (adding the import it needs) and ran StateChangePlugin.test.tsx: all 8 tests passed. The four implied-paragraph tests (StateChangePlugin.test.tsx:142-228) put $createImpliedParaNode() at the root, never inside $createVerseBlockNode, and $textInBlockPara (line 56) throws unless the node is a $isParaNode. I then added the proposed test, a verse block holding an implied paragraph with $textInBlockPara widened to $isSomeParaNode. It fails under the revert (expected undefined to be 'p') and passes on the real code. The gap is test-only, with no behavior effect today.


libs/shared-react/src/plugins/usj/StateChangePlugin.tsx line 114 at r1 (raw file):

      if (
        elementDOM !== null &&
        ($isSomeParaNode(node) || $isBookNode(node) || $isImmutableChapterNode(node))

#2 - low · checked and confirmed

In verses outside any paragraph marker, Platform.Bible's paragraph-style menu now opens with p pre-highlighted, so pressing Enter on the highlighted entry writes a new \p marker into text that had none.

What happens: ImpliedParaNode.getMarker() returns PARA_MARKER_DEFAULT (libs/shared/src/nodes/usj/ImpliedParaNode.ts:30-32). The guard at StateChangePlugin.tsx:112-116 now accepts $isSomeParaNode(node) and reports blockMarker: node.getMarker(), i.e. p. A host that passes blockMarker as its menu's default highlight (Platform.Bible's paragraph-style-trigger.component.tsx passes defaultHighlightedMarker={blockMarker}) then offers p as the current style; choosing it runs formatPara("p"), which replaces the implied paragraph with an explicit ParaNode \p.

Why it matters: a user who opens the menu and presses Enter without moving the highlight changes the file's USFM without intending to. Reporting p is deliberate and the host owns the highlight choice, so the library's part is only to document what accepting p does.

Fix: Extend the blockMarker TSDoc on StateChangeSnapshot (libs/shared-react/src/plugins/usj/StateChangePlugin.tsx:32-35) to say that the p reported for an implied paragraph is not an explicit marker: a host that offers p as the current style (for example by pre-highlighting it) will, when the user accepts it, run EditorRef.formatPara("p"), which replaces the implied paragraph with an explicit \p paragraph. Keep the TSDoc free of ticket IDs, then run pnpm rebuild-committed-output so packages/platform/dist/index.d.ts and etc/ match the new comment in the same PR.

@katherinejensen00

Copy link
Copy Markdown
Contributor Author

All five addressed in 4061d55..bd09b63.

#6 (formatPara from \id into an implied paragraph): fixed in 4061d55. The sibling walk in formatPara's \id path now guards with $isSomeParaNode, so an implied paragraph that the selection ends in is retagged. The \c chapter is still skipped. New test: "retags an implied paragraph that a selection from the \id line ends in", with the anchor in \id and the focus in verse 2. It asserts the split, the \c left alone, both verses in the new \q1, and undo restoring the original USJ. Without the fix it fails: the verses keep no paragraph marker. Changelog entry added under Fixed.

#4 (retag test comment): reworded in 4061d55. It now says the test pins that formatPara retags an implied paragraph without losing its verses, and points to the onStateChange test for the reporting.

#5 (<Editor>-level onStateChange): added describe("onStateChange in an implied paragraph") in Editor.test.tsx (4061d55). It renders <Editor> with hasExternalUI: true, the path Platform.Bible takes, captures Lexical with <EditorRefPlugin>, moves the caret from \id into verse 2, and expects blockMarker id, then p. With StateChangePlugin reverted to $isParaNode, it fails with expected undefined to be 'p'.

#1 (implied paragraph inside a verse block): added as proposed (2a35109). $textInBlockPara accepts $isSomeParaNode, and the new test puts an implied paragraph inside $createVerseBlockNode("1"). I reproduced your result: with only the verse-block lookup reverted, this test fails (expected undefined to be 'p') and the other 8 still pass.

#2 (pre-highlighted p writes \p): documented on StateChangeSnapshot.blockMarker (e39a125). The reported p is not in the file. If a host offers it as the current style and the user accepts it, the resulting formatPara("p") replaces the implied paragraph with an explicit \p. I checked that by running the retag test with p; it produces { type: "para", marker: "p", … }. dist/ is rebuilt (bd09b63) and verify-committed-dist passes. etc/ is unchanged, since TSDoc isn't in the API report.

I've updated the PR description to match: three predicate sites, not two, and the "not separately tested" note is gone.

katherinejensen00 and others added 8 commits November 13, 2026 15:38
Verses outside any paragraph marker live in an ImpliedParaNode, which
StateChangePlugin did not count as a paragraph, so onStateChange never
fired there and hosts kept the previous block's marker (often `id`).
Hosts scope their character-marker menus by blockMarker, so the menu
offered the wrong markers in those verses.

Count ImpliedParaNode as a paragraph at both sites (verse-block
resolution and the reporting guard) via $isSomeParaNode; it reports the
default paragraph marker `p`. Rebuilt packages/platform/dist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
formatPara on verses outside any paragraph marker wraps them in a real
paragraph that keeps its verses, and undo restores the original USJ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getViewOptions() returns ViewOptions | undefined, which
mountEditorForUndo's `view: ViewOptions` rejects, so the platform-editor
typecheck failed in CI. Use editorView("standard") from the view test
helpers, which wraps requireViewOptions(STANDARD_VIEW_MODE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
formatPara's book path splits the \id line, then walks the root siblings
up to the block the selection ends in. The walk only retagged ParaNodes,
so an implied paragraph at the end of the selection kept no paragraph
marker. It now guards with $isSomeParaNode; the \c chapter is still
skipped.

Also adds an <Editor>-level test that onStateChange reports `p` when the
caret moves from the \id line into an implied paragraph, and rewords the
existing retag test's comment so it no longer claims to cover reporting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The block verse layout resolves through the verse block to the paragraph
holding the caret, and that lookup must accept an implied paragraph just
as the reporting guard does. Nothing pinned it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A host that offers the reported `p` as the current style and lets the
user accept it calls formatPara("p"), which replaces the implied
paragraph with an explicit \p.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@katherinejensen00
katherinejensen00 force-pushed the pt-4763-char-style-implied-para branch from bd09b63 to 17c5416 Compare November 13, 2026 23:45

@irahopkinson irahopkinson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irahopkinson+AI made 5 comments and resolved 5 discussions.
Reviewable status: 0 of 8 files reviewed, all discussions resolved.


a discussion (no related file):

Previously, irahopkinson+AI (Agent AI for Ira Hopkinson) wrote…

I thought the editor used to do this, but there probably weren't tests, so it could have been changed. Thanks for fixing this.

I reviewed the implied-paragraph blockMarker change and the tests and changelog around it, and have 5 findings, all minor. Each comment shows the severity I settled on; checked and confirmed means the finding was verified against the code, and needs a human call means it could not be settled either way and is yours to judge.

Findings that could not be attached to a line in this diff

#6 (low · checked and confirmed) packages/platform/src/editor/Editor.tsx:1450 - Changing the paragraph style of a selection that runs from the \id line into verses outside any paragraph marker splits the \id line but leaves those verses' paragraph unchanged.

What happens: on the book path, formatPara calls $splitParagraphWithMarker (Editor.tsx:1419), then walks the root siblings after the new paragraph and retags only those where $isParaNode(sibling) holds (Editor.tsx:1450). An ImpliedParaNode fails $isParaNode, so when the selection ends in one, the walk reaches it as isEndBlock (Editor.tsx:1446) and breaks without retagging it.

Why it matters: the behavior predates this PR (Editor.tsx is unchanged), but the \id, \c, bare-verses layout is the one this change makes the paragraph menu usable in. Reaching it takes a drag from the book line across the chapter into the verses; the result is a partial retag, with no text lost.

Fix: At Editor.tsx:1450, change $isParaNode(sibling) to $isSomeParaNode(sibling) (import it from shared next to $isParaNode) so an implied paragraph reached as the end block is retagged too. The \c chapter node must stay excluded, which $isSomeParaNode does. Add a formatPara test in Editor.test.tsx for a selection anchored in the \id line and ending in an implied paragraph, asserting both the split and that the verses end up in a paragraph with the picked marker, and that undo restores the original USJ. Add a ### Fixed entry under ## [Unreleased] in packages/platform/CHANGELOG.md and rebuild dist/ and etc/ with pnpm rebuild-committed-output.

Not attached to a line: this finding is in a file the pull request does not change, so the review has no file to attach a comment to

(AI-assisted, with my guidance)

Confirmed at 17c5416: the new test fails without the guard change. Thanks.


libs/shared-react/src/plugins/usj/StateChangePlugin.tsx line 114 at r1 (raw file):

Previously, irahopkinson+AI (Agent AI for Ira Hopkinson) wrote…

#2 - low · checked and confirmed

In verses outside any paragraph marker, Platform.Bible's paragraph-style menu now opens with p pre-highlighted, so pressing Enter on the highlighted entry writes a new \p marker into text that had none.

What happens: ImpliedParaNode.getMarker() returns PARA_MARKER_DEFAULT (libs/shared/src/nodes/usj/ImpliedParaNode.ts:30-32). The guard at StateChangePlugin.tsx:112-116 now accepts $isSomeParaNode(node) and reports blockMarker: node.getMarker(), i.e. p. A host that passes blockMarker as its menu's default highlight (Platform.Bible's paragraph-style-trigger.component.tsx passes defaultHighlightedMarker={blockMarker}) then offers p as the current style; choosing it runs formatPara("p"), which replaces the implied paragraph with an explicit ParaNode \p.

Why it matters: a user who opens the menu and presses Enter without moving the highlight changes the file's USFM without intending to. Reporting p is deliberate and the host owns the highlight choice, so the library's part is only to document what accepting p does.

Fix: Extend the blockMarker TSDoc on StateChangeSnapshot (libs/shared-react/src/plugins/usj/StateChangePlugin.tsx:32-35) to say that the p reported for an implied paragraph is not an explicit marker: a host that offers p as the current style (for example by pre-highlighting it) will, when the user accepts it, run EditorRef.formatPara("p"), which replaces the implied paragraph with an explicit \p paragraph. Keep the TSDoc free of ticket IDs, then run pnpm rebuild-committed-output so packages/platform/dist/index.d.ts and etc/ match the new comment in the same PR.

Confirmed at 17c5416, thanks.


libs/shared-react/src/plugins/usj/StateChangePlugin.test.tsx line 142 at r1 (raw file):

Previously, irahopkinson+AI (Agent AI for Ira Hopkinson) wrote…

#1 - low · checked and confirmed

Reverting the verse-block lookup at StateChangePlugin.tsx:102 to $isParaNode leaves StateChangePlugin.test.tsx passing, though the block-verse view then reports no block marker for verses outside any paragraph marker.

What happens: in the block-verse layout a verse block can hold an implied paragraph (packages/platform/src/editor/adaptors/verse-block-utils.test.ts:292), and StateChangePlugin.tsx:102 resolves through it with $isSomeParaNode. The four tests under describe("StateChangePlugin in an implied paragraph") (StateChangePlugin.test.tsx:142-228) all place the implied paragraph at the root, never inside $createVerseBlockNode, and the helper $textInBlockPara throws on anything that is not a ParaNode (line 56).

Why it matters: test-only, with no behavior effect today; the source comment says to keep both sites on the same predicate, and no test enforces it. The PR description notes this case as not separately tested, but gives no reason to leave it that way, and the test below is small enough to add here.

Fix: add a test that builds $createVerseBlockNode("1") holding a $createImpliedParaNode() with the block-verse node set and expects blockMarker "p", and widen $textInBlockPara at StateChangePlugin.test.tsx:56 to accept $isSomeParaNode.

How this was checked: In a separate worktree I reverted StateChangePlugin.tsx:102 to $isParaNode (adding the import it needs) and ran StateChangePlugin.test.tsx: all 8 tests passed. The four implied-paragraph tests (StateChangePlugin.test.tsx:142-228) put $createImpliedParaNode() at the root, never inside $createVerseBlockNode, and $textInBlockPara (line 56) throws unless the node is a $isParaNode. I then added the proposed test, a verse block holding an implied paragraph with $textInBlockPara widened to $isSomeParaNode. It fails under the revert (expected undefined to be 'p') and passes on the real code. The gap is test-only, with no behavior effect today.

Confirmed at 17c5416, thanks.


packages/platform/src/editor/Editor.test.tsx line 2082 at r1 (raw file):

Previously, irahopkinson+AI (Agent AI for Ira Hopkinson) wrote…

#4 - low · checked and confirmed

The comment above the new retag test says the reported p is what lets the menu offer the retag, but the test neither reads the reported marker nor goes through a menu.

What happens: the comment at Editor.test.tsx:2082-2083 ties the test to the implied paragraph reporting p as its block marker. The test body places the caret with lexicalEditor.update and calls formatPara("q1") directly, and never passes or reads onStateChange; formatPara (Editor.tsx:1355) is unchanged by this PR, so the test passes on the merge base too.

Why it matters: maintenance only - a reader takes the test as covering the new reporting when it covers only the retag path.

Fix: reword the comment at Editor.test.tsx:2082-2083 to say the test pins that formatPara retags an implied paragraph, a path hosts reach once the block marker is reported, without claiming the test checks the report.

How this was checked: The comment at Editor.test.tsx:2082-2083 (added by this PR) says the implied paragraph "reports p as its block marker, so the paragraph menu offers to retag it". The test body (about 2084-2125) mounts via mountEditorForUndo, places the caret with lexicalEditor.update, calls getEditorRef(ref).formatPara("q1") directly and asserts getUsj() content. It never passes or reads onStateChange and never renders a menu, so it checks only the retag path, which the PR leaves unchanged. The comment therefore attributes coverage of the reporting to a test that does not cover it. Maintenance-only impact.

Other findings in this file: #5

Confirmed at 17c5416, thanks.


packages/platform/src/editor/Editor.test.tsx line 2084 at r1 (raw file):

Previously, irahopkinson+AI (Agent AI for Ira Hopkinson) wrote…

#5 - low · checked and confirmed

No test checks that the platform <Editor> reports blockMarker: "p" to its host's onStateChange in verses outside any paragraph marker.

What happens: the new reporting is tested only at plugin level, in StateChangePlugin.test.tsx:142-228 through baseTestEnvironment. The one new <Editor>-level test (Editor.test.tsx:2084) exercises formatPara and never passes onStateChange, the prop hosts consume (packages/platform/src/editor/editor.model.ts:1057).

Why it matters: test-only, with no behavior effect today. paraMarkerSelection.test.tsx:214-222 already covers the onStateChange wiring for an explicit paragraph, so the gap is only the implied-paragraph case end to end through <Editor>.

Fix: add an <Editor>-level test in packages/platform/src/editor/ that passes onStateChange, places the caret in an implied paragraph via <EditorRefPlugin editorRef={ref} />, and expects blockMarker: "p", following packages/platform/src/editor/paraMarkerSelection.test.tsx:221.

How this was checked: The new implied-paragraph behavior ($isSomeParaNode in libs/shared-react/src/plugins/usj/StateChangePlugin.tsx) is pinned only by StateChangePlugin.test.tsx. The one new Editor.test.tsx test (about 2084) never passes onStateChange and asserts getUsj() content after formatPara. No Editor-level test asserts blockMarker "p" for an implied paragraph; grep of Editor.test.tsx finds no blockMarker or onStateChange assertion at all. paraMarkerSelection.test.tsx:214-222 covers the onStateChange wiring generically (blockMarker "li2"), and Editor.tsx handleStateChange (about 2012) forwards the snapshot unchanged, so the wiring itself is already covered and the remaining gap is small: only the implied-paragraph case through the full Editor.

Other findings in this file: #4

Confirmed at 17c5416, thanks.

@irahopkinson irahopkinson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@irahopkinson made 1 comment.
Reviewable status: 0 of 8 files reviewed, all discussions resolved (waiting on irahopkinson+AI).

@katherinejensen00
katherinejensen00 merged commit a537920 into main Nov 14, 2026
5 of 6 checks passed
@katherinejensen00
katherinejensen00 deleted the pt-4763-char-style-implied-para branch November 14, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants