Skip to content

fix: deploy hygiene (validate-before-persist, env filter, honest badge, real hostname) — CashPilot-Desktop-ada - #99

Merged
GeiserX merged 1 commit into
mainfrom
fix/loop-ada-deploy-hygiene
Jul 18, 2026
Merged

fix: deploy hygiene (validate-before-persist, env filter, honest badge, real hostname) — CashPilot-Desktop-ada#99
GeiserX merged 1 commit into
mainfrom
fix/loop-ada-deploy-hygiene

Conversation

@GeiserX

@GeiserX GeiserX commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Four pre-existing low-severity latents from the PR #96 review panel.

1. Validate before persisting credentials (app.go DeployService)

Creds were saved before manager.Deploy's validation, so a rejected deploy left invalid/blank creds lingering — they can never deploy, yet they linger and light the "Configured" badge. Now validates via a new Manager.ValidateCredentials (mirroring Deploy's known/deployable/required gates) and persists only on success.

2. Filter container env to catalog-declared keys (runtime.go buildEnv)

buildEnv copied every stored-cred key into the container env unfiltered, so an orphaned pre-migration key (e.g. USER_ID/DEVICE_NAME) could leak into a running container. Now only catalog-declared keys pass. (The native buildNativeEnv keeps its documented passthrough — its test asserts an undeclared override survives — so that path is out of scope.)

3. Honest "Configured" badge (app.go settings)

The badge was len(creds) > 0, so an orphaned old-key blob showed Configured although a deploy would fail until re-entry. Now keyed off the current required fields via Manager.RequiredCredentialsMet (credsConfigured = has creds and they satisfy the required schema).

4. Real hostname instead of the literal {hostname} (both runtimes + form)

An unedited deploy form resubmitted the raw cashpilot-{hostname} default as an override; buildEnv only substituted {hostname} on defaults (and to the literal "desktop"), so a container was literally named cashpilot-{hostname}. Now {hostname} expands to the real host (DeviceHostname()) on defaults and overrides in both the Docker and native paths, and AppState.hostname lets the form render the real value up front.

Tests

  • runtime: buildEnv drops an undeclared override and expands {hostname} on an override.
  • services: ValidateCredentials (unknown/manual/missing/valid) + RequiredCredentialsMet (orphaned blob → false).
  • app: DeployService rejects an invalid blob and persists nothing.
  • go test -race ./..., go vet, gofmt clean; frontend tsc clean.

Closes bead CashPilot-Desktop-ada.

…ge, real hostname (CashPilot-Desktop-ada)

Four pre-existing latents from the PR #96 review:

1. DeployService persisted credentials BEFORE validation, so a rejected deploy
   left invalid/blank creds lingering (and lighting the 'Configured' badge for
   a service that could never start). Validate via the new
   Manager.ValidateCredentials first; persist only if it passes.
2. buildEnv copied every stored-cred key into the container env unfiltered.
   Restrict to catalog-declared keys so an orphaned pre-migration key can't
   leak into a container. (The native twin keeps its documented passthrough.)
3. The 'Configured' badge was len(creds)>0, so an orphaned old-key blob read as
   configured though a deploy would fail. Key it off the current required fields
   via Manager.RequiredCredentialsMet.
4. An unedited deploy form resubmitted the raw 'cashpilot-{hostname}' default as
   an override, which buildEnv only substituted on defaults (and to the literal
   'desktop') — producing a device literally named cashpilot-{hostname}. Expand
   {hostname} to the real host on defaults AND overrides (both runtimes), and
   surface AppState.hostname so the form renders the real value.

Tests: buildEnv filter+hostname, ValidateCredentials/RequiredCredentialsMet,
DeployService validate-before-persist. go test -race + vet + gofmt clean, tsc clean.
@GeiserX

GeiserX commented Jul 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GeiserX, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 10 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2e157aee-e6c2-4c2e-bf54-94afbf7f36a6

📥 Commits

Reviewing files that changed from the base of the PR and between 854084b and 0567af0.

📒 Files selected for processing (9)
  • app.go
  • app_test.go
  • frontend/src/main.ts
  • frontend/src/wails.d.ts
  • internal/runtime/native.go
  • internal/runtime/runtime.go
  • internal/runtime/runtime_test.go
  • internal/services/manager.go
  • internal/services/manager_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/loop-ada-deploy-hygiene

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.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.15%. Comparing base (854084b) to head (0567af0).

Files with missing lines Patch % Lines
internal/runtime/runtime.go 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
+ Coverage   75.03%   75.15%   +0.12%     
==========================================
  Files          14       14              
  Lines        3433     3454      +21     
==========================================
+ Hits         2576     2596      +20     
- Misses        669      670       +1     
  Partials      188      188              
Files with missing lines Coverage Δ
internal/runtime/native.go 82.17% <100.00%> (+0.02%) ⬆️
internal/services/manager.go 96.47% <100.00%> (+0.26%) ⬆️
internal/runtime/runtime.go 57.14% <90.90%> (+0.46%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GeiserX
GeiserX merged commit e48945e into main Jul 18, 2026
6 checks passed
@GeiserX
GeiserX deleted the fix/loop-ada-deploy-hygiene branch July 18, 2026 17:20
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