Skip to content

fix(ui-kit): a not-posted GitHub draft shows its whole body (#4197) - #4199

Merged
schlessera merged 3 commits into
mainfrom
fix/4197-w1-preview-whole-body
Nov 17, 2026
Merged

schlessera merged 3 commits into
mainfrom
fix/4197-w1-preview-whole-body

Conversation

@schlessera

@schlessera schlessera commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #4197. Part of #3791.

What changed

A not-posted GitHub draft in the kit now shows its whole body.

  • Body's draft branch (packages/ui-kit/src/github/object-parts.tsx) applies no bound. It used to cut a draft at the read bodies' 20,000-character bound and say "Truncated · the rest is on GitHub", which is false for a draft that is not on GitHub yet. The host posts up to 65,536 characters (GITHUB_LIMITS.writeBodyChars). The 8-line clamp stays, and its expand control names the whole length. GitHubPullRequest in preview uses this branch.
  • Read bodies are unchanged. They keep BODY_MAX_CHARS = 20_000 and their "Truncated" note.
  • The W1 issue approval (GitHubIssue, posting: { status: "preview" }) did not go through Body on main. Its "As shown" pane already rendered the whole body, but nothing proved it. A unit test and a long-draft story now do.

This mirrors #4198 (#4154), where GitHubComment in preview drops the posted-comment bound.

Issue correction. The issue said W1 renders through Body. It does not on main. I folded the correction into the issue body and posted a dated comment. The scope is still the cited Body draft branch. No styling changes: W1 keeps its As shown / Exact text switch and gains no clamp.

Proof

Unit (packages/ui-kit/tests/github-draft-body.test.tsx, new): a draft of more than 25,000 characters renders whole with no "Truncated" in the W1 issue preview and the PR preview. An issue and a PR as read stay cut at the bound and show the note. bun run test packages/ui-kit/tests: 1102 pass, 0 fail.

Failing-first and mutation receipts. Each mutation was applied, the named assertion failed, and the source was restored.

  • M1: Body draft branch gets maxChars={BODY_MAX_CHARS} back (= main). PR_PREVIEW_WHOLE_BODY fails. The received text ends at the cut with "Truncated · the rest is on GitHub". 4 pass, 1 fail.
  • M2: the bound is removed for read bodies too. ISSUE_READ_BOUND and PR_READ_BOUND fail. 3 pass, 2 fail.
  • M3: the W1 preview's UntrustedText is cut at 20,000. W1_PREVIEW_WHOLE_BODY fails. 4 pass, 1 fail.
  • In a real browser, M1 and M3 together: all 8 new stories (GitHub/Write W1LongDraft and W1LongDraftNarrow, GitHub/GitHubPullRequest PreviewLongDraft and PreviewLongDraftNarrow, in storybook and storybook-light) fail on 'a draft is never shown cut'. 8 failed, 66 passed.

Real browser. Host Chromium 1243, outside the command sandbox, on a built tree. The kit storybook projects storybook (dark) and storybook-light ran GitHubWrite, GitHubPullRequest and GitHubIssue with the a11y gate at error: 106/106 passed. That covers the new long-draft stories at 320px and at desktop width in both themes. The PR preview story opens the clamp through "Show full description · N characters" and checks the last line. The W1 story checks the last line in As shown and in Exact text.

No new pixel baselines. The subjects.visual.tsx list is explicit and does not include the new stories.

Typecheck: root bun run typecheck passes. No exports changed: object-parts.tsx is internal, and BODY_MAX_CHARS is now exported from that module only, for the test.

Collisions (bun scripts/collisions.ts --json --pr 4199, head 5bbdff7bd): no path or textual collisions. Closure-only collisions with #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4173, #4177, #4179, #4194, #4196 and #4198. If #4198 lands first, I'll merge origin/main and keep its W4 stories in GitHubWrite.stories.tsx.

Contract impact: none. This is kit rendering only.

Changeset: .changeset/github-draft-body-whole.md (@schlessera/brain-ui-kit patch).

{"version":1,"kind":"brain-check-pr-receipt","head":"5bbdff7bdfcc6bab7948b338e22ad541cce0e5fe","base":"origin/main","mode":"focused","startedAt":"2026-11-17T17:57:47.088Z","finishedAt":"2026-11-17T17:58:33.137Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":13895.289138},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":104.48015399999713},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":99.20082600000023},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":18.388457000000926},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":31915.869445000004}]}

🤖 Generated with Claude Code

The shared Body cut a draft at the read bodies' 20,000-character bound
and said the rest was on GitHub. A draft is what the host posts, up to
65,536 characters, so the draft branch now applies no bound, as the W4
comment preview does after #4154. Read bodies keep the bound and note.

A unit test and long-draft stories (W1 issue approval, PR preview, both
widths) prove a draft is never cut and a read body still is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera added this to the 0.45.0 milestone Nov 17, 2026
@schlessera schlessera added type: fix Something is broken and must behave the way it is documented. area: ui-kit The presentational design kit: components, tokens, Storybook, visual baselines. labels Nov 17, 2026
@uploads-sh

uploads-sh Bot commented Nov 17, 2026

Copy link
Copy Markdown

No uploads on this PR yet

This PR changes UI files (packages/ui-kit/src/github/object-parts.tsx, packages/ui-kit/stories/github/GitHubPullRequest.stories.tsx, packages/ui-kit/stories/github/GitHubWrite.stories.tsx and 1 more). Screenshots help reviewers see what changed.

  • From the CLI: uploads put before.png after.png --pr 4199
  • From an agent: ask it to attach screenshots with uploads.sh
  • By hand: drag images into the PR description and they're imported automatically
Tips for agents

Label each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one put per shot:

uploads put after.png --pr 4199 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4199 --app ios --screen "Chat" --state after

No CLI? With the Uploads MCP, call sign_upload_url for files on disk (or put) with repo, pr: 4199 and the same screen, state and caption fields.

This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with uploads list --pr 4199. More in the github-screenshots skill or the agent docs.

Workspace admins can turn this comment off in Settings → GitHub · docs

@schlessera

Copy link
Copy Markdown
Owner Author

Collisions (bun scripts/collisions.ts --json --pr 4199) at head 5bbdff7bdfcc6bab7948b338e22ad541cce0e5fe: no path or textual collisions. There are closure collisions only, for the shared affected test closure, with the open drafts and PRs #3054, #3056, #3059, #3069, #3581, #3622, #4151, #4173, #4177, #4179, #4194, #4196 and #4198.

#4198 also adds stories at the end of packages/ui-kit/stories/github/GitHubWrite.stories.tsx, and those edits do not overlap this PR's hunk. If #4198 lands first, I'll merge origin/main here (no rebase) and keep its W4 stories.

@schlessera

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 5bbdff7 against base 0babede. Reviewer: agent. No findings.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4199,
  "head": "5bbdff7bdfcc6bab7948b338e22ad541cce0e5fe",
  "base": "0babedee2b94fb8ae06d3fac7c16917903e2f4e3",
  "reviewer": "agent",
  "outcome": "no-findings",
  "findings": []
}

@schlessera

Copy link
Copy Markdown
Owner Author

Infrastructure retry (orchestrator): confirmation run 44177638029 on head 4dacbc1c9ed26b2a6a2a722608a4471d9a516798 failed only in unit (6), in its "Recompute affected proof on the actual checkout" planning step, before any test ran: Cannot expand 2 changed browser spec(s) to project/file pairs: Installed Vitest discovery failed. The other seven unit shards ran the same planning step on the same inputs and passed, along with verify, pack, changeset, determinism (1) and browser_determinism (1). This PR changes only ui-kit GitHub components, their stories and a test, so it cannot change planner or Vitest discovery behaviour. The missing child diagnostics are tracked in #4241.

Purpose: one new confirmation request on the same head, to get complete exact-head proof. The failed job was not rerun. If discovery fails again without new evidence, the PR goes to diagnosis under #4241 instead of another retry.

@schlessera
schlessera marked this pull request as draft November 17, 2026 21:55
@schlessera
schlessera marked this pull request as ready for review November 17, 2026 21:55
@schlessera
schlessera merged commit 51d0f6d into main Nov 17, 2026
49 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui-kit The presentational design kit: components, tokens, Storybook, visual baselines. type: fix Something is broken and must behave the way it is documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui-kit: the W1 issue approval cuts a long draft body at 20,000 characters without saying so

1 participant