Skip to content

Stub the drive scan the screenshot tool actually calls - #8

Open
owenpkent wants to merge 2 commits into
roadmap-trust-itemsfrom
screenshot-real-volumes
Open

owenpkent wants to merge 2 commits into
roadmap-trust-itemsfrom
screenshot-real-volumes

Conversation

@owenpkent

Copy link
Copy Markdown
Owner

Summary

tools/screenshots.py patched drives.list_volumes to keep real volumes out of the README images. The panel's scan was later rewritten around scan_batches, so that assignment stopped overriding anything and just created an unused attribute — silently. The real scan has been running on every render since.

Whether real drive labels and free space actually reached the committed PNGs came down to a race: _rebuild(VOLUMES) forces the invented list in, but the scan delivers local drives first and network shares seconds later, overwriting it. I hit exactly that while regenerating — one render came out with my real volumes, including an SMB share's label and capacity.

The currently committed images are clean; this is about the next person to run the tool.

What changed

  • Stub drives.scan_batches — the funnel every scan goes through — and yield a single final batch, so there is no second delivery to race the first.
  • SystemExit if that name is ever missing too, rather than quietly handing the panel back to the machine.
  • assert_no_real_volumes() before each picture, reading the labels actually on screen. That is the part that survives the next rewrite of the scan; patching a function name did not.

Committed images are untouched by this PR — it changes the tool, not the output.

Test plan

  • ruff check tools clean
  • python tools/screenshots.py OUT renders all three images, exit 0, only invented volumes
  • Guard fires: with drives.scan_batches deleted the run aborts with the explanatory message instead of rendering
  • Three consecutive runs stay clean

The screenshot tool assigned `drives.list_volumes`. That was the panel's
scan until it was rewritten around `scan_batches`, after which the
assignment created a new unused attribute instead of overriding anything,
and nothing said so. The real scan then ran on every render: whether real
drive labels and free space reached the PNGs came down to which write
landed last, since the network batch arrives seconds after the local one.

Patch the funnel every scan goes through, exit non-zero if that name ever
disappears too, and assert before each picture that only the invented
volumes are on screen — a check that reads the panel rather than trusting
a monkeypatch, so the next rewrite of the scan cannot silently undo it.
The failure being guarded against was a patch that silently stopped
patching, so a guard with no test of its own is the same shape of risk.

Covers both halves: that the stub replaces the function the panel actually
calls and yields a single final batch, leaving nothing to race; and that a
missing — or merely non-callable — target stops the run instead of handing
the panel back to the machine. The check itself is tested against a leaked
network-share label, against several, and against an empty panel, which is
the state before the first batch arrives and must not read as a leak.

@owenpkent owenpkent left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed the screenshot scan replacement and the pre-capture guard against the actual drive-panel path. No actionable defect found in this diff.

The stub now replaces the callable that _ScanTask consumes, refuses to continue if that callable disappears, and emits one final synthetic batch so a delayed network batch cannot overwrite the invented volumes. The guard is checked before both main-window captures, which matters because the watcher polls between captures.

Validation: 8 targeted tests passed on this head; the base/head diff passed git diff --check. No interactive screenshot session was launched for this review. The label-only guard is narrower than a complete comparison of displayed volume rows, but the current scan stub itself is correctly connected.

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