Skip to content

fix: detect loki prefix without requiring hyphen (case-insensitive)#29

Merged
royosherove merged 1 commit intomainfrom
fix/loki-prefix-case-insensitive
May 3, 2026
Merged

fix: detect loki prefix without requiring hyphen (case-insensitive)#29
royosherove merged 1 commit intomainfrom
fix/loki-prefix-case-insensitive

Conversation

@royosherove
Copy link
Copy Markdown
Member

Accounts like loki1-xxxx were not detected as already prefixed, causing a misleading rename suggestion to Loki-loki1-xxxx.

Changed the prefix check from loki-* to loki* so any name starting with loki (case-insensitive) is recognized as already having the Loki prefix.

Changes

  • install.sh: loki-*loki* in _account_already_prefixed()
  • tests/test-account-rename.sh: Added tests for loki1- and LokiDev- variants

All 61 tests pass.

Accounts like 'loki1-xxxx' were not detected as already prefixed,
causing a misleading rename suggestion to 'Loki-loki1-xxxx'.

Changed the prefix check from 'loki-*' to 'loki*' so any name
starting with 'loki' (case-insensitive) is recognized as already
having the Loki prefix.

Added tests for loki1- and LokiDev- variants.
@royosherove royosherove merged commit 3ed8240 into main May 3, 2026
15 checks passed
@royosherove royosherove deleted the fix/loki-prefix-case-insensitive branch May 3, 2026 12:21
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a91a8d4e4c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread install.sh
local lower_name
lower_name=$(printf '%s' "$current_name" | tr '[:upper:]' '[:lower:]')
if [[ "$lower_name" == loki-* ]]; then
if [[ "$lower_name" == loki* ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict prefix detection to names with a real separator

The new loki* check marks any AccountName starting with loki as already prefixed, but this path still assumes an exact Loki- prefix when it computes stripped_original via ${current_name:5}. For inputs like loki1-MyAccount or LokiDev-SomeAccount, the installer now writes malformed /loki/original-account-name values (e.g. -MyAccount, ev-SomeAccount), which corrupts the account-rename metadata this function persists on first install.

Useful? React with 👍 / 👎.

@royosherove
Copy link
Copy Markdown
Member Author

Triage of Codex review 4216296891:

P2 \u2014 malformed /loki/original-account-name when prefix lacks hyphen: AGREE, fixing in #30.

Correct bug. Broadening to loki* case-insensitive matches names like loki1-Foo / LokiDev-Foo where ${current_name:5} produces -Foo / ev-Foo.

Follow-up #30: only strip when the lowercase 5-char prefix is exactly loki-; otherwise fall back to ACCOUNT_ID (matching the existing empty-result fallback).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant