-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
fix(query): emit the ranking it already computes — ANSWER block, camelCase sub-words, test demotion, honest truncation #3417
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
rek
wants to merge
2
commits into
Graphify-Labs:v8
Choose a base branch
from
rek:query-emit-the-ranking
base: v8
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,080
−42
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -763,6 +763,49 @@ def graph_has_legacy_ids(nodes: list, root: str | Path | None = None, sample: in | |
| return False | ||
|
|
||
|
|
||
| def legacy_id_collisions(nodes: list, root: str | Path | None = None) -> int: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
fans out to 7 callees (efferent coupling); 8 callers depend on it (afferent coupling). Grounded coupling-delta finding (deterministic), not an LLM guess. |
||
| """How many pre-#1504 node IDs are AMBIGUOUS — one id claimed by more than one | ||
| source file. This is the harm the new scheme exists to prevent; a legacy id | ||
| that no other file claims resolves to exactly the node it always did. | ||
|
|
||
| `graph_has_legacy_ids` answers "was this graph built by the old extractor", | ||
| which is true of any graph predating the change and stays true no matter how | ||
| harmless the old ids turn out to be. Read-only consumers were printing a | ||
| rebuild nudge on that answer alone, on every single query. Measured on a | ||
| 51k-node graph: 591 file nodes carried legacy ids and **none** of them | ||
| collided, so every query paid a warning for a hazard that had not occurred and | ||
| recommended a full re-extraction that would have changed nothing (#RANK1). | ||
|
|
||
| Callers should nudge on THIS being non-zero and stay quiet otherwise. | ||
| """ | ||
| from graphify.extractors.base import _file_stem | ||
| _r = str(root) if root is not None else None | ||
| claims: dict[str, set[str]] = {} | ||
| for node in nodes: | ||
| if not isinstance(node, dict): | ||
| continue | ||
| if str(node.get("source_location") or "") != "L1": | ||
| continue | ||
| if _has_global_id(node): | ||
| continue | ||
| nid = node.get("id") | ||
| sf = node.get("source_file") | ||
| if not nid or not isinstance(nid, str) or not sf: | ||
| continue | ||
| sf_norm = _norm_source_file(str(sf), _r) or str(sf) | ||
| rel = Path(sf_norm) | ||
| if _is_abs(sf_norm) or not rel.name: | ||
| continue | ||
| new_stem = make_id(_file_stem(rel)) | ||
| if not new_stem: | ||
| continue | ||
| norm = _normalize_id(nid) | ||
| if norm == new_stem or norm.startswith(new_stem + "_"): | ||
| continue # already path-qualified | ||
| claims.setdefault(norm, set()).add(str(sf)) | ||
| return sum(1 for files in claims.values() if len(files) > 1) | ||
|
|
||
|
|
||
| def _doc_twin_remap(nodes: list) -> dict[str, str]: | ||
| """Map a markdown quick-scan's bare doc node ``<slug>`` to the semantic | ||
| ``<slug>_doc`` node for the SAME file (#1799). | ||
|
|
||
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.
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.
legacy_id_collisions()fans out to 7 callees (efferent coupling); 8 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.