Skip to content

Add --dry-run - #244

Merged
BlivionIaG merged 2 commits into
fetchcord:masterfrom
nyannoying1337:feat/dry-run
Sep 11, 2026
Merged

BlivionIaG merged 2 commits into
fetchcord:masterfrom
nyannoying1337:feat/dry-run

Conversation

@nyannoying1337

Copy link
Copy Markdown
Contributor

From the Discord list.

Prints the detected fields and the exact payload each cycle would send, then exits without connecting to Discord. "Why is my GPU not showing" goes from a back-and-forth to a paste.

On the refactor in here: a dry run is only worth anything if it builds what the real loop builds, and the payload mapping was already written out twice - once inline in the main loop, once in scripts/validate.py. They had already drifted (validate.py uses time.time() where the loop uses psutil.boot_time()). Rather than add a third copy, this pulls the mapping into one resolve_cycle() in presence.py that the loop, --dry-run and validate.py all go through. Cycle.update keeps its signature, so nothing about the sending path changes.

Output on my Windows 10 box, trimmed:

=== Would send ===

cycle: hardware  client_id=741099939198926920
  state        'Intel(R) Arc(TM) B580 Graphics'
  details      '15,66 GB / 63,69 GB'
  large_image  'big'
  large_text   '13th Gen Intel(R) Core(TM) i5-13600K'
  small_image  'intel'
  small_text   'Intel(R) Arc(TM) B580 Graphics'

Worth saying what that output is already good for: on this machine one --dry-run shows the resolution field carrying a PowerShell error string (#235), the os and host cycles sending small_image 'unknown' with small_text 'Not Found' (#242), and the host line reading as a bare vendor (#243). Three separate reports that currently take three separate round trips.

There's a test that it never constructs a Presence - being safe to run with Discord closed is the whole point.

Light overlap with #242, which also touches presence.py (different function). Whichever lands first, I'll rebase the other.

Prints the detected fields and the exact payload each cycle would send,
then exits without connecting to Discord. "Why is my GPU not showing" goes
from a back-and-forth to a paste.

A dry run is only worth anything if it builds what the real loop builds,
and the payload mapping was written out twice already - once inline in the
main loop, once in scripts/validate.py, and they had already drifted
(validate.py uses time.time() where the loop uses psutil.boot_time()).
So this pulls the mapping into one resolve_cycle() in presence.py that the
loop, --dry-run and validate.py all go through. Cycle.update keeps its
signature, so nothing about the sending path changes.

Output on my Windows 10 box, lightly trimmed:

    === Would send ===

    cycle: hardware  client_id=741099939198926920
      state        'Intel(R) Arc(TM) B580 Graphics'
      details      '15,66 GB / 63,69 GB'
      large_image  'big'
      large_text   '13th Gen Intel(R) Core(TM) i5-13600K'
      small_image  'intel'
      small_text   'Intel(R) Arc(TM) B580 Graphics'

Worth saying what that output is already good for: on this machine one
--dry-run shows the resolution field carrying a PowerShell error string,
the os and host cycles sending small_image 'unknown' with small_text
'Not Found', and the host line reading as a bare vendor. Three separate
reports that currently need three separate round trips.

Tested that it never constructs a Presence, since being safe to run with
Discord closed is the whole point.
Three combinations rather than either side winning:

- args.py: keep master's --install-startup group and add --dry-run after it.
- presence.py: resolve_cycle/ResolvedCycle sit alongside master's placeholder
  handling in build_presence_activity, so a dry run shows exactly what the
  loop would send - tooltip dropping included.
- __main__.py: the loop keeps master's snapshot-once-per-rotation hoist and
  reads it through _resolve(), so both the perf fix and the shared
  resolution survive.

get_component_id moved out of __main__ into presence.resolve_cycle, so the
snapshot-once test now patches it where it lives.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WB6HG4WLukGEjhcq8FZJ7A
@BlivionIaG
BlivionIaG merged commit 738facb into fetchcord:master Sep 11, 2026
12 checks passed
cursor Bot pushed a commit to nyannoying1337/FetchCord that referenced this pull request Sep 11, 2026
Resolve conflicts with fetchcord#244 (--dry-run) by keeping both features:
pause_when and dry-run are adjacent additions to args, __main__, and tests.
Also point the pause loop test at presence.get_component_id after the
resolve_cycle refactor on master.

Co-authored-by: BlivionIaG <BlivionIaG@users.noreply.github.com>
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.

3 participants