From 0c4609e77e126ed26282f0287cb37991b2d16ce2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 01:00:47 +0000 Subject: [PATCH 1/5] refactor(service-knowledge)!: retire SPLIT_ALGORITHM_VERSION The index fingerprint reads the split version per resolved strategy; the global constant was read by no runtime code. It leaves the split barrel and the package entry at once, with no alias, and a pin asserts its absence. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5omA3kZCsWzBMMqF11 --- .../38377-retire-split-algorithm-version.md | 22 +++++++++++++++++++ .../src/__tests__/index-fingerprint.test.ts | 15 +++++++++++-- .../services/service-knowledge/src/index.ts | 1 - .../service-knowledge/src/split/index.ts | 1 - .../service-knowledge/src/split/splitter.ts | 16 +++----------- 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 .changeset/38377-retire-split-algorithm-version.md diff --git a/.changeset/38377-retire-split-algorithm-version.md b/.changeset/38377-retire-split-algorithm-version.md new file mode 100644 index 00000000000..97438ac40da --- /dev/null +++ b/.changeset/38377-retire-split-algorithm-version.md @@ -0,0 +1,22 @@ +--- +'@objectstack/service-knowledge': patch +--- + +refactor(service-knowledge)!: `SPLIT_ALGORITHM_VERSION` is retired — the index fingerprint reads the split version per strategy + +Clause-②: no (narrowing) +Metadata-protocol: none + + + +**BREAKING** for a host that imports `SPLIT_ALGORITHM_VERSION` from `@objectstack/service-knowledge`. It leaves at once, with no alias. The index fingerprint (ADR-0161 K7) stopped reading it when the split version became per strategy: each strategy (`whole`, `recursive`, `markdown`) carries its own version inside the splitter, and the fingerprint reads the version of the source's resolved strategy. The constant changed nothing a host could observe, and bumping it rebuilt nothing. + +No fingerprint changes and no index is rebuilt when this lands. + +## What leaves, and what to write instead + +| FROM | TO | +|:--|:--| +| `import { SPLIT_ALGORITHM_VERSION } from '@objectstack/service-knowledge'` | delete the import; to tell whether a stored index is current, compare its fingerprint with `computeIndexFingerprint` or `indexExpectation`, which read the per-strategy version | + +What to do: delete the import where a host has one. Nothing else. diff --git a/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts b/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts index c27d4f710ea..18b8af5f684 100644 --- a/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts +++ b/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts @@ -16,7 +16,9 @@ import { computeIndexFingerprint, computeRecipeHash, } from '../knowledge-index-fingerprint.js'; -import { SPLIT_ALGORITHM_VERSION, SPLIT_ALGORITHM_VERSION_BY_STRATEGY, resolveSplit } from '../split/index.js'; +import * as splitBarrel from '../split/index.js'; +import { SPLIT_ALGORITHM_VERSION_BY_STRATEGY, resolveSplit } from '../split/index.js'; +import * as packageEntry from '../index.js'; const source = (extra: Record = {}): KnowledgeSource => ({ @@ -50,7 +52,7 @@ const MARKDOWN_V1 = 'fp1:1455ed0d278a0e58b26ccc2d423298c29d65162125032d76453847f describe('index fingerprint (ADR-0161 K7)', () => { it('is pinned for a fixed input', () => { - expect([INDEX_FINGERPRINT_VERSION, SPLIT_ALGORITHM_VERSION, ASSEMBLY_RULE_VERSION]).toEqual(['fp1', 1, 1]); + expect([INDEX_FINGERPRINT_VERSION, ASSEMBLY_RULE_VERSION]).toEqual(['fp1', 1]); expect(SPLIT_ALGORITHM_VERSION_BY_STRATEGY).toEqual({ whole: 1, recursive: 1, markdown: 2 }); expect(Object.isFrozen(SPLIT_ALGORITHM_VERSION_BY_STRATEGY)).toBe(true); expect(computeIndexFingerprint({ source: source(), embedding, split })).toBe( @@ -59,6 +61,15 @@ describe('index fingerprint (ADR-0161 K7)', () => { expect(computeIndexFingerprint({ source: source(), embedding, split })).toMatchInlineSnapshot(`"fp1:08c130e59628942ccc73bee1ac654a37fb09b6368e3807467998bb2cf0ac9727"`); }); + // The one global split version is retired, at once and with no alias: the + // per-strategy table above is the only split version the fingerprint reads, + // so neither the split barrel nor the package entry publishes another. + it('publishes no global split version beside the per-strategy table', () => { + expect(splitBarrel).not.toHaveProperty('SPLIT_ALGORITHM_VERSION'); + expect(packageEntry).not.toHaveProperty('SPLIT_ALGORITHM_VERSION'); + expect(packageEntry).toHaveProperty('INDEX_FINGERPRINT_VERSION', 'fp1'); + }); + // The values the fingerprint had while one global split version was read: // the per-strategy table starts every strategy at that version, so no // stored index reads as built under another fingerprint when it lands. diff --git a/packages/services/service-knowledge/src/index.ts b/packages/services/service-knowledge/src/index.ts index 1c8be1df600..b8fc4a96ee8 100644 --- a/packages/services/service-knowledge/src/index.ts +++ b/packages/services/service-knowledge/src/index.ts @@ -20,7 +20,6 @@ export { indexExpectation, } from './knowledge-index-fingerprint.js'; export type { IndexFingerprintInput, RecipeHashInput } from './knowledge-index-fingerprint.js'; -export { SPLIT_ALGORITHM_VERSION } from './split/index.js'; export { SEARCH_KNOWLEDGE_DEFAULT_TOP_K, SEARCH_KNOWLEDGE_MAX_TOP_K, diff --git a/packages/services/service-knowledge/src/split/index.ts b/packages/services/service-knowledge/src/split/index.ts index 7d7653bd7a6..ee1cd5e7129 100644 --- a/packages/services/service-knowledge/src/split/index.ts +++ b/packages/services/service-knowledge/src/split/index.ts @@ -3,7 +3,6 @@ export { DEFAULT_SPLIT_MAX_CHARS, DEFAULT_SPLIT_MIN_CHARS, - SPLIT_ALGORITHM_VERSION, SPLIT_ALGORITHM_VERSION_BY_STRATEGY, SPLIT_TOKEN_BUDGET_SHARE, resolveSplit, diff --git a/packages/services/service-knowledge/src/split/splitter.ts b/packages/services/service-knowledge/src/split/splitter.ts index d98c3e8d43a..72c0c6759ff 100644 --- a/packages/services/service-knowledge/src/split/splitter.ts +++ b/packages/services/service-knowledge/src/split/splitter.ts @@ -57,16 +57,6 @@ export const DEFAULT_SPLIT_MIN_CHARS = 200; /** The share of the embedder's input limit a passage may fill, by `estimateTokens`. */ export const SPLIT_TOKEN_BUDGET_SHARE = 0.8; -/** - * The version every split strategy started at (ADR-0161 K7). The index - * fingerprint no longer reads it: each strategy carries its own version, in - * the splitter's per-strategy table (not published), so a change to one - * strategy's passages rebuilds only the sources that resolve to that strategy. - * Kept, at its value, because the package publishes it; bumping it rebuilds - * nothing. - */ -export const SPLIT_ALGORITHM_VERSION = 1; - /** * The version of this splitter's algorithm, per strategy. The index * fingerprint's split algorithm version (ADR-0161 K7) is the entry for the @@ -80,9 +70,9 @@ export const SPLIT_ALGORITHM_VERSION = 1; * * A change shared by several strategies (`markdown` cuts each section as * `recursive` does) bumps every strategy whose passages it changes. Every - * entry started at {@link SPLIT_ALGORITHM_VERSION}, so introducing this table - * changed no fingerprint. Typed over every strategy, so a new strategy cannot - * reach the fingerprint without a version. + * entry started at 1, the one split version the fingerprint read before this + * table, so introducing it changed no fingerprint. Typed over every strategy, + * so a new strategy cannot reach the fingerprint without a version. */ export const SPLIT_ALGORITHM_VERSION_BY_STRATEGY: Readonly> = Object.freeze({ whole: 1, From 4fa2f8eeb221def138c528ee0cc6d371b39f3244 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 01:15:23 +0000 Subject: [PATCH 2/5] docs(changeset): spell the retired operand as the ADR-0087 marker names it Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5omA3kZCsWzBMMqF11 --- .changeset/38377-retire-split-algorithm-version.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/38377-retire-split-algorithm-version.md b/.changeset/38377-retire-split-algorithm-version.md index 97438ac40da..b1e6582bb66 100644 --- a/.changeset/38377-retire-split-algorithm-version.md +++ b/.changeset/38377-retire-split-algorithm-version.md @@ -17,6 +17,6 @@ No fingerprint changes and no index is rebuilt when this lands. | FROM | TO | |:--|:--| -| `import { SPLIT_ALGORITHM_VERSION } from '@objectstack/service-knowledge'` | delete the import; to tell whether a stored index is current, compare its fingerprint with `computeIndexFingerprint` or `indexExpectation`, which read the per-strategy version | +| `SPLIT_ALGORITHM_VERSION` | delete the import from `@objectstack/service-knowledge`; to tell whether a stored index is current, compare its fingerprint with `computeIndexFingerprint` or `indexExpectation`, which read the per-strategy version | What to do: delete the import where a host has one. Nothing else. From f76ba9c9e5c931a93bd8d128c606b84721c79652 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 02:07:05 +0000 Subject: [PATCH 3/5] docs(service-knowledge): name both changes markdown split version 2 carries Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5omA3kZCsWzBMMqF11 --- packages/services/service-knowledge/src/split/splitter.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/services/service-knowledge/src/split/splitter.ts b/packages/services/service-knowledge/src/split/splitter.ts index 72c0c6759ff..767759405ee 100644 --- a/packages/services/service-knowledge/src/split/splitter.ts +++ b/packages/services/service-knowledge/src/split/splitter.ts @@ -79,6 +79,8 @@ export const SPLIT_ALGORITHM_VERSION_BY_STRATEGY: Readonly Date: Sun, 29 Nov 2026 02:25:46 +0000 Subject: [PATCH 4/5] docs(service-knowledge): the fingerprint pin names both changes markdown version 2 carries Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5omA3kZCsWzBMMqF11 --- .../service-knowledge/src/__tests__/index-fingerprint.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts b/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts index 18b8af5f684..9061a06536f 100644 --- a/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts +++ b/packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts @@ -37,7 +37,8 @@ const split = splitFor('markdown'); * The fingerprint of `source()` under `embedding`, per resolved strategy. * `whole`, `recursive` and no split stand as they did under one global split * version; `markdown` is at its version 2 (a heading with no body is a - * passage of its own), and {@link MARKDOWN_V1} is the value it moved from. + * passage of its own, and a section that fits the bounds is one passage + * whatever `minChars` is), and {@link MARKDOWN_V1} is the value it moved from. */ const PINNED = { whole: 'fp1:02171c5bcf94ff5d951de321a1a7206b059e684e094d329c9674309d7e472ce3', From 42214359722832dd0e4e1216a1c7d931f86f3bf9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 02:39:16 +0000 Subject: [PATCH 5/5] docs(changeset): the retirement replaces the same release's keeps-its-name note Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5omA3kZCsWzBMMqF11 --- .changeset/38377-retire-split-algorithm-version.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.changeset/38377-retire-split-algorithm-version.md b/.changeset/38377-retire-split-algorithm-version.md index b1e6582bb66..6aa53e77b76 100644 --- a/.changeset/38377-retire-split-algorithm-version.md +++ b/.changeset/38377-retire-split-algorithm-version.md @@ -11,6 +11,8 @@ Metadata-protocol: none **BREAKING** for a host that imports `SPLIT_ALGORITHM_VERSION` from `@objectstack/service-knowledge`. It leaves at once, with no alias. The index fingerprint (ADR-0161 K7) stopped reading it when the split version became per strategy: each strategy (`whole`, `recursive`, `markdown`) carries its own version inside the splitter, and the fingerprint reads the version of the source's resolved strategy. The constant changed nothing a host could observe, and bumping it rebuilt nothing. +This retirement replaces the earlier note in this same release that `SPLIT_ALGORITHM_VERSION` keeps its name and its value: it is removed. + No fingerprint changes and no index is rebuilt when this lands. ## What leaves, and what to write instead