Skip to content

Commit 796e9d4

Browse files
fix(lint): connector, permission-set and form-view advisories carry a user sentence in every platform locale (#33145)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoWK5rFW1SUGSkDw9iatZE4f)_ Fixes #32842 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:保存连接器、权限集和表单视图时返回的 3 类提示,现在都带一句面向用户的话,覆盖平台全部 11 种语言;规则 id、英文 message 和 hint 一字未改。卡片列出的另外 7 类提示保存时根本不会返回,本 PR 不为它们写文案,只在下方写明原因。 - **为什么改**:此前这些提示只有给开发者看的英文,非英文界面的管理员保存连接器或权限集时看不懂;这是 #32655 已落地做法在连接器、权限和表单领域的延续。连接器那句只说凭据写在哪个请求头或变量里,绝不包含凭据本身。 - **风险与回滚**:只新增文案和 `userTextParams` 字段,不改变哪些写入被拒、哪些通过;回滚即撤销本 PR。`os validate --json` / `os build --json` 的 warnings 里这三类提示会多出 `userTextParams` 键。 - **先看**:`lint-connector-credential-literals.user-text.ts`(4 种情形,最贴近用户),再看 `validate-predicate-path-refs.user-text.ts`(两种理解都给出写法),最后看 `authoring-rules.ts` 里两行转发。 - **两分钟验证**:`pnpm --filter @objectstack/lint exec vitest run src/finding-user-text.connector-permission-form.test.ts`,21 个用例全绿,每条都从真实元数据经运行时保存门取出并逐语言渲染。 - **需要你做的**:无,席位落地。 ## What changes Three advisory rule ids that the save door returns now carry `userTextParams` and a user sentence in all eleven `PLATFORM_LOCALE_TAGS`. Each rule file gets a `*.user-text.ts` catalog beside it, and the three catalogs merge into `FINDING_USER_TEXT_CATALOG` through `mergeUserTextCatalogs`, the way #32655 landed `validate-security-posture.user-text.ts`. | Rule file | Catalog | Id | Write | |---|---|---|---| | `lint-connector-credential-literals.ts` | `CONNECTOR_CREDENTIAL_LITERALS_USER_TEXT` | `connector-credential-literal` | connector | | `validate-retired-permission-residue.ts` | `RETIRED_PERMISSION_RESIDUE_USER_TEXT` | `permission-retired-lifecycle-residue` | permission | | `validate-predicate-path-refs.ts` | `PREDICATE_PATH_REFS_USER_TEXT` | `predicate-rhs-path-shaped` (bare-word `warning` arm only) | view | - `connector-credential-literal` has three push sites and four arms, chosen by `position`: `header` and `env` (a literal in one of the four maps; params `connector`, `name`), `credential-env` (a credential typed into `transport.credentialEnv`) and `stdio-auth` (a stdio MCP server whose `auth` reaches nothing); both carry only `connector`. ⛔ No param and no sentence carries the credential value, following the `lint-flow-credential-literals` precedent. The sentences name the console's own page, Connector credentials (`connectorCredentials.title`). - `permission-retired-lifecycle-residue`: params `permissionSet`, `object`, `key`. The sentence says the line grants nothing, to delete it, and that restore and purge are granted through the recycle bin (`recycleBin.title`). - `predicate-rhs-path-shaped`: params `view`, `word`, `op`, set on the bare-word arm only; the dotted arm refuses the write and carries none. The view name is threaded through `checkPredicate` / `walkFields` (same file). Per the rule's own note (`validate-predicate-path-refs.ts`, §One position, one prescription: which reading the author meant is not decided), the sentence names both readings and the supported spelling of each (`== 'active'`, or the field on the left: `data.active == 'yes'`) and never prescribes the root in place (`== data.active` is the refused arm). - `authoring-rules.ts`: the `lintConnectorCredentialLiterals` and `validateRetiredPermissionResidue` adapters rebuilt findings field by field and dropped `userTextParams`; each gets the one-line conditional spread (#33120, #33140 precedent). `validatePredicatePathRefs` passes findings through unchanged. - Changeset `32842-advisory-user-text.md`, `@objectstack/lint` patch. ## Tests New `finding-user-text.connector-permission-form.test.ts`, 21 tests, in the shape of `finding-user-text.data-model.test.ts`: - exact coverage of each catalog (ids × 11 locales) and its identity in `FINDING_USER_TEXT_CATALOG`; the seven never-at-door ids have no entry; - every push site rendered from its real finding in every locale (connector header, env, credentialEnv and stdio-auth; permission `allowRestore` and `allowPurge`; the bare-word predicate), with no `undefined`, no unfilled `${`, every shown name present, and no locale falling back to the English sentence; the four connector arms render apart in every locale; - no credential sentinel in any param or any locale's sentence; - both predicate readings in every locale, for `==` and `!=`, and never the root in place; the dotted arm carries no params; - one runtime-gate case per write type (connector, permission, view) through `runRuntimeAuthoringRules`, with the advisory's params checked and `userMessage` parsed under `RuntimeAuthoringIssueSchema` (de-DE, ja-JP, fr-FR). ## Acceptance notes **Re-measure.** The card's table lists 10 ids in 8 files; the static scan matches (each id produces exactly one `warning` whole-stack). Through the save door (`runRuntimeAuthoringRules` on each id's own write type with an objects context, main `a83c3667`), 3 reach a user. This PR writes catalogs and pins for those 3 only. Under #32835's Done-when alternative, the 7 that never reach the door: - **(a) reference-integrity suite members on its frozen `flow` default.** An agent, app, skill or mapping write dispatches none of them, and a flow write's snapshot carries no agents, apps, skills or mappings. Measured: 0 at the door for each. - `agent-authoring-withdrawn`, `default-agent-outside-roster`, `default-agent-legacy-alias` (`validate-ai-agent-authoring.ts`) - `mapping-connector-source-unknown` (`validate-mapping-connector-source.ts`) - `ai-skill-tool-unresolved` (`validate-ai-tool-references.ts`): kept off the door on purpose by ruling 5791822697 (ADR-0109 Decision §3), since a per-write snapshot cannot resolve a skill's tools truthfully. - **(b) CLI-only registry entries.** - `security-external-owner-unmapped` (`validateExternalOwnerSharing`, `RUNTIME_OBJECT_ADVISORY_VOLUME`) - `sharing-rule-object-not-shareable` (`validateSharingRuleEnforceability`, pending a `sharing_rule` door that carries `sharingRules`) **Agent-written sentences for the native-review round.** Every non-English sentence in this PR is agent-written: 3 ids (6 sentences counting the connector's four arms) × 10 locales (zh-Hans, zh-Hant, es, ar, fr, pt-BR, ru, de, ja, ko), in the three `*.user-text.ts` files above. Terms follow `ui/packages/i18n`: Connector credentials 连接器凭据 / 聯結器憑據 / Credenciales de conectores / بيانات اعتماد الموصلات / Identifiants des connecteurs / Credenciais de conectores / Учётные данные коннекторов / Connector-Zugangsdaten / コネクタ認証情報 / 커넥터 자격 증명; recycle bin 回收站 / 回收站 / papelera / سلة المحذوفات / corbeille / lixeira / корзина / Papierkorb / ごみ箱 / 휴지통; permission set as in `validate-security-posture.user-text.ts`. zh-Hant uses the console's 聯結器 and 回收站, which differ from the flow catalog's 連接器; the native round may want to settle one spelling. The connector `stdio-auth` and the predicate sentences carry the most technical wording and are the best first read. **Metadata-protocol.** `none`. The #32655 precedent (#32790) declared `added` / `Clause-②: yes` because it added a spec field (`userMessage`, the `api` authorable shard); this PR adds no spec field and moves no shard, so it follows #32835's reading for its lint-only sub-cards (#32836, #32837, #32838 all `none`). **Ruling grep** (`ruling|Ruling-ref|maintainer|⛔` across the surface, read before editing): connector credential literals 2 (never the value; stdio needs `credentialEnv`), retired permission residue 3 (director ruling D, not re-adjudicable; table not derived live), predicate path refs 2 (the consumer's ruling on the right side; which reading the author meant is undecided), `finding-user-text.ts` 2, the four never-at-door files 0–2 each (untouched). The sentences keep every one of them; none is reversed. **Serial.** #32838 (PR #33140) landed on `finding-user-text.ts` and `authoring-rules.ts` while this was in flight; main was merged once and every catalog line and adapter spread from both is kept. #33072's `validate-expressions.ts` and expression entry are untouched. **Ablations** (source, committed first, `scripts/ablation-replace.mjs`, anchor 1 → 0 on disk, each restored to the HEAD blob `9968f378` and verified by hash): - deleting the `lintConnectorCredentialLiterals` adapter spread: 1 failed / 20 passed, exactly the connector-write gate case; - deleting the `validateRetiredPermissionResidue` adapter spread: 1 failed / 20 passed, exactly the permission-write gate case. ## Verification Head `ad51300d`, `c371f044` merged with `origin/main` at `6482c083` (once, after #33140 landed on `finding-user-text.ts`; conflict on the catalog list resolved by keeping both sides; `authoring-rules.ts` auto-merged with all four adapter spreads present). After the merge: `pnpm install --frozen-lockfile`, full `pnpm turbo run build --concurrency=2` (lock VERDICT exit 0), `packages/runtime/.objectstack` cleared. - `pnpm --filter @objectstack/lint test`: 206 files, 8762 tests passed (VERDICT exit 0). Before the merge, at `c371f044`: 204 files, 8732 passed, 5 skipped. - `pnpm --filter @objectstack/lint typecheck`: exit 0 (includes `check:test-typecheck`, debt held). `node scripts/check-cli-command-ids.mjs`: exit 0. `check:nul-bytes`: exit 0. - Consumers of the widened finding shape, each its real reading at the merged head: - `@objectstack/metadata-protocol` (the save door; `protocol.runtime-authoring-gate.test.ts` names these ids): 337 files passed, 7 skipped; 22799 tests passed, 36 skipped. - `@objectstack/cli` `test/connector-credential-literal-doors.e2e.test.ts` (nightly tier, integration project, spawns the CLI): 2 tests passed. - Derived gates: `dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `ad51300d` derives 62 families (identical list to `c371f044`); every line run with stdin closed, exit captured before any pipe, all 62 exit 0. `--ran` reconciliation: 62 derived, 62 run, 0 NOT-MEASURED (a derived zero). Record: `spec-seat-2/r2026-11-13/out/32842-gates-ran-ad51300d.list`. <details><summary>Gate readings that were not exit 0 on the first sweep (c371f04)</summary> - `check-plugin-teardown-shape --self-test` exit 3: the shallow clone could not reach the pinned fixture commit `621a4876`; after fetching it, exit 0 (and exit 0 in the post-merge sweep). </details> - No dogfood battery: the title has no `!` and `Clause-②:` carries no `(narrowing)` arm. --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibwqZc5F1URP3eghRix)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 128b657 commit 796e9d4

10 files changed

Lines changed: 842 additions & 4 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/lint': patch
3+
---
4+
5+
fix(lint): the connector, permission-set and form-view advisories a save returns carry a user sentence in every platform locale
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Three advisory rule ids that the save door returns now carry `userTextParams` (the connector, permission set, object, view and entry names their user sentence interpolates) and have a sentence in all eleven platform locales, each in a `*.user-text.ts` catalog beside its rule and merged into the one catalog `findingUserMessage` renders from:
11+
12+
- `connector-credential-literal` (connector write), in four arms: a credential in a header, in an MCP server's environment variable, in `credentialEnv`, and a stdio MCP server whose credential reaches nothing. The sentence names the connector and the header or variable the credential sits under, and never the credential itself.
13+
- `permission-retired-lifecycle-residue` (permission write): names the permission set, the object and the retired key.
14+
- `predicate-rhs-path-shaped`, its advisory bare-word arm (view write): names the form view, the word and the operator, and gives both readings with the supported spelling of each (the quoted word, or the field on the left compared with a quoted value).
15+
16+
Rule ids, `message` and `hint` are unchanged, and the refusal arm of `predicate-rhs-path-shaped` (a dotted path on the right) carries no params, so it renders no user sentence. The `lintConnectorCredentialLiterals` and `validateRetiredPermissionResidue` registry entries now keep `userTextParams` when they re-map their findings, so the publish gate's advisories carry them. Because the finding objects now carry `userTextParams`, `os validate --json` and `os build --json` show that key on these findings in `warnings`.
17+
18+
The other seven advisory ids in these rule files get no sentence, because the save door never returns them:
19+
20+
- `agent-authoring-withdrawn`, `default-agent-outside-roster`, `default-agent-legacy-alias` and `mapping-connector-source-unknown`: reference-integrity suite members on its default `flow` write type. An agent, app or mapping write dispatches none of them, and a flow write's snapshot carries no agents, apps or mappings.
21+
- `ai-skill-tool-unresolved`: the same, and kept off the door on purpose by ruling 5791822697 (ADR-0109 Decision §3): a per-write snapshot cannot resolve a skill's tools truthfully.
22+
- `security-external-owner-unmapped` and `sharing-rule-object-not-shareable`: their registry entries run on the command line only.

‎packages/lint/src/authoring-rules.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,9 @@ export const AUTHORING_RULES: readonly AuthoringRule[] = [
20782078
path: f.path,
20792079
message: f.message,
20802080
hint: f.hint,
2081+
// The user sentence's names ride through the re-map, so the save door
2082+
// can render this advisory in the request's language.
2083+
...(f.userTextParams !== undefined ? { userTextParams: f.userTextParams } : {}),
20812084
})),
20822085
},
20832086
// The spec-liveness loop on the author side: a property the ledger marks
@@ -2199,6 +2202,9 @@ export const AUTHORING_RULES: readonly AuthoringRule[] = [
21992202
path: f.path,
22002203
message: f.message,
22012204
hint: f.hint,
2205+
// The user sentence's names ride through the re-map, so the save door
2206+
// can render this advisory in the request's language.
2207+
...(f.userTextParams !== undefined ? { userTextParams: f.userTextParams } : {}),
22022208
})),
22032209
},
22042210
// A format like `{plan_no}{000}` makes the referenced field part of the

‎packages/lint/src/finding-user-text.connector-permission-form.test.ts‎

Lines changed: 351 additions & 0 deletions
Large diffs are not rendered by default.

‎packages/lint/src/finding-user-text.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ import { OBJECT_REFERENCES_USER_TEXT } from './validate-object-references.user-t
6969
import { FORM_LAYOUT_USER_TEXT } from './validate-form-layout.user-text.js';
7070
import { VISIBILITY_PREDICATES_USER_TEXT } from './validate-visibility-predicates.user-text.js';
7171
import { PAGE_FIELD_BINDINGS_USER_TEXT } from './validate-page-field-bindings.user-text.js';
72+
import { CONNECTOR_CREDENTIAL_LITERALS_USER_TEXT } from './lint-connector-credential-literals.user-text.js';
73+
import { RETIRED_PERMISSION_RESIDUE_USER_TEXT } from './validate-retired-permission-residue.user-text.js';
74+
import { PREDICATE_PATH_REFS_USER_TEXT } from './validate-predicate-path-refs.user-text.js';
7275

7376
/**
7477
* The names a finding's user sentence interpolates — object, field and
@@ -187,6 +190,11 @@ export const FINDING_USER_TEXT_CATALOG: UserTextCatalog = mergeUserTextCatalogs(
187190
FORM_LAYOUT_USER_TEXT,
188191
VISIBILITY_PREDICATES_USER_TEXT,
189192
PAGE_FIELD_BINDINGS_USER_TEXT,
193+
// The connector, permission and form-view writes: the connector credential,
194+
// retired permission key and form predicate advisories.
195+
CONNECTOR_CREDENTIAL_LITERALS_USER_TEXT,
196+
RETIRED_PERMISSION_RESIDUE_USER_TEXT,
197+
PREDICATE_PATH_REFS_USER_TEXT,
190198
);
191199

192200
/**

‎packages/lint/src/lint-connector-credential-literals.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
import { isCredentialShapedLiteral, isCredentialShapedName } from './credential-literal.js';
7272
import { recordsOf } from './object-graph.js';
73+
import type { UserTextParams } from './finding-user-text.js';
7374

7475
type AnyRec = Record<string, unknown>;
7576

@@ -88,6 +89,14 @@ export interface ConnectorCredentialLiteralFinding {
8889
path: string;
8990
message: string;
9091
hint: string;
92+
/**
93+
* The names this finding's user sentence interpolates
94+
* (`lint-connector-credential-literals.user-text.ts`): the connector, the
95+
* entry's NAME when the finding is about a map entry, and its position
96+
* (`header` · `env` · `credential-env` · `stdio-auth`). ⛔ Never the value,
97+
* for the module note's reason; see `AuthoringFinding.userTextParams`.
98+
*/
99+
userTextParams?: UserTextParams;
91100
}
92101

93102
/**
@@ -194,6 +203,7 @@ export function lintConnectorCredentialLiterals(stack: AnyRec): ConnectorCredent
194203
// `os explain connector-credential-literal`.
195204
message: `${judged.entry} '${key}' in ${label} holds a credential-shaped literal, ${KEPT}; ${steer}`,
196205
hint: judged.entry === 'env' ? ENV_ROUTE : HEADER_ROUTE,
206+
userTextParams: { connector: name, name: key, position: judged.entry },
197207
});
198208
}
199209
}
@@ -213,6 +223,7 @@ export function lintConnectorCredentialLiterals(stack: AnyRec): ConnectorCredent
213223
'providerConfig.transport.credentialEnv reads as a credential, not a variable name, and is served on ' +
214224
'every metadata read; put the secret behind `auth.credentialRef` and name its variable here',
215225
hint: CREDENTIAL_ENV_ROUTE,
226+
userTextParams: { connector: name, position: 'credential-env' },
216227
});
217228
}
218229

@@ -234,6 +245,7 @@ export function lintConnectorCredentialLiterals(stack: AnyRec): ConnectorCredent
234245
`auth '${auth.type}' reaches nothing: a stdio transport passes the resolved credential to the server only ` +
235246
'in the variable `transport.credentialEnv` names, and this entry names none',
236247
hint: STDIO_AUTH_UNPLACED_ROUTE,
248+
userTextParams: { connector: name, position: 'stdio-auth' },
237249
});
238250
}
239251
});

0 commit comments

Comments
 (0)