Skip to content

docs: split CF-7 test harness doc into grading spec / bug history / infra notes - #57

Merged
hardcoreerik merged 17 commits into
masterfrom
docs/cf7-grading-spec-split
Jul 15, 2026
Merged

docs: split CF-7 test harness doc into grading spec / bug history / infra notes#57
hardcoreerik merged 17 commits into
masterfrom
docs/cf7-grading-spec-split

Conversation

@hardcoreerik

@hardcoreerik hardcoreerik commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Splits docs/CONTEXT_FABRIC_TEST_HARNESS.md (504 lines, mixed normative spec + bug-investigation narrative + fleet notes) into three purpose-specific docs, per a combined Grok + DeepSeek external review of the doc.
  • CONTEXT_FABRIC_GRADING_SPEC.md — current-state normative spec only: systems under test, corpus/held-out-split (exact stratified 20%-per-category breakdown pulled from the actual question-suite JSON, not transcribed from prose), a new Mermaid decision flowchart verified line-by-line against FabricAnswerVerifier.NormalizeAndVerify, the full citation_precision algebra (including two ambiguities neither review caught: the gate-level metric is a citation-weighted aggregate, not a mean of per-question scores, and abstention questions are invisible to it), and B4's true provenance (a structurally different, smaller CF-6 benchmark against a different corpus — not a 120-question CF-7 run, contrary to how it reads in the systems table).
  • CONTEXT_FABRIC_BUG_HISTORY.md — the KV-cache investigation narrative and change history, moved verbatim, section numbers (§7/§7a/§7b) preserved since existing code comments cite them directly.
  • CONTEXT_FABRIC_INFRASTRUCTURE_NOTES.md — fleet quirks plus a first-cut Known Model Compatibility table (Gemma-4: incompatible upstream; Llama-3.1-8B: confirmed working; qwen2.5-coder-7b: works, weaker capability; Qwen3.5-9B: works as of PR Fix NoKvSlot/OOM crash on recurrent-architecture models (Qwen3.5) #56).
  • Updated all 11 cross-references (6 code comments in AdapterManager.cs/LLamaSharpRuntime.cs/ModelAdmissionGate.cs/IRoleRuntime.cs/ModelAdmissionGateTests.cs, 5 docs/config files) — grep -r CONTEXT_FABRIC_TEST_HARNESS now returns only the intentional historical note in Bug History explaining the old filename's section numbers.

This is Phase 1 of 4 (doc hygiene only, no code changes). Phases 2–4 (graded gate metric, exhaustive-heuristic hardening, final compatibility-table cleanup) follow in separate PRs once this one is reviewed.

Test plan

  • dotnet build clean (comment-only changes in .cs files, verified no compile impact)
  • dotnet test --filter ModelAdmissionGate — 13/13 pass
  • grep -r CONTEXT_FABRIC_TEST_HARNESS — zero stray references (one intentional historical note remains, explained inline)
  • Every factual claim in the new Grading Spec (citation algebra, held-out split counts, B4 provenance) verified directly against current source/JSON in this session, not carried over from the old doc's prose

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Added a formal grading specification covering answer validation, evidence handling, scoring, recovery, thresholds, and known limitations.
    • Added historical records of scoring, infrastructure, and model-compatibility issues, including resolutions and rerun guidance.
    • Updated documentation navigation and cross-references to the new canonical resources.
    • Retired the previous test-harness documentation and updated related guidance and configuration references.
  • Diagnostics

    • Updated displayed admission diagnostics to link to the current troubleshooting documentation.

…tory, infra notes

The single 504-line doc mixed a normative grading specification with a
chronological bug-investigation log and fleet/environment notes, making
it hard for a reviewer to answer "how does this harness decide pass/fail"
without wading through disproved hypotheses. Split per external review
(Grok + DeepSeek combined critique):

- CONTEXT_FABRIC_GRADING_SPEC.md: current-state normative spec, with a new
  decision flowchart, the full citation_precision algebra (including the
  aggregate-vs-per-question-mean distinction and the abstention edge case,
  neither previously documented), the held-out split's exact stratified
  20%-per-category breakdown (pulled from the actual question-suite JSON,
  not transcribed), and B4's true provenance (a structurally different,
  smaller CF-6 benchmark, not a 120-question CF-7 run).
- CONTEXT_FABRIC_BUG_HISTORY.md: the KV-cache investigation narrative and
  change history, moved verbatim with section numbers preserved (existing
  code comments cite §7/§7a directly).
- CONTEXT_FABRIC_INFRASTRUCTURE_NOTES.md: fleet quirks plus a first-cut
  Known Model Compatibility table.

Updated all 11 cross-references (6 code comments, 5 docs/config).

Phase 1 of 4 (doc hygiene only, no code changes) addressing the combined
Grok+DeepSeek review of the CF-7 test harness documentation. Gate metrics,
exhaustive-heuristic hardening, and final compatibility-table cleanup are
Phases 2-4.
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hardcoreerik, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 77a1fd13-660e-4886-89c0-0d23ac8e6799

📥 Commits

Reviewing files that changed from the base of the PR and between 0135ab4 and 321a0c1.

📒 Files selected for processing (5)
  • OrchestratorIDE/Services/ContextFabric/ContextFabricContracts.cs
  • docs/CF_TEST_RESULTS.md
  • docs/CONTEXT_FABRIC_BUG_HISTORY.md
  • docs/CONTEXT_FABRIC_GRADING_SPEC.md
  • training_pit/foundry/configs/fabric_v0.json
📝 Walkthrough

Walkthrough

The PR retires the Context Fabric test-harness document, adds separate grading, bug-history, and infrastructure documentation, and updates related references in runtime diagnostics, tests, workflows, configuration, and existing documentation.

Changes

Context Fabric documentation migration

Layer / File(s) Summary
Canonical Context Fabric documents
docs/CONTEXT_FABRIC_*.md
Adds normative grading rules, historical CF-7 bug records, and infrastructure compatibility and rerun notes.
Documentation reference migration
docs/CF_*.md, docs/CONTEXT_FABRIC_BENCHMARK_MANIFEST.md, docs/README.md, .github/workflows/release.yml, training_pit/foundry/configs/fabric_v0.json
Replaces references to the retired test harness with the new grading specification and bug-history documents.
Runtime and admission diagnostics
OrchestratorIDE/Core/Runtime/*.cs, OrchestratorIDE.UnitTests/ModelAdmissionGateTests.cs
Updates diagnostic comments and Gemma 4 admission reason references without changing runtime gating or test behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • hardcoreerik/TheOrc#11: Overlaps in the Gemma 4 admission-gate area but changes logic and tests rather than documentation references.
  • hardcoreerik/TheOrc#40: Also touches InferUntilReadyAsync NoKvSlot handling, but changes retry behavior rather than comments.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Accurately summarizes the main change: the CF-7 test harness was split into grading, bug history, and infrastructure docs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/cf7-grading-spec-split

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

ContextFabricContracts.cs used the abbreviated form "CF_TEST_HARNESS.md",
which the original 11-file cross-reference sweep missed (it searched for
the exact full filename). Retargeted to CONTEXT_FABRIC_BUG_HISTORY.md §7,
consistent with every other §7 reference.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
docs/CONTEXT_FABRIC_BUG_HISTORY.md (1)

196-197: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Escape the issue number to avoid markdownlint warnings.

Starting a line with # triggers a markdownlint warning (MD018) for an ATX-style heading without a space. Escaping the hash will clear the warning and ensure it's rendered correctly as plain text across all markdown parsers.

💡 Proposed fix
-SequenceRecycleThreshold = 24). A follow-up finding (CodeRabbit review, PR
-#56): `StreamCompletionAsync`'s `StatelessExecutor` was reusing the same
+SequenceRecycleThreshold = 24). A follow-up finding (CodeRabbit review, PR
+\`#56`): `StreamCompletionAsync`'s `StatelessExecutor` was reusing the same
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/CONTEXT_FABRIC_BUG_HISTORY.md` around lines 196 - 197, Update the PR
reference in the documentation text near StreamCompletionAsync to escape the
hash character in “#56,” preventing it from being interpreted as a Markdown
heading while preserving the displayed issue reference.

Source: Linters/SAST tools

docs/CONTEXT_FABRIC_GRADING_SPEC.md (1)

224-224: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Specify a language for the fenced code blocks.

Adding a language identifier resolves markdownlint warnings (MD040) and ensures consistent rendering across markdown viewers.

  • docs/CONTEXT_FABRIC_GRADING_SPEC.md#L224-L224: Add text to the opening backticks (```text).
  • docs/CONTEXT_FABRIC_GRADING_SPEC.md#L257-L257: Add text to the opening backticks (```text).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/CONTEXT_FABRIC_GRADING_SPEC.md` at line 224, Specify the text language
on both fenced code blocks in docs/CONTEXT_FABRIC_GRADING_SPEC.md at lines
224-224 and 257-257 by changing each opening fence to use the text identifier.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/CONTEXT_FABRIC_BUG_HISTORY.md`:
- Around line 196-197: Update the PR reference in the documentation text near
StreamCompletionAsync to escape the hash character in “#56,” preventing it from
being interpreted as a Markdown heading while preserving the displayed issue
reference.

In `@docs/CONTEXT_FABRIC_GRADING_SPEC.md`:
- Line 224: Specify the text language on both fenced code blocks in
docs/CONTEXT_FABRIC_GRADING_SPEC.md at lines 224-224 and 257-257 by changing
each opening fence to use the text identifier.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7dcca0c4-3e1d-4c59-89ac-49f42c0462dd

📥 Commits

Reviewing files that changed from the base of the PR and between f37e275 and 0135ab4.

📒 Files selected for processing (15)
  • .github/workflows/release.yml
  • OrchestratorIDE.UnitTests/ModelAdmissionGateTests.cs
  • OrchestratorIDE/Core/Runtime/AdapterManager.cs
  • OrchestratorIDE/Core/Runtime/IRoleRuntime.cs
  • OrchestratorIDE/Core/Runtime/LLamaSharpRuntime.cs
  • OrchestratorIDE/Core/Runtime/ModelAdmissionGate.cs
  • docs/CF_RETRIEVAL_IMPROVEMENT_PLAN.md
  • docs/CF_TEST_RESULTS.md
  • docs/CONTEXT_FABRIC_BENCHMARK_MANIFEST.md
  • docs/CONTEXT_FABRIC_BUG_HISTORY.md
  • docs/CONTEXT_FABRIC_GRADING_SPEC.md
  • docs/CONTEXT_FABRIC_INFRASTRUCTURE_NOTES.md
  • docs/CONTEXT_FABRIC_TEST_HARNESS.md
  • docs/README.md
  • training_pit/foundry/configs/fabric_v0.json
💤 Files with no reviewable changes (1)
  • docs/CONTEXT_FABRIC_TEST_HARNESS.md

Escape #56 (MD018, avoids ATX-heading misparse) and add text language
identifiers to two fenced code blocks (MD040).
The flowchart incremented totalCitations on both the H->L "regardless of
outcome" edge and again inside the valid-citation node K, contradicting
the code (ContextFabricValidation.cs:908,925) where totalCitations
increments exactly once per non-null citation immediately after the null
check, and validCitations increments separately only on the fully-valid
path. Restructured so totalCitations++ happens on one edge (TC, gated only
by the null check) and validCitations++ happens only at the end of the
valid path (K), matching the source exactly.
…art (grok review)

Flowchart omitted two real verifier paths (ContextFabricValidation.cs:887-891,
897-898): a null claim item (skips that claim entirely) and exceeding
maxCitationsPerClaim (adds an error but does NOT skip citation processing,
unlike the empty-claim-text check which I'd also mis-modeled as terminal).
Re-verified the full 852-975 method line-by-line against this diagram
before pushing.
…ates (grok review)

Three inaccuracies (ContextFabricValidation.cs:935-957):
1. draftClaims.Count>0 (ERR11) is an independent, always-evaluated check
   under ExpectAbstention, not gated behind Abstained==true and the
   "does not establish" phrase passing.
2. The non-abstention branch's ExpectedTerm/ExpectedSegmentId checks always
   run regardless of the unexpected-abstention check's outcome -- not
   terminal on that error as previously drawn.
3. ExpectAbstention is evaluated once after the whole claims loop, not
   per-claim -- detached the node from the per-claim scope.

Also fixed the final PASS/FAIL convergence to be an unconditional fan-in
from every error node (matching the additive, non-short-circuiting nature
already described in the surrounding prose) rather than a malformed
multi-source conditional edge.
…ce scope (grok review)

Two more inaccuracies:
1. schemaVersion/answer-length/claim-count checks (ContextFabricValidation.cs:862-879)
   don't return/continue on failure -- they always fall through into claim
   processing, same pattern already correctly modeled for the per-claim
   checks. Gave them real forward edges and removed the now-duplicate
   direct-to-PASS edges for ERR/ERR2/ERR3/ERR4/ERR4c (they already flow
   forward, listing them in the final fan-in too created a contradictory
   two-destination edge).
2. groundedTrace (the ExpectedTerms match source) includes claim.Text, not
   just answer text and citation quotes (ContextFabricValidation.cs:948-950)
   -- updated both the flowchart node and §6.4 prose.
Carried over ~740 from the original doc without verifying against current
source; actual location is line 962. Also re-verified every other line
number citation in this doc against current source in this pass.
The link target was correctly retargeted to CONTEXT_FABRIC_BUG_HISTORY.md
in the Phase 1 commit, but the surrounding sentence still said "how the
harness itself grades answers" -- that's Grading Spec content, not what
Bug History §7/§7a (NoKvSlot investigation) actually covers. Split into
two sentences pointing at the correct doc each.
…eAnswer (grok review)

Section 5.3 described only the entity-scoped/category-wide unigram
classification, omitting the higher-precedence Tier 1c anchor-match path
(ContextFabricFeasibilityRunner.cs:1006-1015, landed per
CF_RETRIEVAL_IMPROVEMENT_PLAN.md §1c) that resolves hyphenated identifiers
via verbatim substring match before the unigram heuristic ever runs.
Also updated the "known limitation" note: Tier 1c already fixed the
specific ledger-01-vs-ledger-09 collision originally cited as the
motivating example; the residual heuristic risk now applies specifically
to the non-hyphenated-identifier fallback path.
§6.4 didn't specify that citation quotes feeding ExpectedTerm matching are
only from citations that already passed NormalizeCitation -- normalizedClaims
(the source of groundedTrace) is built from the `citations` list, which only
gets appended to at ContextFabricValidation.cs:927, after segment-exists and
quote-grounded checks pass. A hallucinated citation's quote text cannot be
used to satisfy an ExpectedTerm.
LoadHiveAcceptanceGate also fails closed on questions[].answerValidated
and stitchCases[].validated (or either array being empty), not just
passed/gateMode/readerNodeCount/verifiers -- ContextFabricBaselineRunner.cs:129-180.
…ity (grok review)

1. Section 5.1 claimed BuildEvidencePack "is the same evidence selection
   used by FabricNativeReaderService and HiveNativeRoleExecutorAdapter in
   the real product" -- carried over from the original doc without
   verification. Neither file references BuildEvidencePack; the actual
   product path is FabricAskService via the structurally separate
   EvidencePackBuilder.cs. Corrected to describe them as conceptually
   similar but independent implementations.
2. Section 5.2 claimed B2 uses "the same IDF-weighted, budget-fill approach
   as B3" -- also stale. B2 (BuildTopKText) scores whole segments with the
   stricter 3-char Tokenize and a plain 1/documentFrequency weight; B3
   (BuildEvidencePack) scores cards with TokenizeForScoring and ScoreTextIdf.
   Corrected with the actual algorithmic differences.
3. The flowchart's "all independent checks" edge label on the ERR9/ERR10/P
   fan-in into Q was ambiguous -- could be misread as claiming ERR10 fires
   independently of draft.Abstained, when the graph topology already
   correctly gates it behind O(Abstained)==yes. Reworded to only claim what
   the edge actually shows: Q runs regardless of which upstream path fired.
…ne, not plain IDF (grok review)

Section 5.1 described only the original Tier-0 IDF+budget-fill algorithm
from commit c68e01c. The current implementation (ContextFabricFeasibilityRunner.cs:661-830)
has accreted anchor/proximity-pair extraction, lexicographic AnchorScore-then-
TermScore ranking (not a single ScoreTextIdf call), coverage-aware greedy
fill, MultiHop-specific budget reservation, and a reference-chase pass --
the full retrieval-quality work tracked in CF_RETRIEVAL_IMPROVEMENT_PLAN.md.
Rewrote to describe the current 5-step pipeline accurately.

Also fixed the flowchart's node S label to say "a VALID citation's quote",
matching the already-corrected §6.4 prose (commit 86bbc74) that this
edge had drifted out of sync with.
…iew)

1. Section 5.2 claimed B3's TermScore comes from ScoreTextIdf; it doesn't --
   BuildEvidencePack inlines the same plain 1/documentFrequency formula B2
   uses. ScoreTextIdf is exclusive to BuildExhaustiveAnswer. Corrected to
   note the formulas are actually the same; the real B2/B3 gap is B3's
   additional AnchorScore/coverage-fill/MultiHop-budget/reference-chase
   layers B2 entirely lacks.
2. Section 5.1 combined anchor extraction and proximity-pair extraction
   into one "Tier 1a" step; CF_RETRIEVAL_IMPROVEMENT_PLAN.md marks
   ExtractProximityPairs as the later Tier 1.5. Split into separate
   numbered steps with correct tier labels, renumbering the rest of the list.
…rok review)

1. §5.2's "§5.1 steps 1-5" went stale when the prior commit renumbered
   §5.1 to 6 steps (Tier 1a/1.5 split).
2. fabric_v0.json's "capture point" comment pointed solely at
   CONTEXT_FABRIC_GRADING_SPEC.md, but "capture point" describes the whole
   run/capture infrastructure, not just the scoring rules -- added
   CONTEXT_FABRIC_BENCHMARK_MANIFEST.md (the run/capture recipe) alongside
   it.
…th claim (grok review)

§2's table still called B3 "the actual product answering path" after §5.1
was corrected to say BuildEvidencePack is a separate harness-only
implementation from the shipped product's FabricAskService/EvidencePackBuilder
path -- an internal contradiction between two sections of the same doc.
@hardcoreerik

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hardcoreerik
hardcoreerik merged commit 6622a38 into master Jul 15, 2026
2 checks passed
@hardcoreerik
hardcoreerik deleted the docs/cf7-grading-spec-split branch July 18, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant