Context
`DeviceName` enforces `^[a-z][a-z0-9_]*$` (see
`src/IviCli.Domain/Devices/DeviceName.cs:19`) — no hyphens,
no uppercase, no dots, no leading digit.
When the user runs e.g. `ivicli visa add psu-mock ...`, the
error today is:
```
[WRN] invalid device name: psu-mock
error: invalid device name 'psu-mock'.
```
This doesn't tell the user why it's invalid or what to do
instead. ServerName allows hyphens
(`^[a-z][a-z0-9_-]*$`); PublicEndpoint allows hyphens too —
the inconsistency makes the right answer non-obvious.
Proposal
Either:
- (a) Better error message: e.g.
"invalid device name 'psu-mock': must match
`[a-z][a-z0-9_]*` (lowercase letters, digits, underscores;
must start with a letter). Try `psu_mock`."
- (b) Relax the regex to match ServerName
(`^[a-z][a-z0-9_-]*$`), removing the hyphen ban entirely.
Recommended: (b) for consistency. There's no underlying
constraint that forces device names to be hyphen-free
(VISA resource strings, config TOML, and audit log fields all
tolerate hyphens). Then update PRD / ADRs that document the
naming rule.
Acceptance
- `ivicli visa add psu-mock ...` succeeds (option b), OR
- the error message names the regex and suggests a fix (option a).
- Tests under `tests/IviCli.Domain.Tests/Devices/` updated to
the new rule.
- PRD §6 (visa CRUD) updated if the constraint changes.
Context
`DeviceName` enforces `^[a-z][a-z0-9_]*$` (see
`src/IviCli.Domain/Devices/DeviceName.cs:19`) — no hyphens,
no uppercase, no dots, no leading digit.
When the user runs e.g. `ivicli visa add psu-mock ...`, the
error today is:
```
[WRN] invalid device name: psu-mock
error: invalid device name 'psu-mock'.
```
This doesn't tell the user why it's invalid or what to do
instead. ServerName allows hyphens
(`^[a-z][a-z0-9_-]*$`); PublicEndpoint allows hyphens too —
the inconsistency makes the right answer non-obvious.
Proposal
Either:
"invalid device name 'psu-mock': must match
`[a-z][a-z0-9_]*` (lowercase letters, digits, underscores;
must start with a letter). Try `psu_mock`."
(`^[a-z][a-z0-9_-]*$`), removing the hyphen ban entirely.
Recommended: (b) for consistency. There's no underlying
constraint that forces device names to be hyphen-free
(VISA resource strings, config TOML, and audit log fields all
tolerate hyphens). Then update PRD / ADRs that document the
naming rule.
Acceptance
the new rule.