Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 01 Dec 01:10
· 38 commits to main since this release
454c308

The CI gate release: adopt n1scan in a project that already has N+1 queries
and fail only on the ones a change adds.

Added

  • --report FILE writes a versioned JSON document (n1scan/report/v1) or,
    for .md files, Markdown ready for a pull request comment. Findings have a
    stable id derived from the normalised query.
  • --baseline FILE compares a run with an earlier report; with --ci only
    findings that are not in the baseline fail. --update-baseline writes it.
    --fail-on new|worse|any, --fail-kinds and --allow-growth tune the gate.
  • n1scan diff BASE HEAD (--format text|md|json) compares two reports and
    refuses to call a result verified when the second run captured no queries,
    the commands differ or the command failed (exit status 2).
  • GitHub Action (uses: alex00010/n1scan@v0.2.0): downloads and checksums the
    release binary on Linux, macOS and Windows runners, writes the job summary
    and keeps one pull request comment up to date.
  • skills/n1scan/SKILL.md: a before/after/diff protocol for coding agents.
  • New finding kind batchable for INSERT/UPDATE/DELETE once per row. It is
    reported but does not fail --ci unless listed in --fail-kinds.
  • n1scan help; bench/vs-sql-tap with the benchmark script and results.
  • CI on Windows and macOS, a gofmt check, and a self-test of the action.

Changed

  • Values are redacted by default everywhere: string, number and
    dollar-quoted literals in SQL text, bound parameters and quoted parts of
    server errors become ? in the terminal, the live screen, JSON and reports.
    --show-values shows them again.
  • With --ci, a run in which no query went through the proxy now exits 2 and
    says so, instead of printing "no N+1 patterns found".
  • Only n+1 findings fail --ci by default (write loops used to).
  • Fingerprint format 1 is now frozen and recorded in reports. It differs from
    v0.1.0 in small ways: from (select, in (...) and values (...) keep
    their space, -1 and 1 share a shape, and = true / = false become ?.

Fixed

  • A loop of slow statements (each longer than --gap) was never reported,
    because the burst was closed while the next statement was still running.
  • Lookups in separate tests that each end with ROLLBACK were merged into
    one false N+1.
  • Unknown subcommands (n1scan demo, typos) silently started the proxy; they
    now print an error and exit 2.