cleanup(serve): drop dead <=budget sub-branch in the overshoot notice (#2784)

The `if len(output) <= char_budget: return output` inside the cut_count==0
block sits within `if len(output) > char_budget`, so it can never be true.
Remove it and note why the branch is reached only when nodes fit but edges
overrun. Also adds the CHANGELOG entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
safishamsi
2026-08-17 15:41:59 +01:00
co-authored by Claude Opus 4.8
parent 7d01244a03
commit c44a6cf7f1
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -4,6 +4,7 @@ Full release notes with details on each version: [GitHub Releases](https://githu
## 0.9.46 (unreleased)
- Fix: a `graphify query` whose node set fits the budget but whose edges push the total over now prints an honest "complete answer over budget" notice with the real size, instead of silently returning a payload several times the requested budget (and no longer advises raising the budget, which was the exact trigger); edges are still never dropped from a complete answer (#2784, thanks @AromalBiju1).
- Fix: a `.gitignore`/`.graphifyignore` saved in a non-UTF-8 encoding no longer silently drops its rules (which let an explicitly-excluded directory get scanned anyway); the file is decoded UTF-8-first, then by a UTF-16 BOM, then the host codepage/latin-1, so the rule survives intact with a warning instead of being truncated (#2798, thanks @abhay-codes07).
- Fix: when node dedup merges two nodes, any hyperedge that listed the merged-away node as a member now rewires that member to the survivor instead of silently dropping it, so a grouping no longer loses participants on dedup (#2805, thanks @abhay-codes07).
- Fix: pruning a source file now also sweeps the external-import placeholder nodes it strands at degree 0, instead of leaving them to accumulate in the node count, `GRAPH_REPORT.md`, and exports; genuinely-isolated real nodes (which carry a `source_file`) are never touched (#2807, thanks @abhay-codes07).
+3 -2
View File
@@ -1097,8 +1097,9 @@ def _subgraph_to_text(G: nx.Graph, nodes: set[str], edges: list[tuple], token_bu
# real size instead of silence — still the complete, non-truncated
# answer, just an honest one.
if cut_count == 0:
if len(output) <= char_budget:
return output
# Reached only inside `len(output) > char_budget`, so every node
# fits but the full nodes+edges output does not: an honest
# over-budget notice, never a truncation.
total_edges = sum(1 for l in lines if l.startswith("EDGE "))
est_tokens = len(output) // 3
return (