Repository navigation
feat(platform-objects,service-segmenter): sys_search_term, the administrator's search-word object (step 1, PR 2 of 2) - #38891
Conversation
…tered by the segmenter service Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
…y row Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
…egisters it without a Setup entry Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
…() reads the manifest service from Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
…'s narrowed surface) Claude-Session: https://claude.ai/code/session_01RKKVnitBaUHnfQ8KzxmKkv Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 4 package(s): 71 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 20 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 192 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f47d29c3bf0680a35cbca227f0568a7b907d9ef4 && git checkout f47d29c3bf0680a35cbca227f0568a7b907d9ef4
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin be2df7538dd3ebbf0ac3c8c37c86f2b1e2bff726 a7f5fb61497b6188e2f48a0e87122d80f4ce0f89 && git checkout -B drift-repro be2df7538dd3ebbf0ac3c8c37c86f2b1e2bff726 && git merge --no-ff a7f5fb61497b6188e2f48a0e87122d80f4ce0f89
node scripts/docs-audit/affected-docs.mjs --json be2df7538dd3ebbf0ac3c8c37c86f2b1e2bff726
|
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN Contract-review-claim: session_01RKKVngFfp7HBk6JUUr5vfN · head 7033962 · 2026-12-01T12:38Z |
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN Contract reviewServed-tier: ① Derived judgments
② Semver levelFour ③ Boundary flags
④ Design judgment
No must-fix. One should-fix (import door pin) is open for a delta read. Implemented-by: VERDICT: PASS |
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN 2026-12-01T12:48Z · L1 verdict: REWORK (round 1 of at most 2) · head The seat's L1 reading finds no must-fix. These all hold on the tree:
The L2 contract review above is PASS with one should-fix that owes a delta read. It and the L1 should-fixes are folded into this round. Open question 1 (word list in platform-objects, option A): accepted. Both reviews endorse it: one list and one declared rule, with no new dependency direction. Should-fix (this round)
Nits (carry if cheap)
Carried to step 2 (not this PR; the seat records them on #38710):
After the push, post an updated |
…fusals carry their status The real-stack suite boots under the isolated tenancy wall, so the cross-organization read is a tenancy pin: the org_b system context reads the org_a row only because the object has no organization column. The refusal case adds delete and a modifyAllRecords caller; the platform-word refusal is pinned at its boundary answer, 400 VALIDATION_FAILED. The object drops the six field-level trackHistory flags, which change nothing on these field types, and its test pins each platform word as its own comparison key. Claude-Session: https://claude.ai/code/session_01RKKVngFfp7HBk6JUUr5vfN Co-authored-by: Claude <noreply@anthropic.com>
…hind the real security layer A capability holder's file lands one record per line with no organization stamped; a line disabling a platform word is refused alone on `enabled` while the rest lands; a caller without manage_platform_settings gets every row refused PERMISSION_DENIED and nothing lands. Claude-Session: https://claude.ai/code/session_01RKKVngFfp7HBk6JUUr5vfN Co-authored-by: Claude <noreply@anthropic.com>
…s under the wall Claude-Session: https://claude.ai/code/session_01RKKVngFfp7HBk6JUUr5vfN Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN 2026-12-01T18:03Z · Red check read as a flake, re-run once · head
The failed jobs get one re-run through the relay ( |
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN Contract reviewServed-tier: ① Derived judgmentsUnchanged from 7033962. ② Semver levelFour ③ Boundary flags
④ Design judgmentUnchanged. The step 2 carries stand as recorded in 7311679425 (ordering, normalised unique key, Delta from 7033962
Check runs on this head at read time: 61 success, 11 skipped, No must-fix, no open should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN 2026-12-01T18:09Z · L1 verdict: ACCEPT · head 维护者速读
Seat opinion: land it. Every ruling holds on the tree, and the write gate is pinned on every door, the import door included. The one design move, the 24 platform words living in platform-objects so the object can refuse disabling them, keeps one list and one declared rule. Nothing reads a record until step 2, which adds the reader, the mount and the Setup entry together. 席位核对
|
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN 2026-12-01T18:26Z · Approval requested · head
|
|
repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN 2026-12-01T23:11Z · Landed by hand, recorded by the seat · head
|
Refs #38710 (step 1, PR 2 of 2)
Clause-②: yes
Metadata-protocol: none
维护者速读
What changes
sys_search_term(检索词条) inpackages/platform-objects/src/system/sys-search-term.object.ts: the administrator's search words, one set for the deployment.managedBy: 'system-data'withuserActions: { import: true }: New, Edit, Delete, Import and Export are the platform's own, and record history is on (enable.trackHistory; the field-level flags were dropped in rework round 1, because on these field types they change nothing).systemFields: { tenant: false }, likesys_knowledge_sync_state: no organization column (ADR-0131 D7).requiredPermissions: ['manage_platform_settings']in the flat list form. That form gates every operation in the security middleware, reads and writes alike. The real-stack test below pins it for create, update and read.Field mapping onto the contract (
packages/spec/src/contracts/segmenter-service.ts,SegmenterEntry):term(text, required, max 64)termkind(word/stop_word, defaultword)kindSegmenterEntryKind.purpose(knowledge/record_search/both, defaultknowledge)purposeSegmenterEntryPurpose. Only knowledge retrieval is implemented, per the card.enabled(boolean, default on)enabledknowledge_source(text, optional)note(textarea)The contract has no scope member: it says "the contract carries the entries, never where they are stored". So
knowledge_sourceis for the reader in step 2, which picks a source's records (its own and those with no source) before passing them asentries. Its type follows thesys_knowledge_sync_state.sourceprecedent: a text field holding the source's name as callers spell it. Knowledge sources are governed metadata, not records, so a lookup does not apply.The seat's platform-word cut is enforced at the object. The cross-field validation
search_term_platform_word_not_disabledrefuseskind: wordwithenabled: falsefor a platform word. Making that word a stop word is accepted, and so is disabling a platform stop word or one of the administrator's own words. To make this reachable without an import cycle, the 24 platform words move fromservice-segmentertoplatform-objectsasPLATFORM_SEARCH_WORDS.service-segmenter'sPLATFORM_WORDSnow is that list (same reference, pinned). A second validation,search_term_no_edge_space, refuses a term with a leading or trailing space, because the CELincomparison would otherwise miss a padded platform word.Registration:
SegmenterServicePlugin.init()registers the object on the manifest service (SEARCH_TERM_BUNDLE_ID), the way the queue plugin registerssys_job_queue, and declaresoptionalDependencies: ['com.objectstack.engine.objectql'](ADR-0116,check:init-service-contract). With no manifest service it logs once at info, not warn.No Setup navigation in this PR. Nothing reads a record until step 2, so a record changes no search. AGENTS.md says never to advertise a capability the runtime does not deliver, so this PR shows administrators no screen. Step 2 adds the Setup entry together with the read path.
Translations: the extract config and the bundle-ownership roster gain the object. Every locale's bundle is regenerated (
pnpm i18n:extract,node scripts/check-i18n-bundles.mjs --write), and all ten translated locales are hand-translated (zh-CN 「检索词条」), so only theidlabel keeps a source hash.Registries that red without the new name (each measured red first):
packages/spec/src/system/constants/platform-object-names.ts: one line. The spec conformance testplatform-object-names.test.tsfails by name without it, and feat(service-knowledge): each source's sync state is one durable record, the same on every node #38307 made the same addition.packages/cli/src/utils/organization-ownership-inventory.ts: onecolumn-droprow.organization-ownership-inventory.test.tsfails by name without it.scripts/platform-object-tenancy-census.json: regenerated.Tests
packages/platform-objects/src/system/sys-search-term.object.test.ts(17 cases): the declaration. It parses; the options are the contract's types (the arrays are typed by the contract);system-dataplus the import opt-in resolve to all five affordances, and without the opt-in import is off; history is on; each platform word equals its own normalised key (NFKC, trim, lower case, as the service'skeyOf); both rules are evaluated, the regex throughRegExpand the predicate through the canonical CEL engine.packages/services/service-segmenter/src/search-term-object.integration.test.ts(5 cases) runs on a real stack:ObjectQLoverSqlDriver(better-sqlite3), the realSecurityPlugin, and the object taken from the bundle the plugin hands the manifest:modifyAllRecords, both withoutmanage_platform_settings, are refused create, update, delete and read (PERMISSION_DENIED, 403), and nothing lands;isolatedtenancy wall, another organization's administrator and that organization's system context both read the same row (red to 0 rows whentenant: falseis ablated);VALIDATION_FAILEDonenabled, HTTP 400), and the three shapes the cut keeps are stored;SegmenterEntryand changekeywordTermsas the contract says: 年假 made a stop word is dropped, and the disabled platform stop word 是否 comes back.packages/rest/src/import-search-term-csv.test.ts(3 cases, rework round 1) pins the import door throughPOST /api/v1/data/:object/import/jobswith the realSecurityPlugin, asimport-exchange-rate-csv.test.tsandimport-work-calendar-csv.test.tsdo:rule_violationonenabled) while the other rows land;PERMISSION_DENIEDand nothing is stored.deployment-level-no-tenant-column.test.ts: one row.git checkout HEAD:requiredPermissionsreds the write-gate case;userActions.importreds the affordance case.Acceptance notes
updated_at). A unique key on (term,knowledge_source) would not catch the empty-source case (NULLs are distinct) or case and NFKC variants.KEYWORD_SEPARATORSfrom@objectstack/corein the object package; that is left to the tuning-tools work.record_searchandbothcan be chosen (the ruled reserved field), and today a record withrecord_searchchanges nothing, as with every record until step 2.Verification
Two-minute check:
pnpm --filter @objectstack/service-segmenter exec vitest run src/search-term-object.integration.test.ts. Expected: 5 passed, including the 403 refusal for the member without the capability.Read first, by risk:
packages/platform-objects/src/system/sys-search-term.object.ts: the gate, the tenancy and the platform-word rule (the CELinlist built fromPLATFORM_SEARCH_WORDS).packages/services/service-segmenter/src/segmenter-service-plugin.ts: the registration, with no navigation.packages/services/service-segmenter/src/platform-words.ts: the list now read fromplatform-objects.L2: owed for
Clause-②: yesand one line ofpackages/spec/src/**. The record and its delta read are on this PR.Local gates (derived set, rework head a7f5fb6)
node scripts/pm/dispatch-gates.mjs --ranata7f5fb61: 120 derived, 120 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero: every command recorded exit 0). The original headaba78c9b6read the same.check:init-service-contract(the plugin now declaresoptionalDependencies: ['com.objectstack.engine.objectql']).check-plugin-teardown-shape --self-testfirst exited 3 (its fixture commit was outside the shallow clone); after fetching the commit it exits 0.service-segmenter/README.mdedit, to stay inside the claim's narrowed surface. The derived set is byte-identical, andcheck:published-readme-exports,check:doc-authoring,check:issue-citationsandcheck:published-filesrerun at exit 0.@objectstack/service-segmenter4 files / 36 tests passed, typecheck 0;@objectstack/platform-objects131 files / 2242 tests passed;@objectstack/rest444 files / 9148 passed, typecheck 0, typecheck 0;@objectstack/specplatform-object-names.test.ts14 passed;@objectstack/cliorganization-ownership-inventory.test.ts26 passed.packages/spec/src/system/constants/platform-object-names.ts(1 line),packages/cli/src/utils/organization-ownership-inventory.ts(1 row),packages/platform-objects/scripts/i18n-extract.config.ts(the extractor's object list),packages/services/service-segmenter/vitest.config.ts(source aliases;check:test-source-aliasexits 1 without them, naming the five workspace packages,@objectstack/typesamong them), andpackages/rest/src/import-search-term-csv.test.ts(the import-door pin; the route is RestServer's, and the claim was amended to include it).Generated by Claude Code