Skip to content

fix(vet,debuglog): address review follow-ups on debug-capabilities#21

Merged
srnnkls merged 1 commit into
mainfrom
fix/vet-debuglog-review-followups
Jun 27, 2026
Merged

fix(vet,debuglog): address review follow-ups on debug-capabilities#21
srnnkls merged 1 commit into
mainfrom
fix/vet-debuglog-review-followups

Conversation

@srnnkls

@srnnkls srnnkls commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Follow-up fixes from the branch-diff review of the fas vet + FAS_LOG payload-logging work (originally PR #18, since merged). Each fix has a regression test that fails under the prior behavior.

High

  • gc arbitrary-delete footgungc now removes only files matching the generated log-file name pattern (^\d{8}T\d{6}Z-[0-9a-f]{8}\.json$). Pointing FAS_LOG at a directory holding unrelated *.json (e.g. package.json) no longer deletes them. (shortID's rand-failure fallback widened 000000000000 so gc still matches what Close writes.)
  • Duplicate diagnosticcollectDiagErrors recurses into errors.Join children and returns before the tree-descending errors.As, so fas vet --format json|sarif no longer emits the first diagnostic twice.

Medium

  • Record the preprocessed input envelope in the debug log — the advertised input field was never populated (evaluate now returns it; run records it).
  • vet rejects stray positional arguments instead of silently validating the default dirs.
  • vet routes capability errors through the format-aware renderer and emits SARIF on success under --format sarif (was plain ok: text).
  • vet success summary writes to stdout instead of the errorf stderr-diagnostic helper; dropped the inert --color flag from vet.
  • Extracted registerCommonFlags shared by eval/explain/vet (was duplicated 3×).
  • Unexported test-only GC/LogFiles, dropped the Dir() accessor.
  • Documented FAS_LOG payload sensitivity (unredacted, 0600, may contain secrets) in the usage text.

Tests

TestGC_PreservesForeignJSON, TestCollectDiagErrors_JoinNoDuplicate, TestRun_Vet_PositionalArg_ExitTwo, TestRun_Vet_FormatSARIF_EmitsSARIF, plus an input-field assertion in TestRun_FasLog_WritesLogFile.

Full suite + gofmt/go vet/golangci-lint green via the pre-commit hooks.

Post-merge fixes from the branch-diff review of the fas vet + FAS_LOG
payload-logging work.

debuglog:
- gc now removes only files matching the generated log-file name pattern
  (timestamp + 8 hex), so pointing FAS_LOG at a directory holding other
  *.json never deletes them (data-loss footgun).
- shortID rand-failure fallback widened to 8 chars so gc still matches it.
- unexport the test-only GC/LogFiles and drop the Dir() accessor; tests
  use the package-private forms.

cmd/fas:
- collectDiagErrors recurses into errors.Join children before the
  tree-descending errors.As, so `fas vet --format json|sarif` no longer
  duplicates the first diagnostic.
- record the preprocessed input envelope in the debug log (the advertised
  `input` field was never populated).
- vet rejects stray positional arguments instead of silently ignoring them.
- vet routes capability errors through the format-aware renderer and emits
  SARIF on success under --format sarif (was plain text).
- vet success summary writes to stdout instead of the errorf
  stderr-diagnostic helper; drop the inert --color flag from vet.
- extract registerCommonFlags shared by eval/explain/vet.
- document FAS_LOG payload sensitivity in the usage text.

Regression tests added for gc foreign-json preservation, the join
de-duplication, vet positional-arg rejection, and vet SARIF output.
@srnnkls
srnnkls merged commit f3230c4 into main Jun 27, 2026
5 checks passed
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