Repository navigation
feat: Levelrail v1.5.19, small server backups, Kafka and Spark, staged agent updates and safer redeploys - #1834
Conversation
|
Important Review skippedToo many files! This PR contains 1011 files, which is 911 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 500 files.
|
glinr-botA protected condition applies, so a person decides.
No action taken. A person reviews this one. Checks (shadow, nothing is enforced)
Next steps:
|
| token, _ := rt.resolveGitSourceDeployToken(ctx, name) | ||
| raw, err := rt.sourceCache.CommitObject(rt.withSSHDeployKey(ctx, gs.RepoURL), gs.RepoURL, sha, token) |
There was a problem hiding this comment.
commitSigningRefusal drops the credential scope before fetching the commit. For an SSH source, withSSHDeployKey only attaches the saved key when the context has an app: scope. A new signed push therefore fails with commit_signature_unverifiable even when its deploy key and signature are valid. Use resolveGitSourceDeployCredential and attach its scope before fetching.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/api/commit_signing.go
Line: 186-187
Comment:
**Signed SSH pushes are refused**
`commitSigningRefusal` drops the credential scope before fetching the commit. For an SSH source, `withSSHDeployKey` only attaches the saved key when the context has an `app:` scope. A new signed push therefore fails with `commit_signature_unverifiable` even when its deploy key and signature are valid. Use `resolveGitSourceDeployCredential` and attach its scope before fetching.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| name, _ := ctx.Value(commitSigningAppKey{}).(string) | ||
| if name == "" { | ||
| return nil |
There was a problem hiding this comment.
Unsigned source can still deploy
verifyCheckoutSigning skips the policy when the caller omits the app name. handleDeploySpec does exactly that, and single_service_name lets it replace an existing service that requires signed commits. A caller with deploy access can therefore deploy unsigned source without changing the signing policy. Check the policy for each destination service before building it.
How this was verified: The deploy-spec fetch omits the signing context, and its chosen service name reaches Pipeline.Deploy without another signature check.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/api/commit_signing.go
Line: 141-143
Comment:
**Unsigned source can still deploy**
`verifyCheckoutSigning` skips the policy when the caller omits the app name. `handleDeploySpec` does exactly that, and `single_service_name` lets it replace an existing service that requires signed commits. A caller with deploy access can therefore deploy unsigned source without changing the signing policy. Check the policy for each destination service before building it.
**How this was verified:** The deploy-spec fetch omits the signing context, and its chosen service name reaches `Pipeline.Deploy` without another signature check.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if rerr := e.Backend.Restart(ctx, app); rerr != nil { | ||
| return e.restartFailed(ctx, p, actor, rerr) | ||
| } | ||
| } | ||
| p.State, p.LastError = store.SecretRotationIdle, "" |
There was a problem hiding this comment.
Rotation skips restart failures
restartConsumers waits only for a restart request to be saved, not for the app to restart successfully. The real Restart method changes restart_nonce, writes an event, and returns immediately. The loop can request every restart and mark the rotation complete before the first app fails to start. Wait for each app to become healthy before moving on, and record completion only then.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/secretrotation/engine.go
Line: 317-321
Comment:
**Rotation skips restart failures**
`restartConsumers` waits only for a restart request to be saved, not for the app to restart successfully. The real `Restart` method changes `restart_nonce`, writes an event, and returns immediately. The loop can request every restart and mark the rotation complete before the first app fails to start. Wait for each app to become healthy before moving on, and record completion only then.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| v, err := rt.cachedSummary(r.Context(), key, func(ctx context.Context) (any, error) { | ||
| rules, err := lister.ListRules(ctx) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return summarizeSLO(rules, time.Now()), nil |
There was a problem hiding this comment.
Hidden apps appear in summaries
handleSLOSummary returns every enabled SLO rule without applying the caller's app visibility or IAM policies. A default-organization reader denied access to app:secret can still receive its name, burn rate, and target in worst. Filter the rules with the normal app-read check. Include the caller's access scope in the cache key, or avoid sharing filtered results.
How this was verified: The read-only route calls unfiltered ListRules, while normal app reads apply callerAppAccess and its resource checks.
Knowledge Base Used: Authentication, authorization, and tenancy
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/api/summary_slo.go
Line: 96-101
Comment:
**Hidden apps appear in summaries**
`handleSLOSummary` returns every enabled SLO rule without applying the caller's app visibility or IAM policies. A default-organization reader denied access to `app:secret` can still receive its name, burn rate, and target in `worst`. Filter the rules with the normal app-read check. Include the caller's access scope in the cache key, or avoid sharing filtered results.
**How this was verified:** The read-only route calls unfiltered `ListRules`, while normal app reads apply `callerAppAccess` and its resource checks.
**Knowledge Base Used:** [Authentication, authorization, and tenancy](https://app.greptile.com/-/switch-tenant?tenant=glinr&next=%2Fcustom-context%2Fknowledge-base%2Fglincker%2Flevelrail%2F-%2Fdocs%2Fauthentication-authorization-and-tenancy.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| for _, r := range snap.Records { | ||
| if now.Sub(r.Time) <= retention { | ||
| l.push(r) | ||
| } |
There was a problem hiding this comment.
LoadFile restores saved records without applying the current privacy setting. After saving with full or names_only, restarting with counters_only brings the old domain names back. Restarting with names_only can also restore source IPs. SaveFile then writes those records again. Apply the current privacy level when loading and saving, rather than relying only on Observe.
How this was verified: Restored records go directly to push, bypassing the privacy checks used when a query is first recorded.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/network/dns_querylog_persist.go
Line: 74-77
Comment:
**Old DNS details return**
`LoadFile` restores saved records without applying the current privacy setting. After saving with `full` or `names_only`, restarting with `counters_only` brings the old domain names back. Restarting with `names_only` can also restore source IPs. `SaveFile` then writes those records again. Apply the current privacy level when loading and saving, rather than relying only on `Observe`.
**How this was verified:** Restored records go directly to `push`, bypassing the privacy checks used when a query is first recorded.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| case herr != nil: | ||
| s.log.Warn("secretscan: git history scan failed", slog.String("app", in.App), slog.String("error", herr.Error())) | ||
| case state == HistoryShallow: | ||
| s.log.Info("secretscan: git history not checked, clone is shallow", slog.String("app", in.App)) |
There was a problem hiding this comment.
The history-scan error and shallow-clone branches only write a log message. Neither changes scanErr or marks the result incomplete. With a clean current tree, a missing git executable or failed history read therefore produces StatusComplete and ActionAllow, even under PolicyBlock. Pass history errors into the decision and record skipped history as incomplete.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/deploy/secretscan/service.go
Line: 123-126
Comment:
**Skipped history looks clean**
The history-scan error and shallow-clone branches only write a log message. Neither changes `scanErr` or marks the result incomplete. With a clean current tree, a missing `git` executable or failed history read therefore produces `StatusComplete` and `ActionAllow`, even under `PolicyBlock`. Pass history errors into the decision and record skipped history as incomplete.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| for (const [key, value] of Object.entries(diff.settings)) { | ||
| await setSetting.mutateAsync({ key, value }) | ||
| } |
There was a problem hiding this comment.
Personal modes change server settings
The “apply for me” path also writes instance-wide runtime settings. For laptop and vps-single, a non-root user hits a forbidden write after local preferences have already changed. A root user's personal choice instead changes build and memory settings for everyone. Run the settings loop only for the explicit instance-wide action.
| for (const [key, value] of Object.entries(diff.settings)) { | |
| await setSetting.mutateAsync({ key, value }) | |
| } | |
| if (everyone) { | |
| for (const [key, value] of Object.entries(diff.settings)) { | |
| await setSetting.mutateAsync({ key, value }) | |
| } | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/mode/ModePicker.tsx
Line: 93-95
Comment:
**Personal modes change server settings**
The “apply for me” path also writes instance-wide runtime settings. For `laptop` and `vps-single`, a non-root user hits a forbidden write after local preferences have already changed. A root user's personal choice instead changes build and memory settings for everyone. Run the settings loop only for the explicit instance-wide action.
```suggestion
if (everyone) {
for (const [key, value] of Object.entries(diff.settings)) {
await setSetting.mutateAsync({ key, value })
}
}
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if err != nil { | ||
| return reportError(stdout, stderr, *jsonOutP, fmt.Errorf("commit signing for %q: %w", app, err)) | ||
| } | ||
| _, _ = fmt.Fprintf(stdout, "app %q: require signed commits=%t, allowed keys=%d\n", app, res.Required, len(res.AllowedKeys)) |
There was a problem hiding this comment.
commit-signing show --json still prints the human-readable sentence. The command advertises JSON output but never renders res through the shared output path. Honor --json, --output, and --query so scripts can read the policy and allowed keys.
Prompt To Fix With AI
This is a comment left during a code review.
Path: cmd/levelrail-cli/commit_signing.go
Line: 58
Comment:
**JSON output is plain text**
`commit-signing show --json` still prints the human-readable sentence. The command advertises JSON output but never renders `res` through the shared output path. Honor `--json`, `--output`, and `--query` so scripts can read the policy and allowed keys.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| | `/levelrail redeploy` | Redeploys the app's tracked branch. It deploys the branch tip, not the pull request's code. | | ||
| | `/levelrail rollback` | Rolls back to the newest earlier successful deploy of a different image. | | ||
| | `/levelrail status` | Replies with the running image, the latest deploy and any freeze. Changes nothing. | | ||
| | `/lrail status` | Replies with the running image, the latest deploy and any freeze. Changes nothing. | |
There was a problem hiding this comment.
The status example does nothing
The documented /lrail status comment is not recognized. The comment parser still accepts only /levelrail, so following this example produces no status reply. Keep /levelrail status here and in the preview-environments table; the CLI rename does not change PR comment commands.
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/pr-comment-commands.md
Line: 19
Comment:
**The status example does nothing**
The documented `/lrail status` comment is not recognized. The comment parser still accepts only `/levelrail`, so following this example produces no status reply. Keep `/levelrail status` here and in the preview-environments table; the CLI rename does not change PR comment commands.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if ok { | ||
| shared[vol] = keys[0] |
There was a problem hiding this comment.
Adding services hides existing data
sharedNamedVolumes chooses the first sorted service name as the owner, and that owner becomes part of the Docker volume name. Adding api to a volume shared by worker and web therefore changes the volume mounted by all three services on the next deploy. Existing services start with empty storage instead of their data.
Give shared volumes a stable app-level identity that does not depend on which services mount them.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/compose/translate.go
Line: 249-250
Comment:
**Adding services hides existing data**
`sharedNamedVolumes` chooses the first sorted service name as the owner, and that owner becomes part of the Docker volume name. Adding `api` to a volume shared by `worker` and `web` therefore changes the volume mounted by all three services on the next deploy. Existing services start with empty storage instead of their data.
Give shared volumes a stable app-level identity that does not depend on which services mount them.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if v.Owner != "" { | ||
| p = "app-" + v.Owner + "-" | ||
| } | ||
| logical := strings.TrimPrefix(v.Name, p) |
There was a problem hiding this comment.
Saved templates split shared storage
Saving an app with shared volumes as a template loses the sharing. This code recovers the logical volume name, but composeExportDoc still emits only version and services. It never emits the top-level x-levelrail-shared marker that the parser now requires.
Deploying the saved template gives each service a separate volume, so files written by a setup service never reach its consumers. Export the shared declarations alongside their mounts.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/compose/export.go
Line: 134-137
Comment:
**Saved templates split shared storage**
Saving an app with shared volumes as a template loses the sharing. This code recovers the logical volume name, but `composeExportDoc` still emits only `version` and `services`. It never emits the top-level `x-levelrail-shared` marker that the parser now requires.
Deploying the saved template gives each service a separate volume, so files written by a setup service never reach its consumers. Export the shared declarations alongside their mounts.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| @@ -129,6 +135,7 @@ func (rt *Router) registerProjectRoutes(mux *http.ServeMux) { | |||
| mux.HandleFunc("GET /api/v1/environments/{id}/env/all", rt.requireAbility(AbilityRead, rt.requireEnvironmentGrant(AbilityRead, rt.handleListEnvironmentEnvAll))) | |||
| mux.HandleFunc("GET /api/v1/environments/{id}/env/secrets", rt.requireAbility(AbilityRead, rt.requireEnvironmentGrant(AbilityRead, rt.handleListEnvironmentEnvSecretKeys))) | |||
| mux.HandleFunc("PUT /api/v1/environments/{id}/env/secrets/{key}", rt.requireAbility(AbilityWrite, rt.requireEnvironmentGrant(AbilityWrite, rt.handleSetEnvironmentEnvSecret))) | |||
| mux.HandleFunc("POST /api/v1/environments/{id}/env/secrets/{key}/rotate", rt.requireAuth(rt.requireEnvironmentGrant(AbilityRead, rt.requireAbility(AbilityWriteSensitive, rt.handleRotateEnvironmentEnvSecret)))) | |||
There was a problem hiding this comment.
Rotation bypasses environment write denials
The new rotation route checks environment access with AbilityRead, although it changes a secret and restarts consumers. A caller with global write:sensitive and an explicit write denial for that environment can pass this read check and rotate its secret. environmentEnvSecretScope adds no later resource check.
Require the environment write check used by the neighboring secret-write routes before changing the value.
How this was verified: The rotation route checks only environment read access before calling the secret writer, while ordinary secret writes check environment write access.
| mux.HandleFunc("POST /api/v1/environments/{id}/env/secrets/{key}/rotate", rt.requireAuth(rt.requireEnvironmentGrant(AbilityRead, rt.requireAbility(AbilityWriteSensitive, rt.handleRotateEnvironmentEnvSecret)))) | |
| mux.HandleFunc("POST /api/v1/environments/{id}/env/secrets/{key}/rotate", rt.requireAuth(rt.requireEnvironmentGrant(AbilityWrite, rt.requireAbility(AbilityWriteSensitive, rt.handleRotateEnvironmentEnvSecret)))) |
Knowledge Base Used: Authentication, authorization, and tenancy
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/api/routes_platform_project.go
Line: 138
Comment:
**Rotation bypasses environment write denials**
The new rotation route checks environment access with `AbilityRead`, although it changes a secret and restarts consumers. A caller with global `write:sensitive` and an explicit write denial for that environment can pass this read check and rotate its secret. `environmentEnvSecretScope` adds no later resource check.
Require the environment write check used by the neighboring secret-write routes before changing the value.
**How this was verified:** The rotation route checks only environment read access before calling the secret writer, while ordinary secret writes check environment write access.
```suggestion
mux.HandleFunc("POST /api/v1/environments/{id}/env/secrets/{key}/rotate", rt.requireAuth(rt.requireEnvironmentGrant(AbilityWrite, rt.requireAbility(AbilityWriteSensitive, rt.handleRotateEnvironmentEnvSecret))))
```
**Knowledge Base Used:** [Authentication, authorization, and tenancy](https://app.greptile.com/-/switch-tenant?tenant=glinr&next=%2Fcustom-context%2Fknowledge-base%2Fglincker%2Flevelrail%2F-%2Fdocs%2Fauthentication-authorization-and-tenancy.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| for _, n := range earlier { | ||
| if n.RolledBackFrom == target && !resumed { | ||
| return WaveDecision{Wait: "rollout halted: wave node " + n.ID + " rolled back from " + target, Halted: true, FailedNode: n.ID} | ||
| } | ||
| } | ||
| for _, n := range earlier { | ||
| if n.RolledBackFrom == target { | ||
| continue |
There was a problem hiding this comment.
Resume ignores new update failures
Resuming a rollout disables rollback stops for every later failure on that target. resumed skips the rollback check for all nodes, not just the failure the operator chose to bypass. Rolled-back nodes are then skipped by the remaining checks too.
If another wave fails after resume, later waves can still install the same bad release. Remember which failures were accepted at resume and stop again for any new rollback.
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/nodeinsight/wave.go
Line: 113-120
Comment:
**Resume ignores new update failures**
Resuming a rollout disables rollback stops for every later failure on that target. `resumed` skips the rollback check for all nodes, not just the failure the operator chose to bypass. Rolled-back nodes are then skipped by the remaining checks too.
If another wave fails after resume, later waves can still install the same bad release. Remember which failures were accepted at resume and stop again for any new rollback.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| rt.applyOneShotResourceLimits(r.Context(), &task) | ||
| if sparkPlan != nil { | ||
| task.MemoryLimitMB = sparkPlan.MemoryLimitMB | ||
| } |
There was a problem hiding this comment.
Spark exceeds one-off memory limits
A Spark one-off run overwrites the operator's apps_run.memory_limit_mb limit. applyOneShotResourceLimits sets that limit, but this assignment replaces it with the Spark preset's value. With a 512 MB one-off limit and the default Spark preset, the container instead receives 1024 MB, putting small hosts under unexpected memory pressure.
Keep the operator's nonzero limit as a ceiling when applying the preset.
| rt.applyOneShotResourceLimits(r.Context(), &task) | |
| if sparkPlan != nil { | |
| task.MemoryLimitMB = sparkPlan.MemoryLimitMB | |
| } | |
| rt.applyOneShotResourceLimits(r.Context(), &task) | |
| if sparkPlan != nil { | |
| if task.MemoryLimitMB > 0 { | |
| task.MemoryLimitMB = min(task.MemoryLimitMB, sparkPlan.MemoryLimitMB) | |
| } else { | |
| task.MemoryLimitMB = sparkPlan.MemoryLimitMB | |
| } | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/api/jobs_oneshot.go
Line: 275-278
Comment:
**Spark exceeds one-off memory limits**
A Spark one-off run overwrites the operator's `apps_run.memory_limit_mb` limit. `applyOneShotResourceLimits` sets that limit, but this assignment replaces it with the Spark preset's value. With a 512 MB one-off limit and the default Spark preset, the container instead receives 1024 MB, putting small hosts under unexpected memory pressure.
Keep the operator's nonzero limit as a ceiling when applying the preset.
```suggestion
rt.applyOneShotResourceLimits(r.Context(), &task)
if sparkPlan != nil {
if task.MemoryLimitMB > 0 {
task.MemoryLimitMB = min(task.MemoryLimitMB, sparkPlan.MemoryLimitMB)
} else {
task.MemoryLimitMB = sparkPlan.MemoryLimitMB
}
}
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.- Tauri shell and core crate, tray menu, server picker - Auto update stays off until an endpoint and public key are set - Unsigned bundles in CI
- Manifest of screens and the source files that affect them - Recapture only changed screens, skip unchanged by content hash - Before and after preview snippet for PR descriptions
…plates - Three broker KRaft cluster with SCRAM and optional TLS, read only topics and consumer lag view and CLI - spark-submit preset, spark-local and spark-notebook templates, jobs UI with run history and driver log
…d restore test - 5 day local rotation with live settings and a disk guard - Status card, restore drill button and target delete warning
…t and verified installers - Role grants expire, role scoped passkey requirement, failed bearer throttle, secret reference alert - Optional signed commit requirement for webhook deploys (Gitea and Forgejo only) - Shared variable rotation with per app audit, installers verify downloads by default
…d Azure and Google Cloud listings - YAML and JSON import and export, import from an https address, Kubernetes, AWS, Azure and GCP packs - Read only Azure and Google Cloud listings with per region counts and Azure VM power state
…lumes only when marked, clean up anonymous volumes - Single replica services with writable data stop the old container first, per service opt out - x-levelrail-shared opt in volume sharing, anonymous volumes removed on replace and delete, remote nodes via an additive agent field - Staged agent update waves with health gate, services of one app start together, post upgrade soak
…cate storage alerts - host:port and port range allowlist entries, dry run log kept in the database - Doctor check and alert when a certificate write fails, disk full chaos tests
…board - Tag listing API, CLI and a Browse tags popover in the new app wizard
- Idle memory stated as the measured 223 MB everywhere - Status and limits sections name what is not proven on a real host
- Controls and cards for the features above in all 8 locales, plain language labels with the technical term in a tooltip
- Routes, authz and org isolation entries, runtime settings, migrations 3379 to 3385, generated API reference and SDKs, milestone workflow
ceebc67 to
2867170
Compare
…ema, lint, one shot smoke, bundle budgets)
Summary
Running well on small servers, and safer redeploys.
Closes #1843, #1844
Refs #1845, #1846, #1847, #1848, #1849, #1850, #1851, #1852, #1853
Change ID and tasks
Added / Changed / Removed / Fixed
Surfaces touched
Migrations
Runtime settings added
Feature flags and status
Security review
Behaviour changes and upgrade notes
Redeploys of single replica services with writable volumes now stop the old container first (short gap). Opt out per service with runtime.volume_overlap.
Not verified / needs a real host
Azure and GCP live accounts, backup rotation, egress firewall, agent update waves on real nodes, desktop window, volume removal on remote nodes, Docker Hub tags (fake Hub only), Spark to Kafka.
Tests run
Gate passed. Kafka, redeploy and volume fixes proven on one arm64 server.
Screenshots (demo data)
Rollback
Revert the merge. Set deploy.stop_first_default false for the old overlap.
Release-As: 1.5.19
Confidence Score: 0/5

This PR is not ready to merge because previous findings about signing checks, access checks, shared storage, and rollout safety remain unresolved.
Findings
Fix with agent prompt
Summary
Release 1.5.19 adds small-server features and safer deployment controls.
Reviews (4) · Last reviewed commit: "docs: refresh product screenshots for th..." · Reviewed by Greptile