Skip to content

fix(app-shell): the connector action Input repeater follows the run's declared-keys rule - #34137

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-y1iwy4
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-y1iwy4

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #33838

Clause-②: yes (widening) — @object-ui/i18n gains the studio pack key engine.inspector.flowNode.kv.undeclaredKey (en, zh); nothing removed or narrowed.
Metadata-protocol: none

维护者速读

  • 改了什么:Studio 里连接器动作(connector_action)的 Input「键/值」附加项编辑器,现在按运行时同一条规则判断动作输入是开放还是封闭;封闭时只给声明了但没有专用输入框的键(如 OpenAPI 的 $ref/无 schema 的 body、Slack 的 blocks)留编辑位,其余未声明键逐行标红「运行时会拒绝」。
  • 为什么改:fix(service-automation)!: a connector_action node refuses an input key its action does not declare #33614 之后,运行时会拒绝动作未声明的输入键;Studio 却仍按 JSON Schema 默认「开放」处理,照常让作者加这些键,保存后流程一跑就失败。
  • 风险与回滚:只动 Studio 前端与 i18n 文案,不改任何服务端包;旧流程里已存的未声明键不会被自动删除,只是被标出。回滚即 revert 本 PR。
  • 先看:connector-input-fields.ts(connectorInputContractKeys 与 applyConnectorInputForm 的保留条件)、FlowNodeConfigField.tsx(acceptedKeyProps)、FlowKeyValueField.tsx(keyRefusal 行)。
  • 两分钟验证:cd ui && pnpm exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/connector-input-fields.test.ts packages/app-shell/src/views/metadata-admin/inspectors/FlowNodeInspector.connectorInput.test.tsx,预期全绿。
  • 需要你做的:无,席位落地。

What changes

ui/packages/app-shell/src/views/metadata-admin/inspectors/connector-input-fields.ts decided open/closed with JSON Schema's default (additionalProperties !== false = open). No shipped connector writes additionalProperties, so Studio read every action as open and kept offering the extras repeater for keys the run now refuses.

The rule, read from the run (origin/main 385ea1cc):

  • packages/services/service-automation/src/connector-input-schema.ts:138 — KEY_ADMITTING_KEYWORDS (copied verbatim into the ui module).
  • packages/services/service-automation/src/connector-input-schema.ts:160 — declaredKeysOf: declared = properties names plus required names; open when additionalProperties / unevaluatedProperties is anything but false, when a key-admitting keyword ($ref, allOf/anyOf/oneOf, patternProperties, …) is present, or when no properties is listed and the schema is not additionalProperties: false.
  • packages/services/service-automation/src/connector-input-schema.ts:275–285 — the walk refuses every key declaredKeysOf does not list.
  • packages/services/service-automation/src/builtin/connector-nodes.ts:165 — the connector_action door passes { refuseUndeclaredKeys: true }.
  • packages/connectors/connector-openapi/src/openapi-connector.ts:569 — an unresolved $ref or schemaless request body is declared body: {} (any value); :558 — an unresolved $ref parameter opens the path/query/header sections with additionalProperties: true.

Studio now:

  • connectorInputContractKeys(schema) mirrors declaredKeysOf for the top level of connectorConfig.input (null = open). ConnectorInputForm gains contractKeys; open is contractKeys === null.
  • applyConnectorInputForm keeps the repeater when the schema is open, when it declares a key no typed field owns (an openapi body: {}, slack's item-less blocks), or when the stored map holds a key no typed field owns. On a closed schema the repeater carries a new FlowConfigField.acceptedKeys (the declared keys).
  • FlowNodeConfigField turns acceptedKeys into two FlowKeyValueField props: keyOptions (the declared keys no sibling field types, as key-cell suggestions) and the new keyRefusal, which draws one role="alert" line under any row whose key the schema does not declare.
  • connectorInputFields now resolves a CLOSED schema even when no property gets a typed field (a body-only openapi operation), so its repeater is judged too; an open schema with no typed field still returns null (the generic repeater, unchanged).

Stored keys the run would now refuse: marked, never dropped. A stored undeclared key on a closed schema keeps the repeater alive and stays in its row, with the line "The action does not declare this input, so the run refuses it. Remove it, or pick an action that declares it." under it. Rendering writes nothing back (pinned: onPatch is not called); the author removes the row. A key typed into the repeater that the action does not declare gets the same line as soon as it is typed.

Tests

New pins (all ablated red, below):

  • connector-input-fields.test.ts — new describe('connectorInputContractKeys — the run's declared-keys rule') (closed on properties; required names declared; additionalProperties: false with no properties declares none; additionalProperties/unevaluatedProperties true or a schema is open; each key-admitting keyword is open; no properties is open). In applyConnectorInputForm: closed with every key typed → no repeater; open (allOf) → repeater, no acceptedKeys; closed slack → repeater kept for blocks with acceptedKeys; openapi $ref/schemaless body: {} → repeater offers body; body-only operation still resolves; stored undeclared key on a closed schema → repeater kept and judged.
  • FlowNodeInspector.connectorInput.test.tsx (the existing harness, new top-level describe): a stored undeclared key on a closed schema renders one flow-kv-key-refusal alert and writes nothing; an open (allOf) schema marks no key; a declared-but-untyped body shows in the repeater unmarked.

Forced test edits (the old rule they pinned is the defect):

  • connector-input-fields.test.ts — describe('connectorInputFields — measured additionalProperties semantics') removed: its first case pinned "an ABSENT additionalProperties is OPEN", the rule this card retires; its other two cases are re-pinned in the new connectorInputContractKeys block.
  • connector-input-fields.test.ts — "an OPEN schema keeps the repeater…" now uses an allOf schema (slack's verbatim schema is closed under the run's rule); "a CLOSED schema drops the repeater entirely" now uses slack without blocks, since a closed schema with an untyped declared key keeps the repeater; the in-place splice case's comment says why the repeater is still there.
  • FlowNodeInspector.connectorInput.test.tsx — "an undeclared stored key stays editable in the extras repeater (schema is OPEN)" renamed to "(never hidden or dropped)", body unchanged; "a CLOSED schema (additionalProperties:false) drops the repeater" now uses slack without blocks, for the same reason.

Acceptance notes

  • Nested open sections stay as before. The run judges nested objects too. An openapi query section opened by an unresolved $ref parameter (additionalProperties: true beside declared properties) is flattened into typed sub-fields by the resolver, so a key outside them was not editable in the form before this PR and still is not; a section with no declared parameters is a keyValue field, unjudged (open, as the run reads it). Stored undeclared keys inside a closed nested section are likewise not shown. Neither is a key Studio offers, so neither is in this card's repeater; recorded here, not filed.
  • Action switch (objectstack#33346) keeps typed keys only. On a connector or action switch the inspector keeps the held keys the new action's typed fields own (declaredKeys), so a declared-but-untyped key such as body is dropped on the switch. Unchanged by this PR; it could keep contractKeys instead. Recorded, not filed.
  • The marked key does not hold Studio's autosave or appear in the flow problems list; the line is inline only. The run's own refusal is unchanged.

Verification

Targeted suites (merged head)

Head 3b90535e, under os-verify-lock.sh (VERDICT command-exit 0 each):

  • pnpm --filter @object-ui/app-shell run type-check and pnpm --filter @object-ui/i18n run type-check — exit 0.
  • cd ui && pnpm exec vitest run --maxWorkers=2 over connector-input-fields.test.ts, FlowNodeInspector.connectorInput.test.tsx, FlowNodeInspector.connectorActionSwitch-33346.test.tsx, FlowNodeInspector.connectorInputEnvelope-28164.test.tsx, FlowNodeInspector.connectorOutputRefs-11028.test.tsx, the three FlowKeyValueField.*.test.* files, FlowNodeConfigField.test.tsx, FlowNodeConfigField.entryCondition.test.tsx and packages/i18n/ — Test Files 112 passed (112), Tests 2025 passed | 13 skipped (2038).
  • Narrowed on purpose: the full app-shell suite is left to CI Test UI.
Ablations (each restored; `git diff HEAD` empty after)

Each leg through node scripts/ablation-replace.mjs (anchor hit 1 → 0, blob moved), running connector-input-fields.test.ts + FlowNodeInspector.connectorInput.test.tsx; ui vitest resolves @object-ui/* to src/, so no build sits between mutation and run.

  1. connectorInputContractKeys: if (!properties && additional !== false) return null; → if (additional !== false) return null; (the retired JSON-Schema default) — 9 failed | 42 passed, including every closed-schema pin in both files.
  2. FlowNodeConfigField: the acceptedKeyProps(...) spread forced off — 1 failed | 50 passed: "a stored key a CLOSED schema does not declare is shown and marked as refused by the run".
  3. applyConnectorInputForm: untyped.length > 0 dropped from keepRepeater — 4 failed | 47 passed (slack blocks, openapi body: {}, body-only operation, in-place splice). The render pin for body stays green here because the stored body keeps the repeater on its own; the unit pins carry this leg.
Derived gates (`dispatch-gates --commands`, merged head)

Head 3b90535e; node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 37 commands; all 37 ran, each :: exit 0. --ran reconciliation: 37 derived famil(ies) accounted for — 37 run, 0 NOT-MEASURED.

The first round (head d9362095) had pnpm check:test-source-alias red: the edited harness reaches a lazy import('@objectstack/lint'). Fixed in 3b90535e by the module-top import '@objectstack/lint'; the gate prescribes (precedent: FlowNodeInspector.connectorActionSwitch-33346.test.tsx). Every other command was green in both rounds.


Generated by Claude Code

… declared-keys rule

The repeater now reads the action's input schema the way the
connector_action node does: a schema listing properties is closed, a
key-admitting keyword or a non-false additionalProperties opens it. A
closed schema keeps the repeater only for declared keys no typed field
edits, and marks every other key as one the run refuses.

Claude-Session: https://claude.ai/code/session_01ADHkmNs7VguNqTeS9xDmJQ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 3b90535e66c38798de992e94edadb927154ba896
Local-runs: none

Face: declaration (Clause-②: yes (widening) on the changeset and the PR body; no published schema, no governed path: check-governed-merges --pr 34137 0 of 9 paths). Inputs read: card #33838 (split from #33665 item 2, follow-up of #33614), the Claim, os-dev-report 6901472488, PR #34137 body, the net diff against main at the merge base (9 files), the runtime rule it mirrors on main (packages/services/service-automation/src/connector-input-schema.ts declaredKeysOf, KEY_ADMITTING_KEYWORDS), and the check-runs on this head (2026-11-15T21:35Z: 45 success, 13 skipped, 0 failed).

① Derived judgments

  • The rule: connectorInputContractKeys (connector-input-fields.ts) is line-for-line the run's declaredKeysOf: the same twelve key-admitting keywords, additionalProperties / unevaluatedProperties other than false read open, no properties without additionalProperties: false read open, declared = properties ∪ required. Studio and the connector_action node now judge a key the same way. Right.
  • Behaviour: open schema keeps the repeater as before; closed schema keeps it only for declared keys the resolver cannot type (openapi $ref / schemaless body, slack blocks), offered as key suggestions; an undeclared key, stored or typed, stays and is marked (role=alert) as one the run refuses, never dropped. That keeps the package's "existing config is never hidden" rule. Right.
  • Public surface: @object-ui/i18n gains one studio pack key, engine.inspector.flowNode.kv.undeclaredKey (en, zh; other locales fall back as the studio namespace does). @object-ui/app-shell exports nothing new. This is the widening the line declares. Metadata-protocol: none: no served metadata changes.
  • Nit N1: the keyword list and the judgment are a copy of the run's, not an import (app-shell cannot import service-automation). No parity pin ties the two; a later change to the run's list would not turn this red. No effect on correctness today; noted, no card owed by this record.

② Semver level

patch on @object-ui/i18n, @object-ui/app-shell, @object-ui/console: an additive key and a behaviour fix with no export moved; Check Changeset concluded success on this head. Correct.

③ Boundary flags

  • open_questions, two (nested open segments; the kept set on an action switch): both answered as the dev recommends, out of this PR.
  • Forced test edits: named in the PR body; they move with the new rule (a closed schema no longer offers the free repeater) and loosen no assertion.
  • Ablation: three legs red (9 / 1 / 4 failed), restored green.
  • security_findings: none. The marking is advisory; the run's refusal is the enforcement.

Implemented-by: claude/project-thread-y1iwy4
Reviewed-by: session_01ADHkmT2NE3iyG1o6TDg3sf

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf

席位核对

Verdict: ACCEPT · head 3b90535e · 2026-11-15T21:35Z

  1. Shape. Draft → main, Fixes #33838. 9 files on the claimed surface: connector-input-fields.ts (the run's declared-keys rule mirrored), FlowNodeConfigField.tsx, FlowKeyValueField.tsx, flow-node-config.ts, two test files, the studio i18n pack (en, zh), one changeset (@object-ui/i18n, @object-ui/app-shell, @object-ui/console patch).
  2. Contract. Clause-②: yes (widening) (one studio pack key); same-head TIER_DEFAULT record PASS: comment 6901735855, one nit (N1, the copied rule has no parity pin with the run's), accepted. Metadata-protocol: none.
  3. Open questions. Both answered as recommended: out of this PR.
  4. Gates on 3b90535e. 58 check runs: 45 success, 13 skipped, none failed. Locally 37/37 derived gates exit 0, 0 NOT-MEASURED; ablation three legs red.
  5. K. K = 3; no sync owed.
  6. Governed. check-governed-merges --pr 34137: NOT governed (0 of 9 paths).
  7. Landing. This stroke: pr_ready + automerge_enable, under the maintainer's landing approval in the seat thread (2026-11-15T16:10Z, 「批准席位 本班复核通过的 PR 执行 --land」). On MERGED Fixes #33838 closes the card; the seat then removes pm:dispatched and the assignee.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 21:36
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 1078c73 Nov 15, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-y1iwy4 branch November 15, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Studio: the connector_action input extras repeater (connector-input-fields.ts) follow-up for #33614 — split from #33665 item 2

2 participants