Skip to content

1.10.2#287

Open
digitalghost-dev wants to merge 19 commits into
mainfrom
1.10.2
Open

1.10.2#287
digitalghost-dev wants to merge 19 commits into
mainfrom
1.10.2

Conversation

@digitalghost-dev
Copy link
Copy Markdown
Owner

@digitalghost-dev digitalghost-dev commented May 13, 2026

Summary by CodeRabbit

  • New Features

    • Added Cloudflare Tunnel and n8n pipeline infrastructure documentation.
  • Bug Fixes

    • Added HTTP response body size limits to prevent excessive data downloads and improve security.
    • Centralized HTTP client configuration for more consistent request handling.
  • Documentation

    • Updated Docker installation instructions and added detailed guides for Cloudflare Tunnel integration and n8n workflows.
    • Enhanced configuration for Mermaid diagram support in documentation.
    • Updated Content-Security-Policy header for external resource access.
  • Chores

    • Bumped version to v1.10.2 across all packages and build configurations.
    • Refactored command-line argument handling for improved consistency and maintainability.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

This PR performs a comprehensive refactoring of CLI command handling to pass arguments explicitly instead of reading from global os.Args, centralizes HTTP client configuration with response size limits across the application, bumps the version to v1.10.2 in all manifests and documentation, and adds infrastructure guides for Cloudflare Tunnel and n8n automation.

Changes

CLI Arguments Refactoring with HTTP Client Centralization

Layer / File(s) Summary
Version bump across all manifests
.github/workflows/ci.yml, .goreleaser.yml, Dockerfile, README.md, card_data/pipelines/poke_cli_dbt/dbt_project.yml, card_data/pyproject.toml, nfpm.yaml, web/pyproject.toml, testdata/main_latest_flag.golden
All version references updated from v1.10.1 to v1.10.2 across CI/CD workflows, build configurations, package manifests, and test fixtures.
CLI dispatcher and command invocation refactoring
cli.go, cli_test.go
runCLI dispatch map updated to store raw command functions and invoke them via utils.HandleCommandOutput(cmdFunc, remainingArgs)() so subcommands receive remaining args. Tests no longer mutate global os.Args.
Command output and help flag utilities
cmd/utils/output.go
HandleCommandOutput now accepts fn func([]string) (string, error) with explicit args; CheckHelpFlag takes explicit args []string instead of reading os.Args and checks for -h/--help in position 1.
Argument validation logic
cmd/utils/validateargs.go
checkNoOtherOptions now uses dynamic index based on max length; RequireName validation triggers at len(args) == 1 instead of 2; ValidatePokemonArgs reduces min threshold to 2 args and shifts validation loop from args[3:] to args[2:].
Ability, berry, card, item, move, natures, pokemon, search, speed, tcg, and types commands
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/tcg/tcg.go, cmd/types/types.go and their test files
All command functions updated to accept args []string parameter, use utils.CheckHelpFlag(args, usage) for help detection, and utils.ValidateArgs(args, ...) for validation. Argument indexing adjusted to derive endpoint and command-specific fields from args[0] and args[1]. Flag parsing shifted to operate on args[2:]. Tests updated to call commands directly with argument slices instead of mutating os.Args.
Berry and card image downloads with HTTP client integration
cmd/berry/berryinfo.go, cmd/card/cardinfo.go
Image fetching switched from direct http.Get or local client creation to shared HTTP client; berry images capped at 5 MiB, card images continue using 10 MiB limit, both validated with HTTP 200 OK status check.
Shared HTTP client infrastructure and size limits
connections/connection.go, connections/connection_test.go
New exported NewDefaultHTTPClient() creates HTTP client with DefaultHTTPTimeout; ApiCallSetup enforces maxAPIResponseBytes limit and errors if exceeded; CallTCGData reuses shared client. New test verifies size limit enforcement.
Pokemon sprite and version check HTTP client integration
flags/pokemonflagset.go, flags/version.go, flags/version_test.go
Pokemon sprites limited to 5 MiB via shared client; latest-release fetch refactored into latestReleaseFromURL helper using shared client with response size limit and tag_name validation. Tests add HTTP transport stubs and coverage for error cases.
Command output and validation test updates
cmd/utils/output_test.go, cmd/utils/validateargs_test.go
Tests refactored to pass args directly to utility functions without mutating os.Args or using output builders; validation tests consolidated into table-driven format with ANSI-stripped error substring assertions.

Documentation and Configuration

Layer / File(s) Summary
Infrastructure guides for Cloudflare Tunnel and n8n
docs/Infrastructure_Guide/cloudflare-tunnel.md, docs/Infrastructure_Guide/n8n.md
New guides document Cloudflare Tunnel setup for securing Dagster access, n8n Cloud pipelines (Dagster webhook notifier, Supabase health checker, Firecrawl speed-tiers scraper), concrete node configurations, GraphQL examples, and derived-column formulas.
Installation docs and build configuration
docs/installation.md, mkdocs.yml
Docker installation examples updated to tag v1.10.2; mkdocs configured with custom Mermaid fence for diagram rendering.
Security configuration
docs/nginx.conf
Nginx CSP header connect-src directive expanded to include https://unpkg.com for additional CDN resources.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

🐰 Whiskers twitch as args now flow,
No global state to steal the show,
HTTP clients share their might,
Size limits keep responses tight,
Version bumped to two-point-ten,
Refactored CLI works once again!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '1.10.2' is a version number that correctly summarizes the primary change across the entire changeset—a version bump from v1.10.1 to v1.10.2 applied consistently across CI, Docker, Python packages, documentation, and configuration files.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1.10.2

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 90.97222% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/speed/speed.go 42.85% 4 Missing ⚠️
flags/pokemonflagset.go 33.33% 3 Missing and 1 partial ⚠️
cmd/berry/berryinfo.go 50.00% 1 Missing and 1 partial ⚠️
cmd/ability/ability.go 90.00% 0 Missing and 1 partial ⚠️
cmd/move/move.go 85.71% 0 Missing and 1 partial ⚠️
cmd/types/types.go 87.50% 1 Missing ⚠️
Files with missing lines Coverage Δ
cli.go 87.50% <100.00%> (+0.13%) ⬆️
cmd/berry/berry.go 65.04% <100.00%> (+0.57%) ⬆️
cmd/card/card.go 32.75% <100.00%> (+2.40%) ⬆️
cmd/card/cardinfo.go 76.19% <100.00%> (-0.74%) ⬇️
cmd/item/item.go 94.54% <100.00%> (+0.10%) ⬆️
cmd/natures/natures.go 100.00% <100.00%> (ø)
cmd/pokemon/pokemon.go 85.54% <100.00%> (-0.18%) ⬇️
cmd/search/search.go 92.30% <100.00%> (+0.30%) ⬆️
cmd/tcg/tcg.go 61.64% <100.00%> (+1.64%) ⬆️
cmd/utils/output.go 100.00% <100.00%> (ø)
... and 9 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 13, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks
🆕 41 new benchmarks
⏩ 10 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_build_dataframe_concatenates_all_sets N/A 124.7 ms N/A
🆕 test_pull_product_information_excludes_reverse_holofoil_prices N/A 3.2 ms N/A
🆕 test_build_dataframe_raises_on_empty_dataframe N/A 121.8 ms N/A
🆕 test_pull_product_information_skips_non_cards N/A 3.3 ms N/A
🆕 test_extract_card_name_accented_characters N/A 59.4 µs N/A
🆕 test_pull_product_information_skips_variants N/A 3.3 ms N/A
🆕 test_extract_card_name_dash_and_variant_suffix N/A 55.4 µs N/A
🆕 test_pull_product_information_sm_normalizes_card_number N/A 3.2 ms N/A
🆕 test_extract_card_name_plain N/A 56.8 µs N/A
🆕 test_pull_product_information_success N/A 3.3 ms N/A
🆕 test_extract_card_name_strip_dash_variant N/A 56.8 µs N/A
🆕 test_pull_product_information_validation_error_raises N/A 3.2 ms N/A
🆕 test_extract_card_name_strip_full_art N/A 58.3 µs N/A
🆕 test_extract_series_data_all_filtered_out N/A 123.4 ms N/A
🆕 test_extract_card_name_strip_gold N/A 55.8 µs N/A
🆕 test_extract_series_data_http_error N/A 123 ms N/A
🆕 test_extract_card_name_strip_parenthetical_number N/A 55.2 µs N/A
🆕 test_extract_card_name_strip_reverse_holofoil N/A 57.3 µs N/A
🆕 test_normalize_card_number_already_padded N/A 22.9 µs N/A
🆕 test_extract_series_data_validation_error N/A 123.1 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing 1.10.2 (a0d742e) with main (a935015)2

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (31176b4) during the generation of this report, so a935015 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Copy Markdown
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: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
cmd/utils/validateargs.go (1)

77-86: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Guard empty argument before indexing arg[0] to prevent panic.

With iteration now starting at args[2:], an empty positional argument can reach this branch and panic on arg[0].

Proposed fix
 if len(args) > 2 {
 	for _, arg := range args[2:] {
+		if arg == "" {
+			return fmt.Errorf("%s", FormatError("Empty argument provided.\nOnly flags are allowed after declaring a Pokémon's name"))
+		}
 		// Check for an empty flag after Pokémon's name
 		if arg == "-" || arg == "--" {
 			return fmt.Errorf("%s", FormatError(fmt.Sprintf("Empty flag '%s'.\nPlease specify valid flag(s).", arg)))
 		}
 
 		// Check if the argument after Pokémon's name is an attempted flag
 		if arg[0] != '-' {
 			return fmt.Errorf("%s", FormatError(fmt.Sprintf("Invalid argument '%s'.\nOnly flags are allowed after declaring a Pokémon's name", arg)))
 		}
 	}
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/utils/validateargs.go` around lines 77 - 86, The loop over args[2:]
accesses arg[0] without checking for an empty string, which can panic; modify
the loop in validateargs.go to first guard empty arguments (e.g., if arg == ""
or len(arg) == 0) and return a formatted error via FormatError (similar style to
the existing empty-flag check) before any access to arg[0]; keep the existing
checks for "-" / "--" and the flag-character check afterwards so invalid or
empty positional values are rejected safely.
connections/connection.go (1)

157-168: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Apply bounded read pattern to CallTCGData to match the hardening pattern used elsewhere in the file.

Line 167 reads the response body without limits, risking memory exhaustion on oversized responses. The codebase already implements a bounded read pattern with io.LimitReader and validation (lines 107-113) that should be replicated here.

Proposed fix
-	body, err := io.ReadAll(resp.Body)
+	body, err := io.ReadAll(io.LimitReader(resp.Body, maxAPIResponseBytes+1))
 	if err != nil {
 		return nil, fmt.Errorf("error reading response body: %w", err)
 	}
+	if len(body) > maxAPIResponseBytes {
+		return nil, fmt.Errorf("response body exceeds %d bytes", maxAPIResponseBytes)
+	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@connections/connection.go` around lines 157 - 168, The CallTCGData code reads
resp.Body with io.ReadAll unbounded; mirror the bounded-read hardening used
earlier (the pattern around the previous io.LimitReader usage) by wrapping
resp.Body with io.LimitReader using the same max size constant (e.g.,
maxResponseBodySize or maxPayloadSize), read from that limited reader instead of
resp.Body directly, and validate the returned byte length (error if it equals
the limit implying truncation or exceeds allowed size). Update the logic in
CallTCGData (around the httpClient.Do(req), resp.Body and subsequent io.ReadAll
call) to use io.LimitReader and the same validation check used in the other
function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/ability/ability_test.go`:
- Line 64: The test currently ignores the returned error from AbilityCommand, so
negative-path expectations (wantError) aren't asserted; update the table-driven
test to capture both outputs by changing the call to retrieve (output, err) :=
AbilityCommand(tt.args) and then assert err presence/absence matches
tt.wantError (and optionally assert error contents when wantError is true),
referring to the AbilityCommand call and the tt.wantError field in the test
table to implement the check.

In `@cmd/speed/speed_test.go`:
- Line 32: The test currently ignores the error returned from SpeedCommand (call
site: SpeedCommand in cmd/speed/speed_test.go) which can hide failures; update
the test to capture the error (e.g., output, err := SpeedCommand(tt.args)) and
assert or fail on it — for example use t.Fatalf/t.Errorf or the test helper
being used (require.NoError/assert.NoError) to fail the test when err != nil
before asserting on output so command failures don't produce false positives.

In `@cmd/types/types_test.go`:
- Line 38: The test currently discards the error from TypesCommand (output, _ :=
TypesCommand(tt.args)); change this to capture the error (output, err :=
TypesCommand(tt.args)) and assert it against the test case expectation
(tt.wantErr) instead of ignoring it: if tt.wantErr { assert.Error(t, err) /
require.Error(t, err) } else { assert.NoError(t, err) / require.NoError(t, err)
} and then continue asserting on output; update references to TypesCommand,
output, err and tt.wantErr in the test to perform these checks.

In `@cmd/types/types.go`:
- Line 41: The current derivation endpoint := strings.ToLower(args[0])[0:4] is
brittle and can panic on short args; replace this with a named constant (e.g.,
const endpoint = "xxxx") for the fixed endpoint and stop slicing args[0];
additionally add a short input validation that checks len(args) and len(args[0])
(or ensure args[0] exists) before using it to avoid panics, updating any
references to the local variable endpoint and the args usage in the surrounding
function to use the constant and the new guard.

In `@docs/Infrastructure_Guide/cloudflare-tunnel.md`:
- Around line 96-97: The docs hardcode /home/ubuntu for copying cloudflared
credentials; update the commands to use a generic home reference (e.g., $HOME or
~ or a variable like CLOUD_USER_HOME or use $(whoami) to build the path) and
reference the cloudflared source as ~/.cloudflared/cert.pem and
~/.cloudflared/*.json so the copy to /etc/cloudflared/ works for non‑Ubuntu or
differently named user accounts; ensure the example shows the variable usage
consistently for both cert.pem and the JSON files.
- Around line 51-54: The doc hardcodes the ARM64 binary URL
(cloudflared-linux-arm64) in the curl command which will fail on amd64 hosts;
update the install snippet to be architecture-neutral by detecting architecture
(e.g., use curl .../cloudflared-linux-$(uname -m) -o /usr/local/bin/cloudflared
or map uname -m to the correct release name) and ensure the target path
(/usr/local/bin/cloudflared) and curl -L usage remain the same so the same
command works for both x86_64 and aarch64 hosts.

In `@docs/Infrastructure_Guide/n8n.md`:
- Line 13: Fix the typos in the user-facing documentation by replacing the
misspelled tokens: change "reasoons" to "reasons", "sucess" to "success", and
"defaut" to "default" in the n8n.md content so the sentences read correctly and
clearly (search for those exact tokens to locate where to update).
- Around line 376-384: The GraphQL mutation in LaunchRun uses the outdated
signature launchRun(selector: $s) and JobOrPipelineSelector; update it to the
current Dagster shape by changing the mutation to accept executionParams (e.g.,
mutation LaunchRun($p: ExecutionParams!) { launchRun(executionParams: $p) {
__typename ... on LaunchRunSuccess { run { runId } } ... on PythonError {
message } } }) so callers use $p/ExecutionParams instead of
$s/JobOrPipelineSelector and the documented launchRun(executionParams: $p)
pattern.

---

Outside diff comments:
In `@cmd/utils/validateargs.go`:
- Around line 77-86: The loop over args[2:] accesses arg[0] without checking for
an empty string, which can panic; modify the loop in validateargs.go to first
guard empty arguments (e.g., if arg == "" or len(arg) == 0) and return a
formatted error via FormatError (similar style to the existing empty-flag check)
before any access to arg[0]; keep the existing checks for "-" / "--" and the
flag-character check afterwards so invalid or empty positional values are
rejected safely.

In `@connections/connection.go`:
- Around line 157-168: The CallTCGData code reads resp.Body with io.ReadAll
unbounded; mirror the bounded-read hardening used earlier (the pattern around
the previous io.LimitReader usage) by wrapping resp.Body with io.LimitReader
using the same max size constant (e.g., maxResponseBodySize or maxPayloadSize),
read from that limited reader instead of resp.Body directly, and validate the
returned byte length (error if it equals the limit implying truncation or
exceeds allowed size). Update the logic in CallTCGData (around the
httpClient.Do(req), resp.Body and subsequent io.ReadAll call) to use
io.LimitReader and the same validation check used in the other function.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90725948-e9df-44bd-8cea-1a7699054d18

📥 Commits

Reviewing files that changed from the base of the PR and between 31176b4 and a0d742e.

📒 Files selected for processing (49)
  • .github/workflows/ci.yml
  • .goreleaser.yml
  • Dockerfile
  • README.md
  • card_data/pipelines/poke_cli_dbt/dbt_project.yml
  • card_data/pyproject.toml
  • cli.go
  • cli_test.go
  • cmd/ability/ability.go
  • cmd/ability/ability_test.go
  • cmd/berry/berry.go
  • cmd/berry/berry_test.go
  • cmd/berry/berryinfo.go
  • cmd/card/card.go
  • cmd/card/card_test.go
  • cmd/card/cardinfo.go
  • cmd/item/item.go
  • cmd/item/item_test.go
  • cmd/move/move.go
  • cmd/move/move_test.go
  • cmd/natures/natures.go
  • cmd/natures/natures_test.go
  • cmd/pokemon/pokemon.go
  • cmd/pokemon/pokemon_test.go
  • cmd/search/search.go
  • cmd/search/search_test.go
  • cmd/speed/speed.go
  • cmd/speed/speed_test.go
  • cmd/tcg/tcg.go
  • cmd/tcg/tcg_test.go
  • cmd/types/types.go
  • cmd/types/types_test.go
  • cmd/utils/output.go
  • cmd/utils/output_test.go
  • cmd/utils/validateargs.go
  • cmd/utils/validateargs_test.go
  • connections/connection.go
  • connections/connection_test.go
  • docs/Infrastructure_Guide/cloudflare-tunnel.md
  • docs/Infrastructure_Guide/n8n.md
  • docs/installation.md
  • docs/nginx.conf
  • flags/pokemonflagset.go
  • flags/version.go
  • flags/version_test.go
  • mkdocs.yml
  • nfpm.yaml
  • testdata/main_latest_flag.golden
  • web/pyproject.toml
💤 Files with no reviewable changes (1)
  • cli_test.go

defer func() { os.Args = originalArgs }()

output, _ := AbilityCommand()
output, _ := AbilityCommand(tt.args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Preserve error-path assertions in table tests.

Line 64 drops the returned err, so wantError is never enforced and negative-path regressions can pass unnoticed.

Suggested fix
-			output, _ := AbilityCommand(tt.args)
+			output, err := AbilityCommand(tt.args)
 			cleanOutput := styling.StripANSI(output)
+
+			if (err != nil) != tt.wantError {
+				t.Errorf("AbilityCommand() error = %v, wantErr %v", err, tt.wantError)
+				return
+			}
 
 			assert.Equal(t, tt.expectedOutput, cleanOutput, "Output should match expected")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
output, _ := AbilityCommand(tt.args)
output, err := AbilityCommand(tt.args)
cleanOutput := styling.StripANSI(output)
if (err != nil) != tt.wantError {
t.Errorf("AbilityCommand() error = %v, wantErr %v", err, tt.wantError)
return
}
assert.Equal(t, tt.expectedOutput, cleanOutput, "Output should match expected")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ability/ability_test.go` at line 64, The test currently ignores the
returned error from AbilityCommand, so negative-path expectations (wantError)
aren't asserted; update the table-driven test to capture both outputs by
changing the call to retrieve (output, err) := AbilityCommand(tt.args) and then
assert err presence/absence matches tt.wantError (and optionally assert error
contents when wantError is true), referring to the AbilityCommand call and the
tt.wantError field in the test table to implement the check.

Comment thread cmd/speed/speed_test.go
defer func() { os.Args = originalArgs }()

output, _ := SpeedCommand()
output, _ := SpeedCommand(tt.args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Check the returned error in this test path.

Line 32 discards err, which can mask command failures and let output assertions pass for the wrong reason.

Suggested fix
-			output, _ := SpeedCommand(tt.args)
+			output, err := SpeedCommand(tt.args)
+			if tt.wantError {
+				require.Error(t, err)
+			} else {
+				require.NoError(t, err)
+			}
 			cleanOutput := styling.StripANSI(output)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
output, _ := SpeedCommand(tt.args)
output, err := SpeedCommand(tt.args)
if tt.wantError {
require.Error(t, err)
} else {
require.NoError(t, err)
}
cleanOutput := styling.StripANSI(output)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/speed/speed_test.go` at line 32, The test currently ignores the error
returned from SpeedCommand (call site: SpeedCommand in cmd/speed/speed_test.go)
which can hide failures; update the test to capture the error (e.g., output, err
:= SpeedCommand(tt.args)) and assert or fail on it — for example use
t.Fatalf/t.Errorf or the test helper being used (require.NoError/assert.NoError)
to fail the test when err != nil before asserting on output so command failures
don't produce false positives.

Comment thread cmd/types/types_test.go
defer func() { os.Args = originalArgs }()

output, _ := TypesCommand()
output, _ := TypesCommand(tt.args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Assert command errors instead of discarding them in tests.

Line 38 ignores err, which can hide failures and make output-only checks flaky.

Suggested fix
-			output, _ := TypesCommand(tt.args)
+			output, err := TypesCommand(tt.args)
+			require.NoError(t, err)
 			cleanOutput := styling.StripANSI(output)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
output, _ := TypesCommand(tt.args)
output, err := TypesCommand(tt.args)
require.NoError(t, err)
cleanOutput := styling.StripANSI(output)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/types/types_test.go` at line 38, The test currently discards the error
from TypesCommand (output, _ := TypesCommand(tt.args)); change this to capture
the error (output, err := TypesCommand(tt.args)) and assert it against the test
case expectation (tt.wantErr) instead of ignoring it: if tt.wantErr {
assert.Error(t, err) / require.Error(t, err) } else { assert.NoError(t, err) /
require.NoError(t, err) } and then continue asserting on output; update
references to TypesCommand, output, err and tt.wantErr in the test to perform
these checks.

Comment thread cmd/types/types.go
}

endpoint := strings.ToLower(os.Args[1])[0:4]
endpoint := strings.ToLower(args[0])[0:4]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid brittle slicing when deriving the endpoint.

Line 41 can panic on short input and obscures intent. Since this endpoint is fixed for this command, use a constant.

Suggested fix
-	endpoint := strings.ToLower(args[0])[0:4]
+	endpoint := "type"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
endpoint := strings.ToLower(args[0])[0:4]
endpoint := "type"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/types/types.go` at line 41, The current derivation endpoint :=
strings.ToLower(args[0])[0:4] is brittle and can panic on short args; replace
this with a named constant (e.g., const endpoint = "xxxx") for the fixed
endpoint and stop slicing args[0]; additionally add a short input validation
that checks len(args) and len(args[0]) (or ensure args[0] exists) before using
it to avoid panics, updating any references to the local variable endpoint and
the args usage in the surrounding function to use the constant and the new
guard.

Comment on lines +51 to +54
```bash
sudo curl -L \
https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64 \
-o /usr/local/bin/cloudflared
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use architecture-neutral install commands.

Line 49 says both ARM64 and x86_64 are supported, but Line 53 hardcodes the ARM64 binary URL. This will fail on amd64 hosts.

Suggested doc fix
-sudo curl -L \
-  https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64 \
-  -o /usr/local/bin/cloudflared
+ARCH="$(uname -m)"
+if [ "$ARCH" = "x86_64" ]; then
+  CF_ARCH="amd64"
+elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
+  CF_ARCH="arm64"
+else
+  echo "Unsupported architecture: $ARCH" >&2
+  exit 1
+fi
+
+sudo curl -L \
+  "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${CF_ARCH}" \
+  -o /usr/local/bin/cloudflared
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 51-51: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/Infrastructure_Guide/cloudflare-tunnel.md` around lines 51 - 54, The doc
hardcodes the ARM64 binary URL (cloudflared-linux-arm64) in the curl command
which will fail on amd64 hosts; update the install snippet to be
architecture-neutral by detecting architecture (e.g., use curl
.../cloudflared-linux-$(uname -m) -o /usr/local/bin/cloudflared or map uname -m
to the correct release name) and ensure the target path
(/usr/local/bin/cloudflared) and curl -L usage remain the same so the same
command works for both x86_64 and aarch64 hosts.

Comment thread docs/Infrastructure_Guide/cloudflare-tunnel.md

## Overview

n8n is used in this project for a few different reasoons such as performing API status checks, sending sucess/failure notifications, or ingesting data from sources that are not in a friendly format like a REST API.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix spelling mistakes in user-facing docs.

Line 13 has reasoons and sucess; Line 59 has defaut. These should be corrected for clarity.

Also applies to: 59-59

🧰 Tools
🪛 LanguageTool

[grammar] ~13-~13: Ensure spelling is correct
Context: ...sed in this project for a few different reasoons such as performing API status checks, s...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~13-~13: Ensure spelling is correct
Context: ...s performing API status checks, sending sucess/failure notifications, or ingesting dat...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/Infrastructure_Guide/n8n.md` at line 13, Fix the typos in the
user-facing documentation by replacing the misspelled tokens: change "reasoons"
to "reasons", "sucess" to "success", and "defaut" to "default" in the n8n.md
content so the sentences read correctly and clearly (search for those exact
tokens to locate where to update).

Comment on lines +376 to +384
```graphql
mutation LaunchRun($s: JobOrPipelineSelector!) {
launchRun(selector: $s) {
__typename
... on LaunchRunSuccess { run { runId } }
... on PythonError { message }
}
}
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

GraphQL mutation shape conflicts with the Dagster API version documented in this PR.

This snippet uses launchRun(selector: $s), but the Cloudflare guide in this PR (Line 184 onward) documents launchRun(executionParams: $p) for the current Dagster version. Keeping both patterns will lead to failed trigger calls depending on which guide users follow.

Suggested doc fix
-mutation LaunchRun($s: JobOrPipelineSelector!) {
-  launchRun(selector: $s) {
+mutation LaunchRun($p: ExecutionParams!) {
+  launchRun(executionParams: $p) {
     __typename
     ... on LaunchRunSuccess { run { runId } }
     ... on PythonError { message }
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```graphql
mutation LaunchRun($s: JobOrPipelineSelector!) {
launchRun(selector: $s) {
__typename
... on LaunchRunSuccess { run { runId } }
... on PythonError { message }
}
}
```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 376-376: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/Infrastructure_Guide/n8n.md` around lines 376 - 384, The GraphQL
mutation in LaunchRun uses the outdated signature launchRun(selector: $s) and
JobOrPipelineSelector; update it to the current Dagster shape by changing the
mutation to accept executionParams (e.g., mutation LaunchRun($p:
ExecutionParams!) { launchRun(executionParams: $p) { __typename ... on
LaunchRunSuccess { run { runId } } ... on PythonError { message } } }) so
callers use $p/ExecutionParams instead of $s/JobOrPipelineSelector and the
documented launchRun(executionParams: $p) pattern.

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.

Create centralized HTTP timeout helper Harden API and image HTTP request handling Refactor commands to use explicit argument passing

1 participant