Skip to content

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

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

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