Skip to content

Show unknown order statuses instead of crashing - #1

Open
mtyates wants to merge 1 commit into
mainfrom
tolerate-unknown-order-status
Open

mtyates wants to merge 1 commit into
mainfrom
tolerate-unknown-order-status

Conversation

@mtyates

@mtyates mtyates commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Installed app builds can receive OrderStatus values added to the API after they shipped. getStatusTheme previously returned undefined for those, which crashed StatusPill.

Prepares for mtyates-coderabbit/thicket-api#4 (PARTIALLY_REFUNDED).

  • Unknown statuses get a neutral theme and a humanized label
  • Test covers PARTIALLY_REFUNDED

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Statuses not otherwise recognized now display with a neutral theme instead of relying on a direct status lookup.
    • Unknown status labels are made more readable by converting underscore-separated text into capitalized words.
  • Tests
    • Added coverage for the neutral theme and “Partially refunded” label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Some coding-guideline sources were skipped; the reason is listed next to each one. Other guidelines were applied as usual. On a public repository, sources from your configuration are listed without their names.

Skipped guideline sources: 1
a configured source — couldn't be fetched

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 96b1cd8 and 6eab59a.

Files selected for processing: 2
  • src/lib/statusTheme.test.ts
  • src/lib/statusTheme.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 4 remain after this review.

Walkthrough

getStatusTheme now accepts arbitrary strings. Known statuses retain their mapped themes. Unknown statuses receive neutral colors and a label generated from the status string. A test covers PARTIALLY_REFUNDED.

Changes

Status theme fallback

Layer / File(s) Summary
Unknown status fallback
src/lib/statusTheme.ts, src/lib/statusTheme.test.ts
getStatusTheme returns neutral colors and a humanized label for unknown status strings. The test checks the label and colors for PARTIALLY_REFUNDED.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 6eab5

This change stops the status pill from crashing when the API adds a new order status after the app ships. Unknown statuses now render with a neutral theme and a readable label. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 8
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Show unknown order statuses instead of crashing" matches the main change. The PR makes getStatusTheme return a neutral theme and a humanized label for unknown statuses, so StatusPill no lon…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Operations Match The Api Schema Passed No GraphQL operations or fragments changed. The reviewed diff changes only src/lib/statusTheme.test.ts and src/lib/statusTheme.ts, so it introduces no schema field, argument, enum value, or input-…
Generated Types Are Current Passed The pull request changes only src/lib/statusTheme.test.ts and src/lib/statusTheme.ts. It does not change files under src/graphql/**, schema/thicket-api.graphql, or src/gql/graphql.ts, so nei…
Forward-Compatible Api Handling Passed The changed getStatusTheme returns the mapped theme or a neutral fallback with a humanized label. StatusPill then reads the returned theme fields, so an unknown status does not produce undefined…
Full details: Title check

Explanation

The title "Show unknown order statuses instead of crashing" matches the main change. The PR makes getStatusTheme return a neutral theme and a humanized label for unknown statuses, so StatusPill no longer crashes. The title is in imperative mood, is 47 characters long, and describes the user-visible behavior. The title does not name the function or the test, but it is not vague or misleading.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

Full details: Operations Match The Api Schema

Explanation

No GraphQL operations or fragments changed. The reviewed diff changes only src/lib/statusTheme.test.ts and src/lib/statusTheme.ts, so it introduces no schema field, argument, enum value, or input-field reference to assess. The linked schema was readable, but its selected ref is refs/pull/4/head, not main; this does not affect the result because the PR changes no GraphQL operations or fragments.

Full details: Generated Types Are Current

Explanation

The pull request changes only src/lib/statusTheme.test.ts and src/lib/statusTheme.ts. It does not change files under src/graphql/**, schema/thicket-api.graphql, or src/gql/graphql.ts, so neither failure condition applies.

Full details: Forward-Compatible Api Handling

Explanation

The changed getStatusTheme returns the mapped theme or a neutral fallback with a humanized label. StatusPill then reads the returned theme fields, so an unknown status does not produce undefined. The diff adds no nullable-field reads or API amount arithmetic or formatting.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

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