Skip to content

fix(knowledge): the keyword leg keeps the letters and numbers of the CJK symbols block inside a term - #38566

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-38411-cjk-symbol-block-letters
Nov 29, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-38411-cjk-symbol-block-letters

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread
Part of #38411. This PR takes item 4 of the card's remaining list (the U+3000–303F nit from the review of the previous slice). Items 2 and 3 (the BrightRule model-graded eval and the larger per-leg pool) stay open on the card.
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:知识检索里,中日文提问中的「〻」、假名重复符「〱」到「〵」、「〼」和苏州码子「〡」到「〩」「〸」到「〺」不再把词切断,比如「人〻」现在能被关键词一路匹配到;其他提问的切词结果不变。
  • 为什么做:知识平台专题,上一轮中日韩关键词修复审核时留下的小尾巴,两种存储(本地 libSQL、PostgreSQL)一起改。
  • 出错会怎样:最坏情况是含这些罕见符号的提问关键词排序变差,向量一路照常作答;不改索引、不需重建,可直接撤回。
  • 要你做什么:无。

What changes

  • keywordTerms in packages/plugins/knowledge-turso/src/sql.ts and packages/plugins/knowledge-pgvector/src/sql.ts split a query at every member of the CJK symbols block except the three marks 々 〆 〇 (class U+3000–3004, U+3008–303F). That block also holds 19 more letters and numbers: the Hangzhou numerals U+3021–3029 and U+3038–303A, the kana repeat marks U+3031–3035, U+303B (the vertical iteration mark) and U+303C. Each of them cut the term it sat in, and a run of one character is dropped, so 「人〻」 gave no term.
  • The split class now takes only the members of the block that are neither a letter nor a number: U+3000–3004, U+3008–3020, U+302A–3030, U+3036–3037, U+303D–303F. Everything else in the class is unchanged.
  • The class moves out of the split call into an exported constant KEYWORD_SEPARATORS, byte-identical in both files, so the tests can read it. sql.ts is not re-exported by either package's entry (index.ts names its exports), so the published surface does not change.
  • The UNSEGMENTED_RUN doc comment said the split takes the rest of the block as punctuation. That is no longer true, so the comment now says only why the three marks are named (〆 belongs to no script).
  • Changeset .changeset/38411-cjk-symbol-block-letters.md: patch on both store packages.

Tests

The same two new cases in each store, beside the existing CJK cases (pgvector keyword-terms.test.ts; turso acceptance.test.ts, which runs on :memory: and on a file: URL):

  • Block probe, from Unicode properties. For each code point of U+3000–303F, it checks whether KEYWORD_SEPARATORS splits a, then the code point, then b. The code points that split must equal those that fail the Unicode letter-or-number property test in the runtime. The test computes this from the runtime's Unicode tables, with no hand list. Each letter or number, three in a row, must yield a term. Behaviour pins: 「人〻」 gives 人〻, 「第〢〣号」 gives 第〢〣, 〢〣号, 第〢, 〢〣, 〣号, and 「出差、住宿。「审批」」 gives 出差, 住宿, 审批.
  • Parity. Each store pins KEYWORD_SEPARATORS against the same regex literal, so the two classes are pinned to one text.
Local runs at 082af27
  • pnpm --filter @objectstack/knowledge-pgvector test (no database): Test Files 5 passed, 8 skipped (live files); Tests 24 passed, 93 skipped.
  • pnpm --filter @objectstack/knowledge-pgvector test on a local PostgreSQL 16.15 with pgvector, OS_TEST_POSTGRES_URL set and OS_EXPECT_LIVE_DIALECT_MATRIX=1: Test Files 13 passed (13); Tests 117 passed (117). The cluster was stopped and removed afterwards.
  • pnpm --filter @objectstack/knowledge-turso test (libSQL :memory: and a local file: database): Test Files 4 passed (4); Tests 290 passed (290).
  • pnpm --filter @objectstack/knowledge-pgvector typecheck and the same for turso: exit 0, with check:test-typecheck OK for both.
  • Lock verdict on each run: VERDICT command-exit 0.
Ablation: the old class restored, the new pins red

scripts/ablation-replace.mjs replaced the range U+3008–3020, U+302A–3030, U+3036–3037, U+303D–303F with the old U+3008–303F, one store at a time (anchor 1 → 0; blob moved), then restored (blob equals HEAD, git diff HEAD empty):

  • pgvector keyword-terms.test.ts: 2 failed, 6 passed. Failing: the block probe (61 separators against the 42 the Unicode tables name) and the parity pin.
  • turso acceptance.test.ts: 4 failed, 134 passed. Failing: the same two cases, on :memory: and on file:.

Acceptance notes

  • Count. The card says 18 code points. The runtime's Unicode tables count 19 letters and numbers in U+3000–303F beyond 々 〆 〇: 9 + 3 Hangzhou numerals, 5 kana repeat marks, U+303B and U+303C. The ablation shows the same count (61 − 42).
  • Tone marks. U+302A–302F are combining tone marks, not letters or numbers, so they still split, as the fix shape names.
  • The kana repeat marks and U+303C have no script (Common). The split no longer cuts at them, but UNSEGMENTED_RUN does not name them, so they are not pieced into the run beside them. 「いろ〳〵」 gives 〳〵 (a word) and いろ (a piece); before it gave いろ. Adding them to the run is outside this PR's file surface (the split class only). This is rare in a typed question, so it is not filed.
  • Parity is pinned twice, not compared directly. A pin that reads the other package's sql.ts would need a declaration in scripts/cross-package-test-inputs.mjs and in turbo.json, and both are outside the claimed file surface. Each store's test therefore pins the same literal.

Verification

  • Files to read first, by risk: packages/plugins/knowledge-turso/src/sql.ts (the KEYWORD_SEPARATORS hunk: the class ranges), packages/plugins/knowledge-pgvector/src/sql.ts (the same hunk, byte-identical apart from the store name in the comment), packages/plugins/knowledge-pgvector/src/__tests__/keyword-terms.test.ts (the block probe).
  • Two-minute check: pnpm --filter @objectstack/knowledge-pgvector exec vitest run --maxWorkers=2 src/__tests__/keyword-terms.test.ts. Expected result: 8 passed, including "splits at the punctuation of the CJK symbols block and at none of its letters or numbers".
  • Derived gates (node scripts/pm/dispatch-gates.mjs --commands, at 082af27): 67 derived, 66 run with exit 0. --ran reconciles: 67 accounted, 0 unrun. NOT MEASURED: check:dual-build-cjs-loads, reason: exit 3, PREREQUISITE NOT MET. It needs every package's dist/, and this container built only the two stores' closure. CI runs it.

🤖 Generated with Claude Code

…CJK symbols block inside a term

keywordTerms in both stores split at every member of U+3000-303F except
the three marks named in the run; the split now takes only the members
that are neither a letter nor a number, with one identical exported
class (KEYWORD_SEPARATORS) in both sql.ts files.

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 anchor(s) derived from 2 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
  • the SDK route bridge reached 69 of 253 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); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 — 2 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 cd191797d25f88502e52437764efb3a3fe7d4703 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a7da683b50ae598a6e52abe1370dfcfe447ca95b — the merge of head 082af270f1e0702de1aeffd8218bb794cfd01c7d into base cd191797d25f88502e52437764efb3a3fe7d4703, 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 a7da683b50ae598a6e52abe1370dfcfe447ca95b && git checkout a7da683b50ae598a6e52abe1370dfcfe447ca95b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cd191797d25f88502e52437764efb3a3fe7d4703 082af270f1e0702de1aeffd8218bb794cfd01c7d && git checkout -B drift-repro cd191797d25f88502e52437764efb3a3fe7d4703 && git merge --no-ff 082af270f1e0702de1aeffd8218bb794cfd01c7d

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

⚠️ 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#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb

席位核对 — L1 ACCEPT · head 082af27 · 2026-11-29T10:13Z

I read the diff at 082af27 (5 files, +91/−10) against the L1 checklist. At the time of reading, the checks on this head were 12 success, 16 skipped, 24 pending and 0 failed. This verdict is on the diff, so landing waits for green.

Part of #38411 is right. The PR takes item 4 only, the U+3000–303F nit from my #38498 record. Items 2 and 3 (the BrightRule graded eval and the per-leg pool) stay on the card, and the body says so. Clause-② no, Metadata-protocol none, and one patch for each store package all match a split-class change with no index, fingerprint or reindex effect.

Measured by me:

  • The class matches the Unicode tables exactly. Over U+3000–303F, a code point is in the new KEYWORD_SEPARATORS exactly when it is not \p{L}/\p{N}: 0 mismatches. 22 are kept: 々〆〇, 〡–〩, 〱–〵, 〸–〺, 〻 and 〼.
  • My fix(knowledge): the keyword leg keeps 々, 〆 and 〇 inside an unspaced run #38498 count was wrong. That record said 18 other code points; it is 19 beyond 々〆〇 (9 + 5 + 3 + 1 + 1). The body's 19 is right.
  • The two stores agree. The KEYWORD_SEPARATORS lines in the pgvector and turso sql.ts are byte-identical.
  • The pgvector test passes, and an ablation turns it red. keyword-terms.test.ts passes 8/8 in a worktree. With the class reverted to the old 〈-〿 range, both new cases go red: the property-derived one and the literal pin. Restored afterwards, with git status clean. The turso acceptance file needs a built service-knowledge dist, which this container lacks. I rely on CI for it, and on the body's 290/290 live reading.
  • Probes on the new keywordTerms:
    • 「人〻」 → [人〻]
    • 「第〢〣号」 → the five pieces the test pins
    • 「人々〻」 → [人々〻, 人々, 々〻]
    • 「、」「。」 and the corner brackets still split.

Nit, not a hold. 〱–〵 and 〼 are letters but Script=Common, so UNSEGMENTED_RUN does not take them. They now survive as a one-character term beside the kana run instead of joining it: 「いろ〱」 → [〱, いろ], where main gave [いろ]. That fits what this item asked for (none of them splits or is dropped). Whether a kana repeat mark should join its run is a separate question. If the area thinks it is worth asking, it can ride on #38411, which stays open.

Cross-package pin: keeping two literal pins (the area's choice A) is fine for a class that changes this rarely. Each pin's comment names the other store's.

ACCEPT once the pending checks finish green. Tier S, so the area lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb

Landing: head 082af27 · L1-a ACCEPT 7254301241 · Part of #38411 (item 4 only; items 2–3, the BrightRule graded eval and the per-leg pool, stay on the card) · Clause-②: no, Metadata-protocol: none, patch on both store packages, no contract review owed · CI on this head: every check run success or expected skip, none failed · check-governed-merges --pr 38566: NOT governed. The class is byte-identical in both stores and matches the Unicode letter/number tables over U+3000–303F (19 code points kept beyond 々〆〇, per the dev and L1 both). Kana repeat marks joining their run stay a question on #38411 (L1 nit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants