Commit bdf3f51
authored
* fix(cli): wheels stop lists running servers when cwd doesn't match a registered project
Closes #2316. Before this PR, running `wheels stop` from any directory
that isn't a registered project root (parent dir, sibling dir, deleted
project dir, anywhere else) silently printed "No running server found
for this directory." while the original Java/Catalina process kept
listening. The user's only escape hatch was `lsof -i :<port>` + `kill`.
This change adds a pre-delegation check in stop():
1. `$findServerForProject(projectRoot)` scans `~/.wheels/servers/*/.project-path`
for an entry whose stored canonical path matches the current cwd.
2. If no match is found, `$listRunningWheelsServers()` enumerates all
registered LuCLI server entries with a live PID (parsing the
`<pid>:<port>` server.pid format and using `java.lang.ProcessHandle`
for liveness without shelling out).
3. When there are running servers but none match the cwd, print a
helpful list with each server's name + port + project path, plus
the explicit syntax — `wheels server stop --name <name>` and
`wheels server list` — that recovers from the orphan state without
leaving the wheels CLI.
Verified end-to-end on macOS arm64:
$ cd /tmp/parent # not a Wheels project
$ wheels stop
Stopping Wheels server...
No registered server matches this directory.
Running Wheels servers:
- repapp (port 9991, project /private/tmp/parent/repapp)
To stop a specific server: wheels server stop --name <name>
To list all servers: wheels server list
Normal in-project `wheels stop` is unaffected — the registered-server
match short-circuits the orphan check and falls through to the regular
LuCLI delegation. CLI suite: 457 pass, 3 fail (pre-existing DoctorSpec
#2260, unrelated).
* fix(model): migrator emits symmetric DDL for empty default across string-like types
Closes fresh-VM journal F17. Before this PR, `addColumnOptions` in
`vendor/wheels/databaseAdapters/Abstract.cfc` had a special case for
`type='string'` with `default=""` that omitted the DEFAULT clause:
} else if (arguments.options.type == 'string' && arguments.options.default eq "") {
arguments.sql = arguments.sql; // no DEFAULT clause
} else {
arguments.sql = arguments.sql & " DEFAULT ...";
}
…but `text` and `char` columns fell through to the else branch and
emitted `DEFAULT ''`. So a migration that declared title and body
identically:
t.string(columnNames="title", default="", allowNull=true, limit=255);
t.text(columnNames="body", default="", allowNull=true);
…produced asymmetric DDL. That asymmetry then interacted with
`validatesPresenceOf` — which checks the column's introspected
`hasDatabaseColumnDefault` and skips presence-check when a default
exists — making the user's `validatesPresenceOf` rule fire for `title`
(no DEFAULT clause emitted) but silently skip for `body` (DEFAULT ''
emitted). Tutorial chapter 7's model spec `requires a body` failed
because of this; an HTTP request that omits `post[body]` (vs sending
empty string) also slipped past validation.
Fix: extend the special case to cover all string-like types
(`string,text,char`). Empty default → no DEFAULT clause for all three;
explicit non-empty defaults still emit DEFAULT correctly.
Seven new specs in `addColumnOptionsSpec.cfc` cover:
- string/text/char with default="" all omit DEFAULT
- string/text with non-empty default still emit DEFAULT '<value>'
- integer with default="" still becomes DEFAULT NULL (regression for
the existing typed-numeric branch)
- boolean with default=true still emits DEFAULT 1
All 7 pass; framework suite: 3340 pass, 0 fail (was 3333 before).
* fix(view): wheels-typed error pages set HTTP status (404 / 500), not 200
Closes #2319. Before this PR, when `$runOnError` rendered a
Wheels-typed exception (`Wheels.RouteNotFound`,
`Wheels.DataSourceNotFound`, `Wheels.ViewNotFound`, etc) in HTML
format, no `$header(statusCode = ...)` fired before the body was
written. Lucee defaulted to HTTP 200 — misleading anything monitoring,
caching, retrying, or alerting on status codes.
JSON and XML branches for non-Wheels exceptions had explicit
`$header(statusCode = 500)`; the Wheels-error branch and the JSON/XML
Wheels-error sub-branches all skipped status assignment.
This change adds a single mapping at the top of the wheelsError branch:
- Any `Wheels.*NotFound` (RouteNotFound, RecordNotFound, ViewNotFound,
PackageNotFound, DataSourceNotFound, …) → 404
- Everything else → 500
The status is set before the body is written so the response header
commits at the right code regardless of when the servlet engine
flushes. `$throwErrorOrShow404Page` already calls $header(statusCode=404)
before throwing, but the onError flow can reset the response, so
re-asserting in $runOnError is the durable place.
Five new specs in onerrorSpec.cfc lock the mapping table — they mirror
the same regex used in EventMethods so a rename there breaks the
build immediately. Includes an explicit case for ActionParameterMissing
(Missing != NotFound, stays 500) to guard against a too-greedy regex
later.
Framework suite: 3347 pass, 0 fail (was 3333 before this PR's chain;
+7 from F17 specs, +7 from these new mappings). One pre-existing test
that hits an unknown route and expects 404 (testClientSpec
`assertNotFound() passes on 404 response`) still passes — Wheels.ViewNotFound
maps to 404 under the new rule.
1 parent da9058f commit bdf3f51
5 files changed
Lines changed: 280 additions & 1 deletion
File tree
- cli/lucli
- vendor/wheels
- databaseAdapters
- events
- tests/specs
- events
- migrator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
397 | 422 | | |
398 | 423 | | |
399 | 424 | | |
| |||
3750 | 3775 | | |
3751 | 3776 | | |
3752 | 3777 | | |
| 3778 | + | |
| 3779 | + | |
| 3780 | + | |
| 3781 | + | |
| 3782 | + | |
| 3783 | + | |
| 3784 | + | |
| 3785 | + | |
| 3786 | + | |
| 3787 | + | |
| 3788 | + | |
| 3789 | + | |
| 3790 | + | |
| 3791 | + | |
| 3792 | + | |
| 3793 | + | |
| 3794 | + | |
| 3795 | + | |
| 3796 | + | |
| 3797 | + | |
| 3798 | + | |
| 3799 | + | |
| 3800 | + | |
| 3801 | + | |
| 3802 | + | |
| 3803 | + | |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
| 3813 | + | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
| 3817 | + | |
| 3818 | + | |
| 3819 | + | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
| 3823 | + | |
| 3824 | + | |
| 3825 | + | |
| 3826 | + | |
| 3827 | + | |
| 3828 | + | |
| 3829 | + | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
| 3842 | + | |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
| 3858 | + | |
| 3859 | + | |
| 3860 | + | |
| 3861 | + | |
| 3862 | + | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
3753 | 3873 | | |
3754 | 3874 | | |
3755 | 3875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
86 | 96 | | |
87 | 97 | | |
88 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
20 | 64 | | |
21 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
22 | 73 | | |
Lines changed: 78 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments