Skip to content

Report the Stripe key mode on /v1/info; pin CI lint to v2.14.0 - #114

Merged
jasonnorch merged 2 commits into
mainfrom
feat/billing-mode-status
Oct 15, 2026
Merged

jasonnorch merged 2 commits into
mainfrom
feat/billing-mode-status

Conversation

@jasonnorch

@jasonnorch jasonnorch commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

First step of the Stripe go-live (#53).

Why

Nothing in internal/billing tells a live Stripe configuration from a test one. A test key, test webhook secret and test price ID all work together in production, take no money, and raise no error. #53's own notes call this out: a half-rotated secret set degrades quietly. There was no single check that the switch to live mode had happened.

What

  • billing.KeyMode reads live / test / unknown from the secret key prefix (sk_ and rk_ forms). Table-driven test.
  • /v1/info gains services.billing.mode; the same struct feeds the startup log, so it appears there too. omitempty, so the field is absent when billing is disabled.
  • app.go warns once at startup when application.mode is production and the mode is not live.
  • README's /v1/info row mentions the field.

CI fix folded in

make verify failed locally on lint: golangci-lint v2.13.1 cannot decode the export data Go 1.27.2 emits and fails typecheck on every package. CI pins v2.13.1 and resolves Go from go.mod, and its last run predates 1.27.2, so the next PR would have failed on the lint step whatever it touched. Bumped the pin to v2.14.0, which handles it. Separate commit.

Verification

make verify passes: gofmt, vet, lint-new (0 issues with v2.14.0), unit tests with -race, integration tests.

After merge and release, the go-live check becomes: /v1/info shows services.billing.mode: "live".

Summary by CodeRabbit

  • New Features
    • Billing status in /v1/info now reports the Stripe key mode as live, test, or unknown.
  • Bug Fixes
    • The application logs a startup warning when billing is configured with a non-live key while running in production.

…uction

Nothing in the billing path distinguishes a live Stripe configuration from a
test one: a test key, test webhook secret and test price ID work together in
production, take no money, and raise no error. The go-live (#53) therefore had
no single check that it had actually happened.

billing.KeyMode reads the mode from the secret key prefix (sk_/rk_ live or
test). It is reported as services.billing.mode on /v1/info and in the startup
log, and the app warns once at startup when production is running on anything
other than a live key.

Assisted-by: Claude Fable 5.1
golangci-lint v2.13.1 cannot decode the export data Go 1.27.2 emits ("export
data version 5 is greater than maximum supported version 4") and fails
typecheck on every package. CI resolves Go from go.mod and the last run was
before 1.27.2 shipped, so the next PR would have failed regardless of content.
v2.14.0 handles it; make lint-new reports 0 new issues with it locally.

Also adds the changelog entries for this branch.

Assisted-by: Claude Fable 5.1
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Review in Change Stack →

Security-Accelerated is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.

  • Ask an admin to upgrade

Open in CodeRabbit

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Security-Accelerated/intelligence-api/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Free
  • Run ID: bf2032b5-6e11-4ca3-8609-7e7b2d2f5ae2
📥 Commits

Reviewing files that changed from the base of the PR and between 6223cc5 and e4c50d5.

📒 Files selected for processing: 7
  • .github/workflows/test.yml
  • README.md
  • internal/app/app.go
  • internal/billing/keymode.go
  • internal/billing/keymode_test.go
  • internal/config/status.go
  • internal/handler/changelog.yaml

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

📝 Walkthrough

The change classifies Stripe secret keys as live, test, or unknown. Billing status adds an optional mode field, and production startup warns when the configured mode is not live. The service description and changelog are updated. The lint workflow installs a newer golangci-lint version.

Changes: Billing key-mode reporting

Layer / File(s) Summary
Key-mode classification and status
internal/billing/keymode.go, internal/config/status.go, internal/billing/keymode_test.go
Added key-mode constants and prefix classification. BillingStatus adds an optional mode field. Tests cover standard and restricted live/test prefixes, plus unrecognized inputs.
Startup warning and reporting description
internal/app/app.go, README.md, internal/handler/changelog.yaml
Production startup warns when enabled billing uses a mode other than live. The /v1/info description and changelog record billing-mode reporting and the warning.

CI lint version

Layer / File(s) Summary
Lint job version update
.github/workflows/test.yml
The lint job installs golangci-lint v2.14.0 instead of v2.13.1.

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

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@jasonnorch
jasonnorch merged commit ab6d7ec into main Oct 15, 2026
3 checks passed
@jasonnorch
jasonnorch deleted the feat/billing-mode-status branch October 15, 2026 20:52
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