Skip to content

Remove ROSA cluster discovery from fetch_pricing#17

Merged
jeremyeder merged 1 commit into
mainfrom
remove-rosa-cluster-scan
May 20, 2026
Merged

Remove ROSA cluster discovery from fetch_pricing#17
jeremyeder merged 1 commit into
mainfrom
remove-rosa-cluster-scan

Conversation

@jeremyeder
Copy link
Copy Markdown
Contributor

Summary

  • Remove kubeconfig scanning (oc get nodes across all contexts) from fetch_pricing.py — it touched clusters unnecessarily and provided no value
  • Remove rosa_cluster_instance table, v_rosa_estimated_cost view, and rosa_cluster_costs MCP tool
  • Remove --rosa-only / --skip-rosa CLI flags
  • ROSA service fee pricing (static published rates from aws.amazon.com/rosa/pricing) is retained

Test plan

  • uv run scripts/fetch_pricing.py completes without any oc calls
  • scripts/test.sh passes (pricing table checks updated)
  • No kubeconfig or cluster access attempted

🤖 Generated with Claude Code

The kubeconfig scan (oc get nodes across all contexts) provided no
value and touched clusters unnecessarily. Remove the rosa_cluster_instance
table, v_rosa_estimated_cost view, rosa_cluster_costs MCP tool, and
--rosa-only/--skip-rosa CLI flags.

ROSA service fee pricing (static published rates) is retained in
cloud_pricing since it requires no cluster access.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Walkthrough

The PR replaces dynamic ROSA cluster discovery with static service fee pricing. Database schema elements supporting dynamic instance lookup are removed, static ROSA fees are introduced and fetched alongside AWS pricing, the MCP tool exposing cluster costs is deleted, and tests are updated to reflect the new schema.

Changes

ROSA Pricing Model Migration

Layer / File(s) Summary
ROSA Database Schema Cleanup
scripts/fetch_pricing.py
Removes the rosa_cluster_instance table, its index (idx_rosa_instance_type), and the v_rosa_estimated_cost view that supported dynamic cluster cost estimation queries.
Static ROSA Service Fees
scripts/fetch_pricing.py
Introduces ROSA_SERVICE_FEES constant containing hardcoded ROSA service fee SKUs and pricing, and adds fetch_rosa_service_fees() function that converts these entries into rows for the cloud_pricing table.
Pricing Ingestion Pipeline Refactor
scripts/fetch_pricing.py
Updates CLI argument parsing to remove --rosa-only and --skip-rosa flags, simplifies source-selection booleans to tie ROSA fetching to AWS data fetching, and replaces the old cluster discovery block in main() with static service fees ingestion.
MCP Tool Removal
mcp_server.py
Removes the rosa_cluster_costs() MCP tool function that previously queried the deleted v_rosa_estimated_cost view.
Test Schema Validation Update
scripts/test.sh
Updates the Pricing DB smoke test to validate only cloud_pricing and _meta tables, removing the check for the deleted rosa_cluster_instance table.
Code Formatting
scripts/fetch_pricing.py
Minor refactoring of iteration and expression layout in AWS/Claude pricing extraction (OnDemand loop, HTTP streaming call, product description construction) with no behavioral change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing ROSA cluster discovery from fetch_pricing, which aligns with the primary objective and changeset.
Description check ✅ Passed The description is directly related to the changeset, detailing the removal of kubeconfig scanning, database tables/views, CLI flags, and retention of static ROSA service fees.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
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 remove-rosa-cluster-scan

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

Copy link
Copy Markdown

@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: 1

Caution

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

⚠️ Outside diff range comments (1)
scripts/fetch_pricing.py (1)

1-1: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Resolve ruff formatting failure.

The CI pipeline indicates this file fails ruff format --check. Run ruff format scripts/fetch_pricing.py to auto-fix.

🤖 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 `@scripts/fetch_pricing.py` at line 1, The file scripts/fetch_pricing.py is
failing ruff format --check; run the formatter (e.g., `ruff format
scripts/fetch_pricing.py`) to auto-apply style fixes so the shebang and file
formatting conform to ruff rules, then re-run the CI check and commit the
formatted file (targeting the fetch_pricing.py module).
🤖 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 `@scripts/fetch_pricing.py`:
- Around line 559-566: The if-condition for ROSA service fees is redundant
because fetch_aws is already set as not args.claude_only; replace the compound
condition "if fetch_aws or (not args.claude_only)" with the simpler "if
fetch_aws" where the ROSA block calls fetch_rosa_service_fees(...) and upserts
via upsert_pricing(...), leaving the rest of the block unchanged.

---

Outside diff comments:
In `@scripts/fetch_pricing.py`:
- Line 1: The file scripts/fetch_pricing.py is failing ruff format --check; run
the formatter (e.g., `ruff format scripts/fetch_pricing.py`) to auto-apply style
fixes so the shebang and file formatting conform to ruff rules, then re-run the
CI check and commit the formatted file (targeting the fetch_pricing.py module).
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 445eeeb1-029e-4367-83c6-37a252d1a709

📥 Commits

Reviewing files that changed from the base of the PR and between 7813614 and bdf958a.

📒 Files selected for processing (3)
  • mcp_server.py
  • scripts/fetch_pricing.py
  • scripts/test.sh
💤 Files with no reviewable changes (1)
  • mcp_server.py

Comment thread scripts/fetch_pricing.py
Comment on lines +559 to +566
# --- ROSA service fees ---
if fetch_aws or (not args.claude_only):
print("\n=== ROSA Service Fees (aws.amazon.com/rosa/pricing) ===")
rows = fetch_rosa_service_fees(now)
if rows:
count = upsert_rosa_instances(conn, rows)
count = upsert_pricing(conn, rows)
conn.commit()
print(f" Total: {count} cluster nodes upserted")
conn.execute(
"INSERT INTO _meta (key, value) VALUES ('last_rosa_fetch', ?) "
"ON CONFLICT(key) DO UPDATE SET value=excluded.value",
(now,),
)
else:
errors.append("ROSA: no nodes discovered (oc may not be available)")
print(f" Total: {count} ROSA fee entries upserted")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Redundant condition — simplify to if fetch_aws:

Since fetch_aws = not args.claude_only (line 511), the condition fetch_aws or (not args.claude_only) is logically equivalent to just fetch_aws. The second disjunct is always equal to the first.

♻️ Proposed fix
-        # --- ROSA service fees ---
-        if fetch_aws or (not args.claude_only):
+        # --- ROSA service fees (bundled with AWS) ---
+        if fetch_aws:
             print("\n=== ROSA Service Fees (aws.amazon.com/rosa/pricing) ===")
             rows = fetch_rosa_service_fees(now)
📝 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
# --- ROSA service fees ---
if fetch_aws or (not args.claude_only):
print("\n=== ROSA Service Fees (aws.amazon.com/rosa/pricing) ===")
rows = fetch_rosa_service_fees(now)
if rows:
count = upsert_rosa_instances(conn, rows)
count = upsert_pricing(conn, rows)
conn.commit()
print(f" Total: {count} cluster nodes upserted")
conn.execute(
"INSERT INTO _meta (key, value) VALUES ('last_rosa_fetch', ?) "
"ON CONFLICT(key) DO UPDATE SET value=excluded.value",
(now,),
)
else:
errors.append("ROSA: no nodes discovered (oc may not be available)")
print(f" Total: {count} ROSA fee entries upserted")
# --- ROSA service fees (bundled with AWS) ---
if fetch_aws:
print("\n=== ROSA Service Fees (aws.amazon.com/rosa/pricing) ===")
rows = fetch_rosa_service_fees(now)
if rows:
count = upsert_pricing(conn, rows)
conn.commit()
print(f" Total: {count} ROSA fee entries upserted")
🤖 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 `@scripts/fetch_pricing.py` around lines 559 - 566, The if-condition for ROSA
service fees is redundant because fetch_aws is already set as not
args.claude_only; replace the compound condition "if fetch_aws or (not
args.claude_only)" with the simpler "if fetch_aws" where the ROSA block calls
fetch_rosa_service_fees(...) and upserts via upsert_pricing(...), leaving the
rest of the block unchanged.

@jeremyeder jeremyeder merged commit 3ec3f5a into main May 20, 2026
5 of 8 checks passed
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