Skip to content

Remove unused FetchCord 3.0 API that production no longer calls - #253

Draft
BlivionIaG wants to merge 1 commit into
masterfrom
cursor/delete-dead-fetchcord-api-f3ad
Draft

BlivionIaG wants to merge 1 commit into
masterfrom
cursor/delete-dead-fetchcord-api-f3ad

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Deletes FetchCord 3.0 rewrite code (from 5bbd936 / #229) that nothing in production calls or displays, plus tests that existed only to exercise that dead API. User-visible presence is unchanged. No new functions, flags, or files.

Every listed finding checked out. Nothing was dropped.

  • Fetch.fetch and Fetch._cache. Production reads snapshot() and the returned dict (__main__.py, scripts/validate.py). Removed test_fetch_missing_field_returns_not_found and the fetch.fetch asserts in test_fetch_snapshot_first_provider_wins (snapshot asserts kept).
  • FieldProvider.name and the name = assignments on the providers and test fakes. Nothing reads the attribute.
  • WAIT_INTERVAL_SECONDS, the ignored interval_duration parameter on Cycle.wait, and test_cycle_wait_with_interval. test_cycle_wait_returns_promptly_when_stopped still covers the early return.
  • run_command(..., shell=...) and test_run_command_with_shell. Production passes argument lists; exec_bash is the shell path. subprocess.run keeps its default shell=False.
  • Unreachable GPU branch in _format_module. parse_fastfetch_json already routes GPU through _format_gpu, which stays.
  • Orphan id tables fetch_cord/resources/desktop.json and windowmanager.json. get_infos callers and RESOURCE_FILES never load them. Package-data globs left as they are.
  • host: block in fetchcord_cmds.yml (the host cycle displays motherboard, resolution, and system type; the report has no host row) and the Darwin font entry whose command is true (prints nothing, so it never yields a value). Linux font still ends with || true, which is a shell fallback, not that entry.

The only docstring edits are the sentences on Fetch and Cycle.wait that named the deleted methods. No other comment or docstring cleanup.

Left alone

fetch_cord/native/Windows/host.py still fetches a host value into the snapshot on Windows. Nothing displays it. Left untouched because it belongs to another contributor; possible follow-up.

Explicitly out of this PR: the Windows system_type script, the provider list in scripts/validate.py, packaging (requirements.txt, black config, MANIFEST.in, Formula), and comment/docstring trims.

Proof

This environment has Python 3.12.3 (python is not on PATH; 3.12 is in the CI test matrix). Commands from .github/workflows/ci.yml:

python3 -m pip install -e ".[dev]" — succeeded.

$ ruff check .
All checks passed!

$ ruff format --check .
44 files already formatted

$ mypy fetch_cord tests
Success: no issues found in 36 source files

$ python3 -m pytest tests/ -q --cov=fetch_cord --cov-fail-under=80
197 passed, 3 skipped, 13 warnings in 1.47s
Required test coverage of 80% reached. Total coverage: 88.26%

rg after the deletion (no matches means the symbol is gone):

$ rg -n "WAIT_INTERVAL_SECONDS|interval_duration|desktop\.json|windowmanager\.json|test_run_command_with_shell|test_cycle_wait_with_interval|test_fetch_missing_field|_cache"
pyproject.toml:80:  | \.mypy_cache

That hit is the mypy cache exclude, not Fetch._cache.

$ rg -n "def fetch\(" fetch_cord/fetch.py
73:    def fetch(self, skip: set[str] | None = None) -> dict[str, str]: ...
84:    def fetch(self, skip: set[str] | None = None) -> dict[str, str]:
118:    def fetch(self, skip: set[str] | None = None) -> dict[str, str]:
154:    def fetch(self, skip: set[str] | None = None) -> dict[str, str]:

Those are the provider methods. Fetch.fetch(self, field) is gone. No fetch.fetch( calls remain.

$ rg -n "run_command\(" 
fetch_cord/tools.py:15:def run_command(command: list[str]) -> str:
fetch_cord/fetch.py:86:            raw = run_command(
scripts/validate.py:84:            run_command(
tests/test_fetch_cord.py:564:        result = run_command(["ls", "-la"])
tests/test_fetch_cord.py:729:            run_command(["fastfetch"])
tests/test_more.py:947:        self.assertEqual(run_command(["ls", "-la"]), "ls output")

No caller passes shell=. The remaining shell=True is exec_bash.

$ rg -n "module_type == \"GPU\"|_format_gpu" fetch_cord/info.py
51:def _format_gpu(result: dict[str, Any]) -> str:
102:        if module_type == "GPU":
103:            names = [name for name in (_format_gpu(item) for item in items) if name]

GPU formatting stays on the parse_fastfetch_json path. _format_module no longer has a GPU branch.

$ rg -n "get_infos\(" 
# cpus, gpus, os, terminal, shell, motherboards, system_types only

$ rg -n -A8 "^RESOURCE_FILES" fetch_cord/constants.py
# cpus.json, gpus.json, os.json, terminal.json, shell.json,
# motherboards.json, system_types.json

$ ls fetch_cord/resources/*.json
cpus.json  gpus.json  motherboards.json  os.json  shell.json  system_types.json  terminal.json

$ rg -n "^  host:" fetch_cord/resources/fetchcord_cmds.yml
# no matches

$ ls fetch_cord/native/Windows/host.py
fetch_cord/native/Windows/host.py
Open in Web Open in Cursor 

Drop Fetch.fetch and its cache, unread provider names, the ignored cycle wait interval, the unused run_command shell flag, an unreachable GPU formatter branch, orphan id tables, and command entries that never produce a displayed field.

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.

2 participants