8000 A Document containing only a list has no paragraph-scope Target by kiran-brahma · Pull Request #75 · kiran-brahma/writing-tool · GitHub
[go: up one dir, main page]

Skip to content

A Document containing only a list has no paragraph-scope Target - #75

Merged
kiran-brahma merged 1 commit into
v1.3from
v1.3-55
Sep 26, 2026
Merged

kiran-brahma merged 1 commit into
v1.3from
v1.3-55

Conversation

@kiran-brahma
Copy link
Copy Markdown
Owner

Closes #55.

What changed

  • src/core/canonicalText.ts — new canonicalParagraphs(tree): every Paragraph with prose, in document order, including Paragraphs inside list items at any depth. The list renderer records where each list item's Paragraph lands (line and marker/indent width) during the same traversal that renders it, so there is still one renderer and one coordinate system. Each entry carries the top-level block index that holds it, and its interval covers the prose only, never the - / 1. marker or indent.
  • src/core/passContext.ts — passContext resolves its Target from canonicalParagraphs rather than filtering top-level paragraph blocks. nearestParagraphIndex is unchanged in logic; its doc comment now says how list Paragraphs resolve.

Acceptance

  • A Document that contains only a list has a paragraph-scope Target: verified by tests (passContext on a bullet-list-only Document returns the first item's Paragraph, with its neighbour as context).
  • The Target's interval sits in the one canonical string, so Containment is unaffected: verified by tests (canonical.slice(interval) equals the Target text for top-level, list-item and nested-list Paragraphs, including escaped prose and trimmed trailing spaces).
  • A Document with no prose at all still has no Target, so the scope's empty message still applies: verified by tests.
  • Existing Target resolution for top-level Paragraphs is unchanged: the existing passContext / critique / modelRuns tests pass as before.
  • Observed in the running app: not verifiable here. Running a paragraph Pass needs a configured Critic, and without one the critic guard fires before the Target check, so the no-Target message can't be reached without a provider key.

Worth reviewing

The cursor reports only a top-level block index ($from.index(0)), so every Paragraph inside a list shares the list's index, and a cursor anywhere in a list resolves to the list's first Paragraph (the existing earlier-on-a-tie rule). Resolving to the item under the cursor would mean the Editor reporting a finer cursor position, which goes beyond this Core-only ticket. If that's wanted, it should be its own ticket.

pnpm test (1002 passed), pnpm typecheck, pnpm run gates and pnpm build all pass. No prompt, schema, migration or UI change.

🤖 Generated with Claude Code


Generated by Claude Code

A Document written only as a list had no paragraph-scope Target, so every
local Pass refused to run. `canonicalParagraphs` now finds the Paragraphs
inside list items, at any depth, from the same traversal that renders them,
and `passContext` resolves its Target from that list. The interval covers
the Paragraph's prose in the one canonical string, never the list marker,
so Containment is unaffected.

Closes #55.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FjB3Gu8vhg5enkAneTdqga
@chatgpt-codex-connector
chatgpt-codex-connector Bot commented Sep 26, 2026 •
Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-26T09:36:57.480676Z 43fcf4d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

0