Skip to content

check HEAD --signatures flags newly ADDED exported functions (should only flag modifications) #2674

Open

Description

@avengedsevenskull-ctrl

Summary

codegraph check HEAD reports [FAIL] signatures when an exported function is newly added (not modified). The predicate help text says "Assert no exported function/method/class declaration lines were modified" — additions are not modifications, yet they are flagged, and the run exits 1. This blocks additive-extension work.

Minimal repro

  1. In a tracked JS file, append a new exported function (no existing lines touched):
    export function brandNewThing(x) { return x; }
  2. codegraph build . --no-incremental
  3. codegraph check HEAD
    [PASS] cycles
    [FAIL] signatures
           brandNewThing (function) at <file>:NNN
    [PASS] boundaries
    3 predicates | 2 passed | 1 failed    (exit 1)
    

Observations (all reproduced)

  • Inserting the function before an existing export and appending at EOF both fail → not a line-offset artifact.
  • Declaring it as export const brandNewThing = (x) => x; is also classified function and flagged → no syntax workaround.
  • codegraph check HEAD --json reports the symbol with "passed": false; the symbol is absent at HEAD (e.g. git show HEAD:<file> | grep -c brandNewThing → 0) and has 0 transitive callers (codegraph fn-impact brandNewThing → 0).
  • Manifesto mode (codegraph check, no ref) exits 0.

Version

@optave/codegraph 3.17.0 (native engine unavailable → wasm). Report pointer: dist/features/check.js:439 (checkNoSignatureChanges) flags any changed range covering an exported def line without distinguishing add from modify.

Requested

Discriminate additions from modifications: only flag a symbol whose declaration exists at the base ref and changed at the same line/signature; treat symbols that are new at HEAD as non-violations. (Or add an explicit opt-out flag for additive changes.)

Activity

  1. avengedsevenskull-ctrl commented on Sep 30, 2026

    @avengedsevenskull-ctrl
    Author

    Opened PR #2677 for this: fix(check): don't flag newly-added exported functions as signature changes.

    • Implements the add-vs-modify discrimination using the already-parsed ParsedDiff.changedEdits — a pure insertion (empty removedText) means the declaration is new at the base ref, not modified.
    • Adds a regression test; tests/integration/check.test.ts → 61/61 pass, tsc clean, lint/commitlint pass.

    Refs, does not close — verification welcome.

  2. avengedsevenskull-ctrl commented on Sep 30, 2026

    @avengedsevenskull-ctrl
    Author

    Opened PR #2677 for this — fix(check): only flag modified exports whose name existed at the base ref.

    A declaration is now flagged only when a symbol of the same name appears in the file's removed lines (i.e. existed at the base ref). This covers both false-positive facets:

    • appends / pure insertions
    • renames and newly-exported names that share a hunk with removed text (register → registerPanel, etc.)

    Genuine same-name signature edits still flag. tests/integration/check.test.ts → 62/62 pass.

    Refs, does not close.

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