Skip to content

changed: classify edits by place and parameters, not by name - #1809

Merged
swapnilpaliwal-sd merged 1 commit into
0.1.9from
apps/javascript/declaration-diff-misclassifies-edits
Sep 30, 2026
Merged

swapnilpaliwal-sd merged 1 commit into
0.1.9from
apps/javascript/declaration-diff-misclassifies-edits

Conversation

@swapnilpaliwal-sd

@swapnilpaliwal-sd swapnilpaliwal-sd commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The per-declaration diff behind changed, test-impact and the edit hooks matched declarations by name and header text.

  • A method renamed in place (same parameters, no overload keeping them) is now signature old — renamed old → new, targeted at the old declaration and its callers. Before, it was removed old + added new.
  • JS/TS constructors are looked for as constructor(, not under the graph's <constructor> name. Before, every header edit was reported as removed + added S.constructor.
  • Parameters are parsed by bracket depth. A destructured parameter is one row per field, defaults are compared, and a { inside the parameter list no longer ends the header.
  • A function written inside another function's parameter list (a default value) is charged to the outer function. A file:line target that would resolve to a narrower callable on the same line falls back to the qualified name.
  • this.x = … counts as declaring field x, so a field that is still assigned is not reported removed.
  • A header that reappears word for word further down is reported as a move, not a signature change. When the graph already holds the new name, the old header is reported as renamed, not as a "return type".

Checked: new case javascript/edits-in-place (9 checks: 6 fail before the fix, all pass after). The rename checks in the python/java/csharp edit-targets-the-declaration-edited cases now require renamed X → Y. Case suites: JS 250/253, TS 176/181, Python 268/269, Java 304/304, C# 201/203; the failing checks are the same on the base branch. Engine JS suite 89/89. On the product: probes 47/70 on both builds, call edges 8960 = 8960, and a real rename gives the same 52 tests from the hook and the CLI.

  • Rebased on 0.1.9: one name helper, header_name(n, d, rel) (how a declaration is spelled), used by both the range diff and this change; the header-text reader is now declared_name(h, is_py).
  • Checked: 282/282 case checks (javascript + edit-targets in C#, Java, Python), edit_stale_spans 46/46, diff_verb ok; the new checks fail 9 of 28 on the base script.

Base automatically changed from apps/integration-0.1.9 to 0.1.9 September 30, 2026 06:47
@swapnilpaliwal-sd
swapnilpaliwal-sd force-pushed the apps/javascript/declaration-diff-misclassifies-edits branch from 9a149c5 to c224262 Compare September 30, 2026 07:31
…rs, not by its name

The per-declaration diff behind `changed`, test-impact and the edit hooks found a declaration's
new header by searching for its name, and read a parameter list with a regex. So:
- a method renamed in place was "removed old" + "added new";
- a JS/TS constructor (`<constructor>` in the graph, `constructor(` in the text) was never found
  again: every header edit came back as removed + "added S.constructor";
- a destructured parameter's `{` ended the header, and an arrow inside a default value took the
  edit ("signature millis");
- a `this.x = ...` field whose line moved was "removed" while still assigned;
- a graph holding the new name printed the old header's words as a "return type".

Now a header that became another name with the same parameters (and no overload keeps them) is
"renamed old → new", targeted at the old declaration; constructors are looked for as written;
parameters are parsed by bracket depth, destructured fields are one row each, defaults compared;
a function written inside another's parameter list is charged to that one; `this.x =` declares a
field; a header found word for word further down is a move, not a signature change.

A span whose header line was rewritten into a header of another name with the same parameters is
kept there when the graph already holds the new name (a refresh that raced the edit), and reported
as the rename.

Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
@swapnilpaliwal-sd
swapnilpaliwal-sd force-pushed the apps/javascript/declaration-diff-misclassifies-edits branch from c224262 to 7217619 Compare September 30, 2026 07:38
@swapnilpaliwal-sd
swapnilpaliwal-sd merged commit 48dfc54 into 0.1.9 Sep 30, 2026
12 checks passed
@swapnilpaliwal-sd
swapnilpaliwal-sd deleted the apps/javascript/declaration-diff-misclassifies-edits branch September 30, 2026 07:53
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