Skip to content

fix(text): bound trimMiddle for small caps - #687

Merged
steipete merged 1 commit into
mainfrom
fix/trim-middle-small-caps
Jul 19, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/trim-middle-small-caps

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • bound trimMiddle for small and non-positive caps
  • preserve the existing middle-elision path for larger caps
  • add regression coverage for the reported reverse-slice and impossible-count behavior

Thanks @anagnorisis2peripeteia for the report and original diagnosis.

Proof

  • pnpm run build
  • node --test test/clawsweeper-text.test.ts
  • AutoReview branch review: clean (0.99)

Closes #571

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 10:40 PM ET / July 19, 2026, 02:40 UTC.

Summary
Adds a small-cap guard to trimMiddle and regression coverage for non-positive/small limits and valid middle-elision counts.

Reproducibility: yes. —source inspection gives a deterministic reproduction path: pass text longer than a cap below 120, where the pre-fix edge calculation becomes negative and produces reverse-slice output.

Review metrics: 1 noteworthy metric.

  • Patch surface: 1 production line added; 23 test lines added across 2 files. The change is tightly scoped to one text helper and its direct regression coverage.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #571
Summary: This PR is a focused candidate fix for the deterministic trimMiddle boundary bug tracked in the canonical issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Run a fresh build and attach a redacted terminal transcript covering small, zero, negative, and normal-cap calls to trimMiddle.
  • After updating the PR body with proof, wait for the automatic re-review or ask a maintainer to comment @clawsweeper re-review if it does not trigger.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR lists build and unit-test commands, but it needs a redacted after-fix terminal or live-output transcript that demonstrates the real built helper behavior before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR has no redacted after-fix runtime transcript showing the built helper’s output at the small-cap boundary; the supplied build and unit-test claims are supplemental only.

Maintainer options:

  1. Decide the mitigation before merge
    Attach a redacted terminal transcript from a fresh build that invokes trimMiddle at small, zero, negative, and normal caps, then merge this focused fix if the output remains bounded and the middle-elision path remains intact.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The remaining merge blocker is contributor-supplied real behavior proof, not a mechanical repair ClawSweeper should make on the branch.

Security
Cleared: The two-file text-helper and test change adds no dependency, workflow, permission, secret, or supply-chain surface.

Review details

Best possible solution:

Attach a redacted terminal transcript from a fresh build that invokes trimMiddle at small, zero, negative, and normal caps, then merge this focused fix if the output remains bounded and the middle-elision path remains intact.

Do we have a high-confidence way to reproduce the issue?

Yes—source inspection gives a deterministic reproduction path: pass text longer than a cap below 120, where the pre-fix edge calculation becomes negative and produces reverse-slice output.

Is this the best way to solve the issue?

Yes—the guard keeps small and non-positive caps within a simple prefix-boundary path while retaining the established middle-elision behavior for larger caps.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f8d5393f5894.

Label changes

Label changes:

  • add P2: This is a bounded existing-behavior bug that can produce oversized diagnostic text and impossible counts, with limited blast radius.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR lists build and unit-test commands, but it needs a redacted after-fix terminal or live-output transcript that demonstrates the real built helper behavior before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded existing-behavior bug that can produce oversized diagnostic text and impossible counts, with limited blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR lists build and unit-test commands, but it needs a redacted after-fix terminal or live-output transcript that demonstrates the real built helper behavior before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

Likely related people:

  • Cameron Beeley: The submitted fix commit credits Cameron Beeley as co-author, connecting them to the diagnosis and narrow boundary behavior addressed here. (role: original-diagnosis co-author; confidence: low; commits: a8336b7cbdc3; files: src/clawsweeper-text.ts, test/clawsweeper-text.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 78d244f into main Jul 19, 2026
11 checks passed
@steipete
steipete deleted the fix/trim-middle-small-caps branch July 19, 2026 02:49
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trimMiddle: negative edge for maxLength<120 overflows output and reports impossible truncated count

1 participant