Skip to content

fix(sdl): preserve all args elements when importing an SDL into the builder - #3536

Merged
baktun14 merged 4 commits into
mainfrom
fix/deploy-web-preserve-multi-args-sdl-import
Jul 29, 2026
Merged

fix(sdl): preserve all args elements when importing an SDL into the builder#3536
baktun14 merged 4 commits into
mainfrom
fix/deploy-web-preserve-multi-args-sdl-import

Conversation

@baktun14

@baktun14 baktun14 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Why

A user reported (via Slack) that importing an SDL with command: [/tini, -s, --] and args: [bash, -c, <setup script>] into the Console GUI silently deployed args: [bash] only, so the container ran an idle bash and none of the setup script executed.

Root cause: the builder form models args as a single scalar. importSimpleSdl kept only args[0] and generateSdl could only emit a one-element args list, and only when a command was set. The configure flow always deploys the SDL regenerated from form values, so the truncation landed on-chain with no warning.

What

  • sdlImport: import the full args array through the existing parseSvcCommand (newline-joined tokens), matching how command already round-trips.
  • sdlGenerator: tokenize the arg field with the existing buildCommand and emit args independently of command, so an SDL with args but no command also round-trips.
  • Arguments textarea placeholders (configure flow card and legacy builder modal) now document the one-token-per-line format.
  • Regression tests: multi-element args round-trip cases, args-without-command, and a semantic round-trip fixture (tini-multi-args-sdl.yml) mirroring the reported SDL including its folded >- script block.

Known limitation (pre-existing, applies to command identically): tokens containing literal newlines (- | block scalars) are split per line. Follow-up candidates: a lossless string[] args model and a post-import round-trip diff warning for anything the builder cannot represent.

Summary by CodeRabbit

  • Improvements
    • Enhanced SDL generation and import to preserve newline-delimited command/argument tokens, omit empty entries, and avoid unintended shell wrappers.
    • Correctly maps command/arg presence: services omit missing fields and handle arg-only cases without losing additional tokens.
  • UI Updates
    • Updated argument placeholders to a concise one-token-per-line example across the command editing dialogs.
    • Refined CommandList display logic so it won’t show “None” when command/arg contains meaningful text.
  • Tests
    • Added/expanded roundtrip and rendering coverage for command/args behavior.
  • Documentation
    • Reworded Commands card guidance to clarify override and token mapping behavior.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 44 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: 12125c32-f570-4e98-af2a-01e81ef5bc91

📥 Commits

Reviewing files that changed from the base of the PR and between bba026d and 3794c74.

📒 Files selected for processing (2)
  • apps/deploy-web/src/utils/sdl/sdlImport.spec.ts
  • apps/deploy-web/src/utils/sdl/sdlImport.ts
📝 Walkthrough

Walkthrough

Changes

Deployment command inputs now document one-token-per-line values. SDL generation and import preserve complete command and argument arrays, command display handles args-only and whitespace-only values, and tests cover round trips plus a multi-argument fixture.

SDL command and argument handling

Layer / File(s) Summary
Command input guidance
apps/deploy-web/src/components/deployments/.../CommandsCard.tsx, apps/deploy-web/src/components/sdl/CommandFormModal.tsx
Documentation and argument placeholders describe newline-delimited tokens and image-default behavior.
SDL command serialization
apps/deploy-web/src/utils/sdl/sdlGenerator.ts, apps/deploy-web/src/utils/sdl/sdlImport.ts
SDL arguments are split into token arrays, while imported SDL arguments are fully reconstructed instead of using only the first element.
Command display handling
apps/deploy-web/src/components/sdl/CommandList.tsx, apps/deploy-web/src/components/sdl/CommandList.spec.tsx
Command presence uses trimmed command or argument values, with coverage for command-plus-args, args-only, and empty states.
Round-trip coverage and fixture
apps/deploy-web/src/utils/sdl/*spec.ts, apps/deploy-web/tests/mocks/tini-multi-args-sdl.yml
Tests cover command-only, args-only, empty-args, and multi-element round trips; a multi-argument deployment manifest was added.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • akash-network/console#3290: Updates SDL command/args tokenization and round-trip behavior in the same generator and importer areas.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deploy-web-preserve-multi-args-sdl-import

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

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.40%. Comparing base (afb7de0) to head (3794c74).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3536      +/-   ##
==========================================
- Coverage   74.33%   73.40%   -0.94%     
==========================================
  Files        1150     1060      -90     
  Lines       29882    27534    -2348     
  Branches     7471     7017     -454     
==========================================
- Hits        22214    20212    -2002     
+ Misses       6774     6458     -316     
+ Partials      894      864      -30     
Flag Coverage Δ *Carryforward flag
api 87.50% <ø> (ø) Carriedforward from bba026d
deploy-web 63.94% <100.00%> (+0.03%) ⬆️
log-collector ?
notifications 93.84% <ø> (ø) Carriedforward from bba026d
provider-console 81.38% <ø> (ø) Carriedforward from bba026d
provider-inventory ?
provider-proxy 88.17% <ø> (ø) Carriedforward from bba026d
tx-signer ?

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...nt/ConfigurationPane/CommandsCard/CommandsCard.tsx 92.59% <ø> (ø)
...deploy-web/src/components/sdl/CommandFormModal.tsx 33.33% <ø> (ø)
apps/deploy-web/src/components/sdl/CommandList.tsx 85.71% <100.00%> (+57.14%) ⬆️
apps/deploy-web/src/utils/sdl/sdlGenerator.ts 64.76% <100.00%> (+0.95%) ⬆️
apps/deploy-web/src/utils/sdl/sdlImport.ts 87.30% <100.00%> (+0.10%) ⬆️

... and 91 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — the args-array fix is correct and well-tested; the inline nit is cosmetic only and doesn't block this.

Extended reasoning...

Overview

This PR fixes a real reported bug: the SDL builder truncated multi-element args arrays to a single scalar on both import (sdlImport.ts) and generation (sdlGenerator.ts), and previously only emitted args when a command was also set. The fix makes args round-trip through the same newline-joined-token mechanism already used for command (parseSvcCommand/buildCommand), and decouples args emission from command emission. Placeholder text in two textareas was updated to document the one-token-per-line format. Changes are isolated to apps/deploy-web's SDL import/generate utilities and two form components.

Security risks

None. This is client-side form/YAML transformation logic with no auth, crypto, or trust-boundary changes. Worst case of a regression here is a malformed SDL being generated, which is already the class of bug being fixed.

Level of scrutiny

Moderate-low. The change affects what actually gets deployed on-chain (via the regenerated SDL), so correctness matters, but the diff is small, self-contained, and the fix mirrors an existing, already-proven pattern (how command is handled) rather than inventing new logic. Test coverage is strong: new unit tests in sdlGenerator.spec.ts cover multi-token args, args-without-command, and blank-arg cases; sdlImport.spec.ts adds round-trip tests including a semantic-equality fixture (tini-multi-args-sdl.yml) mirroring the originally reported SDL. I traced the core logic (buildCommand, the trimmedCommand/trimmedArg split in generateSdl, and parseSvcCommand in sdlImport) and it matches the stated intent.

Other factors

One inline nit was found: the legacy builder's CommandList.tsx preview still gates its command/args summary solely on command.command being non-empty, so an args-only configuration will show "None" in the preview even though it now deploys correctly per this PR's fix. I verified this against CommandList.tsx:43-50 and confirmed the gate doesn't check command.arg. It's purely cosmetic (deployment behavior is correct) and doesn't warrant blocking this fix. No outstanding reviewer comments need addressing, and the PR description accurately documents a known pre-existing limitation (literal-newline tokens in - | block scalars) as a follow-up, not a regression.

Comment thread apps/deploy-web/src/utils/sdl/sdlGenerator.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/deploy-web/src/components/sdl/CommandList.spec.tsx (1)

25-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover whitespace-only values in the regression tests.

The implementation now treats whitespace-only command and argument values as absent, but this suite only tests empty strings. Add a case using spaces/newlines and assert that "None" is rendered.

🤖 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 `@apps/deploy-web/src/components/sdl/CommandList.spec.tsx` around lines 25 -
29, Extend the regression coverage in the CommandList rendering tests to pass
whitespace-only command and argument values, including spaces or newlines,
through setup. Assert that the rendered output contains “None,” while preserving
the existing empty-string test.
🤖 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.

Nitpick comments:
In `@apps/deploy-web/src/components/sdl/CommandList.spec.tsx`:
- Around line 25-29: Extend the regression coverage in the CommandList rendering
tests to pass whitespace-only command and argument values, including spaces or
newlines, through setup. Assert that the rendered output contains “None,” while
preserving the existing empty-string test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 10de1017-2584-440d-b4cb-f8bd2b0b603d

📥 Commits

Reviewing files that changed from the base of the PR and between 17d1a7a and 762cc7e.

📒 Files selected for processing (2)
  • apps/deploy-web/src/components/sdl/CommandList.spec.tsx
  • apps/deploy-web/src/components/sdl/CommandList.tsx

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM — approving despite the inline nit, which is a narrow pre-existing edge case (unquoted falsy YAML scalars like 0/false in args) rather than a defect introduced by this PR's core logic.

Extended reasoning...

Overview

This PR fixes a real reported production bug: importing an SDL with multi-element args into the deploy-web builder silently truncated to just the first element, and generateSdl could only ever emit a single-element args array gated behind a non-empty command. The fix routes args through the existing parseSvcCommand/buildCommand newline-tokenization helpers (mirroring how command already round-trips), and decouples args emission from command emission in the generator. Changes are scoped to the SDL import/generate utilities and two UI placeholders/textarea copy, with substantial new round-trip test coverage including a semantic-equality fixture based on the actual reported SDL.

Security risks

None. This is client-side form/YAML transformation logic with no auth, injection, or data-exposure surface — it only affects how text the user already controls is round-tripped through the builder UI.

Level of scrutiny

Medium-low is appropriate: this is a well-tested, narrowly-scoped bug fix in non-critical (but user-visible/deploy-impacting) frontend logic, not a security- or auth-sensitive path, and not CODEOWNER-restricted. The PR includes strong regression coverage (multi-element round-trips, args-without-command, blank-arg omission, and a full semantic round-trip fixture mirroring the originally reported SDL).

Other factors

I previously flagged that CommandList.tsx's preview gate didn't account for args-only configs becoming deployable under this PR's new independent-emission logic; the author addressed this in 762cc7e with a matching trim()-based gate and added CommandList.spec.tsx coverage, so that's resolved. The one remaining inline finding (a nit) is a narrow, pre-existing edge case unrelated to this PR's main risk surface — unquoted YAML falsy scalars in an array being silently dropped by `filter(Boolean)" — and doesn't undermine the correctness of the actual fix being shipped.

Comment thread apps/deploy-web/src/utils/sdl/sdlImport.ts
@baktun14
baktun14 enabled auto-merge July 29, 2026 13:07

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Beyond the two previously reported issues (both now fixed), I re-checked this round's changes: buildCommand's filter(Boolean) only ever runs on trimmed strings (never raw YAML scalars), so it can't reintroduce the falsy-token-drop bug fixed in 3794c74, and the CommandSchema fields are unconstrained strings with no length/pattern validation that would reject multi-line args. No new issues found.

Extended reasoning...

Re-verified the current HEAD (3794c74) against the diff: parseSvcCommand now stringifies tokens before filtering (fixing the 0/false drop bug), and CommandList's preview gate checks both command and arg (fixing the args-only 'None' display bug). Both fixes match what was requested in my prior inline comments and are covered by new regression tests. I additionally checked that buildCommand (used on the regenerate path) can't reintroduce either bug since it only operates on already-stringified, trimmed form values, and confirmed CommandSchema has no validation that would reject multi-line arg/command text. No new findings this round.

@baktun14
baktun14 added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 5e322f8 Jul 29, 2026
58 checks passed
@baktun14
baktun14 deleted the fix/deploy-web-preserve-multi-args-sdl-import branch July 29, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants