Skip to content

fix(web): renumber following items when inserting into a numbered list - #14332

Open
saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:fix/composer-renumber-ordered-list
Open

saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:fix/composer-renumber-ordered-list

Conversation

@saphid

@saphid saphid commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

In the composer, Shift+Enter inside a numbered list now renumbers the items below the new one, not just the new item itself.

listContinuationForEnter (apps/web/src/composer-list-continuation.ts) now also rewrites the numbers of the ordered items that follow:

  • It walks the contiguous run of items at the same indent width and delimiter.
  • It skips deeper-indented children and lines that sit inside a multi-line chip.
  • It stops at a blank line or a shallower line.
  • Items that are already in sequence are left untouched. Explicitly zero-padded markers (01.) keep their width; others don't gain padding.

The edit now carries an explicit expanded cursorAfter so the caret still lands right after the new marker even though the replaced range extends past it. Tab uses the same field with its previous offset.

Why

Put the caret at the start of an earlier item's text and press Shift+Enter to push it down. The pushed item gets the next number, but everything below keeps its old number, leaving duplicates (1. 2. 3. 3.). Enter only ever inserted a single marker and never looked at later lines. Fixing it where the marker is inserted keeps both composer modes identical, because they share this store-replacement path.

Bullets, tasks, the empty-item exit path, and non-list lines behave as before.

UI Changes

Fresh attached-preview verification on disposable data. Same project, list and viewport on current main c18e5ea and clean candidate d630285. At the end of item 2, press Shift+Enter and type into the inserted item.

Before (current main): the following item keeps 3, leaving duplicate numbers.

Before: inserting an item leaves the list numbered 1, 2, 3, 3

After (candidate): the following item becomes 4; typing stays in the inserted item.

After: inserting an item produces 1, 2, 3, 4 with the caret in the new item

Full recordings: before · after. GIFs show the first seven seconds sampled at 10 fps, at real-time speed, cropped to the full composer and heading. Recordings retain the full viewport. Screenshots: before · after.

Verification

  • Five focused composer suites: 220 tests passed, exit 0. Keeping the new regression tests on baseline source produces 8 failures; restoring the candidate passes all 19 list tests.
  • Web typecheck passed. Scoped lint has no errors and no new warnings; its 43 warnings match the baseline.
  • Live preview: middle-list insertion and caret placement pass in rich and literal modes. Cmd+Z restores the original list. File-chip insertion, splitting after the chip, and Tab indentation preserve the chip and text.
  • Fresh independent GPT-6 Astra review through Codex found no correctness blockers. A nonblocking performance observation remains for unusually large lists: token scanning grows with lines × chips.
  • Desktop shares the web composer but was not run separately. Mobile uses its own composer and is unaffected. No provider message was submitted during verification.

Original implementation: Claude Sonnet 5.5 and Claude Opus 5.5 in Claude Code. Readiness audit: GPT-6.1 Sol through Codex. Independent review and attached-preview verification: GPT-6 Astra through Codex in T3 Code.

… the composer

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 29, 2026
@saphid
saphid marked this pull request as ready for review September 30, 2026 00:44
@saphid saphid changed the title fix(web): renumber following list items when Enter splits a numbered item fix(web): renumber following items when inserting into a numbered list Sep 30, 2026
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Sep 30, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 30, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d630285

Macroscope's review found this PR approvable — The PR is a localized web composer bug fix that renumbers only the affected ordered-list run and preserves existing behavior for other composer paths. Its production changes are self-contained and accompanied by focused regression coverage, with no schema, deployment, security, billing, or static-analysis changes.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6d2c4faf-588f-4d74-b82e-a9e3d99e977a

📥 Commits

Reviewing files that changed from the base of the PR and between 8792f95 and d630285.

📒 Files selected for processing (3)
  • apps/web/src/components/chat/ChatComposer.tsx
  • apps/web/src/composer-list-continuation.test.ts
  • apps/web/src/composer-list-continuation.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Enter continuation can renumber matching ordered-list items below the current item. List edits now return explicit caret offsets, which ChatComposer applies after Enter and Tab edits.

Changes

Composer list editing

Layer / File(s) Summary
List continuation and edit results
apps/web/src/composer-list-continuation.ts, apps/web/src/composer-list-continuation.test.ts
List edits return the caret offset after the edit. Enter continuation can renumber following ordered items with matching indentation and delimiter. The scan accounts for inline chips and stops at blank or nonmatching lines. Tests cover numbering, boundaries, caret placement, and chip offsets.
Apply returned caret offsets
apps/web/src/components/chat/ChatComposer.tsx
Enter continuation and Tab indentation use edit.cursorAfter to set the caret.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to d6302

The list-renumbering and caret updates have no identified merge-blocking issue. Mergeable after normal checks; runtime editor interaction was not independently exercised.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to d6302

The change remains within local composer editing. It preserves structured references, existing input restrictions, and submission behavior while correcting numbering and caret placement. No material security risk was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The effective changed surface is the current composer prompt and its caret. The inspected path grants no additional service, tenant, tool, credential, or context-payload authority.

Trust Boundaries and Controls

  • observed — User-authored prompt text remains input to a local text transformation. Carets inside inline tokens are rejected, multiline-chip interiors are skipped, and intervening chip source is preserved rather than interpreted or rewritten.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: renumbering following items when inserting into a numbered list. It is concise and specific.
Description check ✅ Passed The description covers what changed, why it changed, UI verification, test results, typecheck and lint results, scope limitations, and checklist-related information. The UI evidence is included, and t…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 1, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 1, 2026 20:52

Dismissing prior approval to re-evaluate d630285

…bers unpadded

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@saphid
saphid force-pushed the fix/composer-renumber-ordered-list branch from d630285 to 3ba1166 Compare October 5, 2026 04:43
@saphid

saphid commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Review requested

Date (UTC) Reviewer Where
2026-10-03 Julius Discord DM

Logged so this PR shows when a maintainer was asked to review it.

@saphid

saphid commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Review requested

Date (UTC) Reviewer Where
2026-10-06 Maria Discord DM

Logged so this PR shows when a maintainer was asked to review it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants