Skip to content

fix(audit): merge --update-baseline results into the existing baseline#126

Merged
CybotTM merged 1 commit into
mainfrom
fix/update-baseline-merge
Jul 23, 2026
Merged

fix(audit): merge --update-baseline results into the existing baseline#126
CybotTM merged 1 commit into
mainfrom
fix/update-baseline-merge

Conversation

@CybotTM

@CybotTM CybotTM commented Jul 23, 2026

Copy link
Copy Markdown
Member

Fixes #125.

Root cause

cmd_update_baseline built a fresh empty UpstreamCache() (audit.py:1029), filled it with only the tools collected this run, and write_upstream_cache overwrote the whole file. Consequences:

  • A tool-scoped run (audit.py --update-baseline vault) replaced upstream_versions.json with just that one entry, dropping ~95 committed entries (observed in feat(catalog): add HashiCorp Vault #124).
  • Even in full runs, a transient collection failure silently deleted that tool's committed entry (the exception path never re-adds it).

Fix

Start from load_upstream_cache() and update only the entries collected this run — everything else survives. Follow-ups inside the same blast radius:

  • The ✓ Collected N versions summary counted the merged map size, which would have read "Collected 96" after collecting 1; it now reports successful collections as N/total.
  • UpstreamCache import removed from audit.py (orphaned by the fix; the other pre-existing F401s are untouched).

Side-effect note: a full --update-baseline run 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:

  • tool-scoped run preserves unrelated entries and updates the requested one
  • failed collection leaves the existing entry intact

Full suite 740 passed / 1 skipped, smoke test OK; flake8 findings on audit.py are the 3 pre-existing ones from main.

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>
Copilot AI review requested due to automatic review settings July 23, 2026 08:35
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM merged commit 299a90a into main Jul 23, 2026
6 of 7 checks passed
@CybotTM
CybotTM deleted the fix/update-baseline-merge branch July 23, 2026 08:52
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.

audit.py --update-baseline <tool> replaces the whole baseline instead of merging

2 participants