fix(vet,debuglog): address review follow-ups on debug-capabilities#21
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up fixes from the branch-diff review of the
fas vet+FAS_LOGpayload-logging work (originally PR #18, since merged). Each fix has a regression test that fails under the prior behavior.High
gcarbitrary-delete footgun —gcnow removes only files matching the generated log-file name pattern (^\d{8}T\d{6}Z-[0-9a-f]{8}\.json$). PointingFAS_LOGat a directory holding unrelated*.json(e.g.package.json) no longer deletes them. (shortID's rand-failure fallback widened0000→00000000sogcstill matches whatClosewrites.)collectDiagErrorsrecurses intoerrors.Joinchildren and returns before the tree-descendingerrors.As, sofas vet --format json|sarifno longer emits the first diagnostic twice.Medium
inputfield was never populated (evaluatenow returns it;runrecords it).vetrejects stray positional arguments instead of silently validating the default dirs.vetroutes capability errors through the format-aware renderer and emits SARIF on success under--format sarif(was plainok:text).vetsuccess summary writes to stdout instead of theerrorfstderr-diagnostic helper; dropped the inert--colorflag fromvet.registerCommonFlagsshared byeval/explain/vet(was duplicated 3×).GC/LogFiles, dropped theDir()accessor.FAS_LOGpayload sensitivity (unredacted, 0600, may contain secrets) in the usage text.Tests
TestGC_PreservesForeignJSON,TestCollectDiagErrors_JoinNoDuplicate,TestRun_Vet_PositionalArg_ExitTwo,TestRun_Vet_FormatSARIF_EmitsSARIF, plus aninput-field assertion inTestRun_FasLog_WritesLogFile.Full suite +
gofmt/go vet/golangci-lintgreen via the pre-commit hooks.