Skip to content

fix: Query both ABS and vmpooler services to find all active VMs - #47

Merged
gavindidrichsen merged 13 commits into
mainfrom
fix-missing-vmpooler-vms
Jul 9, 2026
Merged

fix: Query both ABS and vmpooler services to find all active VMs#47
gavindidrichsen merged 13 commits into
mainfrom
fix-missing-vmpooler-vms

Conversation

@gavindidrichsen

@gavindidrichsen gavindidrichsen commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

The vmpooler provider had a visibility gap: it only queried ABS (floaty list --active), which filters by user but only shows jobs still in the ABS queue. When ABS reaps a job, the VMs disappear from the query even though they may still be running on vmpooler. This PR fixes that and adds supporting features:

  • Dual-service query (e7d3e28): Query both ABS and vmpooler services, merge results by hostname with deduplication
  • VM cache with TTL (494a1ae): File-based cache avoids repeated floaty+nmap queries; invalidates on VM TTL expiry or 24h age
  • Cache test isolation (f31a709): Stub VmCache in specs to avoid reading real cache files
  • TTL tracking + unavailable group (51a6df6): Enrich VMs with TTL from vmpooler lifetime/running fields; surface unreachable VMs in a dedicated unavailable group instead of silently dropping; add --refresh/-r CLI flag
  • ADR documentation (63d5120): ADR-0008 (dual-service query), ADR-0009 (caching), ADR-0010 (unavailable group)

Test plan

  • All rspec tests pass with updated specs covering TTL, unavailable group, and cache behavior
  • Live verification: binv --provider=vmpooler finds all active VMs including those no longer tracked by ABS
  • Reviewer: confirm with own vmpooler VMs if available

🤖 Generated with Claude Code

gavindidrichsen and others added 12 commits July 9, 2026 10:42
The ABS service only returns VMs from its own job tracking, missing VMs
from previous checkouts. Now also queries the vmpooler service directly
and merges results with deduplication by hostname.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cache vmpooler VM data locally (~/.bolt_dynamic_inventory/cache/) with
a 24-hour TTL so repeated inventory calls don't re-query ABS and
vmpooler services. Includes require 'time' fix that was crashing
iso8601 calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without these stubs, tests hit the on-disk cache from prior live runs,
bypassing the Open3 stubs entirely and causing all 14 vmpooler tests
to fail with unexpected nmap arguments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enrich VM data with TTL (time-to-live) calculated from vmpooler's
lifetime/running fields so users see when each VM will be reaped.
The merge logic now enriches ABS VMs with TTL from vmpooler data.

Add smart cache invalidation: if any cached VM's TTL has passed,
the cache is automatically refreshed. Add --refresh/-r CLI flag
for manual cache bypass.

Surface unreachable VMs in a dedicated 'unavailable' group instead
of silently dropping them, making connectivity issues visible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ADR-0008 (query both ABS and vmpooler services), ADR-0009
(cache with TTL-based invalidation), and ADR-0010 (surface
unavailable VMs instead of silently dropping). Update ADR-0006
with cross-references and refresh the docs README index.

ADR-0008 context corrected to accurately describe the ABS/vmpooler
visibility gap: ABS filters by user but only shows jobs still in
its queue; vmpooler filters by token and shows all VMs still alive
regardless of ABS state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix rubocop offenses in inventory.rb (use to_set block), vm_cache.rb
  (FileUtils.rm_f, class comment), and exe/binv (ternary for pluralization)
- Move cache directory from ~/.bolt_dynamic_inventory/cache/ to
  ~/.config/bolt_dynamic_inventory/cache/ (XDG convention)
- Add stderr warning in binv when unavailable VMs are present
- Update ADRs 0009 and 0010 to reflect cache path and warning behavior
- Regenerate .rubocop_todo.yml for current offense counts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move from flat cache/ dir to per-provider directories:
  ~/.config/bolt_dynamic_inventory/<provider>/cache.json
  ~/.config/bolt_dynamic_inventory/<provider>/inventory.yaml

The inventory.yaml is written on every generate call so users can
point Bolt at it directly without piping binv output. binv reports
the inventory path on stderr for vmpooler provider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The cache.json now shows `expires_in: "24 hours"` instead of
`ttl_seconds: 86400`, and the cached inventory.yaml gets `# created:`
and `# expires:` comment headers so users can tell at a glance when
the data was fetched and when it goes stale.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Gavin Didrichsen <gavin.didrichsen@gmail.com>
Signed-off-by: Gavin Didrichsen <gavin.didrichsen@gmail.com>
@gavindidrichsen
gavindidrichsen force-pushed the fix-missing-vmpooler-vms branch from 5f34c31 to 8a12399 Compare July 9, 2026 12:09
Signed-off-by: Gavin Didrichsen <gavin.didrichsen@gmail.com>
@gavindidrichsen
gavindidrichsen merged commit 010e99e into main Jul 9, 2026
1 check passed
@gavindidrichsen
gavindidrichsen deleted the fix-missing-vmpooler-vms branch July 9, 2026 12:15
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