fix(audit): merge --update-baseline results into the existing baseline#126
Merged
Conversation
cmd_update_baseline started from an empty UpstreamCache, so a tool-scoped
run ('audit.py --update-baseline vault') rewrote upstream_versions.json
with only the requested tool, dropping every other committed entry. A
transient collection failure likewise deleted that tool's entry even in
full runs.
Load the existing baseline and update only the collected entries. The
'Collected N versions' summary now counts this run's successful
collections instead of the merged map size. The orphaned UpstreamCache
import is removed.
Fixes #125
Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
|
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.



Fixes #125.
Root cause
cmd_update_baselinebuilt a fresh emptyUpstreamCache()(audit.py:1029), filled it with only the tools collected this run, andwrite_upstream_cacheoverwrote the whole file. Consequences:audit.py --update-baseline vault) replacedupstream_versions.jsonwith just that one entry, dropping ~95 committed entries (observed in feat(catalog): add HashiCorp Vault #124).Fix
Start from
load_upstream_cache()and update only the entries collected this run — everything else survives. Follow-ups inside the same blast radius:✓ Collected N versionssummary counted the merged map size, which would have read "Collected 96" after collecting 1; it now reports successful collections asN/total.UpstreamCacheimport removed fromaudit.py(orphaned by the fix; the other pre-existing F401s are untouched).Side-effect note: a full
--update-baselinerun no longer prunes entries for tools removed from the catalog — stale entries are removed by editing the committed file, which review covers.Tests
TestUpdateBaselineMerges(tests/test_update_fixes.py) — written red against the unfixed code:Full suite 740 passed / 1 skipped, smoke test OK; flake8 findings on
audit.pyare the 3 pre-existing ones frommain.