Skip to content

fix(repair): keep truncated slugs idempotent - #688

Merged
steipete merged 1 commit into
mainfrom
fix/slug-truncation-idempotence
Jul 19, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/slug-truncation-idempotence

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • remove trailing dashes after applying the slug length cap
  • preserve the existing fallback behavior for empty normalized values
  • add regression coverage for truncation boundaries and idempotence

Thanks @anagnorisis2peripeteia for the report and original diagnosis.

Proof

  • pnpm run build
  • node --test test/repair/text-utils.test.ts
  • live repeated-normalization matrix for single and repeated dash boundaries
  • AutoReview local and branch reviews: clean (0.99)

Closes #572

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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:54 PM ET / July 19, 2026, 02:54 UTC.

Summary
Updates slug() to trim trailing dashes after length truncation and adds regression tests for truncation-boundary idempotence.

Reproducibility: yes. from source: current main can produce a trailing dash when truncation lands on the replacement dash, and re-normalizing that output removes it. The linked report supplies the concrete boundary input.

Review metrics: 1 noteworthy metric.

  • Patch scope: 2 files affected; 19 added, 2 removed. The implementation and its regression coverage are tightly scoped to one slug-normalization boundary.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #572
Summary: This PR is a direct candidate fix for the canonical slug idempotence report.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

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

Rank-up moves:

  • [P1] Add redacted terminal output or a terminal screenshot for the original truncation case and the repeated-normalization matrix.
  • [P1] After adding proof, update the PR body for an automatic fresh review, or ask a maintainer to comment @clawsweeper re-review if needed.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR claims a live repeated-normalization matrix, but no inspectable output, screenshot, recording, log, or linked artifact demonstrates the after-fix result; please add redacted terminal proof 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] Merge remains blocked on real after-fix behavior proof: include redacted terminal output, a terminal screenshot, or a linked artifact showing the stated truncation/idempotence matrix.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the small post-slice trim and focused regression coverage, then attach observable after-fix matrix output demonstrating the original failing boundary and repeated normalization result.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Obtain contributor-supplied after-fix runtime evidence before normal maintainer merge review; no code repair is indicated by this review.

Security
Cleared: The two-file TypeScript and test-only diff introduces no dependency, workflow, secret, permission, supply-chain, or execution-path change.

Review details

Best possible solution:

Keep the small post-slice trim and focused regression coverage, then attach observable after-fix matrix output demonstrating the original failing boundary and repeated normalization result.

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

Yes from source: current main can produce a trailing dash when truncation lands on the replacement dash, and re-normalizing that output removes it. The linked report supplies the concrete boundary input.

Is this the best way to solve the issue?

Yes. Re-trimming only trailing dashes after the existing length cap preserves the established normalization and fallback behavior without widening the API.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P3: This is a localized repair-lane slug idempotence bug with a focused, low-blast-radius fix.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 claims a live repeated-normalization matrix, but no inspectable output, screenshot, recording, log, or linked artifact demonstrates the after-fix result; please add redacted terminal proof 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:

  • P3: This is a localized repair-lane slug idempotence bug with a focused, low-blast-radius fix.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 claims a live repeated-normalization matrix, but no inspectable output, screenshot, recording, log, or linked artifact demonstrates the after-fix result; please add redacted terminal proof 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:

  • Current-main bug and narrow repair: The base implementation slices after trimming edge dashes, so a truncation boundary can reintroduce a trailing dash; the PR adds a post-slice trailing-dash trim while preserving the existing fallback. (src/repair/text-utils.ts:31, cf4e83eff832)
  • Regression coverage: The added cases check both no trailing dash and slug(slug(value)) === slug(value) across single- and repeated-dash truncation boundaries, including the empty-normalized fallback. (test/repair/text-utils.test.ts:21, cf4e83eff832)
  • Canonical bug report: The linked report provides the same concrete reproduction (slug("a a", "x", 2)) and proposes the same post-slice trimming boundary, so this PR is a direct candidate fix rather than duplicate behavior.
  • Real-behavior proof gap: The PR body lists a live repeated-normalization matrix, but the supplied review context contains neither its output nor a screenshot, terminal transcript, log, or linked artifact that shows the after-fix behavior.

Likely related people:

  • anagnorisis2peripeteia: Provided the concrete failing boundary case and original diagnosis in the linked canonical report; current-main feature-history ownership could not be established from the supplied read-only context. (role: reproduction author; confidence: low; files: src/repair/text-utils.ts, test/repair/text-utils.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 9a6980c into main Jul 19, 2026
12 checks passed
@steipete
steipete deleted the fix/slug-truncation-idempotence branch July 19, 2026 03:04
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

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

slug: not idempotent — slice after trailing-dash trim can re-introduce a trailing dash

1 participant