Skip to content

[comp] Production Deploy#3148

Merged
tofikwest merged 10 commits into
releasefrom
main
Jun 15, 2026
Merged

[comp] Production Deploy#3148
tofikwest merged 10 commits into
releasefrom
main

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.


Summary by cubic

Stabilizes the Policy AI Assistant and editor to prevent interrupted/empty runs and ensure precise list, paragraph, and section edits. Cleans model markdown, preserves table headers, keeps inline-formatting-only changes, and adds retry/timeout safeguards.

  • Bug Fixes
    • Prevent blank “success” runs: tie tool success to real content; show Interrupted/Error/Incomplete with Retry; retries send live editor content.
    • Lists: fix list-item off-by-one; unwrap list wrappers on apply; correct insert anchors and nearest-line fallback; avoid splitting/nesting.
    • Blocks/sections: map blocks to outer node boundaries so replace/delete operate cleanly; extend heading-led deletes to the whole section.
    • Diffing: don’t merge separate modifies across gaps; fix pure-insert positioning; preserve formatting-only edits (bold/italic/code/link) as suggestions; shared inline parser/serializer used by diff and apply.
    • Input hygiene: strip control chars (e.g. “013”) and normalize CR/CRLF; apply before diff/apply and section edits.
    • Reliability/UI: add AbortController timeout for section edits; raise chat maxDuration to 300s and set maxOutputTokens (chat: 16000, edit-section: 4000); tool card shows correct states with Retry.
    • Tests: add end-to-end pipeline suite (lists, inserts, deletes, formatting), list apply, markdown round-trip, proposal card states, and table headers.

Written for commit c38b1d5. Summary will update on new commits.

Review in cubic

github-actions Bot and others added 3 commits June 15, 2026 16:25
Addresses the consolidated policy editor / AI Policy Assistant bug cluster:

- 013 artifact: strip C0/C1 control chars at the markdown boundary
  (new sanitizeMarkdown) so stray glyphs never reach the document.
- CS-418a: preserve tableHeader cells in the content validator instead of
  collapsing header rows to a single empty cell.
- CS-256: tie proposePolicy success to real content and show an
  "incomplete + Retry" card instead of a false "Policy updated" on a
  truncated/blank run.
- CS-265: fix the list-item position off-by-one in buildPositionMap and
  unwrap list wrappers on apply so single/multi-bullet edits replace the
  intended item(s) without bleeding into neighbors or splitting the list;
  also fix a leading-blank-line trim that desynced lineToPos for
  list-first documents.
- Hung/"Interrupted" runs: add maxOutputTokens (chat + edit-section), raise
  chat maxDuration, add a Retry affordance (regenerate), and an
  AbortController+timeout on the section-edit fetch.
- SALE-65 + CS-265 formatting: consolidate the hand-rolled markdown
  converters into one symmetric mark-aware encoder/decoder (policy-markdown)
  used by the diff and apply paths, and neutralize inline-marker
  differences in normalizeContent so markup asymmetry can't create phantom
  suggestions.

Adds 35 unit tests (converter round-trip, real-ProseMirror list apply,
card-state, table headers). No production behavior outside the policy AI
editor is touched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[dev] [tofikwest] tofik/fix-policy-ai-editor-cs427
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app (staging) Ready Ready Preview, Comment Jun 15, 2026 8:10pm
comp-framework-editor (staging) Ready Ready Preview, Comment Jun 15, 2026 8:10pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal (staging) Skipped Skipped Jun 15, 2026 8:10pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 18 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

tofikwest and others added 7 commits June 15, 2026 15:20
The previous commit added inline-marker stripping to normalizeContent as a
phantom-diff safety net, but it backfired: a user asking only to bold/italic/
code a phrase (same words) normalized to "no change", so zero suggestions were
produced and the formatting was silently dropped despite the assistant
reporting success.

The markdown encoder is already mark-aware and symmetric with the model's
output, so unchanged formatted content compares equal without stripping. Remove
the inline-marker strip (keep block-marker + whitespace normalization) so
explicit formatting edits surface as accept-able suggestions and apply as real
marks. Adds regression tests for bold-only and link-only changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lti-edit merge

Found via a new deterministic end-to-end pipeline harness (start doc + AI
markdown -> positionMap -> diff -> apply against real ProseMirror), which
reproduces "accept all" without a deploy.

- Insert position: jsdiff's oldStart for an insertion is the line to insert
  BEFORE; resolveHunkPositions now collapses inserts to a zero-width point at
  that boundary (was inserting AFTER the anchor, so a new bullet landed below
  its intended neighbor). Exposed by the list-first lineToPos alignment fix.
- Paragraph/heading modify: replacing a textblock's content range with a whole
  block node split the block and left an empty paragraph. buildReplacementNodes
  now splices inline content for same-shape textblock edits.
- Multi-edit data loss: mergeOverlappingRanges merged two modifies across a gap,
  dropping the unchanged content between them (e.g. a heading) from the merged
  proposedText -> it was deleted on apply. Now only overlapping ranges and
  adjacent section-deletes merge.

Adds a 17-scenario e2e harness (single/multi bullet, ordered lists, inserts,
deletes, inline marks, multi-section edits, full-policy generation) as a
permanent regression guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Section deletes left an empty heading behind, and any non-list delete/modify
left an empty block, because non-list blocks mapped to their inner content
range (single-bullet edits only worked because list items already use
boundaries). Map every block to its outer [before, after] boundary so
accept/delete operate on the whole block. This also lets modifies replace the
whole node cleanly, so the textblock inline-splice workaround is removed.

Also extract the heading-led delete-section extension into a pure, tested
helper (extendDeleteRangesToSections) shared by the hook and the e2e harness.

Harness now covers section delete, no-op proposals, and stray-whitespace
normalization (20 scenarios).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… blockquote)

Round 3 scenarios — all pass except a documented known limitation: a
heading-LEVEL-only change (## -> ###) or block-type change with identical text
is suppressed by normalizeContent's block-marker stripping (it.skip with a
note). Text edits to any block work; pure structural changes are out of scope.

26 e2e scenarios total. No production changes this round.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses a P1 from automated review (identified by cubic): the nearest-position
fallback for pure inserts used `near.to` unconditionally, so when the nearest
mapped line is AFTER the insertion anchor (e.g. an insert in a double-blank gap
where both neighboring lines are unmapped), content was placed after that block
instead of before it. Now the side is chosen by the nearest line's position
relative to the anchor (.from when at/after, .to when before). Adds tests for
both sides.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
[dev] [tofikwest] tofik/fix-policy-ai-editor-cs427
@vercel vercel Bot temporarily deployed to staging – portal June 15, 2026 20:06 Inactive
@tofikwest tofikwest merged commit c8d11ed into release Jun 15, 2026
14 checks passed
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.83.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants