Skip to content

knowledge: Chinese questions are cut into real words by a dictionary segmenter, in one module both knowledge-turso and knowledge-pgvector use #38710

Description

@os-bob

Filing gate: ③ maintainer-directed (child of topic #38711, rows B8a-1 and B8a-2; moved from #38703 on 2026-11-30). Key words (maintainer, 2026-11-30): 「首要解决的应该是 用中文分词词典在应用层切词(Node 有现成的库),只留真正的词。」「立卡专题处理」 and, on tuning, 「但是管理员如果需要调优和维护呢」.

修订 2026-11-30 08:10Z:按维护者裁定(评论 7272436453)改正文。包改为 packages/services/service-segmenter(不放 plugins,不叫 analyzer);本期只做两层词条(平台默认 + 管理员「检索词条」),不在知识源上加词典字段;「检索词条」部署级、manage_platform_settings 可改。
Grading: area:ai · domain:server · p1 (the maintainer names it the first fix) · reach: every knowledge source searched in Chinese with a keyword leg, on both stores · evidence: measured on #38671 (132 real questions, 59,621 clauses); segmenter comparison below (local, 20 questions).

维护者速读

Problem

keywordTerms() exists twice with identical bodies: packages/plugins/knowledge-turso/src/sql.ts:432 and packages/plugins/knowledge-pgvector/src/sql.ts:184 (origin/main). For a run of Han characters, it takes every three-character window, then every two-character window, up to 16 terms. On #38671's 132 questions, every question hit the 16-term cap, mostly with three-character windows. The identifying words were dropped: 「我在集团干了 12 年了,一年有几天年假?」 yields 我在集, 在集团, 集团干 and so on, but not 「年假」.

Segmenter comparison (local, Node 22 with full ICU, 20 colloquial policy questions, 44 expected key terms)

Segmenter Key terms whole Cold start Memory Install
Intl.Segmenter('zh', {granularity:'word'}) 23 / 44 36 ms +14 MB none
@node-rs/jieba 2.0.4 (MIT, prebuilt native) 37 / 44 120 ms +53 MB ~12 MB
jieba-wasm 2.4.0 (MIT) 37 / 44 320 ms +83 MB ~16 MB
jieba + a 6-word supplementary dictionary 42 / 44
… + adjacent single characters joined into two-character words 43 / 44
  • Intl.Segmenter keeps 年假 whole but splits 脱密, 技改 and 超预算.
  • jieba's default dictionary splits 年假 (年|假) and 应急采购. Its HMM recovers 脱密 by guessing, but it also invents words such as 能付 and 黑后.
  • cutForSearch adds sub-words, for example 住宿 and 宿费. Cutting a question takes 2–13 µs in every mode.
  • After cutting, a question yields 3–5 terms, about 80% of them two characters. On Turso these go to content LIKE, because the trigram FTS serves three characters or more.

What

  1. A segmenter service, following the service-i18n precedent (AGENTS.md:737: a new package that registers a kernel service is @objectstack/service-<name> in packages/services/; the maintainer asked to avoid packages/plugins/):
    • Contract: packages/spec/src/contracts/segmenter-service.ts, with a purpose parameter (only knowledge implemented). Registered in ServiceSlotContracts, not in the CoreServiceName enum.
    • Implementation: @objectstack/service-segmenter in packages/services/service-segmenter. Not service-analyzer: it is one or two letters from service-analytics, and AnalyzerConfigSchema (spec/src/system/search-engine.zod.ts) already means something else.
    • The knowledge service depends on the contract only.
    • Today's sliding-window extraction moves to one copy in @objectstack/core in step 1; it answers when the service is absent or jieba fails to load, so no third copy appears.
    • @node-rs/jieba is an optional dependency, marked external in tsup, loaded once per process and read-only. "Not installed" and "failed to load" are logged apart; "service absent" is never cached at boot; which segmentation is in use is visible.
    • Before segmenting: NFKC normalization (full-width and half-width folded). By script: Han → jieba; other unspaced scripts → Intl.Segmenter fallback; English, numbers and document numbers as today. Japanese and Korean dedicated segmenters, and simplified/traditional conversion, wait for a customer (maintainer 07:47Z).
    • It does not go in @objectstack/core, and it is not under packages/services/service-knowledge/**, which service-knowledge: split knowledge-service.ts (5,411 lines, one class) into concern modules, move-only, so knowledge cards stop queueing on one file #38660 holds.
    • It answers the same shape keywordTerms() answers today, so each adapter's SQL is unchanged.
    • If a native segmenter is used, it is marked external in the tsup build.
  2. Segmentation of Han runs.
    • Use jieba (@node-rs/jieba; jieba-wasm as fallback) with the HMM off and a built-in supplementary dictionary.
    • Join adjacent single characters into two-character words, after single-character stop words are removed. Without that filter, noise such as 上干 and 要过 appears.
    • The fixture picks cut or cutForSearch by measured hit@3, and the card records which.
    • Kana and Hangul runs keep today's windowing. English words, numbers, document numbers and code terms are cut as today.
  3. Two layers of words (this card). The platform's defaults, then the administrator's entries; the later layer wins. The administrator's words are protected by a longest-match pass outside jieba, so they apply even when jieba is not loaded, and per-source words need no second jieba instance.
    • Platform: the segmenter dictionary, plus a supplementary Chinese dictionary and a general stop-word list (的, 了, 是否, 怎么, 什么 and the like) shipped in the package.
    • App (not this card): no dictionary, dictionaryFrom or stopWords on the knowledge source. The 知识源加「检索方式」和混合比例:只用向量 / 只用关键词 / 混合(可设比例),由应用元数据指定,单次检索可覆盖 #38692 ruling (comment 7270218011) keeps the tokenizer out of the knowledge-source schema. Policy titles and section names reach the dictionary by an administrator's import.
    • Administrator: the platform system object 检索词条, declared in packages/platform-objects and registered by the service; managedBy: 'system-data' (import, export and history are the platform's own); one set per deployment; editable only with manage_platform_settings. A reserved 用途 field (知识检索 / 记录搜索 / 两者), only 知识检索 implemented and the default.
      • Fields: the word; its kind (custom word or stop word, open to a synonym kind later); its scope (one knowledge source, or empty for every source in the environment); enabled; a note.
      • A record can disable or override a platform default.
      • Only administrators can edit. Record history keeps who changed what.
  4. Changes apply at once. Terms are cut only from the question, so a word change needs no index rebuild. The term list is cached per environment and refreshed when a record changes.
  5. Tuning tools for the administrator.
    • Split preview: type a question and see its terms, which were dropped as stop words, and how many passages each term matches.
    • Suggestions:
      • Terms most passages in a source hold, offered as stop words.
      • Words that questions keep splitting, offered as dictionary entries. These come from the search log, where one is kept.
    • Import and export of entries as CSV or Excel.

Acceptance

  • Fixture in the shared package's tests. Chinese colloquial questions over policy-clause passages, with deterministic vectors.
  • Both adapters import the shared package. The old Han windowing is removed from both. The kana and Hangul windowing stays.
  • Existing tests. English and code-term keyword tests pass unchanged. Chinese term-cut tests are rewritten to the new rules.
  • Turso before and after. Report the number of LIKE terms per question.
  • BrightRule question set (the 132 questions held by the reporter of 知识库混合检索在中文口语问题上比只用向量更差:关键词一路的滑动窗口切词 + 等权 RRF #38671, or the 15-question set). Re-run on both adapters, reporting hit@1, hit@3 and hit@8 before and after. The card names who runs it.
  • Administrator object.
    • A record added in the object changes the terms of the next search with no rebuild, pinned by test.
    • Split preview answers for a question.
  • Enterprise kit. The image (apps/objectos-ee/Dockerfile, node:22-slim, linux/amd64 glibc only, per deploy/README.md:42) installs the segmenter with no build step, and the offline bundle carries it. Full ICU in that image is not yet verified; check it if Intl.Segmenter is kept as a fallback.

Relation to other cards

为平台共用预留(维护者 2026-11-30:重心是知识检索,记录搜索是下一步)

本卡只服务知识检索,不扩大范围。只做三处不增加工作量、但能避免以后迁移的预留:

  • 包名和依赖(已定,7272436453):packages/services/service-segmenter,接口 packages/spec/src/contracts/segmenter-service.ts。不依赖知识服务,以后 objectql 的记录搜索(ADR-0061)也只依赖接口。
  • 检索词条对象放哪里(已定,7272383831):平台对象 packages/platform-objects,由 service-segmenter 注册。
  • 对象名和字段:对象叫「检索词条」,不叫「知识检索词条」;预留「用途」字段(知识检索 / 记录搜索 / 两者),本卡只实现「知识检索」,默认值也是它。
  • 切词接口带用途参数:本卡只实现知识检索的规则(去停用词、只留关键词)。记录搜索要的保守规则以后再加。

不在本卡:记录搜索接入切词、模糊匹配加索引(pg_trgm / FTS5 trigram)、相关度排序,属于 ADR-0061 第二层,留作下一步计划。

第二步要先定的设计点(Fable 评审 2026-11-30 提出)

Decisions needed

  1. Segmenter: — ruled @node-rs/jieba (7272241375). @node-rs/jieba (native, prebuilt; 37/44 key terms, 42/44 with the supplementary dictionary) or jieba-wasm (portable, slower, more memory). Recommended: @node-rs/jieba. The kit ships linux/amd64 glibc only, which its prebuilt binary covers.
  2. Administrator object now: — ruled 「这次就做」 (7272241375). Build the 检索词条 object and its tuning tools in this card, not later. The maintainer's question above points to now. Recommended: yes. The object is one object with a kind field, not separate custom-word and stop-word objects.
  3. App-level fields on the knowledge source — ruled not in this card (7272436453, superseding 7272241375 item 3): only platform defaults and the administrator's 检索词条.
  4. Package location and name — ruled packages/services/service-segmenter (7272436453).
  5. Who edits 检索词条 — ruled one set per deployment, manage_platform_settings (7272436453).

Generated by Claude Code

Activity

  1. added
    priority:p1
    pm:queue
    area:ai
    domain:server
    on Nov 30, 2026
  2. os-bob commented on Nov 30, 2026

    @os-bob
    ContributorAuthor

    Phase ruling (maintainer, 2026-11-30T07:00Z): 「明规条款只用语义检索是第一步,然后第二期要评测加上关键词的效果」


    Generated by Claude Code

  3. objectstack-fleet commented on Nov 30, 2026

    @objectstack-fleet
    Contributor

    triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ

    Triage: route · pm:queue → needs-user-decision · area:ai · domain:server · Feature · p1 as filed (topic #38703 row B8, the maintainer's 「首要解决」), not moved by triage · size L.
    Grade: area:ai · Feature (a new shared term-extraction package, a new administrator object 知识检索词条, and new knowledge-source keys), pre-authorised as a child of a topic the maintainer opened · evidence measured by the filer (#38671's 132 questions; a 20-question segmenter comparison).
    Rationale: the card's own "Decisions needed" are on the human floor: a new runtime third-party dependency (@node-rs/jieba or jieba-wasm, item 1) and a spec change (item 3), so it is not dispatchable until they are answered. The maintainer's phase ruling at 2026-11-30T07:00:00Z also places this card in phase 2, after the vector-only first version (#38692), and the 05:39Z pause on new knowledge work still stands on the topic. Whether the p1 stays once it is a phase-2 card is the maintainer's call on the topic; triage leaves it. The three decisions carry recommendations on the card; the 速读 and four-axis analysis follow decision-analysis.md through the topic's decision thread.

  4. added
    needs-user-decision
    and removed
    pm:queue
    on Nov 30, 2026
  5. objectstack-fleet commented on Nov 30, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-11-30T07:53Z · Rulings recorded — this card's three "Decisions needed", and its start. Put to the maintainer by seat repo:objectstack@baozhoutao (topic #38711's seat, post #38724) as a choice prompt in this account's fleet project; each answer verbatim.

    Thread-read: the card body and both comments (7271251336, 7271341893) were re-read for this record.

    1. Segmenter: 「@node-rs/jieba (Recommended)」 — @node-rs/jieba, HMM off, marked external in the tsup build; jieba-wasm stays only the card's named fallback.
    2. Administrator object now: 「这次就做 (Recommended)」 — the 知识检索词条 object is built in B8a-1: one object with a kind field, scoped to one knowledge source or the whole environment. The tuning tools (split preview, suggestions, import and export) may come after and do not block E1.
    3. App-level knowledge-source fields (dictionary, dictionaryFrom, stopWords): 「加 (Recommended)」 — added, in B8a-2.
    4. Start: on topic 专题:中文关键词检索质量——关键词一路能找对中文条款,管理员可调,两个知识适配器通用 #38711 (ruling comment there, this session) the maintainer answered 「E0 和 B8a-1 都开」. The 2026-11-30 pause no longer holds B8a-1. B8a-2 keeps the pause and the topic's Blocked-by order: 知识源加「检索方式」和混合比例:只用向量 / 只用关键词 / 混合(可设比例),由应用元数据指定,单次检索可覆盖 #38692 phase 1a, PRs fix(knowledge-turso): a scoped search reads its passage table once a statement; a request past its bound answers TIMEOUT #38693 and perf(knowledge-turso): compute the keyword leg once a search; send a scope too narrow for the approximate pass straight to the exact scan #38697 on the Turso side, and 专题:私有部署企业版(PostgreSQL + pgvector)知识检索 10 人同时提问不超时;Turso 只保基本能力 #38703's B3/B4 on the pgvector side.

    Governing text: this card's 「Decisions needed」 items 1–3 and its 「What」 §1 (the embedder precedent: the contract in packages/spec/src/contracts/, the implementation as a kind-named plugin under AGENTS.md's package-naming rule).

    State: needs-user-decision → pm:queue. B8a-1 is this card's next claim; its PR carries Refs #38710 (step 1), and the card returns to the queue for step 2.

  6. added
    pm:queue
    and removed
    needs-user-decision
    on Nov 30, 2026
  7. 19 remaining items

  8. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-12-01T04:48Z · Claim · #38710 step 1, PR 2 of 2 (topic #38711 row B8a-1): the 检索词条 platform object, registered by @objectstack/service-segmenter. PR 1 (#38744) merged at d7d46059. Rulings: 7272436453, 7272455751, 7272462484, and the seat's platform-word cut.

    Claim: PM loop round 1
    Session: session_01RKKVngFfp7HBk6JUUr5vfN
    Account: baozhoutao
    Branch: claude/issue-38710-search-term-object
    Worktree: objectstack-issue-38710-pr2
    Domain: domain:server
    Seat: repo:objectstack@baozhoutao
    File surface: packages/platform-objects/src/system/sys-search-term.object.ts (the name is the dev's by convention), packages/platform-objects/src/system/index.ts, packages/platform-objects/src/deployment-level-no-tenant-column.test.ts, packages/platform-objects/src/apps/translations/** (reason: regenerated by pnpm i18n:extract), scripts/platform-object-tenancy-census.json (reason: regenerated), packages/services/service-segmenter/** (reason: object registration and the new platform-objects dependency), pnpm-lock.yaml; ⛔ both knowledge adapters, packages/services/service-knowledge/**, packages/spec/src/** without a reported need (stop on breach; explain in the report)
    Container & model: M, mode:cloud, model: default (dispatch-gates --tier: "Model tier — no path-derived mandate"), effort: high
    Clause-②: yes
    Metadata-protocol: none
    Responsibility: n/a — not a defect card
    Thread-read: 7301021798
    Premise: holds
    Serial constraints cleared: check-handover.mjs --inflight on this surface (origin/main 1de73c0) reads no overlap. The one unread surface (#38415, a pm-dispatch skill reading) was read by hand: it is unrelated. #36496, which held the translations serial line, has closed.

    Premise reading (read-only subagent and seat, origin/main 1de73c0):

    • Precedent: sys_knowledge_sync_state (tenant: false, requiredPermissions: ['manage_platform_settings'], registered via manifest.register).
    • system-data gives every action except Import by default, so enable settings are owed.
    • service-segmenter does not yet depend on platform-objects.
    • Size: generated translations run about 100–150 lines per locale (the feat(service-knowledge): each source's sync state is one durable record, the same on every node #38307 reference). This PR therefore takes the card's total past 3000, so it is Tier H and goes to a human approval after ACCEPT and L2.

    Dispatch order: the opening message of a mode:cloud session.

    • Order sections: rulings verbatim, mechanism assumptions, optional route, the four-axis block at 39064f6.
    • Suggested route: no Setup navigation until step 2 wires the read path (no dead admin surface), and refuse the cut disable-a-platform-word record if that is reachable.
    • The PR carries Refs #38710 (step 1, PR 2 of 2).
  9. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 1, 2026
  10. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-12-01T08:40Z · Claim amendment to 7301129774 (#38710 step 1 PR 2). The surface is narrowed so E0 (#38843) can take packages/services/service-segmenter/bench/** without overlapping. The dev session for this claim is session_01RKKVnitBaUHnfQ8KzxmKkv, created at 08:39Z; the first attempt at the claim was lost to a worker restart.

    Claim: PM loop round 1 (amendment of 7301129774)
    Session: session_01RKKVngFfp7HBk6JUUr5vfN
    Account: baozhoutao
    Branch: claude/issue-38710-search-term-object
    Worktree: objectstack-issue-38710-pr2
    Domain: domain:server
    Seat: repo:objectstack@baozhoutao
    File surface: packages/platform-objects/src/system/sys-search-term.object.ts, packages/platform-objects/src/system/index.ts, packages/platform-objects/src/deployment-level-no-tenant-column.test.ts, packages/platform-objects/src/apps/translations/** (reason: regenerated), scripts/platform-object-tenancy-census.json (reason: regenerated), packages/services/service-segmenter/package.json, packages/services/service-segmenter/src/** (reason: object registration), pnpm-lock.yaml; ⛔ packages/services/service-segmenter/bench/** (E0, #38843), both knowledge adapters, packages/services/service-knowledge/** (stop on breach; explain in the report)
    Container & model: M, mode:cloud, model: default (dispatch-gates --tier: "Model tier — no path-derived mandate"), effort: high
    Clause-②: yes
    Metadata-protocol: none
    Thread-read: 7301129774

  11. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVnitBaUHnfQ8KzxmKkv
    os-dev-report

    {
      "issue": 38710,
      "status": "done",
      "branch": "claude/issue-38710-search-term-object",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38891",
      "session": "session_01RKKVnitBaUHnfQ8KzxmKkv",
      "premise_still_valid": true,
      "summary": "Step 1, PR 2 of 2. platform-objects declares sys_search_term (检索词条): fields term, kind (word|stop_word), purpose (knowledge|record_search|both, default knowledge), knowledge_source, enabled and note. managedBy system-data with userActions.import, record history on, systemFields.tenant false, and requiredPermissions ['manage_platform_settings'] (the flat form gates every operation, writes included; pinned on a real stack). term/kind/purpose/enabled map 1:1 onto the contract's SegmenterEntry. The contract has no scope member ('carries the entries, never where they are stored'), so knowledge_source, a text field by the sys_knowledge_sync_state.source precedent, is for step 2's reader to filter on. The seat's platform-word cut is enforced: a cross-field CEL rule refuses kind word + enabled false for a platform word. That was reachable without an import cycle only by moving the 24 platform words into platform-objects as PLATFORM_SEARCH_WORDS; service-segmenter's PLATFORM_WORDS now is that list (open_questions[0]). SegmenterServicePlugin registers the object on the manifest service with no Setup navigation (nothing reads a record until step 2), says so at info without a manifest service, and declares optionalDependencies on ObjectQL. Measured: Clause-② yes, widening (new exports SysSearchTerm, PLATFORM_SEARCH_WORDS, SEARCH_TERM_BUNDLE_ID, a new runtime object; nothing removed). Metadata-protocol none (no authorable key, value or metadata type changes; precedent #38307 declared the same for a new platform object).",
      "tests": "Head 7033962b7 (code head aba78c9b6; the last commit reverts this PR's README edit only). service-segmenter: 4 files / 36 tests passed, typecheck 0. Includes search-term-object.integration.test.ts, 5 cases on a real ObjectQL + SqlDriver (better-sqlite3) + SecurityPlugin with the object taken from the plugin's manifest bundle: registered with no navigation; a member with full CRUD but no capability is refused insert, update and find with PERMISSION_DENIED/403 and nothing lands; the capability holder creates and updates, no organization stamped, another org's admin reads the row; disabling a platform word is refused on insert and update (VALIDATION_FAILED on field enabled) while the three kept shapes store; records map onto SegmenterEntry and change keywordTerms (年假 as a stop word dropped, disabled 是否 back). platform-objects: 131 files / 2241 tests passed, typecheck 0 (sys-search-term.object.test.ts 16 cases, both rules evaluated, the regex via RegExp and the predicate via celEngine). spec platform-object-names.test.ts 14 passed (measured red by name first). cli organization-ownership-inventory.test.ts 26 passed (measured red by name first). Ablations on committed heads, restored with git checkout HEAD, porcelain clean: dropping requiredPermissions reds the write-gate case; dropping the platform-word rule reds the refusal case (only that case, after the mapping case was decoupled into its own stack); dropping userActions.import reds the affordance case.",
      "gates": "Local, head aba78c9b6: node scripts/pm/dispatch-gates.mjs --ran gives 120 derived, 120 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero: all 120 recorded exit 0). Earlier, fixed: check:init-service-contract exit 1 (fixed by optionalDependencies); check-plugin-teardown-shape --self-test exit 3 (shallow clone; the fixture commit was fetched, then 0). Head 7033962b7 (README revert only): --commands set byte-identical; check:published-readme-exports, check:doc-authoring, check:issue-citations and check:published-files 0. check:i18n 0 after the bundles were regenerated. CI check-runs on 7033962b7 were in_progress at report time; the seat reads them.",
      "line_budget": "39 files, +1245 / -18 = 1263 changed lines against origin/main (PR reads additions 1245, deletions 18). Card total with PR #38744's 1891: 3154, over 3000, so a human approval, as the order expected. Of these, translations are 20 files and about 560 lines.",
      "deviations": [
        "Files beyond the claimed surface, each required by a gate or test and measured red first where it is a test: packages/spec/src/system/constants/platform-object-names.ts, 1 line (platform-object-names.test.ts reds by name; a measured spec need, reported here; precedent #38307); packages/cli/src/utils/organization-ownership-inventory.ts, 1 column-drop row (organization-ownership-inventory.test.ts reds by name); packages/platform-objects/scripts/i18n-extract.config.ts (the extractor's object list; without it the bundles cannot be generated); packages/services/service-segmenter/vitest.config.ts (source aliases, required by check:test-source-alias; outside the amended surface 7305636030 and outside bench/**); packages/platform-objects/src/system/sys-search-term.object.test.ts and the changeset (implicit).",
        "packages/services/service-segmenter/README.md was edited and then reverted to origin/main after the claim amendment 7305636030 narrowed the surface to package.json and src/**. Nothing under bench/** was touched.",
        "The 24 platform words moved from service-segmenter/src/platform-words.ts to platform-objects (PLATFORM_SEARCH_WORDS); PLATFORM_WORDS is still exported, same contents, same reference.",
        "The first WIP commit carried a mistyped Claude-Session id and was amended and pushed once with --force-with-lease=BRANCH:991b3e55 (all five unshared criteria held: claude/issue-* branch, made by this worktree, no other pusher, no PR yet, lease spelled out).",
        "Two gate chunks overran the 600 s foreground limit and the harness moved them to the background. They ran to completion and were awaited with until-loop monitors; every monitor has ended.",
        "Commits carry the model-free trailer pair (AGENTS.md), not the harness's model-named Co-Authored-By line.",
        "The shared cloud checkout /home/user/objectstack was detached at 81aacd34 and its local copy of the branch (equal to origin/main) was deleted so dev-worktree.sh could create the branch in ../objectstack-issue-38710-pr2; no commits were lost."
      ],
      "files_changed": [
        ".changeset/38710-search-term-object.md",
        "packages/cli/src/utils/organization-ownership-inventory.ts",
        "packages/platform-objects/scripts/i18n-extract.config.ts",
        "packages/platform-objects/src/apps/translations/ar.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/ar.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/bundle-ownership.test.ts",
        "packages/platform-objects/src/apps/translations/de.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/en.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/es-ES.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/fr.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/ja-JP.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/ko.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/ko.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/pt-BR.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/ru.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/ru.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/zh-CN.source-hashes.generated.ts",
        "packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts",
        "packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.generated.ts",
        "packages/platform-objects/src/deployment-level-no-tenant-column.test.ts",
        "packages/platform-objects/src/system/index.ts",
        "packages/platform-objects/src/system/sys-search-term.object.test.ts",
        "packages/platform-objects/src/system/sys-search-term.object.ts",
        "packages/services/service-segmenter/package.json",
        "packages/services/service-segmenter/src/index.ts",
        "packages/services/service-segmenter/src/platform-words.ts",
        "packages/services/service-segmenter/src/search-term-object.integration.test.ts",
        "packages/services/service-segmenter/src/segmenter-service-plugin.test.ts",
        "packages/services/service-segmenter/src/segmenter-service-plugin.ts",
        "packages/services/service-segmenter/vitest.config.ts",
        "packages/spec/src/system/constants/platform-object-names.ts",
        "pnpm-lock.yaml",
        "scripts/platform-object-tenancy-census.json"
      ],
      "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0: no GitHub MCP calls; reads were gh api REST GETs",
      "api_writes": "2 relay strokes: fleet-write pr_create (run 46624354701: draft POST pulls + POST issues/38891/assignees, read back identical, 9567 bytes) and this comment (POST issues/38710/comments via post-stamped). git push is not a REST write.",
      "classifier_refusals": [],
      "open_questions": [
        {
          "question": "Where should the platform word list live so that sys_search_term can refuse 'disable a platform word' (the seat's cut)? This PR moved it into platform-objects as PLATFORM_SEARCH_WORDS; service-segmenter reads it from there.",
          "options": [
            "A (done): the list lives in platform-objects; the object declares the CEL rule with a translated message; the service re-exports it as PLATFORM_WORDS. One list, a loud refusal at every write door (form, API, import). Cost: the segmenter's dictionary data lives in the object package.",
            "B: keep the list in service-segmenter and add the rule to the object at registration. The declared object then differs from the registered one, the i18n extractor never sees the message (English in every locale), and the registered object carries a rule no declaration shows.",
            "C: drop the refusal and defer it to step 2's tuning UI (platform words shown read-only). Nothing refuses the meaningless record until then."
          ],
          "recommendation": "A. Business need: the cut makes such a record meaningless, and the object is the only write door today. Long-term: one list and one declared rule, contract-first, no registration-time patching. AI-error: a strict refusal at write time beats a record that is stored and silently does nothing. Scope: zero new gates and 24 words moved, with no new surface. B fails on the AI-error and long-term axes; C leaves a declared-but-silent capability until step 2."
        },
        {
          "question": "Step 2's reader must order entries for 'a later entry wins' (contract). No uniqueness is enforced on (term, knowledge_source): a unique index misses the empty-source case (NULLs are distinct) and case/NFKC variants.",
          "options": [
            "A: step 2 orders the records it reads (e.g. by updated_at ascending), so the latest edit wins",
            "B: add a uniqueness rule now (a normalised key column plus a unique index), more surface before any reader exists"
          ],
          "recommendation": "A: decide it with the read path, where the order is consumed. Startup-stage axis: no new surface without a reader. It is recorded in the PR's Acceptance notes."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: step 2 of #38710 · noted, not filed: a term holding a separator other than a single space (R&D, 《员工手册》) is stored but never matched (contract text); a write-time refusal needs KEYWORD_SEPARATORS from @objectstack/core inside the object package. In the PR's Acceptance notes."
      ],
      "l2": "owed: Clause-② yes and one line under packages/spec/src/**; no review seat was knocked"
    }
  12. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-12-01T16:38Z · Rework hand-over on the same claim (7301129774, amended 7305636030): no change of seat or claim.

    • REWORK round 1 for PR feat(platform-objects,service-segmenter): sys_search_term, the administrator's search-word object (step 1, PR 2 of 2) #38891 (7311679425) could not reach the cloud dev session session_01RKKVnitBaUHnfQ8KzxmKkv. The cross-session message was cut off twice by this seat's worker restarts; that session is idle with nothing unpushed.
    • The rework is taken by an in-seat os-dev subagent (mode:subagent) on the same branch claude/issue-38710-search-term-object from head 7033962b. Container & model: M, mode:subagent, model: default (dispatch-gates --tier: "Model tier — no path-derived mandate"), effort: high.
    • Items P1–P4 and the nits are as listed on the PR. The step-2 items there stay with step 2.
  13. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN
    os-dev-report

    2026-12-01T18:01Z · REWORK round 1 · new head a7f5fb61 · PR #38891

    {
      "issue": 38710,
      "status": "done",
      "branch": "claude/issue-38710-search-term-object",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38891",
      "session": "session_01RKKVngFfp7HBk6JUUr5vfN",
      "premise_still_valid": true,
      "round": "REWORK round 1 (list 7311679425), taken over from session_01RKKVnitBaUHnfQ8KzxmKkv on the same branch from 7033962b, history not rewritten; new head a7f5fb61497b6188e2f48a0e87122d80f4ce0f89",
      "rework_items": {
        "P1": "fixed. One new file, packages/rest/src/import-search-term-csv.test.ts (the precedents' pattern plus the real SecurityPlugin), through POST /api/v1/data/:object/import/jobs: a manage_platform_settings holder lands 3 rows (job succeeded, created 3, organization_id undefined on each); a file whose row 1 disables 年假 gets row 1 refused alone (ok false, field enabled, code rule_violation, the runner's per-row shape the work-calendar precedent asserts) while rows 2-3 land (created 2, errors 1); a full-CRUD member without the capability gets a failed job with every row PERMISSION_DENIED and nothing stored. Placed in rest, not service-segmenter: see deviations[0]. The sentence at sys-search-term.object.test.ts:11-13 now names both homes. The changeset needed no narrowing.",
        "P2": "fixed. Measured first: the old harness ran with no tenancy wall (posture single), so the case passed whether or not the object had an organization column; the capability exemption was not the cause. The integration boot now registers the tenancy service at posture isolated, and the case reads the org_a row as the org_b administrator and as SYS_CTX with tenantId org_b. Under the wall both callers are scoped: with tenant false ablated, each reads 0 rows (ablations R3b and R3c below).",
        "P3": "fixed. Both refusals (insert and update) also assert resolveThrownHttpError(refusal) matches status 400, code VALIDATION_FAILED. This adds @objectstack/types to service-segmenter devDependencies (lockfile +3 lines) and one alias line in vitest.config.ts.",
        "P4": "cited. node scripts/check-test-source-alias.mjs with packages/services/service-segmenter/vitest.config.ts restored on disk to origin/main's blob 6a4f24f7 exits 1: 'check-test-source-alias FAILED ... packages/services/service-segmenter (@objectstack/service-segmenter): tests import 5 workspace package(s) that resolve to dist/ with no source alias: @objectstack/driver-sql, @objectstack/objectql, @objectstack/platform-objects, @objectstack/plugin-security, @objectstack/types' (types is this round's; the other four are the original PR's). Restored with git checkout HEAD: blob e0dc53f1 equals HEAD's, git diff HEAD empty. At HEAD the gate exits 0 (in the --ran list).",
        "nit_delete_modifyAll": "fixed. The refusal case now runs insert, update, delete and find as both the member and a MODIFY_ALL_SET caller (viewAllRecords and modifyAllRecords on every object, no capability); each is refused PERMISSION_DENIED/403, and only the seeded row stands.",
        "nit_platform_word_key": "fixed. sys-search-term.object.test.ts pins that each PLATFORM_SEARCH_WORDS entry equals its own key, spelled as the service's keyOf (NFKC, trim, character-wise lower case; keyOf is module-private in segmenter-service.ts).",
        "nit_field_trackHistory": "dropped. The six field-level trackHistory: true lines are gone from sys-search-term.object.ts (spec: on these field types true changes nothing), and so is their test pin. enable.trackHistory stays and is still pinned. The PR body still credits 'each field's trackHistory' under What changes: the seat refreshes the body.",
        "step_2_items": "not in this PR, per the order"
      },
      "summary": "Rework round 1 on PR #38891. P1: the import door is pinned on a real stack in packages/rest (holder lands rows, a platform-word row is refused alone, a member gets every row PERMISSION_DENIED). P2: the cross-organization case is now a tenancy pin. The harness boots under the isolated wall, and the org_b administrator and the org_b system context read the org_a row only because there is no organization column (measured red with tenant false ablated). P3: both refusals assert 400 VALIDATION_FAILED through resolveThrownHttpError. P4 is cited under rework_items. All three nits are carried. Observation, not a finding: with userActions.import removed, the generic import door still imports (ablation R4, 3/3 green). The spec declares userActions as the UI's affordances, so the door is gated by the capability, which the member pin holds.",
      "tests": "Head a7f5fb61. @objectstack/service-segmenter: pnpm test 4 files / 36 passed; typecheck exit 0 (tsc --listFiles includes the 4 test files). @objectstack/platform-objects: pnpm test 131 files / 2242 passed (2241 before, plus the key pin); typecheck exit 0. @objectstack/rest: pnpm test (project local) 444 files / 9148 passed / 351 skipped; typecheck exit 0, check:test-typecheck 0 errors. New file alone: 3 passed. Ablations, each through scripts/ablation-replace.mjs (anchor hit 1, blob changed) on committed heads, restored to the HEAD blob with git diff HEAD empty. The four object ablations rebuilt platform-objects and proved a planted marker present in dist (ablation-dist-preflight, 4 built files), then absent after the restore rebuild (0 of 66). R1, requiredPermissions dropped: rest 'refuses every row to a caller without the capability' red (job succeeded, created 2), and segmenter refusal case red (insert resolved); every other case green. R2, platform-word rule neutralised: rest 'refuses a line that disables a platform word' red, and segmenter refusal case red; others green. R3, tenant false dropped: rest landing case red (organization_id org_default), plus two segmenter cases. R3b, tenant false dropped and the earlier organization_id assertion removed, segmenter only: the cross-org case reds at the read, 'org_b administrator: expected [] to have a length of 1 but got +0'. R3c, as R3b with the administrator removed from the loop: 'org_b system: expected [] to have a length of 1 but got +0'. R5, upper-case 'OA' planted in PLATFORM_SEARCH_WORDS: only the key pin reds ('OA: expected oa to be OA'), 16 others green. R4 (observation), userActions.import dropped, marker in dist: rest 3/3 and segmenter 5/5 stay green.",
      "gates": "Local, head a7f5fb61: node scripts/pm/dispatch-gates.mjs --ran (repo objectstack-ai/objectstack) gives 'Run reconciliation: 120 derived, 120 run, 0 NOT-MEASURED, 0 UNRUN', a derived zero. All 120 recorded exit 0. Four records were replaced after their prerequisite was met, each first exit 3. check-plugin-teardown-shape --self-test: the fixture commit 621a4876 sat outside the shallow clone; it was fetched into an own ref (deleted after), and the rerun exits 0 with 48 cases. check:i18n, check:i18n-walk-parity and check:i18n-coverage needed the built CLI (and, for coverage, the examples); check:dual-build-cjs-loads needed every dist. The whole workspace was built (turbo, docs excluded: 124 tasks), and the reruns exit 0. dispatch-gates warns STALE TREE: the branch is 41 commits behind origin/main, and the order says not to merge. CI on a7f5fb61, read once with no waiting: 61 success, 11 skipped, 2 failure. The failures are 'Test Core (11/12)' and its roll-up 'Test Core', both from one test: plugin-approvals src/flow-route.integration.test.ts, '[#38838] a fan-out to two approval steps is refused at publish', 'Test timed out in 5000ms' inside boot(). The same file run locally on a7f5fb61: 20/20 passed. plugin-approvals has 0 references to sys_search_term or service-segmenter. Read as a CI timeout, not caused by this diff; a rerun is the seat's call.",
      "line_budget": "PR vs merge base 81aacd34: 40 files, +1507 / -18 = 1525 changed lines (PR API: additions 1507, deletions 18, 40 files). This round vs 7033962b: 7 files, +309 / -47. Card total with PR #38744's 1891: 3416, over 3000, so it still needs a human approval, as the claim expected.",
      "deviations": [
        "P1's pin is ONE new file outside the amended surface: packages/rest/src/import-search-term-csv.test.ts. Reason: the route is RestServer's (packages/rest), and service-segmenter's test stack (ObjectQL, SqlDriver, SecurityPlugin) cannot reach it. Making it reach would take three new devDependencies (@objectstack/rest, @objectstack/metadata-protocol, @objectstack/metadata-core) plus source aliases in service-segmenter's vitest.config.ts for them and the surface their source imports (check:test-source-alias walks into aliased deps). That is a larger edit, to a file that is also outside the surface. rest already depends on all of them, and its unaliased-import registry entry already lists every package the new file imports, so no gate file changes. Both precedents live there too.",
        "packages/services/service-segmenter/vitest.config.ts: +2 lines (an @objectstack/types alias and its comment). It is outside the amended surface, and the PR already carries it as a deviation. It is required by check:test-source-alias for the P3 devDependency (measured exit 1 naming @objectstack/types; see P4).",
        "packages/platform-objects/src/system/sys-search-term.object.test.ts edited (the P2/P1 header sentence, the key pin, the field trackHistory pin dropped). The claim's file list names the object file, not its test; the original report counted the test as implicit.",
        "No merge of origin/main at takeover. os-dev.md rule 1 says a resumed branch merges main first; the order said not to merge without a conflict or a main-caused red. The PR read mergeable/clean, and the order was followed. Base pinned at 7033962b.",
        "Commits carry the model-free trailer pair (AGENTS.md), not the harness's model-named Co-Authored-By line.",
        "A throwaway probe file (service-segmenter src/zz-probe-tenancy.test.ts) measured which contexts the tenancy wall scopes. It was deleted before any commit and never pushed."
      ],
      "files_changed": [
        "packages/platform-objects/src/system/sys-search-term.object.ts",
        "packages/platform-objects/src/system/sys-search-term.object.test.ts",
        "packages/rest/src/import-search-term-csv.test.ts",
        "packages/services/service-segmenter/package.json",
        "packages/services/service-segmenter/src/search-term-object.integration.test.ts",
        "packages/services/service-segmenter/vitest.config.ts",
        "pnpm-lock.yaml"
      ],
      "files_changed_scope": "this round only (7033962b..a7f5fb61); the PR's full list is 40 paths, the original report's 39 plus the new rest test",
      "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0: no GitHub MCP calls; reads were gh api REST GETs",
      "api_writes": "1: this comment, POST issues/38710/comments via scripts/pm/post-stamped.mjs. git push is not a REST write. No PR body edit, no label write, no review knock.",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: the generic async import door does not read userActions.import. With the opt-in removed, a capability holder's CSV still imports (ablation R4). The spec declares userActions as 'the generic CRUD affordances that the UI surfaces', so this is per contract. The door's gate is the object's requiredPermissions, pinned by the member case.",
        "carrier: PM seat · noted, not filed: Test Core (11/12) on a7f5fb61 is red with a 5000 ms timeout in plugin-approvals flow-route.integration.test.ts boot(). It passes 20/20 locally on the same head and does not touch this diff's surface."
      ]
    }
  14. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-12-01T18:05Z · Claim amendment to 7301129774 (after 7305636030): adds ONE file, from REWORK round 1 item P1 (the import-door pin). No other change to the claim.

    Claim: PM loop round 1 (amendment of 7301129774)
    Session: session_01RKKVngFfp7HBk6JUUr5vfN
    Account: baozhoutao
    Branch: claude/issue-38710-search-term-object
    Seat: repo:objectstack@baozhoutao
    File surface: as amended in 7305636030, plus packages/rest/src/import-search-term-csv.test.ts (reason: the async import route is RestServer's. Both import pins for system-data objects with import, import-exchange-rate-csv.test.ts and import-work-calendar-csv.test.ts, live there, and service-segmenter's test stack cannot reach the route without three new devDependencies). The rework's two in-package test edits (sys-search-term.object.test.ts, search-term-object.integration.test.ts) are implicit, beside their sources.
    Thread-read: 7320278565

  15. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-12-01T18:28Z · Step 2 carry-forward (from the L1 and L2 reviews of PR #38891, 7311679425 and 7320456291). These are acceptance items for step 2's claim, not for PR 2:

    1. Entry ordering for "a later entry wins".
      • Unscoped entries come first, then the source's own.
      • Ties go by created_at, then id.
      • ⛔ Not by updated_at: under the contract, a later disabled entry withdraws an earlier one of the same kind, so disabling one duplicate would silently withdraw its enabled twin.
    2. A normalised unique key per term and source. Normalise as NFKC, trim, lower case. Store an empty source as ''. Land the key before the Setup entry, while the table is still empty; later it needs a dedupe migration.
    3. knowledge_source handling. A typo, or a source that has been renamed, silently never applies: surface or refuse it. NULL and '' both mean every source.
    4. enabled is passed as a strict boolean. The service tests === false.
    5. One landing. The mount, the reader and the Setup entry land together, so no administrator meets a screen that does nothing.
    6. Export the service's keyOf, so that the platform-word key pin in sys-search-term.object.test.ts cannot drift.
    7. The README. Restore the SEARCH_TERM_BUNDLE_ID row in service-segmenter's README Exports table.
    8. userActions.import gates only the console entry, not the import door (per spec). The door is gated by requiredPermissions, which is already pinned.
  16. objectstack-fleet commented on Dec 1, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack@baozhoutao · baozhoutao · session_01RKKVngFfp7HBk6JUUr5vfN

    2026-12-01T23:37Z · Step 1 complete; claim released; the card is held for step 2. PR #38891 merged as 387224383c. With PR #38744 (d7d46059), step 1 is done.

    Release: claim 7301129774 and its amendments (7305636030, 7320393617). Landed in step 1: the segmenter contract and @objectstack/service-segmenter (#38744), the single keywordTerms() copy in core (#38744), and the 检索词条 object sys_search_term (#38891). Remaining: step 2. Both adapters read the service and drop their two keywordTerms() copies, the mount, the reader and the Setup entry land together, and the eight acceptance items in the carry-forward comment on this card apply.
    Resume-from: none

    Why the card goes to pm:on-hold:

    Restart-when: closed #38692

  17. added
    pm:on-hold
    and removed
    pm:dispatched
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:aidomain:serverpm:on-holdpriority:p1

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions