Show HN: Canontra, deterministic semantic fingerprints for source code github.co...

@show

Show HN: Canontra, deterministic semantic fingerprints for source code github.com · 2 points · 0 comments · HN thread

TL;DR Canontra is an open-source Haskell command-line tool that computes deterministic semantic fingerprints for source code in Python, JavaScript, TypeScript, Go and Rust, so that formatting, comment, docstring and local-renaming changes do not count as program changes. The v0.3.0 release adds scope-aware alpha-canonicalization, algebraic normalization, control-flow canonicalization, type-contract normalization and a PR impact analysis command. The Show HN post has 2 points and no comments yet.

  • Produces layered fingerprints: raw source text (F0), structural AST (F1), declarations/public API (F2), dependencies (F3), call graph, control flow, data flow, type contracts (F_T), and a composite (F4).
  • Claims that renaming locals, reformatting, adding docstrings and reordering independent functions leave F1, F2, F3, F_T and F4 identical, while an operator change such as * to - is flagged as divergent.
  • Targets CI pipelines, monorepo test selection and PR review bots by letting builds skip rebuilding or retesting when only cosmetic changes occurred.
  • Written in pure Haskell with zero runtime dependencies and no network access; installable via cabal, stack, or one-line install scripts for Linux, macOS and Windows.
  • Commands include compare (exit codes 0 to 4), fp with JSON or hash output, diff, graph in DOT format, export to SARIF v2.1.0, a binary cache with CRC32 page checks, and impact analysis for PRs.
  • Licensed under Apache 2.0; the project is described as an open-source research project by Jash Thakkar and SymtraceLabs.

Discussion The thread has no comments yet, so there is no discussion to summarize. The post has only its initial 2-point score.

#showHN #haskell #codeAnalysis #buildSystems #semanticDiff #cli