Skip to content

feat(examples): the Starter help articles as a knowledge source, in the blank template too - #39340

Draft
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-38374-starter-knowledge-source
Draft

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-38374-starter-knowledge-source

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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

维护者速读

  • 用户能看到什么变化:基础模板和空白模板里的帮助文章多了一个知识源;配了嵌入参数并重启的私有部署可以按语义检索已发布文章,没配时不生效、不列出检索工具。
  • 为什么做:知识检索专题里「模板自带可检索知识」这一步,替自托管用户把帮助文章接上知识检索。
  • 出错会怎样:目前没配嵌入参数时,新建项目启动会多打一行关于知识检索的警告(平台缺陷,见验收说明),功能本身不受影响;本改动可直接撤回。
  • 要你做的:无。

What changes

  • examples/app-starter/src/knowledge/articles.knowledge-source.ts (new) and its blank-template mirror: biz_articles / blank_articles over the article object. source.content: ['body'] (not title), no adapter, source.where: { status: 'published' }, source.metadataFields: ['category'], source.split: { strategy: 'markdown' } (the markdown split on main keeps a section that fits maxChars as one passage, so no maxChars/minChars pair).
  • Both configs list it in knowledgeSources; neither adds requires: ['knowledge'].
  • The parity test holds the two sources equal (modulo the namespace, blind to comments), with a one-value control, and checks both configs list it.
  • The template's starter.test.ts: a no-embedder case (no WARN/ERROR line mentioning knowledge during the boot; MCP lists record tools but no search_knowledge) and an embedder case (a small word-hash embedder through extraPlugins; search_knowledge is listed; every published ## section is found under [article title, section title]; the draft's sections never answer).
  • The Starter's boot.test.ts: a second boot on a host that asks for knowledge and has no embedder. The installed copy duplicates with its knowledge source copied, and the service holds both sources with an empty tool list.
  • Both READMEs: how to enable search on a self-hosted deployment (save the embedder provider under Settings, AI, Embedder; restart) and that the article bodies are then sent to that provider.
  • One changeset (create-objectstack, patch).

Tests

Local runs at ca114a3
  • pnpm --filter @objectstack/example-starter test (lock VERDICT command-exit 0): Test Files 2 passed, Tests 17 passed.
  • pnpm --filter @objectstack/example-starter typecheck: exit 0.
  • pnpm --filter create-objectstack exec vitest run --maxWorkers=2 src/blank-template-starter-parity.test.ts: 15 passed. pnpm --filter create-objectstack typecheck: exit 0.
  • Template starter.test.ts, run from a copy of the template against this checkout's packages: 5 passed, 1 failed. The failing case is the no-embedder log assertion, red on a platform defect named under Acceptance notes; the embedder case is green.
  • Template tsc --noEmit in a scaffold of this branch installed from the registry: exit 0; control (one injected type error) exit 2.

Acceptance notes

  • Open: a fresh scaffold prints one WARN at boot. With no embedder, the seed's four article writes reach the record-sync queue before the knowledge service settles enablement at kernel:bootstrapped. resolveRecordSync (packages/services/service-knowledge/src/knowledge-service-record-sync.ts) skips only once this.held is set, so the batch is handed to the turso adapter, which has no embedder yet, and the boot prints: WARN [knowledge] a batch of 4 record syncs of source 'blank-blank_articles' failed (knowledge-turso has no embedder ...). The template's no-embedder case pins the card's "no warn" acceptance and stays red until that is fixed in service-knowledge, which is outside this card's file surface. Reported to the dispatching seat for a card.
  • On a host that runs no knowledge service at all (one that installs the Starter from the marketplace and ships no source of its own), duplicating the installed copy is refused 503 SERVICE_UNAVAILABLE naming biz_articles. That is the duplicate door's existing contract for a deployment with no service. Before this PR the Starter carried no source, so its duplicate was not asked. Reported to the seat, not pinned here.
  • Separate, pre-existing: a duplicate of the installed Starter answers copiedCount: 13, failedCount: 3. Each of its three seeds is refused on re-save with "Unrecognized key(s) on this seed: name". This does not involve the knowledge source. Reported to the seat.

Verification

  • os validate on the Starter: "Validation passed", exit 0. On a copy of the blank template: "Validation passed", exit 0.
  • node scripts/ci/publish-starter-marketplace.mjs --dry-run after building the Starter: exit 0, bundle knowledgeSources 1.
  • Derived local gate families: 68 derived, 65 exit 0, 3 NOT MEASURED (check-plugin-teardown-shape --self-test on a shallow clone, check:dual-build-cjs-loads and check:i18n-coverage on dist outside the Starter closure). Those three run in CI.

Read first: packages/create-objectstack/src/templates/blank/starter.test.ts (the two new cases), examples/app-starter/test/boot.test.ts (the second describe), packages/create-objectstack/src/blank-template-starter-parity.test.ts (exportedConsts).

Two-minute check: pnpm --filter @objectstack/example-starter test. Expected result: 17 passed, including "duplicating the installed starter copies the source".


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CY1DVmttnuNH77G3ht

… the blank template too

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY1DVmttnuNH77G3ht
…dder, and found by search with one

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY1DVmttnuNH77G3ht
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 2 changed file(s) yielded no anchor (packages/create-objectstack/src/templates/blank/README.md, packages/create-objectstack/src/templates/blank/objectstack.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/create-objectstack/src/templates/blank/README.md, packages/create-objectstack/src/templates/blank/objectstack.config.ts) — pages documenting those are invisible to this run
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 1 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 ccc0838e804151f3923399b79fb58f93473aba23 → packageMentionDocs.

Which tree this was computed on

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

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

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

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/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.

examples/app-starter and the blank template: a knowledge source over the help articles, served only where knowledge retrieval is enabled

2 participants