-
Notifications
You must be signed in to change notification settings - Fork 11
feat(doc-index): section-granularity inference, hashing, and caching fixes #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tkcoding
wants to merge
5
commits into
constructorfabric:main
Choose a base branch
from
tkcoding:jit-retrieval-cascade
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,019
−154
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
38020f1
feat(doc-index): infer real section granularity, hash sections for st…
e62c30f
fix(doc-index): resolve CodeRabbit review findings on PR #109
e3daf45
fix(doc-index): resolve second CodeRabbit review round on PR #109
5e46011
fix(doc-index,validate-toc): resolve CodeRabbit deep-review findings …
dc3c8d3
fix(test-doc-index): make new caplog assertions robust to suite ordering
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cfs doc-index --help never explains how section_level is inferred
Severity: Minor
Problem
cfs doc-indexpickssection_levelvia a frequency-based heuristic ininfer_section_level(): the heading level used most often wins, levels appearing exactly once are excluded as candidates, and ties (or an all-singletons document) fall back to the shallowest level. This choice directly determines which lines get grouped intoretrieval_sectionsin both JSON and human-readable output. None of this is mentioned anywhere a CLI user would see it.How to reproduce
Run
cfs doc-index --help(or read theargparse.ArgumentParserdescription incommands/doc_index.py). The description reads only: "Build or reuse a cached heading/section index for a Markdown file, so navigation reads the file's structure once, not once per query." No mention ofsection_level, how it's chosen, or that it can differ from the "obvious" chapter level in irregularly-leveled documents (the exact PDF-conversion scenarioinfer_section_level()'s own docstring cites as its motivating case).Expected behavior
A user seeing
"section_level": 5(say) instead of the level they expected should have a way, via--helpor the command's own output, to understand that the level was inferred from heading-frequency, not simply "H1/H2 is always the section level."Actual behavior
--helpgives no indication that section-level selection is heuristic at all.Impact
Minor UX/discoverability gap — doesn't cause incorrect behavior, but makes an already-nontrivial, silently-applied heuristic harder to audit or trust from the CLI alone.
Suggested correction
Extend the
argparse.ArgumentParser(description=...)incmd_doc_index()(or add a short note to_human_doc_index()'s output) with one sentence, e.g.: "section_levelis inferred from the most frequently repeated heading level (ties prefer the shallower level); a level used only once is never chosen."How to verify
Run
cfs doc-index --helpafter the fix and confirm the heuristic is described.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 8b80cd1: extended
cmd_doc_index'sargparsedescription with a one-sentence explanation of the heuristic (most-frequent heading level wins; a level used only once is never chosen). Regression test:test_help_explains_how_section_level_is_inferred.