fix: trim trailing hyphens from truncated usernames #15

Merged
rcsheets merged 1 commit from fix/username-double-hyphen into master 2026-03-26 21:27:25 +00:00
Owner

When deriveUsername truncates at 31 chars it can end on a hyphen,
producing a double-hyphen when the hash suffix is appended (e.g.
auto-admin-brooktrails-forgejo--f1cad0ee). Forgejo rejects these
as invalid usernames.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

When deriveUsername truncates at 31 chars it can end on a hyphen, producing a double-hyphen when the hash suffix is appended (e.g. auto-admin-brooktrails-forgejo--f1cad0ee). Forgejo rejects these as invalid usernames. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: trim trailing hyphens from truncated usernames
Some checks are pending
CI / ci (push) Waiting to run
CI / ci (pull_request) Waiting to run
E2E smoke test / e2e (pull_request) Waiting to run
a28a7ada7f
When deriveUsername truncates at 31 chars it can end on a hyphen,
producing a double-hyphen when the hash suffix is appended (e.g.
auto-admin-brooktrails-forgejo--f1cad0ee). Forgejo rejects these
as invalid usernames.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.15.0 | Safety Check | anthropic | tracking id r-c5a198-ceddd5
This is an AI-genrated review and may contain mistakes.

Status: Completed


Verdict: LGTM — Clean fix that prevents double-hyphens in usernames by trimming trailing hyphens before appending the hash suffix.
Complexity: trivial

This is a straightforward bug fix that addresses username validation issues in Forgejo. The change prevents double-hyphens (e.g., --) from appearing in generated usernames by trimming trailing hyphens from the truncated portion before appending the hash suffix. The fix is minimal and targeted - no security concerns or breaking changes identified.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.15.0 | Safety Check | anthropic | tracking id `r-c5a198-ceddd5`* *This is an AI-genrated review and may contain mistakes.* **Status:** ✅ Completed --- **✅ Verdict: LGTM** — Clean fix that prevents double-hyphens in usernames by trimming trailing hyphens before appending the hash suffix. **Complexity:** trivial This is a straightforward bug fix that addresses username validation issues in Forgejo. The change prevents double-hyphens (e.g., `--`) from appearing in generated usernames by trimming trailing hyphens from the truncated portion before appending the hash suffix. The fix is minimal and targeted - no security concerns or breaking changes identified.
rcsheets force-pushed fix/username-double-hyphen from a28a7ada7f
Some checks are pending
CI / ci (push) Waiting to run
CI / ci (pull_request) Waiting to run
E2E smoke test / e2e (pull_request) Waiting to run
to d97817769e
Some checks failed
CI / ci (push) Has been cancelled
CI / ci (pull_request) Has been cancelled
E2E smoke test / e2e (pull_request) Has been cancelled
2026-03-26 21:14:07 +00:00
Compare
Collaborator

Automated review by pr-reviewer v0.15.0 | Safety Check | anthropic | tracking id r-c5a1a1-cb3fbb
This is an AI-generated review and may contain mistakes.

Status: Completed


Verdict: LGTM — The fix correctly prevents double-hyphens in usernames by trimming trailing hyphens before appending the hash suffix.
Complexity: trivial

Safety Check Review

The change fixes a bug where truncated usernames ending with a hyphen would create invalid double-hyphen usernames when the hash suffix is appended. The fix is straightforward - using strings.TrimRight(name[:31], "-") to remove trailing hyphens before appending the - and hash suffix.

No security issues or breaking changes identified. The logic is sound and addresses the described problem.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.15.0 | Safety Check | anthropic | tracking id `r-c5a1a1-cb3fbb`* *This is an AI-generated review and may contain mistakes.* **Status:** ✅ Completed --- **✅ Verdict: LGTM** — The fix correctly prevents double-hyphens in usernames by trimming trailing hyphens before appending the hash suffix. **Complexity:** trivial # Safety Check Review The change fixes a bug where truncated usernames ending with a hyphen would create invalid double-hyphen usernames when the hash suffix is appended. The fix is straightforward - using `strings.TrimRight(name[:31], "-")` to remove trailing hyphens before appending the `-` and hash suffix. No security issues or breaking changes identified. The logic is sound and addresses the described problem.
rcsheets merged commit 3975e7070d into master 2026-03-26 21:27:25 +00:00
rcsheets deleted branch fix/username-double-hyphen 2026-03-26 21:27:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
brooktrails/forgejo-runner-operator!15
No description provided.