feat: cross-link shared device errors from sub-category error pages#1223
Merged
Conversation
The lock/thermostat/phone Errors and Warnings pages are subsets of the aggregate /api/devices/errors page: they omit the device-level codes (device_offline, device_disconnected, missing_device_credentials, …) that apply to every device. A reader troubleshooting connectivity on /api/locks/errors previously had no pointer to those codes. Each device sub-category error page now opens with a <Note> linking to the shared Device Errors and Warnings page, derived from the page's noun and its actual sections (e.g. the phones page, which has only warnings, reads "Phone-specific warnings"). Also make the hand-maintained DEVICE_SUBCATEGORY_ERROR_ROUTES allowlist self-checking: a new device sub-category with its own object + events pages and an error/warning variant group would otherwise silently produce no errors page until someone edited the map. The generator now logs a warning for any device variant group that has codes and an object+events page under /api/<key> but is neither mapped nor a documented resource — without false-positiving on real resources (access_codes) or annotation-only groups (hardware, provider_metadata). Adds a defensive guard in writeErrorPage to skip a route already written, protecting against a variant-group key ever colliding with a real resource route (device_provider already shares /devices with device; the guard makes that ordering explicit rather than relying on an empty-codes early-return). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
The shared device errors/warnings the note points to are physical-device connectivity and subscription codes (device_offline, hub_disconnected, salto_ks_subscription_limit_exceeded, …). They apply to locks and thermostats but not to phones (mobile devices used for credentials), so the note was misleading there. Make the cross-link per sub-category: DEVICE_SUBCATEGORY_ERROR_ROUTES now carries a `linkCommonDeviceErrors` flag alongside the route, set true for locks/thermostats and false for phones. The phones page no longer renders the note; locks and thermostats are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up improvements to the API-reference errors-page generator (
mintlify-codegen/errors.ts), building on #1219 and #1209.Device sub-categories (locks, thermostats, phones) are not distinct blueprint resources — the Seam API models them as
devices, so their error/warning codes live on thedeviceresource under variant groups. #1219 added theDEVICE_SUBCATEGORY_ERROR_ROUTESallowlist +variantGroupProp()to emit dedicated pages for those. Their pages are subsets of the aggregate/api/devices/errorspage.1. Cross-link the shared device errors from the lock/thermostat pages (primary)
The sub-category pages omit the device-level codes (
device_offline,device_disconnected,missing_device_credentials, …) that live on/api/devices/errors. A reader troubleshooting connectivity on/api/locks/errorscouldn't finddevice_offlinethere.The lock and thermostat pages now open with a
<Note>linking back to the shared page:The note is derived from the page's noun (
resourceNoun()) and its actual sections. The link target/api/devices/errorsis registered indocs.jsonand matches the form other pages already use. The note is added only on sub-category pages, never on/api/devices/errorsitself.The phones page deliberately omits the note. The shared codes are physical-device connectivity/subscription errors (
device_offline,hub_disconnected,salto_ks_subscription_limit_exceeded, …) that apply to locks and thermostats but not to phones (mobile devices used for credentials), so pointing a phones reader at them would be misleading. This is encoded per sub-category:DEVICE_SUBCATEGORY_ERROR_ROUTESnow carries alinkCommonDeviceErrorsflag (true for locks/thermostats, false for phones) alongside each route.Implemented via a
commonDeviceErrorsRouteoption threaded throughwriteErrorPage(), set at the device-sub-category call site only when the sub-category shares the device-level codes.2. Make the allowlist self-checking (secondary)
DEVICE_SUBCATEGORY_ERROR_ROUTESis hand-maintained, so a new device sub-category with its own docs route (object + events pages) and an error/warning variant group would silently produce no errors page until someone edited the map.The generator now logs a warning when a device errors/warnings variant group key: (a) has non-empty codes, (b) has both
/api/<key>/object.mdxand/api/<key>/events.mdx, and (c) is not in the allowlist and is not itself a documented blueprint resource. Condition (c) is what prevents false positives on real resources (access_codes, which owns its own distinct errors) and annotation-only groups (hardware,provider_metadata, which have no such route). The current blueprint produces zero warnings; verified the warning fires correctly whenlocksis temporarily removed from the allowlist.3. Defensive double-write guard (reduce drift)
Added a guard in
writeErrorPage()to skip aroutePathalready written. This surfaced a latent collision:device_provideris a documented resource that sharesroutePath/deviceswithdevice. Previously the second write was avoided only implicitly (viadevice_provider's empty-codes early-return); the guard makes the ordering explicit and prevents a future clobber. Verified/api/devices/errorsoutput is byte-identical tomain.Relationship to #1210
Docs PR #1210 currently links lock/thermostat troubleshooting to
/api/devices/errors(rather than the sub-category resource pages) precisely because the sub-category pages lacked the device-level codes. Improvement #1 is the prerequisite that would later let those links point at the sub-category resource pages while still directing readers to the shared device-level codes.Verification
npm run generate:mintlify— the lock and thermostat pages gained the cross-link note, the phones page did not; no new warnings fire.npm run typecheck,npm run lint,npm run formatall pass.openapi.jsoncode-sample reformatting churn (from missingruff/shfmt/streein this environment) was not committed — only the generator + the 3 regeneratederrors.mdxpages are included.🤖 Generated with Claude Code