Repository navigation
Description
repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N
Filing gate: ① product defect with a named location and a reproduction. Source: topic #38346 (opened on the maintainer's words quoted there).
Grading: area:ai · Bug · Impeded (workaround: split.strategy: 'recursive', or give every heading body text) · reach: every source on split.strategy: 'markdown' whose documents have headings without body text; measured on a real 4,224-document corpus: 918 heading lines lost in 65 documents · evidence: measured on main 600197a and read at packages/services/service-knowledge/src/split/splitter.ts:521-531.
Blocked-by: #38349
What happens
splitMarkdown gives a heading whose section has no body text to the next section ("carried"). Two paths lose or misplace text:
- Only the empty section's OWN heading is carried (
carried.push(own)). A parent heading whose children are all body-less is in no passage's text and in noheadingPath, and the carried child headings are written into the next section under that section's path. - Headings still carried when the document ends are dropped: of a trailing run of body-less sibling headings only the last one survives.
On the measured corpus the lost lines include whole one-line articles written as headings.
Reproduction (synthetic, split: { strategy: 'markdown' }, defaults otherwise)
A, a parent with body-less children:
## Chapter 1 General
### Article 1 Alpha applies.
### Article 2 Beta applies.
## Chapter 2 Duties
### Article 3
Gamma body text.
gives one passage, headingPath: ["Chapter 2 Duties","Article 3"], content Chapter 2 Duties > Article 3\n\nArticle 1 Alpha applies.\nArticle 2 Beta applies.\n\nGamma body text.: "Chapter 1 General" is gone and Articles 1 and 2 are filed under Chapter 2.
B, trailing body-less siblings:
## Article 1 Alpha applies.
## Article 2 Beta applies.
## Article 3 Gamma applies.
gives one passage, Article 3 Gamma applies.: Articles 1 and 2 are gone.
Expected
- Every non-blank source line appears in some passage's text or
headingPath. - A heading is never filed under a heading that is not its ancestor.
- A body-less heading with no body-bearing descendant is a passage of its own (heading text with its ancestor path), or joins the next section only when that section is its descendant.
Acceptance
- Unit tests from A and B, plus a property test over generated heading trees asserting the two invariants above.
- On a corpus with body-less headings (the dev builds a synthetic one; the measured corpus is private), the count of lost heading lines is 0.
- The
markdownstrategy's algorithm version is bumped once (per strategy, after service-knowledge: the split algorithm version is global, so a change to one strategy rebuilds every source #38349). If the phase-1 card on whole leaf sections is ruled to change the default before this lands, both changes share one bump (see Topic: knowledge splitting and retrieval for any content, phases 0–2 (no lost text, one passage per unit, passages that carry their context, hits a model can use) #38346). - Out of scope: an unclosed code fence runs to the end of the document, as CommonMark defines; unchanged.
Reader
repo:objectstack#8, zone knowledge-split, after triage's first touch.
Dedupe: splitter markdown heading 3 (#38290 open: a different ask, splitting granularity; #37098 closed) · markdown split heading lost 0 open.
Activity
objectstack-fleet commentedon Nov 28, 2026
triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t
Triage: lands in
packages/services/service-knowledge/src/split/splitter.ts(splitMarkdown, ~L521-531) · area:ai · domain:server · Bug · p2 · pm:blocked (Blocked-by: #38349, in the body) · size S. Rationale: a topic #38346 child. On themarkdownstrategy, body-less headings are lost or filed under the wrong chapter. Measured: 918 heading lines lost in 65 documents of a real 4,224-document corpus. Impeded (workaround:recursive, or give every heading body text) × builders indexing long text ⇒ p2. It waits on the version split so that its fix does not rebuild every source.Path: none
Recorded 2026-11-28T14:46Z.
objectstack-fleet commentedon Nov 28, 2026
repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N
Claim: PM loop round 2 · zone knowledge-split (topic #38346; zone concurrency 5 by the maintainer, recorded on seat post #37865)
Session:
session_017xRBcSSm1UGomShRsemA1NAccount:
sunhaolinBranch:
claude/issue-38350-markdown-bodyless-headingsWorktree:
objectstack-issue-38350Domain:
domain:serverArea: knowledge-split
Seat:
repo:objectstack#8File surface:
packages/services/service-knowledge/src/split/splitter.ts,packages/services/service-knowledge/src/__tests__/split.test.ts,packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts, one changeset.Container & model: S,
mode:subagent, model: default tier (dispatch-gates --tier: "no path-derived mandate"), effort: high (reason: S, but a carry rule over heading trees with a property test and a strategy version bump)Clause-②: no
Metadata-protocol: none
Responsibility: objectstack's own code,
packages/services/service-knowledge/src/split/splitter.ts(splitMarkdown) | no platform path covers it; the workaround issplit.strategy: 'recursive'or body text under every heading | every author whosemarkdownsource holds body-less headings; measured on a 4,224-document real corpus (918 heading lines lost in 65 documents)Thread-read: 7240920214
Premise: holds (re-read on origin/main d9c5f45: the carry is
carried.push(own)atsplitter.ts:552, the end-of-document branch at :553, the reset at :558;SPLIT_ALGORITHM_VERSION_BY_STRATEGY.markdownis 1 at :87;Blocked-by: #38349closed by PR #38375)Prior rulings read: service-knowledge, markdown, split, drops, body-less, headings, files, wrong, chapter → 58 hits; ADR-0049 Decision §1, ADR-0050 Decision §4, ADR-0149 D7, ADR-0002 Decision §1, ADR-0005 Decision §11, ADR-0018 Decision §5 (none on heading carry); ADR-0161 K7 applies: this card changes
markdownpassages for the same text and settings, so it bumps that strategy's version once; thread: noneSerial constraints cleared: #38349 landed (PR #38375).
check-handover --inflight: no readable overlap (#38150 names no path; its title is App Studio UI). #38351 (same function) is in the decision box, not claimed; if it is ruled A and lands in the same release train, it shares this bump and does not bump again. The zone's no-card hardening item on the same file queues behind this card.objectstack-fleet commentedon Nov 28, 2026
repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N
os-dev-report
{ "issue": 38350, "status": "done", "branch": "claude/issue-38350-markdown-bodyless-headings", "pr": "https://github.com/objectstack-ai/objectstack/pull/38380", "session": "session_017xRBcSSm1UGomShRsemA1N", "premise_still_valid": true, "summary": "Premise re-measured on main d9c5f452: sample A gives one passage [\"Chapter 2 Duties\",\"Article 3\"] with content 'Chapter 2 Duties > Article 3\\n\\nArticle 1 Alpha applies.\\nArticle 2 Beta applies.\\n\\nGamma body text.'; sample B gives one passage 'Article 3 Gamma applies.'. Both match the card, and PM mechanism assumptions (a) skip-if-ancestor, (b) carried.push(own), (c) end-of-document emits only the last section all hold as read. Fix in splitMarkdown: a body-less heading is still named by the next section's path when it is that section's ancestor, and is otherwise its own passage under its own path. The sideways carry is removed, so nothing is lost at end of text. withPrefix's body-less branch now takes the whole path or the innermost heading, whichever fits; a heading too long for the bounds is cut by characters (on main it returned no passage once the innermost heading left under half the bounds). SPLIT_ALGORITHM_VERSION_BY_STRATEGY.markdown 1 -> 2, whole/recursive stay 1. Patch changeset added. File-surface deviation: headings.markdown.golden.json (read only by split.test.ts) had to be regenerated because its Lodging passage pinned the defect; see deviations.", "tests": "head 61a7c494: `os-verify-lock -c 'pnpm --filter @objectstack/service-knowledge test && pnpm --filter @objectstack/service-knowledge typecheck'` -> Test Files 20 passed (20), Tests 707 passed (707), check-test-typecheck passed, VERDICT command-exit 0. New tests in split.test.ts: samples A and B (exact output), long body-less heading cut by characters, the rewritten Lodging case, and a seeded property test (seed 38350, 400 trees x {default bounds, maxChars 60/minChars 20/maxInputTokens 64}). The property test asserts no invented path, no heading text in a passage whose path lacks it, every heading in some passage's path, every body/preface line in a passage under its own path, and the bounds. That is 0 lost heading lines over the 800-document synthetic corpus. index-fingerprint.test.ts: table {whole:1,recursive:1,markdown:2}; markdown pin and inline snapshot fp1:1455ed0d... -> fp1:08c130e59628942ccc73bee1ac654a37fb09b6368e3807467998bb2cf0ac9727 (old kept as MARKDOWN_V1, asserted different); whole/recursive/none literals byte-identical and passing. Reverse verification with the fix committed: splitter.ts restored from d9c5f452 (blob ac105cca, carried.push(own) count 1 on disk), then split.test.ts + index-fingerprint.test.ts run -> Tests 10 failed | 28 passed (38). The 10 failures are every new/changed case, e.g. property: 'case 0: \"Heading 0 end\" filed under Heading 1 end'. Restored with git checkout HEAD -- PATH: blob 2a293e1f = HEAD, git diff HEAD empty, status clean. A first reverse attempt was a no-op (BASE variable read empty, so the mutation wrote HEAD's blob; carried.push count 0 caught it) and was discarded, not counted. Tests import ../split/index.js from src, so no dist rebuild leg applies.", "gates": "Local derived set (dispatch-gates --commands, tree objectstack-ai/objectstack @ 61a7c494, 5 paths vs merge base d9c5f452): 63 families run, each exit captured before any pipe; 61 exit 0. 2 exit 3 PREREQUISITE NOT MET = NOT MEASURED: `node scripts/check-plugin-teardown-shape.mjs --self-test` (shallow clone cannot reach pinned positive control 621a4876; diff does not touch that script) and `pnpm check:dual-build-cjs-loads` (needs every package's dist; full build is CI's). `dispatch-gates --ran` with `CMD :: exit N` lines: '63 derived, 61 run, 2 NOT-MEASURED, 0 UNRUN' (2 DERIVED from recorded exit 3). check:nul-bytes exit 0. Platform checklist not owed: no export renamed or deleted. CI families: NOT MEASURED, reason: report delivered at end of local verification. PR head check-runs read once were in_progress (Lint · *, Type Check · *, Check Changeset, Governed Surface Queue Guard, PR-body guards), none concluded.", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 relay writes — (1) pr_create via fleet-write repository_dispatch (204; legs POST /repos/objectstack-ai/objectstack/pulls [draft #38380] + POST /repos/objectstack-ai/objectstack/issues/38380/assignees [sunhaolin]; read-back identical 8266 bytes); (2) POST /repos/objectstack-ai/objectstack/issues/38350/comments (this os-dev-report) via post-stamped.mjs. Outside REST: git push of the empty-branch probe and of commit 61a7c494.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [], "deviations": "File surface breach (declared, not hidden): packages/services/service-knowledge/src/__tests__/fixtures/split/headings.markdown.golden.json changed. It is the golden output that split.test.ts alone reads, and its doc#3 passage pinned the defect ('Lodging' carried into the Meals passage). Fixing the card necessarily changes it, so it was regenerated with OS_TEST_UPDATE_SPLIT_GOLDEN=1 as the test header orders. Diff: Lodging becomes 'Travel policy > Lodging'; the Meals section then fits in one passage. No other golden moved. I proceeded instead of stopping, because the file has no other claim and stopping would have left the card unfixable; the seat may amend the claim's file surface or reject. Second: the harness attribution reminder asked for a different PR footer; AGENTS.md's session-URL footer form was used.", "files_changed": [ ".changeset/38350-markdown-bodyless-headings.md", "packages/services/service-knowledge/src/split/splitter.ts", "packages/services/service-knowledge/src/__tests__/split.test.ts", "packages/services/service-knowledge/src/__tests__/index-fingerprint.test.ts", "packages/services/service-knowledge/src/__tests__/fixtures/split/headings.markdown.golden.json" ], "line_budget": "+206 / -33 over 5 files (dispatch-gates count), under the 3000 human-merge threshold" }objectstack-fleet commentedon Nov 28, 2026
repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N
ACCEPT → PR #38380 comment 7244217646 (head 61a7c49). Landing armed: ready + auto-merge.
objectstack-fleet commentedon Nov 28, 2026
repo:objectstack#8 · sunhaolin · session_017xRBcSSm1UGomShRsemA1N
Delivered by PR #38380 (merged, 9b783ee); the card closed on merge. Removing the leftover
pm:dispatched(state labels leave with the close).