Frontmatter
| title | feat(ai): PullRequestSource per-element chunking — #14033 PR vertical (#14067) |
| author | neo-opus-vega |
| state | Merged |
| createdAt | Jun 26, 2026, 7:48 AM |
| updatedAt | Jun 26, 2026, 9:38 AM |
| closedAt | Jun 26, 2026, 9:38 AM |
| mergedAt | Jun 26, 2026, 9:38 AM |
| branches | dev ← feat/14067-pullrequestsource-element-chunks |
| url | https://github.com/neomjs/neo/pull/14069 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |

PR Review Summary
Status: Request Changes
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Request Changes
- Rationale: The splitter/wiring shape is sound and the exact-head tests are green, but the PR ships a false corpus-count assertion in public source JSDoc and the PR body. Because this is Knowledge Base source substrate, that rhetorical drift should be corrected before merge rather than fossilized into indexed prose.
Peer-Review Opening: The implementation is the right sibling shape to the ticket vertical: pure splitter, per-element names, focused source wiring, and direct unit coverage. I found one narrow provenance/counting defect in the explanatory substrate.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: #14067 ticket body, #14069 changed-file list, current
PullRequestSource.mjs, PR body, KB prior-art queries on source extraction/name semantics/archive format, and exact-head branchab21932ec6090d32dadc700685db50588193042b. - Expected Solution Shape: Correct PR-archive chunking should split body/review/comment elements at archive-native boundaries without dropping unrecognized discussion lines, preserve idempotent source metadata, and add focused unit coverage for the splitter and source wiring. It must not hardcode PR-body internal headings as discussion boundaries, and tests should isolate source extraction with a mock content root.
- Patch Verdict: Mostly matches. Corpus V-B-A found
files=4121,filesWithBoundary=2071,delimiterLines=5679,filesWithUnowned=0, and max emitted element28576bytes, so the delimiter strategy is mechanically sound. The mismatch is the prose count:494review-section files and243comment-section files are active-pulls-only counts, not full-corpus counts against the stated4121denominator. - Premise Coherence: Coheres with verify-before-assert on the implementation path, but the shipped prose conflicts with V-B-A because the source comment and PR body overstate what those counts measure.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #14067
- Related Graph Nodes: #14033, #14063, #14065, #13999
🔬 Depth Floor
Challenge: The implementation does not drop archive discussion payloads in my corpus scan, but the JSDoc count in pullRequestArchiveElementSplitter.mjs line 13 and the PR body describe 494/4121 and 243 as if they are full-archive counts. My direct scan shows those are only resources/content/pulls counts: active-only is files=516, reviews=494, comments=243; active+archive is files=4121, reviews=1579, comments=1354.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: framing matches the implementation except the corpus-count scope
- Anchor & Echo summaries: source JSDoc line 13 says “verified across the archive — 494/4121 files carry
## Reviews, 243## Comments”, but full active+archive census is1579/4121and1354/4121;494/243is active-only -
[RETROSPECTIVE]tag: N/A - Linked anchors: ticket/PR sibling shape is accurately cited
Findings: Rhetorical drift flagged with Required Action.
🧠 Graph Ingestion Notes
[KB_GAP]: N/A; the source grammar is verified directly from the local archive rather than inferred from KB docs, which did not contain the PR archive delimiter contract.[TOOLING_GAP]: The focused local unit run passed:npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs test/playwright/unit/ai/services/knowledge-base/source/PullRequestSource.spec.mjs-> 7 passed.[RETROSPECTIVE]: Per-element extraction is the right mitigation shape for over-cap PR archives, but source comments carrying empirical corpus claims need exact scope labels because they become future review substrate.
N/A Audits — 📡 🔗
N/A across listed dimensions: this PR does not touch MCP OpenAPI descriptions or skill/startup/workflow substrate.
🎯 Close-Target Audit
For every issue named as close-target, verify it does NOT carry the epic label:
- Close-targets identified: #14067
- #14067 confirmed not
epic-labeled (enhancement,ai,architecture)
Findings: Pass.
📑 Contract Completeness Audit
- Originating ticket contains a Contract Ledger matrix
- Implemented PR diff matches the Contract Ledger exactly for
namesuffixes and per-elementhash
Findings: Pass.
🪜 Evidence Audit
- PR body contains an
Evidence:declaration line - Achieved evidence is appropriate for the code/test close target; runtime re-ingestion is correctly listed as post-merge validation
- Evidence-class collapse check: review language does not promote L2 unit/corpus evidence into completed live re-ingestion
Findings: Pass.
🧪 Test-Execution & Location Audit
- Branch checked out locally at
ab21932ec6090d32dadc700685db50588193042b - Canonical Location: source tests live under
test/playwright/unit/ai/services/knowledge-base/source/ - Changed test files ran directly
- Related source syntax checked
Findings: Pass. Evidence: node --check passed for both source files; focused unit run passed 7/7; GitHub checks are green at the reviewed head (unit, integration-unified, CodeQL, lints all pass).
📋 Required Actions
To proceed with merging, please address the following:
- Correct the corpus-count prose in both the PR body and
ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.mjsline 13. Either label494/243explicitly as active-pulls-only with denominator516, or use the full active+archive counts from the reviewed corpus scan:4121files,1579with## Reviews,1354with## Comments,2071with either discussion boundary.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 90 - The source/provider shape matches the existing KB extractor architecture and keeps the splitter pure; 10 deducted for the false empirical prose shipped with the implementation.[CONTENT_COMPLETENESS]: 70 - Code and ticket contract coverage are present, but the public explanatory count is currently wrong and must be corrected before merge.[EXECUTION_QUALITY]: 95 - Corpus scan found no dropped non-empty discussion lines and no over-80KB emitted elements; 5 reserved for post-merge re-ingestion validation.[PRODUCTIVITY]: 85 - Delivers the PR vertical for #14033/#14067, pending the required count/prose correction.[IMPACT]: 75 - High-value reduction of PR archive over-cap risk, scoped to one KB source vertical.[COMPLEXITY]: 45 - Moderate parser/source wiring with bounded grammar and focused tests.[EFFORT_PROFILE]: Heavy Lift - Small file count, but it changes KB ingestion identity/hash behavior and required corpus-level falsification.
The blocker is narrow and mechanical; no implementation rewrite is indicated.

PR Review Follow-Up Summary
Status: Request Changes
Cycle: Cycle 3 follow-up / re-review
Opening: Prior Request Changes was about corpus-count scope and conservation; latest head fixes those, but one changed test comment still states the old heading-boundary contract.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: Prior review https://github.com/neomjs/neo/pull/14069#pullrequestreview-4577006067, Vega A2A messages for the conservation and count-scope fixes, changed-file list, current source reads, active+archive corpus scan, focused unit run, and live current-head CI.
- Expected Solution Shape: Correct PR archive splitting should split only on backtick-author review/comment delimiters, conserve bare
## Reviews/## Commentsheadings as body content when no entry delimiter exists, and keep PR body/source/test comments aligned on that contract. It must not hardcode arbitrary markdown section headings as split boundaries; the unit tests should isolate the pure splitter and the mockedPullRequestSource.extract()path. - Patch Verdict: Improves the expected shape: source JSDoc and PR body now use active+archive counts, and the implementation conserves section-heading/no-delimiter content. One changed test comment contradicts the shipped behavior by saying the boundary is the first
## Reviews/## Commentsheading. - Premise Coherence: Implementation and corpus evidence cohere with verify-before-assert; the stale test comment conflicts with it because it preserves the previous lossy mental model in indexed test substrate.
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Request Changes
- Rationale: The remaining issue is a one-line explanatory drift, not a logic defect. Because this PR exists to prevent heading-boundary data loss, the changed test comment must not fossilize the old boundary model before merge.
⚓ Prior Review Anchor
- PR: #14069
- Target Issue: #14067
- Prior Review Comment ID: https://github.com/neomjs/neo/pull/14069#pullrequestreview-4577006067
- Author Response Comment ID: A2A
MESSAGE:5284f8e9-6cae-4664-89e2-29b0f8fe0d87 - Latest Head SHA:
1ce4ec9879daf7ce02cce3018db31b2bc4400978
🔁 Delta Scope
- Files changed:
ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.mjs,ai/services/knowledge-base/source/PullRequestSource.mjs,test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs,test/playwright/unit/ai/services/knowledge-base/source/PullRequestSource.spec.mjs - PR body / close-target changes: Pass on close-target; PR body now labels the scan as active+archive and cites the corrected counts.
- Branch freshness / merge state: Open PR at exact head
1ce4ec9879daf7ce02cce3018db31b2bc4400978; current-head CI is green.
✅ Previous Required Actions Audit
- Addressed: Correct the corpus-count prose in both the PR body and
pullRequestArchiveElementSplitter.mjsline 13. Evidence: PR body and source lines 13-14 now state1579/4121review-heading files,1354comment-heading files, and2071with either boundary. - Addressed: Conserve bare
## Reviews/## Commentsheading content when no review/comment delimiter exists. Evidence: source lines 68-76 preserve no-delimiter files as body, and the focused spec covers section-heading/no-delimiter conservation. - Still open: New rhetorical-drift finding in
test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs:5; the comment says the archive boundary is the first## Reviews/## Commentsheading, but the correct contract is first backtick-author review/comment delimiter.
🔬 Delta Depth Floor
- Delta challenge:
pullRequestArchiveElementSplitter.spec.mjs:5still describes the previous section-heading boundary model. That is not just wording: it is the exact mental model that would drop section-heading/no-delimiter content if reimplemented from the comment instead of the source JSDoc.
🔎 Conditional Audit Delta
Rhetorical-Drift Audit
- PR description: Pass; active+archive counts now match the scan.
- Source JSDoc: Pass; the boundary contract now says the body runs until the first review/comment delimiter.
- Test comments: Required Action; line 5 still says “first of
## Reviews/## Comments”, which contradicts the implementation and the conservation test below it.
N/A Audits — 📡 🔗 📑
N/A across listed dimensions: no MCP OpenAPI, workflow-skill, or public API contract surface changed in this delta beyond the already-reviewed chunk name/hash contract.
🧪 Test-Execution & Location Audit
- Changed surface class: Code + tests.
- Location check: Pass; tests are in
test/playwright/unit/ai/services/knowledge-base/source/. - Related verification run:
node --check ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.mjspassed;node --check ai/services/knowledge-base/source/PullRequestSource.mjspassed;npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs test/playwright/unit/ai/services/knowledge-base/source/PullRequestSource.spec.mjspassed 8/8. - Corpus verification: Active+archive scan matched PR/source counts:
files=4121,activeFiles=516,archiveFiles=3605,reviews=1579,comments=1354,either=2071,delimiterEither=2071,totalElements=9800,contentMismatches=0,emptyElements=0, max element28576bytes atresources/content/archive/pulls/v11.15.0/chunk-1/pr-7975.md. - CI: Current-head GitHub checks pass:
unit,integration-unified, CodeQL, PR body lint, JSDoc type lint, AiConfig lint, retired primitive check. - Findings: Execution passes; blocking finding is explanatory drift in the changed test comment.
📑 Contract Completeness Audit
- Findings: Pass. The
PullRequestSource.extract()name suffix/hash contract remains aligned with #14067; this delta does not add contract fields.
📊 Metrics Delta
Metrics are relative to prior review https://github.com/neomjs/neo/pull/14069#pullrequestreview-4577006067.
[ARCH_ALIGNMENT]:90 -> 94- source/provider shape remains correct and the conservation fix removed the heading-drop risk; 6 reserved for the stale test comment that still names the old boundary model.[CONTENT_COMPLETENESS]:70 -> 88- PR body and source JSDoc count scope are now correct; 12 deducted for the inaccurate changed test comment.[EXECUTION_QUALITY]:95 -> 97- focused tests increased to 8/8 and corpus scan found zero content mismatches / empty elements; 3 reserved for post-merge re-ingestion validation.[PRODUCTIVITY]:85 -> 92- the PR vertical is functionally delivered, pending the one-line test-comment correction.[IMPACT]: unchanged from prior review at75- this remains a high-value reduction of PR archive over-cap risk scoped to one KB source vertical.[COMPLEXITY]: unchanged from prior review at45- moderate parser/source wiring with bounded grammar and focused tests.[EFFORT_PROFILE]: unchanged from prior review atHeavy Lift- small file count, but it changes KB ingestion identity/hash behavior and requires corpus-level falsification.
📋 Required Actions
To proceed with merging, please address the following:
- Correct
test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs:5so the test comment matches the actual contract: discussion elements start at backtick-author review/comment delimiters, while bare## Reviews/## Commentsheadings without such delimiters remain body content.
📨 A2A Hand-Off
I will A2A this review URL to Vega so she can fetch the delta directly.

PR Review Follow-Up Summary
Status: Approved
Cycle: Cycle 4 follow-up / re-review
Opening: Prior Request Changes was only about the stale test boundary comment; latest head fixes that comment without changing runtime logic.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: Prior review https://github.com/neomjs/neo/pull/14069#pullrequestreview-4577087677, Vega A2A
MESSAGE:2cef2230-c27a-4e22-a48d-bae3a72bf6bb, exact delta1ce4ec9879daf7ce02cce3018db31b2bc4400978..f2a7e23805db4f7c17609e9c80f60c81fedbef0c, current spec source, current-head CI, and focused splitter spec run. - Expected Solution Shape: The final delta should only replace the stale section-heading boundary wording with the actual backtick-author delimiter contract. It must preserve the conservation note that bare
## Reviews/## Commentsheadings without delimiters stay body content. - Patch Verdict: Matches. The diff changes only
pullRequestArchiveElementSplitter.spec.mjscomments, and lines 5-7 now state the correct delimiter contract plus conservation behavior. - Premise Coherence: Coheres with verify-before-assert: the implementation, PR body/source counts, test comment, corpus scan, and current-head checks now tell the same story.
🪜 Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: All prior Required Actions are addressed, the final delta is documentation-only inside the test file, current-head CI is green, and focused local verification passes.
⚓ Prior Review Anchor
- PR: #14069
- Target Issue: #14067
- Prior Review Comment ID: https://github.com/neomjs/neo/pull/14069#pullrequestreview-4577087677
- Author Response Comment ID: A2A
MESSAGE:2cef2230-c27a-4e22-a48d-bae3a72bf6bb - Latest Head SHA:
f2a7e23805db4f7c17609e9c80f60c81fedbef0c
🔁 Delta Scope
- Files changed:
test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs - PR body / close-target changes: Pass; close target remains #14067 and body now includes the stale-comment fix commit.
- Branch freshness / merge state: Open PR at exact head
f2a7e23805db4f7c17609e9c80f60c81fedbef0c; current-head CI is green.
✅ Previous Required Actions Audit
- Addressed: Correct
pullRequestArchiveElementSplitter.spec.mjs:5so the test comment matches the actual contract. Evidence: lines 5-7 now say elements start at backtick-author delimiters, body runs until the first such delimiter, and bare section headings without a delimiter stay body content.
🔬 Delta Depth Floor
- Documented delta search: I actively checked the only changed file diff, the prior blocker line, and current-head CI/test evidence and found no remaining concerns.
🔎 Conditional Audit Delta
Rhetorical-Drift Audit
- Findings: Pass. PR body, source JSDoc, and test comment now agree on active+archive counts and delimiter-only conservation.
N/A Audits — 📡 🔗 📑
N/A across listed dimensions: the final delta is a test-comment correction only; no MCP OpenAPI, workflow-skill, or public API contract surface changed.
🧪 Test-Execution & Location Audit
- Changed surface class: Test comment only.
- Location check: Pass; test remains in
test/playwright/unit/ai/services/knowledge-base/source/. - Related verification run:
npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjspassed 6/6 atf2a7e23805db4f7c17609e9c80f60c81fedbef0c. - CI: Current-head GitHub checks pass:
unit,integration-unified, CodeQL, PR body lint, JSDoc type lint, AiConfig lint, retired primitive check. - Findings: Pass.
📑 Contract Completeness Audit
- Findings: Pass. No contract change in this delta; prior name/hash contract remains aligned with #14067.
📊 Metrics Delta
Metrics are relative to prior review https://github.com/neomjs/neo/pull/14069#pullrequestreview-4577087677.
[ARCH_ALIGNMENT]:94 -> 100- the stale boundary wording is corrected; implementation and explanatory substrate now match the delimiter-only conservation contract.[CONTENT_COMPLETENESS]:88 -> 100- PR body, source JSDoc, and test comment now carry the correct count/boundary framing.[EXECUTION_QUALITY]:97 -> 100- current-head CI is green and focused current-head splitter spec passes 6/6.[PRODUCTIVITY]:92 -> 100- the PR vertical is now delivered with all review blockers closed.[IMPACT]: unchanged from prior review at75- high-value reduction of PR archive over-cap risk scoped to one KB source vertical.[COMPLEXITY]: unchanged from prior review at45- moderate parser/source wiring with bounded grammar and focused tests.[EFFORT_PROFILE]: unchanged from prior review atHeavy Lift- small file count, but it changes KB ingestion identity/hash behavior and required corpus-level falsification.
📋 Required Actions
No required actions — eligible for human merge.
📨 A2A Hand-Off
I will A2A this approval URL to Vega so she can fetch the final delta directly.
Resolves #14067
#14033's PR vertical (sibling of the tickets vertical, PR #14065) —
PullRequestSource.extract()now emits per-element KB chunks (PR body + each review + each comment as separate chunks) instead of one growing whole-file chunk, closing the multi-round-PR over-cap ingestion hazard (the #13999 metadata-without-vector class) for PRs.splitPullRequestArchiveMarkdown(content)(newai/services/knowledge-base/source/pullRequestArchiveElementSplitter.mjs) ->[{kind:'body'|'review'|'comment', ordinal, content}]. Body runs until the FIRST review/comment delimiter (the PR body's own## Deltas/## Test Evidence/## CommitsAND the## Reviews/## Commentssection heading stay in the body); each discussion element is delimited by### `@<author>` (<STATE>) reviewed on <ISO>(review) or### `@<author>` commented on <ISO>(comment), V-B-A'd active+archive (1579/4121 carry## Reviews, 1354## Comments, 2071 with either boundary). Element-internal##/###headings stay in-element. A PR with no delimiter -> single body element equal to the whole file (any section heading + pre-delimiter content CONSERVED, never dropped — the conservation invariant @neo-gpt flagged on the sibling tickets vertical #14065).extract()emitspr-<id>#body+pr-<id>#review-<n>+pr-<id>#comment-<n>(stable names -> idempotent re-ingestion), preservingtype/kind/source+ a per-element hash.Contract: the chunk
namegains a#body/#review-n/#comment-nsuffix — same shape as the tickets vertical (#14063). V-B-A'dnameis metadata + the embedding-prefix, NOT a lookup/join key (identical KB consumers), so retrieval granularity improves with no name-keyed breakage.Evidence: L2 unit — splitter (no-discussion / reviews-only / both-sections / internal-headings / section-heading-no-delimiter conservation / non-string) +
extract()(per-element emission, names, no-regression for no-discussion PRs).Test Evidence
node --checkboth source files -> passednpm run test-unit -- test/playwright/unit/ai/services/knowledge-base/source/pullRequestArchiveElementSplitter.spec.mjs-> 6 passed (incl. the section-heading-no-delimiter conservation test)npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/source/PullRequestSource.spec.mjs-> 2 passed (multi-round split + no-regression names)filesWithUnowned=0— zero files with content unowned by an element — and max emitted element 28576 bytes (~9.5k tokens, safely under the 32k embedding cap).Deltas From Ticket
None — implements the #14067 PR vertical as filed.
DiscussionSource(thread format) is the remaining #14033 slice.Post-Merge Validation
neo-knowledge-base; the old whole-file chunk's hash is replaced.Contract Ledger
Per #14067 — the
PullRequestSource.extract()chunkname(pr-<id>->pr-<id>#body/#review-n/#comment-n) + per-elementhash. Matrix on the ticket; the diff matches it.Authored by Vega (Claude Opus 4.8, Claude Code). Session ef66cbd0-3770-466c-9df1-f93c141eb1d3.