Skip to content

The corpus counts AST nodes, not every dataclass - #76

Merged
rmichaelthomas merged 1 commit into
mainfrom
fix/corpus-counts-ast-nodes-only
Sep 12, 2026
Merged

rmichaelthomas merged 1 commit into
mainfrom
fix/corpus-counts-ast-nodes-only

Conversation

@rmichaelthomas

Copy link
Copy Markdown
Owner

node_kinds counted any dataclass it walked into.

ChooseBranch is a plain dataclass here — not an ASTNode subclass — and in TypeScript it is an interface with no kind field. Both implementations already agree it is a container rather than a node. Counting it was the one thing making them disagree:

TS:     [... "ChooseNode", "ConditionNode", ...]
Python: [... "ChooseBranch", "ChooseBranch", "ChooseNode", "ConditionNode", ...]

Two corpus cases failed in the port for a representation difference neither side considers meaningful.

An ASTNode subclass is a node; another dataclass is a container. The walk still recurses through both — only the counting is narrowed. Two results move, both choose if ... includes ....

Found on the first run of the node comparison against the port, which is the comparison doing its job in the other direction — on itself.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E6qcDj1e1dEYvc8jLnpGZy

`node_kinds` counted any dataclass it walked into. `ChooseBranch` is a
plain dataclass here — not an `ASTNode` subclass — and an interface with
no `kind` field in TypeScript. So both implementations already agree it
is a container rather than a node, and counting it was the one thing
making them disagree: two corpus cases failed in the port for a
representation difference neither side considers meaningful.

Recursion is unchanged; only the counting is narrowed. Two results move,
both `choose if ... includes ...`.

Found on the first run of the node comparison against the port, which is
the comparison doing its job — in the other direction, on itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E6qcDj1e1dEYvc8jLnpGZy
@rmichaelthomas
rmichaelthomas merged commit 1c4f90c into main Sep 12, 2026
3 checks passed
@rmichaelthomas
rmichaelthomas deleted the fix/corpus-counts-ast-nodes-only branch September 12, 2026 07:16
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