Skip to content

refactor(composer): give the approval redirect wiring readable lines - #847

Merged
astyfx merged 1 commit into
mainfrom
refactor/composer-approval-redirect-lines
Oct 28, 2026
Merged

astyfx merged 1 commit into
mainfrom
refactor/composer-approval-redirect-lines

Conversation

@astyfx

@astyfx astyfx commented Oct 28, 2026

Copy link
Copy Markdown
Member

Summary

When #845 was merged, the composer's approval redirect code was squeezed onto single lines so ChatInputComposer.tsx stayed under its max-lines ratchet. The longest was the redirect submit call, about 330 characters. Others were the redirect-mode call, the approval-shortcuts hook call, the steerSubmission and isDraftCurrent one-liners, and the onEmptyEditorKey prop with a trailing comment. This PR expands those lines and makes room by moving the submit's draft handling and send out of the component. Behavior is unchanged.

Changes

  • ChatInputComposer.tsx: the redirect lines from feat(composer): keep the composer usable while an approval is pending #845 now use multi-line object arguments, and their comments sit on their own line above the code. The component goes from 1843 to 1825 lines.
  • New src/components/session/composer-submission.ts:
    • trackSubmittedDraft checks whether the editor still shows the submitted draft (same task, same text) before it clears the draft, and restores the draft only into an empty editor on its task. It replaces the restoreSubmittedDraft, clearSubmittedDraft and isDraftCurrent closures, which repeated that check.
    • sendComposerSubmission sends a submit through the approval redirect (submitApprovalRedirect) or a plain sendUserMessage, then clears or restores the draft based on the outcome. The redirect still clears Lens annotations only once the message is delivered.
  • config/max-lines-ratchet.json: the ChatInputComposer.tsx limit drops from 1845 to 1826.
  • docs/architecture/code-organization.md: the redirect row names the new module and its test.
  • New tests/composer-submission.test.ts covers the draft checks, plain-send outcomes (steered, blocked, steer-unavailable, queued) and the redirect order: send first, then clear Lens annotations and the draft.

Lines over 160 characters that were already there before #845 stay as they are (the mentions hooks, the ComposerShelf line and the compare-history description).

Verification

  • bun run lint: pass. No new warnings; the one warning in this file, about queuedTurns, is already on main.
  • bun run typecheck: pass
  • bun run check:max-lines-ratchet: pass (64 files)
  • bun run check:switch-exhaustiveness: pass
  • bun run check:doc-paths: pass (112 Markdown files)
  • bun run check:i18n: pass
  • bun test tests/composer-submission.test.ts tests/approval-redirect-send.test.ts tests/approval-redirect-store.test.ts tests/prompt-input-submit-labels.test.ts tests/prompt-input-utils.test.ts tests/chat-input-utils.test.ts tests/chat-input.runtime.test.ts: 103 pass, 0 fail
  • bunx --bun playwright test tests/e2e/composer-approval-request.e2e.ts: 6 passed
  • bunx --bun playwright test tests/e2e/attachment-execution-notice.e2e.ts: 5 passed (plain sends from the composer)
  • bun run build:pages: pass

🤖 Generated with Claude Code

The merge of #845 squeezed the composer's approval redirect code onto
single lines (one about 330 characters) to fit the max-lines ratchet.
Expand those lines into multi-line arguments with comments above the
code, and make room by moving the submit's draft handling and send into
composer-submission.ts:

- trackSubmittedDraft checks whether the editor still shows the
  submitted draft before clearing or restoring it. It replaces the
  restore, clear and isDraftCurrent closures that repeated that check.
- sendComposerSubmission sends a submit through the approval redirect
  or a plain send and settles the draft by the outcome.

Behavior is unchanged. ChatInputComposer.tsx goes from 1843 to 1825
lines and its ratchet limit drops from 1845 to 1826.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@astyfx
astyfx requested a review from a team as a code owner October 28, 2026 02:00
@astyfx
astyfx requested review from heath-s and schang124 and removed request for a team October 28, 2026 02:00
@upwind-code-us

upwind-code-us Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Passed

0 newly introduced misconfigurations · 0 resolved · 0 total in this PR vs the default branch

View full analysis in Upwind Console →

Scan completed in 5s

Scan history (2 scans)
Commit Scanned at New Resolved Net
b886aa9 2026-10-28 02:00 UTC — — —
b886aa9 < 2026-10-28 02:00 UTC 0 0 0

Last scanned: b886aa9 · 2026-10-28 02:00 UTC

@heath-s heath-s left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved

@astyfx
astyfx merged commit 850c89f into main Oct 28, 2026
6 checks passed
@astyfx
astyfx deleted the refactor/composer-approval-redirect-lines branch October 28, 2026 03:57
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