Skip to content

fix: harden fingerprint, const resolve, and version parse - #5

Closed
Pieczasz wants to merge 2 commits into
mainfrom
cursor/go-quality-audit-8703
Closed

Pieczasz wants to merge 2 commits into
mainfrom
cursor/go-quality-audit-8703

Conversation

@Pieczasz

Copy link
Copy Markdown
Collaborator

Summary

Correctness hardening from a Go quality audit (no new features):

  1. Fingerprint field-boundary collision — finding.Fingerprint used |-joined fields, so file="a|b", symbol="c" collided with file="a", symbol="b|c". Now length-prefixes fields. Baseline version bumped to 2; regenerate with --baseline-write (v1 files are rejected).
  2. Go const carry-forward — engine/resolve.analyzeGo missed string consts whose expression list was omitted (Go reuses the previous list). Label names in those specs now resolve.
  3. ast-grep version suffixes — parseVersion used Atoi on tokens like 1-rc.1, which became 0. Now takes the leading integer so pre-release builds still compare correctly.

Also adds fuzz targets (Fingerprint, versionAtLeast, Analyze) and benchmarks for the touched paths.

Test plan

  • go test -race -shuffle=on ./...
  • go vet ./...
  • golangci-lint run ./finding/... ./engine/resolve/... ./engine/pattern/...
  • go test -fuzz=FuzzFingerprintFieldBoundaries -fuzztime=5s ./finding
  • go test -fuzz=FuzzVersionAtLeast -fuzztime=3s ./engine/pattern
  • go test -fuzz=FuzzAnalyzeGo -fuzztime=5s ./engine/resolve
  • go test -bench=. -benchtime=50ms ./finding ./engine/resolve

Note for adopters: existing tarsier-baseline.json files (version 1) must be rewritten with tarsier scan --baseline-write ....

Pieczasz and others added 2 commits September 18, 2026 21:14
Length-prefix finding fingerprints so field boundaries cannot collide,
bump baseline to v2 (regenerate with --baseline-write), carry Go const
expression lists across omitted specs, and parse leading ints in
ast-grep versions so pre-release suffixes do not become 0.

Add fuzz targets and benchmarks for the touched paths.

Co-authored-by: Bartłomiej Piekarz <Pieczasz@users.noreply.github.com>
Tool is still beta, so length-prefixed fingerprints stay on
baselineVersion 1 (no forced regenerate). Break newScanCommand into
opts/engine helpers and split multi-lang resolve into per-language files.

Co-authored-by: Bartłomiej Piekarz <Pieczasz@users.noreply.github.com>
@Pieczasz

Copy link
Copy Markdown
Collaborator Author

Leaving open as a non-trivial draft (dirty vs main; fingerprint v2 + resolve/version changes). Not merging as part of the tarsier-internal hygiene pass focused on internal #45/#29.

@Pieczasz

Copy link
Copy Markdown
Collaborator Author

Closing as stale/superseded hygiene cleanup. Work is on main or abandoned; do not land from this tip.

@Pieczasz Pieczasz closed this Sep 28, 2026
@Pieczasz

Copy link
Copy Markdown
Collaborator Author

Hygiene pass: rebased onto current main, kept fingerprint length-prefix + baseline v2 (v1 files rejected), Go const carry-forward, leadingInt version parse, fuzz/bench, and resolve package split. Dropped the stale scanOpts refactor so TAR-47 check helpers (normalizeEngine / flagString / ensurePatternRules) stay intact.

Local: go test -race -count=1 ./... green with ast-grep 0.45.1. Will squash-merge when CI is green.

@Pieczasz

Copy link
Copy Markdown
Collaborator Author

Incorrectly closed: the quality-audit commits were not on main. Restored as a new PR from the rebased tip (cursor/pr5-quality-audit-merge-65ed) — see follow-up PR. Force-push on this head prevented reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant