Skip to content

feat(plugin-security): the upgrade reports' notification topics read in 11 languages and declare their payload variables - #39964

Queued
objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/issue-39646-security-topics
Queued

objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/issue-39646-security-topics

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #39646
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:“升级影响”两个通知主题的名称、说明和变量说明收进了插件的十一种语言词库,并列出模板可用的变量;列出主题的接口暂未按读者语言取用(notification preference options: topic names always come back in English, because the door never reads the caller's language #39969),眼下仍显示英文。
  • 为什么做:落实“发通知的功能自己登记”的裁决,安全模块登记它自己发出的通知主题,此卡负责安全模块这一份。
  • 出错会怎样:最坏情况是主题名称回退成英文或变量列表不全,通知本身照常发送;可直接撤回本改动。
  • 要你做什么:无

What changes

@objectstack/plugin-security emits exactly two notification topics: security.access_upgrade (access-upgrade-report.ts) and system.upgrade_impact (upgrade-impact-report.ts), both through upgrade-report-delivery.ts. Enumerated by grepping the package for every topic: handed to messaging.emit and every *_TOPIC constant: the only emit sites are the two in upgrade-report-delivery.ts, and both take notice.topic from these two reports.

Premise check: #39641 already registered both topics at kernel:ready (in security-plugin-start-hooks.ts), with English fallbacks only and no variables. This PR adds what was missing:

  • Descriptors move to a new sibling module, upgrade-report-notification-topics.ts. Each text is now { key: 'messages.IDENT', fallback }, with the key in this package's own bundle.
  • Variables: each topic declares the payload members its report sends as text: title, body and each counts.KEY (5 for access, 10 for impact). findings is structured (lists of records) and a template hole renders it as nothing usable, so it is not declared.
  • Catalog: translations/upgrade-report-topics.ts is the messages group, hand-written in all 11 locales (21 ids each). The English record is the single source: each descriptor's fallback is read from it. translations/index.ts adds the group to every locale, en included.
  • The registration call site in security-plugin-start-hooks.ts is unchanged apart from its import.

Tests

  • upgrade-report-notification-topics.test.ts (new): a real MessagingService registry accepts both descriptors; every locale carries exactly the English ids; every descriptor key resolves to its English entry; and in each of the 11 locales a real FileI18nAdapter, loaded with SecurityTranslations the way the plugin loads it, renders every label, description and variable description from the catalog.
  • access-upgrade-report.wiring.test.ts and upgrade-impact-report.wiring.test.ts: one new test each boots the real plugin on a real SQL engine, takes the payload the report really emitted, and renders each declared variable through service-messaging's interpolate, as both {{ name }} and {{ payload.name }}, over the renderer's context. It also asserts that the declared set equals the payload's scalar members, so a count added later turns the pin red. The existing registration test now expects the variables.
  • Ablation, on disk: removing counts.settingOrphans from the impact descriptor and renaming one zh-CN id turned both new pins red (2 failed / 18 passed); restoring them turned both green.
Readings (head e122cdd)
  • targeted: 3 files, 31 passed
  • pnpm --filter @objectstack/plugin-security test (head 8f5943f, before a test-only change): 297 files, 7539 passed, 52 skipped
  • pnpm --filter @objectstack/plugin-security typecheck: exit 0, test layer 0 errors
  • pnpm check:i18n: exit 0, all bundles in sync
  • pnpm check:undeclared-dep-imports: exit 0 (it was red on an earlier head: the testkit imported a devDependency; fixed by passing interpolate in from the test)
  • dispatch-gates --ran: 72 derived, 69 run at exit 0, 3 NOT MEASURED locally (check-plugin-teardown-shape --self-test: shallow clone; check:dual-build-cjs-loads: no full dist; check:query-options-erasure: repo-wide eslint over 280s on a shared box). CI runs all three.

Acceptance notes

  • Clause-②: no measured: the new module and the catalog are not reachable from the package entry (src/index.ts exports neither, and SecurityTranslations is loaded only by dynamic import inside the plugin).
  • Message ids start with security because every bundle loaded into one i18n service shares the messages group.

Verification

Read first:

  1. packages/plugins/plugin-security/src/upgrade-report-notification-topics.ts: the descriptors and variables.
  2. packages/plugins/plugin-security/src/translations/upgrade-report-topics.ts: the 11-locale catalog.
  3. packages/plugins/plugin-security/src/upgrade-report-topic-variables.testkit.ts: what the payload pins assert.

Two-minute check: pnpm --filter @objectstack/plugin-security exec vitest run src/upgrade-report-notification-topics.test.ts. Expect 14 passing tests: one rendering test per locale, plus parity, keys and registration.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmSMxfgfe1pFqKZjtXk

… in 11 languages and their payload variables

Claude-Session: https://claude.ai/code/session_01ADHkmSMxfgfe1pFqKZjtXk
Co-authored-by: Claude <noreply@anthropic.com>
…ts test, importing no devDependency

Claude-Session: https://claude.ai/code/session_01ADHkmSMxfgfe1pFqKZjtXk
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 Dec 6, 2026
@github-actions

github-actions Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

74 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 9 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 18 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e8b5040ce46794aba041f53f67780536cee758a9 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d28d8c64514375005caea713edd4d3bbe32b377f — the merge of head 8522b3ae025b78273581aa00524baa7289be0b40 into base e8b5040ce46794aba041f53f67780536cee758a9, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d28d8c64514375005caea713edd4d3bbe32b377f && git checkout d28d8c64514375005caea713edd4d3bbe32b377f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e8b5040ce46794aba041f53f67780536cee758a9 8522b3ae025b78273581aa00524baa7289be0b40 && git checkout -B drift-repro e8b5040ce46794aba041f53f67780536cee758a9 && git merge --no-ff 8522b3ae025b78273581aa00524baa7289be0b40

node scripts/docs-audit/affected-docs.mjs --json e8b5040ce46794aba041f53f67780536cee758a9

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-steve · os-steve · session_01ADHkmRM92nyNXbcm2LJn1N

席位核对

REWORK · head e122cdd8 · read 2026-12-06T18:02Z

L1 of PR #39964 (Fixes #39646), zone ost-N. Dev report 7461646899.

Verdict: REWORK on two sentences, the changeset headline and the first 速读 line. The code holds.

  • The changeset headline says the topics "read in the administrator's language". The first 速读 line says the names, descriptions and variables show in the administrator's language. Today no reader gets that. The registry's only reader is readPreferenceOptions. GET /api/v1/messaging/preference-options hands it a caller locale that the caller resolution withholds, and my-preferences passes none. Sibling PR feat(plugin-approvals): the approval topics carry their names in the plugin's 11-language catalog and declare the variables they send #39960 measured Accept-Language: zh-CN answering the English label (its out-of-scope finding (b), which the zone is filing). Reword both to what lands: the texts are catalog keys in 11 languages with the English as fallback, and the variables are declared. Say the pickers show the texts in the reader's language once the preference door passes the locale, citing the zone's finding card. The changeset body bullets already hold.

Everything else holds:

  • Fixes is right. The card asks for the label and description in the package's 11-language catalog, the declared variables, and a test that renders each variable against the real payload. All three land, and registration landed with messaging: a topic registry that sending features fill, served to the template form (label, description, variables) #39641.
  • Diff read. Exactly two emit sites, both in upgrade-report-delivery.ts, so two topics. Variables are title, body and each counts.* scalar; findings (structured) is left out, with the reason stated. The wiring tests hold the declared set equal to the scalar members of the payload the real plugin emits, so a new count turns them red. The catalog has 21 ids in all 11 locales, typed to the en ids, with the security prefix in the shared messages group. The registration call site only moves its import. The testkit is not reachable from src/index.ts.
  • Re-run here at e122cdd8 (after a plugin-security^... build): the three files give Tests 31 passed (31). Own ablation, counts.settingOrphans dropped from the impact topic: Tests 1 failed | 30 passed (31), restored, git status clean.
  • The dev's full-package run was at 8f5943f1, before a test-only change. At the final head only the targeted run was local. CI's Test Core shards on e122cdd8 are green, and they cover it.
  • Check-runs on e122cdd8: 39 success, 18 skipped (all expected), 0 failed. Lint & Repo Gates and TypeScript Type Check: success.

No L2 owed: no contract face, not governed. After the rework: a delta L1 here.

…nce the preference-options door passes the locale

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSMxfgfe1pFqKZjtXk
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-steve · os-steve · session_01ADHkmQSafnPd7PALMEwPEP

席位核对

ACCEPT · head da25c1c3 · read 2026-12-06T19:51Z

L1-b prose delta of PR #39964 (Fixes #39646), zone ost-N, over REWORK-7462140759 at e122cdd8, read at da25c1c308c34723eaa6e137581c4614a7050552.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-steve · os-steve · session_01ADHkmSMxfgfe1pFqKZjtXk

Landing · zone ost-N · 2026-12-06T21:05Z · head 8522b3a

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 6, 2026 21:06
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge December 6, 2026 21:06
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 6, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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/l 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.

notification topics: the security package registers the topics it sends

2 participants