Found during the e2e test pass for issue #2.
Symptom
When config.viewports is empty (e.g. running without plumb.toml, or with one that has no [viewports.*]), the CLI silently discards any --viewport argument and falls back to a single 1280x800 desktop viewport.
Reproduction
No plumb.toml in CWD:
$ ./target/release/plumb lint plumb-fake://hello --viewport mobile --format json
[ ...one violation, viewport: \"desktop\", rect 1280x800... ]
$ echo $?
3
$ ./target/release/plumb lint plumb-fake://hello --viewport bogus --format json
[ ...one violation, viewport: \"desktop\", rect 1280x800... ]
$ echo $?
3
I asked for mobile (and separately bogus) and got desktop either way, with no warning. The behavior is documented in crates/plumb-cli/src/commands/lint.rs:87 ("Any viewports_arg is ignored — the user can't ask us to inflate viewports they never declared"), but the silent-discard UX is surprising.
When config.viewports is non-empty, --viewport bogus correctly errors with unknown viewport(s): bogus. configured viewports: ... (commands/lint.rs:30). So the inconsistency is only on the no-config path.
Why this matters
Phase 1 ticket #16 acceptance criterion: "`plumb lint --viewport mobile --viewport desktop` runs against exactly those two viewports." Without a config, that criterion silently fails — and the user has no signal that anything is wrong.
Suggested fix
Pick one:
- Error explicitly when
viewports_arg is non-empty and config.viewports is empty: "no [viewports] configured in plumb.toml — cannot honor --viewport flag."
- Treat user-supplied viewport names as default-sized viewports when no config is present (e.g.
--viewport mobile → mobile at the canonical 375×667 of common defaults). This is more user-friendly but introduces magic.
- Print a stderr warning ("--viewport ignored: no [viewports] in config; falling back to default desktop") and exit 0/3 as today. Cheapest fix.
Parent
Refs #2.
Found during the e2e test pass for issue #2.
Symptom
When
config.viewportsis empty (e.g. running withoutplumb.toml, or with one that has no[viewports.*]), the CLI silently discards any--viewportargument and falls back to a single 1280x800 desktop viewport.Reproduction
No
plumb.tomlin CWD:I asked for
mobile(and separatelybogus) and gotdesktopeither way, with no warning. The behavior is documented in crates/plumb-cli/src/commands/lint.rs:87 ("Anyviewports_argis ignored — the user can't ask us to inflate viewports they never declared"), but the silent-discard UX is surprising.When
config.viewportsis non-empty,--viewport boguscorrectly errors withunknown viewport(s): bogus. configured viewports: ...(commands/lint.rs:30). So the inconsistency is only on the no-config path.Why this matters
Phase 1 ticket #16 acceptance criterion: "`plumb lint --viewport mobile --viewport desktop` runs against exactly those two viewports." Without a config, that criterion silently fails — and the user has no signal that anything is wrong.
Suggested fix
Pick one:
viewports_argis non-empty andconfig.viewportsis empty: "no [viewports] configured in plumb.toml — cannot honor --viewport flag."--viewport mobile→ mobile at the canonical 375×667 of common defaults). This is more user-friendly but introduces magic.Parent
Refs #2.