Skip to content

Tidy up: make generated definition identifiers collision-free (EsmRenderer.java) #202

Open

Description

@simbo1905

Sub-issue 23 of 26 from the 2026-11-21 bot-review-comment audit. Parent issue: #179 (Bot review comment tidy up).
Audited origin/main HEAD: 2e5cf37. Audit date: 2026-11-21.

== Finding 23 (verbatim from the audit findings file) ==

  1. PR Port jtd-esm-codegen onto the incubator main #169 — Definition identifiers can collide in generated ES modules.
    Author: chatgpt-codex-connector[bot], 2026-08-31. Comment: Port jtd-esm-codegen onto the incubator main #169 (comment)
    Source: jtd-esm-codegen/src/main/java/io/github/simbo1905/json/jtd/codegen/EsmRenderer.java:102. Current: jtd-esm-codegen/src/main/java/io/github/simbo1905/json/jtd/codegen/EsmRenderer.java:102 + 442-443 (toSafeName = replaceAll("[^a-zA-Z0-9_]", "_") only).
    Flagged: "When two valid definition names sanitize to the same value, such as a-b and a_b, both are emitted as validate_a_b. This produces duplicate top-level declarations... assign unique generated identifiers rather than relying only on character replacement".
    Still applies: toSafeName is still a pure char replacement with no uniqueness pass, so a-b/a_b definitions still emit the same function name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions