Skip to content

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

Closed

Description

@anagnorisis2peripeteia

slug(value, fallback, maxLength) in src/repair/text-utils.ts:19 trims edge dashes and THEN .slice(0, maxLength), so slicing on a - boundary re-introduces a trailing dash.

Repro:

slug("a a", "x", 2) === "a-"   // trailing dash
slug("a-", "x", 2)  === "a"    // => not idempotent: slug(slug(x)) !== slug(x)

Fix: trim trailing dashes AFTER the length slice (or re-trim post-slice).

Activity

  1. clawsweeper commented on Jul 15, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 18, 2026, 10:35 PM ET / July 19, 2026, 02:35 UTC.

    Summary
    This issue remains necessary: the merged PR was deliberately narrowed to the separate compactText correction, and the recent reopening comment confirms that the slug implementation was removed before merge and is not fixed on current main.

    Likely related people: steipete — recent triage decision author (high confidence).

    Reproducibility: yes. at source level: the report provides a deterministic two-call input sequence against the slug normalization order and a concrete expected idempotence invariant. This review did not execute the helper, so the status is source-reproducible rather than reproduced.

    Next step
    A recent maintainer decision confirms the bug remains, while the clawsweeper:no-new-fix-pr routing signal means a maintainer should choose whether to sponsor the focused follow-up rather than dispatching another automated branch now.

    Review details

    Best possible solution:

    Apply one focused slug normalization-order correction, preserving fallback semantics, and add boundary tests that prove no trailing dash is returned after truncation and that slug(slug(value)) is unchanged.

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

    Yes, at source level: the report provides a deterministic two-call input sequence against the slug normalization order and a concrete expected idempotence invariant. This review did not execute the helper, so the status is source-reproducible rather than reproduced.

    Is this the best way to solve the issue?

    Yes, a post-slice edge-dash trim is the narrowest maintainable fix, provided the implementation retains the helper's existing fallback behavior and receives boundary/idempotence regression coverage.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The focused correction should retain existing fallback behavior for values that become empty after normalization, with regression coverage for both truncation and idempotence.

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

    Label changes

    Label changes:

    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.
    • remove clawsweeper:linked-pr-open: Current issue advisory state no longer selects this label.

    Label justifications:

    • P3: This is a narrow helper-invariant bug with limited user-facing blast radius and a focused proposed correction.
    Evidence reviewed

    What I checked:

    Likely related people:

    • steipete: Authored the reopening decision that distinguishes the merged compactText fix from this still-unfixed slug behavior. (role: recent triage decision author; confidence: high; commits: f8d5393f5894; files: src/repair/text-utils.ts)
    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.
  2. added
    P3
    issue-rating: 🦞 diamond lobster
    clawsweeper:source-repro
    on Jul 15, 2026
  3. added a commit that references this issue on Jul 15, 2026
    37c14fb
  4. added
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    on Jul 15, 2026
  5. brokemac79 commented on Jul 16, 2026

    @brokemac79
    Contributor

    Thanks for the report. We?ve confirmed this is separate from the recent ClawSweeper review/publication stability incident.

    Our immediate priority is keeping the recovered path stable and completing a careful maintainer review of outstanding changes. We will review this report and its linked implementation together in the next maintenance pass, then leave a specific decision here.

    Please do not treat this as a request for further changes at present.

  6. brokemac79 commented on Jul 18, 2026

    @brokemac79
    Contributor

    @clawsweeper re-review

  7. clawsweeper commented on Jul 18, 2026

    @clawsweeper
    Contributor

    🦞🧹
    ClawSweeper re-review requested.

    I asked ClawSweeper to review this item again.
    Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
    Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

    Re-review progress:

  8. steipete commented on Jul 19, 2026

    @steipete
    Contributor

    Reopening: #576 was deliberately narrowed before merge to the compactText fix for #573 only. This issue's implementation was removed from the final diff, so the merge did not fix it. GitHub nevertheless applied the PR's older closing relationship at merge time.

    No new contributor changes requested. This restores the pre-merge open state for separate maintainer triage.

  9. added
    clawsweeper:needs-maintainer-review
    and removed
    clawsweeper:linked-pr-open
    on Jul 19, 2026
  10. steipete commented on Jul 19, 2026

    @steipete
    Contributor

    Fixed by #688.

    Proof:

  11. added a commit that references this issue on Jul 19, 2026
    f8d5393
  12. added a commit that references this issue on Sep 21, 2026
    38ddba6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3clawsweeper:needs-maintainer-reviewclawsweeper:no-new-fix-prclawsweeper:source-reproissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions