Skip to content

fix(callflow): mark compacted labels — non_ai_ silently renders as "ai" - #2510

Open
Tomaskobel wants to merge 1 commit into
Graphify-Labs:v8from
Tomaskobel:fix/callflow-label-truncation
Open

Tomaskobel wants to merge 1 commit into
Graphify-Labs:v8from
Tomaskobel:fix/callflow-label-truncation

Conversation

@Tomaskobel

@Tomaskobel Tomaskobel commented Aug 6, 2026 •

Copy link
Copy Markdown

Problem

humanize_label reduces a snake_case name to its last three words past 28 characters. It drops leading words — where negations live — and leaves no ellipsis to signal that anything was removed:

stored label rendered as
api_list_non_ai_email_templates ai email templates
api_update_non_ai_email_template ai email template
generate_non_ai_template_email ai template email
skip_company_content_too_short content too short

The first three drop non_, inverting the meaning. The fourth turns a skip condition into what reads as an assertion. Each reads as a complete, correct identifier — of a function that does the opposite. truncate_text appends ... when it cuts; this path does not.

Separately, the threshold is 28 while the render width applied on the next line is 42, so names of 29–42 characters are shortened even though they fit.

Fix

Two changes, deliberately narrow:

  1. Prefix compacted labels with an ellipsis, so they cannot be mistaken for whole names.
  2. Make the threshold a parameter, defaulting to the historical 28.

humanize_label feeds two surfaces with different constraints, which is why a single threshold cannot be right for both:

  • Mermaid node boxes (node_label) — width is scarce. Unchanged at 28. Measured on a 4,990-node graph: mean label width 24.3 → 25.6 chars, entirely from the ellipsis. No layout change.
  • Table cells (node_display_name → format_node_refs) — flowing HTML, width is not scarce. These now pass the 42-char render width, so 87 of 96 affected labels show their real name instead of a rewritten one.

The main table label column already uses the raw label, so it is unaffected.

Result

diagram box table cell
api_list_non_ai_email_templates() ...ai email templates() api_list_non_ai_email_templates()
skip_company_content_too_short() ...content too short() skip_company_content_too_short()

Meaning is no longer silently inverted on either surface, and diagram width is preserved.

Notes

  • Three regression tests; all three fail on v8 as-is (verified against a clean checkout, not a working-tree revert).
  • Full suite: 3,867 passing, failure set matches v8 (31 pre-existing, mostly test_terraform.py/test_skillgen.py). test_labeling.py::test_label_communities_batches_when_over_batch_size is flaky and fails intermittently on unpatched v8 too.
  • Rebased on 0.9.35.
  • Ellipsis written as ... to match truncate_text rather than ….
  • Tail-preserving compaction is kept; this changes only when it fires and makes it visible. If you would rather keep the head (api_list_non_ai...), that is a one-line change.

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR modifies the humanize_label function in graphify/callflow_html.py, which shortens snake_case identifiers for display. It raises the compaction threshold from 28 to 42 characters (to match the render width) and prepends a leading "..." to labels that do get shortened by dropping leading words. Two new tests are added covering that fitting-width labels are left unchanged and that compacted labels are prefixed with the ellipsis.

No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 371 functions depend on the 151 functions this change touches.

Health — grade A; 9 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):

  • _rebuild_code() — 87 callers, 51 callees (high)
  • dispatch_command() — 2 callers, 118 callees (high)
  • write_callflow_html() — 7 callers, 25 callees (high)
  • watch() — 5 callers, 6 callees (medium)
  • load_graph() — 3 callers, 7 callees (medium)
  • derive_sections_from_communities() — 3 callers, 6 callees (medium)
  • generate_section_flowchart() — 1 callers, 11 callees (medium)
  • generate_call_table_rows() — 1 callers, 6 callees (medium)
  • …and 1 more

Verification — 371 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: 241 function(s) in the blast radius were not formally verified this run

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR adjusts the humanize_label function in graphify/callflow_html.py so that snake_case identifiers are only compacted when they exceed 42 characters (up from 28), aligning the threshold with the render width, and prepends a "..." prefix when leading words are dropped. Two new tests in tests/test_callflow_html.py cover that labels fitting within the width are left unchanged and that compacted labels are marked as truncated.

No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 390 functions depend on the 164 functions this change touches.

Health — grade A; 9 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):

  • _rebuild_code() — 93 callers, 52 callees (high)
  • dispatch_command() — 2 callers, 118 callees (high)
  • write_callflow_html() — 7 callers, 25 callees (high)
  • load_graph() — 8 callers, 7 callees (high)
  • generate_call_table_rows() — 8 callers, 6 callees (high)
  • watch() — 5 callers, 6 callees (medium)
  • derive_sections_from_communities() — 3 callers, 6 callees (medium)
  • generate_section_flowchart() — 1 callers, 11 callees (medium)
  • …and 1 more

Verification — 390 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: 260 function(s) in the blast radius were not formally verified this run

@Tomaskobel
Tomaskobel force-pushed the fix/callflow-label-truncation branch from a6060cd to 51947d0 Compare August 6, 2026 19:12
@Tomaskobel Tomaskobel changed the title fix(callflow): stop truncating labels that already fit — non_ai renders as "ai" fix(callflow): mark compacted labels — non_ai_ silently renders as "ai" Aug 6, 2026

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR modifies humanize_label in graphify/callflow_html.py to add a configurable compact_over threshold parameter and to prepend a leading "..." when a long snake_case label is compacted down to its last three words. It updates node_display_name to pass compact_over=42 so table cells compact only at the render width rather than the default 28 used for Mermaid boxes. It also adds three tests covering the render-width behavior, the truncation ellipsis, and the unchanged diagram-width threshold.

No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 392 functions depend on the 166 functions this change touches.

Health — grade A; 9 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):

  • _rebuild_code() — 93 callers, 52 callees (high)
  • dispatch_command() — 2 callers, 118 callees (high)
  • write_callflow_html() — 7 callers, 25 callees (high)
  • load_graph() — 8 callers, 7 callees (high)
  • generate_call_table_rows() — 8 callers, 6 callees (high)
  • watch() — 5 callers, 6 callees (medium)
  • derive_sections_from_communities() — 3 callers, 6 callees (medium)
  • generate_section_flowchart() — 1 callers, 11 callees (medium)
  • …and 1 more

Verification — 392 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: 262 function(s) in the blast radius were not formally verified this run

… that fit

humanize_label reduces a snake_case name to its last three words past 28
characters. It drops *leading* words, which silently reverses meaning
when the head carries a negation, and leaves no ellipsis to signal that
anything was removed:

    api_list_non_ai_email_templates  -> "ai email templates"
    skip_company_content_too_short   -> "content too short"

Both read as complete, correct identifiers of a different function.
truncate_text appends '...' when it cuts; this path did not.

Prefix compacted labels with an ellipsis, and make the threshold a
parameter. Mermaid node boxes keep the historical 28 so diagram width is
unchanged (measured: mean 24.3 -> 25.6 chars, the ellipsis only). Table
cells are flowing HTML, not fixed-width boxes, so node_display_name
passes the 42-char render width -- 87 of 96 affected labels there were
being shortened despite fitting.

Three regression tests, all failing on v8 as-is.
@Tomaskobel
Tomaskobel force-pushed the fix/callflow-label-truncation branch from 51947d0 to c37f7c2 Compare August 9, 2026 18:29

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR modifies humanize_label in graphify/callflow_html.py to add a configurable compact_over threshold parameter (defaulting to the previous 28) and to prepend a leading "..." when a snake_case label is compacted to its last three words. It also updates node_display_name to pass compact_over=42 so table cells only compact labels that exceed the render width, while Mermaid boxes keep the original threshold. Three new tests are added covering table-cell labels that fit the render width, the leading-ellipsis marking on compacted labels, and the unchanged diagram-width behavior.

No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 402 functions depend on the 166 functions this change touches.

Health — grade A; 10 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):

  • _rebuild_code() — 93 callers, 51 callees (high)
  • dispatch_command() — 2 callers, 117 callees (high)
  • write_callflow_html() — 7 callers, 25 callees (high)
  • load_graph() — 8 callers, 7 callees (high)
  • generate_call_table_rows() — 8 callers, 6 callees (high)
  • watch() — 5 callers, 6 callees (medium)
  • derive_sections_from_communities() — 3 callers, 6 callees (medium)
  • generate_section_flowchart() — 1 callers, 11 callees (medium)
  • …and 2 more

Verification — 402 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: 262 function(s) in the blast radius were not formally verified this run

@Tomaskobel

Copy link
Copy Markdown
Author

Still reproducible on 0.9.45 — humanize_label compacts at 28 characters while truncate_text on the next line allows 42, and callflow_html.py is unchanged since this branch was cut.

No rush at all, and happy to reshape it if you'd prefer a different approach — e.g. keeping the head (api_list_non_ai...) rather than the tail, or leaving table cells alone entirely. Rebased on v8, CI green.

This branch has not been deployed

No deployments
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