Skip to content

fix(server): start --dry-run writes nothing and previews --name - #23

Merged
bpamiri merged 3 commits into
wheelsfrom
peter/start-dry-run-no-write
Oct 6, 2026
Merged

bpamiri merged 3 commits into
wheelsfrom
peter/start-dry-run-no-write

Conversation

@bpamiri

@bpamiri bpamiri commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Upstream issue: cybersonic#139

What

In a folder without lucee.json, lucli server start --dry-run:

  • wrote a default lucee.json into the project, because LuceeServerConfig.loadConfig() persists the default config when the file is missing;
  • previewed the folder name as the server name, ignoring --name, which only the real start applies (LuceeServerManager.startServerInternal).

How

  • LuceeServerConfig.loadConfig(projectDir, configFileName, boolean persistDefault). The existing one- and two-arg signatures delegate with true, so every other caller is unchanged.
  • ServerCommandHandler start: loads with persistDefault = !dryRun.
  • The dry-run preview applies --name (trimmed, non-empty) to the in-memory config, as startServerInternal does.

Tests

  • New in ServerCommandHandlerTest:
    • serverStartDryRun_withoutLuceeJson_writesNothing: a preview is still printed, and no lucee.json is created.
    • serverStartDryRun_previewShowsTheNameOverride: the preview shows "name" : "foo", and lucee.json is unchanged.
  • RED on wheels @ 8942048 (updated test file only, separate worktree): exactly these 2 failed; the other 17 passed (1 skipped).
  • GREEN: mvn test gave 771 tests, 0 failures, 0 errors, 6 skipped. BATS not run locally; please rely on CI.
  • End to end (isolated home; folder with only index.cfm; server start --name=foo --port=63301 --dry-run): the preview shows "name" : "foo" and "port" : 63301, and the folder still holds only index.cfm. v0.6.2.2 showed "name" : "<folder>" and left a lucee.json.

Fork bookkeeping

CHANGELOG ## Unreleased entry; FORK.md "Next queue" row 11.

Upstream

The same change goes to cybersonic/LuCLI as a cherry-pick -x onto upstream main (without FORK.md) once this is reviewed.

🤖 Generated with Claude Code

bpamiri and others added 2 commits October 6, 2026 04:38
In a folder without lucee.json, 'server start --dry-run' saved a default
lucee.json into the project (LuceeServerConfig.loadConfig persists the
default), and the preview showed the folder name although --name was
given (the name is only applied by the real start).

loadConfig gains a persistDefault flag (the existing signatures keep
persisting); the start handler passes !dryRun, and the dry-run preview
applies --name as startServerInternal does.

Upstream: cybersonic#139

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Unit Tests (ubuntu-latest, Java 21)

 63 files   63 suites   2m 34s ⏱️
773 tests 767 ✅ 6 💤 0 ❌
778 runs  772 ✅ 6 💤 0 ❌

Results for commit 5b79b81.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Integration Tests (ubuntu-latest, Java 21)

78 tests   78 ✅  2m 5s ⏱️
14 suites   0 💤
 1 files     0 ❌

Results for commit 5b79b81.

♻️ This comment has been updated with latest results.

@bpamiri

bpamiri commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

rev1-r3 review @ b2ff003: APPROVE (final)

RED before, reproduced. I copied the updated ServerCommandHandlerTest onto wheels @ 8942048: 19 tests, exactly 2 failures (serverStartDryRun_withoutLuceeJson_writesNothing and serverStartDryRun_previewShowsTheNameOverride), 1 skipped. GREEN on the branch: 19 run, 0 failures, 1 skipped. Both runs used -DargLine="-Duser.home=<sandbox> -Dlucli.home=<sandbox>".

End to end: JDK 21 jars, isolated LUCLI_HOME, sandboxed HOME / -Duser.home, project folder holding only index.cfm, server start --name=foo --port=63301 --dry-run.

base this branch
preview name "proj" (folder name, --name ignored) "foo"
preview port 63301 63301
project folder afterwards index.cfm + lucee.json index.cfm only
anything under user.home / listener on 63301 none none

With an existing lucee.json ("name": "keepme"), the branch's preview shows foo and the file stays byte-identical, checked by hash.

  • Code: minimal. There's a loadConfig(…, boolean persistDefault) overload, and the existing one- and two-arg signatures delegate with true, so every other caller is unchanged. The dry run passes !dryRun, and the --name override touches only the in-memory config used for the preview, applied (trimmed, non-empty) the same way startServerInternal applies it.
  • PR CI: green, 8 pass with the APT smoke check skipped.
  • CHANGELOG and FORK.md row 11 are fine; it's ready for the upstream cherry-pick.

…-no-write

Signed-off-by: Peter Amiri <peter@alurium.com>

# Conflicts:
#	CHANGELOG.md
#	FORK.md
@bpamiri

bpamiri commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

rev1-r3 review @ 5b79b81: APPROVE (final)

This head is a two-parent merge of the approved b2ff003 and wheels (7830ed0, which includes #21 and #22). The PR's src/ changes against wheels are identical to b2ff003: LuceeServerConfig, ServerCommandHandler and the test. The conflict resolution touches only CHANGELOG and FORK.md and keeps every side:

PR CI on this head: 8 pass (Build ×3, Unit ×3, Integration ×2); APT smoke skipped. mergeStateStatus is CLEAN.

Ready to merge.

@bpamiri
bpamiri merged commit c3a2d2e into wheels Oct 6, 2026
11 checks passed
@bpamiri
bpamiri deleted the peter/start-dry-run-no-write branch October 6, 2026 11:57
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