You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix real-device follow-ups and harden JSON contracts (#38)
* Fix cache-backed device visibility and small command UX regressions
* Tighten audit semantics and suggestion safeguards
* Make policy validation and migration contract truthful
* Polish catalog, status/watch, and operator tooling
* Tighten policy validation and status-sync preflight
* Finish residual diagnostics and contract coverage
* Fix MCP missing-device fallback and lock JSON shapes
* Add catalog fidelity fixtures and contract helpers
* Harden JSON contracts and release smoke coverage
* Expand contract coverage and clean release smoke
* Expand low-frequency contracts and catalog fixtures
* Align policy rule fixtures with current validation
* Correct release-notes registry and pin self-review contracts
Self-review of the 3.3.1 follow-up rollup surfaced a false breaking-change
record and several contracts that were only held in place by careful
reading. This commit corrects the record and pins each contract with a
test that fails loudly if it drifts.
- src/version-notes.ts: remove the 3.3.0 envelope entry from
RELEASE_METADATA. The {schemaVersion,data} envelope actually shipped
in commit 33d3825 (v2.0.0) and has been in every 3.x release; flagging
3.3.0 as the breaking boundary would fire upgrade-check warnings on
every 3.2.x → 3.3.x upgrade for no reason.
- tests/commands/upgrade-check.test.ts + tests/commands/doctor.test.ts:
update the asserted contract to match — empty registry returns null;
doctor release-notes check reports 'ok' for a version with no notice.
- tests/policy/validate.test.ts: add parametric coverage for pathological
rule device refs (undefined, empty string, literal `<id>`) against
validateLoadedPolicyAgainstInventory. The live validator's silent
`continue` on null-resolved refs is only safe because the offline base
pass catches the same shapes; the new test couples the two so weakening
either side is caught immediately.
- tests/utils/audit.test.ts: spy ENOSPC and EACCES fs failures into
writeAudit and assert it does not throw. Several callers (dry-run
path in src/lib/devices.ts in particular) rely on this being
best-effort; the contract is now a test, not a comment.
- src/policy/validate.ts: add clarifying comments on the permissive
offline device-ID regex (real gate is alias-live-device-not-found)
and on the findCatalogEntry ambiguous-array branch (rare, silence
beats false positives against drifting upstream types).
- package.json: rename `test:release-smoke` → `test:release-smoke:manual`
so future maintainers do not assume it runs in prepublishOnly or CI.
- package.json + package-lock.json + README.md: bump package version to
match the branch-intended rollup and refresh the upgrade-check
example.
* Fix status-sync --probe preflight and parent-command option inheritance
Three follow-up fixes surfaced by deeper review of the 3.3.1 rollup. Each
was producing a user-visible regression despite passing tests, because the
existing tests pinned the wrong contract.
- src/status-sync/manager.ts: the --probe preflight was hitting the
OpenClaw base URL with GET and treating any response (including 401 /
404 / 5xx from upstream proxies) as success, so misconfigurations
surfaced only after the detached daemon had already been spawned and
was silently dropping writes. Probe now POSTs to the same endpoint
the sink uses at runtime (`/v1/chat/completions`), with a body the
server actually parses, and separates network-error handling from
HTTP-error handling. Status-specific hints (401/403 → token, 404 →
URL path, 400/422 → model, 5xx → server) point at the misconfigured
input so the operator does not have to guess.
- src/commands/schema.ts + src/commands/health.ts: the bare fallback
forms (`switchbot schema --type Bot`, `switchbot health --prometheus`)
were previously declared with options on the root command, on the
subcommand, or on both — none of which worked, because commander v12
routes parsing of a parent/child dual-declared option to the PARENT
command, leaving the subcommand action with empty opts. Options are
now declared only on the root; subcommand actions pull them via
`cmd.optsWithGlobals()`. The bare and explicit forms now behave
identically, and `health serve --audit-log` still works because
optsWithGlobals merges parent options into serve's own port/host.
- tests/status-sync/manager.test.ts: default fetch mock flipped from
401-returning to 200-returning so existing success-path tests no
longer accidentally exercised the failure hint. Three new tests pin
the probe contract: POST to /v1/chat/completions with the model in the
body, 401 surfaces a token hint, 404 surfaces a URL-path hint, and
trailing slashes on the base URL are trimmed before appending the
probe path.
* Validate trigger and condition device refs
---------
Co-authored-by: chenliuyun <chenliuyun@onero.com>
Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "@switchbot/openapi-cli",
3
-
"version": "3.3.0",
3
+
"version": "3.3.1",
4
4
"description": "SwitchBot smart home CLI — control devices, run scenes, stream real-time events, and integrate AI agents via MCP. Full API v1.1 coverage.",
0 commit comments