Skip to content

refactor: share upload filename parser#14

Merged
CircleCrop merged 1 commit into
mainfrom
codex/extract-filename-parsing-helper
Jul 13, 2026
Merged

refactor: share upload filename parser#14
CircleCrop merged 1 commit into
mainfrom
codex/extract-filename-parsing-helper

Conversation

@CircleCrop

Copy link
Copy Markdown
Member

Motivation

  • Prevent divergent filename parsing logic between the scanner and UI by extracting a single pure parser for flat upload filename stems.
  • Ensure consistent handling of common separators (spaced dash, dash, underscore, dot) so grouping, labels, and tests remain aligned.

Description

  • Add apps/internal-site/components/web-uploader/filename-parser.ts that exports parseUploadFilenameStem(stem) returning { prefix, frame, variant } | null and supports spaced-dash, dash, underscore, and dot separators.
  • Replace the ad-hoc FILENAME_RE use in source-scanner.ts with the shared parseUploadFilenameStem helper and remove the local regex.
  • Add fullFrameTitleFromSourcePath(path) to web-upload-view-model.ts, which uses the shared parser to produce ${prefix} - ${frame} or fall back to the stem.
  • Add tests: filename-parser.test.ts (unit tests for separators and missing variant) and small regression tests added/updated in source-scanner.test.ts and web-upload-view-model.test.ts to ensure consistent behavior across scanner and view-model.

Testing

  • Ran the internal-site test suite (Vitest) for the changed files, with all tests passing (Test Files 39 passed, Tests 126 passed).
  • Ran linting for @magic-compare/internal-site with no errors.
  • Ran typechecking/build (next build) for @magic-compare/internal-site, which completed successfully.

Codex Task

Copilot AI review requested due to automatic review settings July 13, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CircleCrop

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 333d39944a

ℹ️ 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".

@CircleCrop
CircleCrop merged commit 5deaf3c into main Jul 13, 2026
3 checks passed
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