Skip to content

report: count an all-file-node community as thin, not invisible (#3548) - #3549

Open
ayushcodes10 wants to merge 2 commits into
Graphify-Labs:v8from
ayushcodes10:fix-3548-thin-community-undercount
Open

ayushcodes10 wants to merge 2 commits into
Graphify-Labs:v8from
ayushcodes10:fix-3548-thin-community-undercount

Conversation

@ayushcodes10

Copy link
Copy Markdown
Contributor

Summary

Fixes #3548. The issue's own reported repro (shown_count overstating the number of rendered ### Community sections by counting all-file-node communities as shown) turned out to already be fixed on current v8 by #3148/#2129shown_count is now computed directly from the render condition rather than total - thin. But that earlier fix left a residual gap this issue's own invariant check still catches: the thin count kept a 0 < guard excluding all-file-node (zero-real-node) communities, so those communities — which the render loop skips for exactly the same reason as a genuinely thin one — went uncounted anywhere in the report. shown + thin no longer summed to the total community count, and the "N thin communities omitted" figure undercounted what was actually omitted.

Reproduced directly: a 3-community graph (one large, one genuinely thin, one all-file-node) reported "(1 shown, 1 thin omitted)" for 3 total communities — 1 + 1 = 2 ≠ 3. Both counting sites (thin_count_summary in the Summary section, thin_communities in the Knowledge Gaps section) drop the 0 < guard, exactly matching the issue's own suggested patch, applied against the current (already-partially-fixed) code shape rather than the older len(communities) - thin_count_summary form the issue was written against.

Test plan

  • Three existing tests in tests/test_report_gap_thresholds.py pinned the old, undercounting figures — one explicitly, in its own docstring, asserting the exact shape this PR corrects. Updated all three to the now-correct counts, verified by hand against a direct generate() call before updating the assertions.
  • Added a new test asserting the two invariants the issue itself suggested as a regression check (shown == rendered, shown + thin == total) at both thresholds already exercised in this file.
  • Verified all 4 updated/new tests fail against the pre-fix code and pass with the fix.
  • Full suite: python3 -m pytest -q — 5487 passed, only the pre-existing unrelated failures (test_ollama_retry_cap.py missing openai in this env, one flaky timing assertion in test_ts_import_type_arguments.py).
  • python3 -m tools.skillgen --check — OK.

Note: the issue's separate "second, smaller issue" (the Knowledge Gaps section's hardcoded < 3 threshold disagreeing with min_community_size) was also already fixed on current v8 by #3148 — confirmed the code already reads min_community_size there, not a hardcoded 3.

🤖 Generated with Claude Code

https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh

ayushcodes10 and others added 2 commits September 14, 2026 14:04
Number 3148 fixed shown to be computed directly instead of total
minus thin, since the old formula counted a community with zero real
nodes as shown even though the render loop skips it. That fix left
thin itself under a zero real guard from before it, so a zero real
community was excluded from both figures at once and went uncounted
anywhere the report prints about itself, and shown plus thin no
longer summed to the total community count. Both counting sites drop
that guard so a community the render loop skips for having too few
real nodes, zero included, is now always reflected in the thin
figure next to it. Fixes Graphify-Labs#3548.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
Three existing tests pinned the old, undercounting behavior directly,
including one whose own docstring asserted the exact shape this fix
corrects. Updates all three to the now correct figures and adds a
dedicated test asserting the two invariants the issue itself
suggested, shown equals what actually renders and shown plus thin
equals the total, at both thresholds already exercised in this file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Formal verification. No changes could be formally verified in this run.


Graphify review — findings

Counts a zero-real-node (all-file) community as "thin" in generate, dropping the earlier 0 < guard from both thin_count_summary and thin_communities so a community the render loop skips is no longer omitted from every tally. This restores the shown + thin == len(communities) invariant, at the cost that any all-file community now shows as thin at every positive min_community_size. Tests assert the invariant and matching render count at thresholds 3 and 5.

Worth a look

  • Thin/shown counts use a different file-node predicate than the render filtergraphify/report.py:175 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 353 functions depend on the 21 functions this change touches.

Health — this change adds coupling hotspots:

  • new: _rebuild_code() — 116 callers, 51 callees
  • new: dispatch_command() — 2 callers, 124 callees
  • new: generate() — 34 callers, 7 callees
  • new: run_pipeline() — 8 callers, 13 callees
  • new: watch() — 5 callers, 7 callees
  • new: load_learning_for_report() — 4 callers, 3 callees
  • new: test_report_shows_avg_confidence_for_inferred() — 0 callers, 7 callees
  • new: test_poisoned_manifest_is_healed() — 0 callers, 6 callees
  • …and 1 more — each is listed as a finding

Verification — 353 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 178 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

6 of 275 test file(s) selected (2%) via static blast radius.

  • tests/test_confidence.py — impact
  • tests/test_hypergraph.py — impact
  • tests/test_pipeline.py — impact
  • tests/test_report.py — impact
  • tests/test_report_gap_thresholds.py — impact, changed-test
  • tests/test_semantic_similarity.py — impact

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

Could not verify: Could not verify generate.

The verifier did not have enough to check generate, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: not verifiable: all 200 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly ValueError — names the real obstacle, not a sampling gap)

· 9 more finding(s) on lines outside this diff (see the check run).

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.

GRAPH_REPORT.md counts more communities as "shown" than it renders

1 participant