Repository navigation
docs(den-api): name Automation schemas as OpenAPI components - #4705
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add .meta({ ref }) to the shared Automation Zod schemas in @openwork/types
and the two route-local run wrappers so hono-openapi emits them once under
components.schemas instead of inlining them into all 13 Automation
operations. Wire payloads are unchanged (timestamps stay epoch-ms
integers); the dereferenced document is byte-identical.
ow-timestamps-date-time 155 -> 33, baseline 256 -> 134.
Mechanical output of pnpm sdk:generate after the Automation schemas became components.schemas: the SDK now exports Automation, AutomationRun, AutomationRevision, AutomationDetail, AutomationList, AutomationRunReceipt and friends as named types instead of repeating inline object literals.
The MCP search_capabilities catalog copies request-body schemas from the OpenAPI document verbatim without resolving $ref, so a named AutomationSchedule/AutomationModel/AutomationAction/AutomationExecutionTarget would have turned the updateAutomation and createCloudAutomation tool bodySchema fields into dangling references. Name only response-side schemas; the lint result is unchanged (134 warnings, 33 timestamp hits).
2f8a012 to
1c40bab
Compare
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Warden review summary — ClearNative findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (50941 ms), confidentiality-review (77046 ms), desktop-den-sync-review (24224 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (1c40bab961ac0de32c3b3c4cf4a992e9fd60528a). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
|
Passed · 12/12 tests · 18/18 assertions · 8 images Commit |
What changed
Gives the shared Automation Zod schemas stable OpenAPI component names so the document emits each one once under
components.schemasand the 13/v1/automations*and/v1/automation-runs*operations reference them with$ref, instead of inlining the sameAutomation/AutomationRevision/AutomationRunstructures into every response.packages/types/src/automations.ts:.meta({ ref: "<PascalName>" })on the response-side schemas —Automation,AutomationRevision,AutomationRun,AutomationRunEvent,AutomationRunReceipt,AutomationDetail,AutomationList,AutomationNeedsAttentionReason,AutomationError,AutomationUsage,AutomationExecutionThread,AutomationDesktopRunnerPresence,AutomationRunnerTokenResponse, and the enumsAutomationState,AutomationRunStatus,AutomationRunTrigger,AutomationRunEventType. Names follow the existing.meta({ ref })style inee/apps/den-api/srcand match the exported TypeScript type names.ee/apps/den-api/src/routes/automations/index.ts: the two route-local wrappers becomeAutomationRunListandAutomationRunResponse.packages/docs/openapi.json,.spectral-baseline.jsonregenerated.packages/sdk/src/gen/types.gen.tsregenerated: the SDK now exports namedAutomation*types instead of repeating inline object literals (−1462 / +252 lines, mechanical output ofpnpm sdk:generate;pnpm sdk:checkpasses).Deliberately not named:
automationScheduleSchema,automationModelSchema,automationActionSchema,automationSavedScriptReferenceSchema,automationExecutionTargetSchema. They also appear in thecreateAutomation/createCloudAutomation/updateAutomationrequest bodies, andee/apps/den-api/src/mcp/catalog.tscopies request-body schemas intosearch_capabilitiesbodySchemaverbatim without resolving$ref, so naming them would have turned theschedule/model/actionfields of two MCP tools into dangling{"$ref": ...}. Also not named: runner-protocol-only schemas (assignment, registration, heartbeat, work, remote-session command), because those routes are taggedInternaland stripped from the snapshot, so their components would only addoas3-unused-componentwarnings.Timestamp encoding is untouched (epoch-ms integers); that wire change is tracked separately.
Warnings before -> after (
pnpm api:lint)0 errors before and after. Baseline ratcheted down with
pnpm api:lint --update-baseline.Metadata-only proof
git diff --stat origin/feat/api-quality-spectral..HEADlists onlypackages/types/src/automations.ts,ee/apps/den-api/src/routes/automations/index.ts,packages/docs/openapi.json,.spectral-baseline.json,packages/sdk/src/gen/types.gen.ts. Every source line changed is a.meta({ ref })addition; no handler, validator, guard, or request schema changed.#/components/schemas/*inpathsof the base document and this one yields byte-identical JSON (1,252,708 chars each), so the described contract is unchanged; only its structure moved from inline to$ref.$refafter this change, so MCPbodySchemaoutput is unaffected. Operation summaries/descriptions are unchanged, sosearch_capabilitiestool text and tool set are unchanged even thoughAutomationsis inSAFE_INCLUDED_TAGS.Verification
pnpm exec tsc -p ee/apps/den-api/tsconfig.json --noEmit --pretty false— cleanpnpm api:snapshot,pnpm api:lint— 0 errors, 134 warningspnpm sdk:generate && pnpm sdk:check— "Generated SDK matches the Den route schemas", SDK typecheck cleanpnpm --filter @openwork-ee/den-api test— 24 pass, 0 failpnpm --filter @openwork-ee/den-api typecheck:automations— cleanbun test --conditions development test/automation-*.test.ts— 43 pass, 2 fail; both failures are pre-existing and reproduce identically onorigin/feat/api-quality-spectralwith this PR's source files reverted:automation-index.test.ts("the index carries the identity and live state…", fixture lacksexecutionTarget) andautomation-runner-protocol.test.ts("desktop recovery deadlines hold…")..meta()does not change runtime parsing;@openwork/typesis consumed by the desktop app:pnpm --filter @openwork/types build,pnpm --filter @openwork/app typecheckclean, andapps/app/tests/automation-*.test.ts43 pass, 0 fail.Docs/structure-only change per
docs/api-style.md; no runtime journey proof applies.Merge note
Every API follow-up regenerates
packages/docs/openapi.json,.spectral-baseline.jsonandpackages/sdk/src/gen/**, so expect conflicts with sibling PRs. Resolve mechanically after merging the base:pnpm api:snapshot && pnpm api:lint --update-baseline && pnpm sdk:generate && pnpm sdk:check.Noticed, not touched
ee/apps/den-api/src/mcp/catalog.ts#getJsonRequestBodySchemareturns raw OpenAPI request-body schemas; 23 operations on the base branch (API Keys, Organizations, Capability Sources, Dashboards, Desktop Policies, MCP connections) already ship$refs inbodySchemathat MCP clients cannot resolve. Dereferencing components there would let request-side schemas be named too./openapi.json; naming them would require the snapshot script to prune components unreachable from published operations.