Skip to content

1.8.10#246

Open
digitalghost-dev wants to merge 9 commits intomainfrom
1.8.10
Open

1.8.10#246
digitalghost-dev wants to merge 9 commits intomainfrom
1.8.10

Conversation

@digitalghost-dev
Copy link
Owner

@digitalghost-dev digitalghost-dev commented Feb 14, 2026

Summary by CodeRabbit

  • Bug Fixes

    • API failures now surface as in-app error messages instead of terminating the application.
  • Style

    • New distinct styling for API error messages to improve visibility.
  • Documentation

    • Updated macOS executable note and Docker examples/badges in the README.
  • Refactor

    • Consolidated command argument validation into a unified validator with slightly updated error formatting.
  • Chores

    • Bumped release/version to v1.8.10.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

This PR bumps versions to v1.8.10, consolidates many per-command argument validators into a generic Validator/ValidateArgs system, shifts some flag-parse timing, and changes card list/set commands to store API errors (and render them) instead of quitting.

Changes

Cohort / File(s) Summary
Release & Build Metadata
/.github/workflows/ci.yml, /.goreleaser.yml, Dockerfile, nfpm.yaml, card_data/pyproject.toml, testdata/main_latest_flag.golden, README.md
Bumped version strings to v1.8.10; updated Docker/readme examples and badges; test golden updated.
DBT pipeline
card_data/pipelines/poke_cli_dbt/dbt_project.yml
Bumped project version to 1.8.10, added models.poke_cli_dbt.materialized: table, removed on-run-end: {{ create_relationships() }} hook.
Validation core
cmd/utils/validateargs.go, cmd/utils/validateargs_test.go
Added Validator struct and ValidateArgs(args, Validator) generic validator; removed many per-command ValidateXArgs helpers; tests updated to use generic validator; minor error-message formatting change.
Command-callers (validation updates)
cmd/ability/ability.go, cmd/berry/berry.go, cmd/card/card.go, cmd/item/item.go, cmd/move/move.go, cmd/natures/natures.go, cmd/pokemon/pokemon.go, cmd/search/search.go, cmd/speed/speed.go, cmd/types/types.go
Replaced specialized validation calls with ValidateArgs(..., Validator{...}); pokemon.go also reorders/removes an early flag.Parse() before validation.
Card UI error handling
cmd/card/cardlist.go, cmd/card/cardlist_test.go, cmd/card/setslist.go, cmd/card/setslist_test.go
Added exported Error error fields to CardsModel and SetsModel; on fetch errors store Error and stop loading instead of quitting; views render API error state; tests updated accordingly.
Styling
styling/styling.go
Added public ApiErrorStyle (red, bold, padding) for rendering API errors.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User as "User (CLI)"
participant Cmd as "Command (cmd/*)"
participant Validator as "utils.ValidateArgs\n(Validator)"
participant FlagParser as "FlagSet / parser"
participant UI as "Card UI (model/view)"
Note over Cmd,Validator: argument validation flow
User->>Cmd: invoke command + args
Cmd->>Validator: ValidateArgs(os.Args, Validator{...})
alt validation fails
Validator-->>Cmd: error
Cmd->>User: print error & return
else validation succeeds
Validator-->>Cmd: ok
Cmd->>FlagParser: parse flags (if any)
FlagParser-->>Cmd: parsed flags
Cmd->>UI: fetch data / render
alt fetch error
UI-->>Cmd: returns error
Cmd->>UI: set model.Error, stop loading
Cmd->>User: render ApiErrorStyle view
else success
UI-->>Cmd: data
Cmd->>User: render normal view
end
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • 1.8.4 #224: Overlaps release metadata, Docker/goreleaser/version bumps and dbt_project.yml edits present in this PR.
  • 1.8.1 #211: Overlaps dbt pipeline changes (version bump and removal of create_relationships hook).
  • 1.8.8 #239: Modifies CardsModel/cardlist UI error handling, matching the card UI error behavior changes here.

Poem

🐰 A hop from nine up to ten,
One validator now, tidy again.
Errors kept safe, no hasty quit,
Styled in red where troubles sit.
Tiny paws applaud this gentlest fix.

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.93% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title '1.8.10' is vague and does not clearly describe the main changes in the pull request. Use a descriptive title that summarizes the main changes, such as 'Bump version to 1.8.10' or 'Release v1.8.10 with validation refactoring'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1.8.10

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 60.46512% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/card/cardlist.go 50.00% 6 Missing and 1 partial ⚠️
cmd/card/setslist.go 36.36% 6 Missing and 1 partial ⚠️
cmd/ability/ability.go 0.00% 0 Missing and 1 partial ⚠️
cmd/move/move.go 0.00% 0 Missing and 1 partial ⚠️
cmd/speed/speed.go 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
cmd/berry/berry.go 58.42% <100.00%> (ø)
cmd/card/card.go 30.50% <100.00%> (ø)
cmd/item/item.go 94.23% <100.00%> (ø)
cmd/natures/natures.go 100.00% <100.00%> (ø)
cmd/pokemon/pokemon.go 88.11% <100.00%> (-0.09%) ⬇️
cmd/search/search.go 90.56% <100.00%> (ø)
cmd/types/types.go 83.11% <100.00%> (ø)
cmd/utils/validateargs.go 82.35% <100.00%> (-7.31%) ⬇️
styling/styling.go 85.50% <ø> (ø)
cmd/ability/ability.go 75.43% <0.00%> (-0.43%) ⬇️
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 14, 2026

Merging this PR will not alter performance

✅ 22 untouched benchmarks


Comparing 1.8.10 (f01c1fd) with main (e14d9ef)

Open in CodSpeed

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@cmd/berry/berry.go`:
- Line 40: The validator in the call to utils.ValidateArgs is using the wrong
command name string; update the utils.Validator literal in cmd/berry/berry.go
(the call to utils.ValidateArgs) so the CmdName field is "berry" instead of
"types" — i.e., change utils.Validator{MaxArgs: 3, CmdName: "types",
RequireName: false, HasFlags: false} to use CmdName: "berry" so validation/error
messages reference the correct command.

In `@cmd/card/card.go`:
- Line 36: The call to utils.ValidateArgs is passing the wrong CmdName ("types")
causing misleading error messages; update the Validator literal used in cmd/card
(the utils.ValidateArgs call in card.go that sets Validator{MaxArgs: 3, CmdName:
"types", ...}) to use CmdName: "card", and likewise update the Validator literal
in cmd/berry (the utils.ValidateArgs call in berry.go that sets CmdName:
"types") to use CmdName: "berry" so checkNoOtherOptions and related error text
reference the correct command names.

In `@cmd/card/setslist.go`:
- Around line 93-96: On the error path inside the message handler where you set
m.Error and m.Loading = false, ensure m.List is either initialized to a valid
list.Model or that downstream handlers guard against a zero-value list before
calling methods on it; specifically update the error branch in the handler that
sets m.Error so it initializes m.List (the list.Model used elsewhere) or add
nil/zero checks before calling m.List.SetWidth and m.List.Update(msg)
(referencing the m.List, SetWidth and Update usage in the same file) to avoid
invoking methods on an uninitialized list.Model.

In `@cmd/utils/validateargs_test.go`:
- Line 194: Tests use incorrect Validator.CmdName values; update the Validator
instances in the listed tests so CmdName matches the real command name.
Specifically, change the CmdName in TestValidateNaturesArgs to "natures", in
TestValidateBerryArgs to "berry", in TestValidateCardArgs to "card", and in
TestValidateSpeedArgs to "speed" where Validator{... CmdName: ...} is
constructed in validateargs_test.go; ensure these Validator configs mirror the
production command code.

In `@cmd/utils/validateargs.go`:
- Around line 42-44: The error returned in the v.RequireName check uses plain
fmt.Errorf; update the branch in the validation logic (the block that checks
v.RequireName and len(args) == 2) to build the message using
styling.ErrorColor.Render("✖ Error!") combined with the rest of the text and
wrap the full message with styling.ErrorBorder.Render(...) before returning the
error (i.e., return fmt.Errorf(styling.ErrorBorder.Render(...))). Keep CmdName
(v.CmdName) in the message so the final error text matches other errors in the
file.
🧹 Nitpick comments (1)
styling/styling.go (1)

56-59: Consider using a consistent red across error styles.

ApiErrorStyle uses #FF0000 while the adjacent ErrorColor uses #F2055C. If this distinction is intentional (e.g., differentiating API errors from validation errors), a comment would help. Otherwise, consider reusing #F2055C for visual consistency.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
cmd/card/setslist.go (2)

77-89: enter key handler calls m.List.SelectedItem() without an error guard.

When m.Error is set, m.List is a zero-value list.Model. Pressing enter in the error state calls m.List.SelectedItem() on it. While the .(item) type assertion should safely fail (ok == false), resulting in a clean quit, this is inconsistent with the explicit guards you added elsewhere and relies on an implicit contract of list.Model's zero-value behavior.

Consider adding a guard for consistency and safety:

Suggested fix
 	case "enter":
+		if m.Error != nil {
+			return m, nil
+		}
 		i, ok := m.List.SelectedItem().(item)

137-143: Consider whether raw error details should be shown to end users.

m.Error.Error() may contain internal details like URLs, connection info, or stack traces depending on what the HTTP client or JSON parser returns. For a CLI tool this is likely fine (and even helpful for debugging), but if you want a cleaner UX, you could show a generic message and log the details separately.

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.

Add error handling to Supabase API calls Reduce repeated validation logic Remove duplicated flag parsing command

1 participant