Skip to content

Preserve keeplist prefix case in UI validation#11

Merged
Therosin merged 1 commit intodevelopfrom
codex/update-prefix-handling-in-main.ts
Mar 1, 2026
Merged

Preserve keeplist prefix case in UI validation#11
Therosin merged 1 commit intodevelopfrom
codex/update-prefix-handling-in-main.ts

Conversation

@Therosin
Copy link
Member

@Therosin Therosin commented Mar 1, 2026

Motivation

  • Align UI prefix handling with core logic by preserving the exact user-entered keeplist prefix casing while retaining existing validation constraints.

Description

  • Stop lowercasing input in applyPrefixValue (removed .toLowerCase()), validate the trimmed value against /^[A-Za-z0-9_-]+$/, and assign keeplistPrefix = trimmed so the active keeplist label reflects the user-entered case in main.ts.
  • Add a regression assertion to logic_test.ts to ensure resolveKeeplistName preserves mixed-case prefixes (e.g., Vanilla_Profile).

Testing

  • Formatted files with deno fmt main.ts logic_test.ts which completed successfully.
  • Ran the test suite with deno task test and all 58 tests passed.

Codex Task

Copilot AI review requested due to automatic review settings March 1, 2026 14:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns the UI keeplist prefix handling in main.ts with the existing mixed-case support already present in the core logic.ts. Previously, applyPrefixValue lowercased the user's input before storing it, causing the active keeplist name shown in the UI and passed to core functions to always be lowercase, even though logic.ts (via validateKeeplistName and isProtectedKeeplistPath) already accepted and operated on mixed-case prefixes.

Changes:

  • Removed .toLowerCase() normalization in applyPrefixValue, updated the validation regex from [a-z0-9_-] to [A-Za-z0-9_-], and now stores the trimmed (not lowercased) value as keeplistPrefix.
  • Added a regression test in logic_test.ts to assert that resolveKeeplistName("Vanilla_Profile") returns "#Vanilla_Profile-keeplist.txt", confirming mixed-case prefix preservation end-to-end.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
main.ts Removes lowercase normalization in applyPrefixValue; updates validation regex to allow uppercase letters; stores the user-entered case directly.
logic_test.ts Adds a mixed-case assertion to the existing resolveKeeplistName test to cover the preserved-case behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Therosin Therosin merged commit 0d7457a into develop Mar 1, 2026
6 checks passed
@Therosin Therosin deleted the codex/update-prefix-handling-in-main.ts branch March 1, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants