Skip to content

fix(codegraph): strip comments before parameterize alignment — found by the live v8 dry-run#100

Merged
QodeXcli merged 1 commit into
mainfrom
fix/v8-comment-alignment
Jul 2, 2026
Merged

fix(codegraph): strip comments before parameterize alignment — found by the live v8 dry-run#100
QodeXcli merged 1 commit into
mainfrom
fix/v8-comment-alignment

Conversation

@QodeXcli

@QodeXcli QodeXcli commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Live extract-helper (v8) dry-run on QodeX itself, as planned: 1,686 functions → 25 near-dupe clusters → VERIFIED-PR: blocked — dry-run: 0 candidate(s).

The block is the product working

Hand-inspection of every near-miss confirmed the declines are correct:

  • dedupeStr vs dedupe (99%) — behaviorally different (empty-string filtering)
  • isPrivateOrLocal ×2 (100%) — merged-if vs split-if: structurally divergent though equivalent
  • the 4-copy walkSource family — genuinely divergent shapes/filters → human-judgment territory (the existing task chip covers it)
  • the 5-copy path-helpers cluster — two families (1-arg / 2-arg) mixed; full-coverage rule refuses to half-consolidate

The bug the run caught

100%-similar pairs were declining as "structurally divergent" only because their comments tokenized differently. Fixed: stripComments() (string-literal-aware — // inside a string survives) runs before token alignment in proposeParameterizedHelper.

+1 regression test (comment-only diff aligns; string-embedded // preserved). ADOPTION.md gains the live dry-run story — run → receipt → refine guardrail → remaining blocks all correct. Full suite 1526 green, tsc clean.

…by the live v8 dry-run

Ran the extract-helper (v8) selection live against QodeX itself (1,686 functions → 25 near-dupe
clusters). Verdict: blocked — 0 qualifying clusters. Hand-inspection confirmed every decline was
CORRECT (dedupeStr vs dedupe differ on empty-string handling; the isPrivateOrLocal pair is
structurally divergent; walkSource is genuinely a 4-way divergent family; the path-helpers
cluster mixes two arg-shapes) — the conservative gate is doing its job.

But the run also exposed a real calibration bug: 100%-similar pairs were declining as
"structurally divergent" ONLY because their COMMENTS tokenized differently. Comments are
semantically irrelevant to alignment.

- helper-extract.ts: stripComments() (string-literal-aware — a // inside a string survives)
  applied before token alignment in proposeParameterizedHelper.
- Regression test: comment-only differences now align (params = the actual varying literal);
  a // inside a string is not eaten.
- ADOPTION.md: the live dry-run story — "a block worth reading": receipt, per-decline
  inspection, and the refine-the-guardrail loop.
@QodeXcli QodeXcli merged commit 2cbc4a3 into main Jul 2, 2026
2 checks passed
@QodeXcli QodeXcli deleted the fix/v8-comment-alignment branch July 2, 2026 01:55
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