Skip to content

fix(server): reject malformed startup environment defaults - #454

Merged
cristim merged 1 commit into
mainfrom
fix/env-default-validation
Sep 29, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/env-default-validation

Conversation

@cristim

@cristim cristim commented Sep 29, 2026

Copy link
Copy Markdown
Member

Malformed DEFAULT_TERM, DEFAULT_COVERAGE, or ANALYTICS_COLLECTION_ENABLED now stops startup with an error naming the setting, before external initialization. Previously, inputs such as 3y, 80%, and no silently became the built-in defaults. Both configuration loaders return parse errors directly. Unset defaults, accepted boolean spellings, zero coverage, and disabled analytics retain their behavior.

Closes #236.

Validation on macOS with Go 1.26.6:

  • Eight real NewApplication regression cases fail against the original source and pass with the fix. An empty DB_HOST prevents the original path from reaching cloud services, and assertions require the malformed setting's name.
  • Race tests pass for internal/server, internal/database, internal/purchase, cmd/server, and cmd/lambda.
  • Full backend build, golangci-lint 2.10.1, and normal commit hooks pass.
  • Loaded-config tests cover defaults, valid spellings, snapshots, and the actual disabled-analytics handler path.

Independent gpt-6-astra review used the user-authorized substitution for unavailable Opus, with two clean source passes and independent original-source red/fixed-source green execution. Final verdict: PUBLICATION APPROVED for 6fc436c95de3e5163fe8c575e7c443d0d515322d, following a complete committed-diff reread and fresh startup/config/analytics race tests (exit 0, 3.321s).

No cloud operations, purchases, or deployments were performed.

Return parse errors for term, coverage and analytics enablement before
initializing external dependencies. Preserve unset defaults and valid
values, including disabled analytics and zero coverage.

Closes #236
@cristim cristim added severity/medium Moderate harm urgency/this-sprint Within the current sprint triaged Item has been triaged priority/p1 Next up; this sprint impact/all-users Affects every user effort/xs Trivial / one-liner type/bug Defect labels Sep 29, 2026
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 36 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 68 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 91cf22b4-2d11-4de9-92f4-da2aebb49c14

📥 Commits

Reviewing files that changed from the base of the PR and between 4507933 and 6fc436c.

📒 Files selected for processing (4)
  • internal/server/analytics_collect.go
  • internal/server/analytics_collect_test.go
  • internal/server/app.go
  • internal/server/app_test.go

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

@cristim
cristim merged commit 897ce18 into main Sep 29, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/xs Trivial / one-liner impact/all-users Affects every user priority/p1 Next up; this sprint severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(server): three env knobs silently fall back on an unparseable value

1 participant