Skip to content

tools: the README card scripts name a picture argument that came out empty - #3345

Merged
Gathin23 merged 2 commits into
Gathin23:mainfrom
xbsheng:tools/card-empty-picture-name
Nov 6, 2026
Merged

Gathin23 merged 2 commits into
Gathin23:mainfrom
xbsheng:tools/card-empty-picture-name

Conversation

@xbsheng

@xbsheng xbsheng commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Tested on: no TV — the card scripts and their tests only; nothing here talks to a TV.

The three scripts that draw the README card answered a picture argument that came out empty with a sentence that names nothing:

$ tools/venv/bin/python tools/readme_stats.py launcher/app/src/main/res/font/outfit.ttf ""
 has no extension, so the format to write is unknown: pass a name ending in .png. Nothing was written.

out_problem() judged a folder, a folder that is not there, a path through a file and a suffixless name, so "" (what "$OUT" gives with OUT unset, the way a reader runs these by hand) fell through to the extension branch. The message starts with a space, names no argument, and does not say where the name came from. tools/screendiff.py already answers this shape — --out was given as '', an empty name ... if the name came from a shell variable, that variable was empty — and these three scripts take the same line, judged in out_problem() before anything is read or Pillow is imported.

The same shape was invisible to tests/test_card_out_path.py: assert_refused() asks whether the path it passed is in the message, and str("") is in every string, so an empty name passed any wording at all. The new test asks for the argument in repr and covers "" and " " on all three scripts; the module docstring records why the helper could not catch it.

$ tools/venv/bin/python tools/readme_featured.py launcher/app/src/main/res/font/outfit.ttf ""
the picture was given as '', an empty name, so no picture would be written: name the file, e.g.
docs/featured.png - and if the name came from a shell variable, that variable was empty. Nothing was written.

Counter-proof: tests/test_card_out_path.py from this branch, in a worktree at fc148d5a (origin/main), fails six ways — AssertionError: "' '" not found in ' has no extension, ...' : readme_card.py does not name the picture argument it was given; on the branch all 10 tests pass. The four shapes that already answered keep their wording and their status, and the real-picture test still writes its PNG/JPEG with Pillow present.

  • tools/readme_stats.py, tools/readme_featured.py, tools/readme_card.py: the empty-name branch, its docstring sentence and the comment above the guard; exit statuses unchanged (1, as the other shapes answer).
  • tests/test_card_out_path.py: one test, two names × three scripts, and the docstring paragraph above.
  • +61 −3 in 4 files. No package line, list, tv.json, PROMPT.md, disable.sh/check.py/restore.sh, Home guard, .github/ or launcher/ file; no new file, no binary.

CLEANYOURTV_STRICT=1 tools/venv/bin/python -m unittest discover -s tests → 2936 OK (skipped=27), which is origin/main fc148d5a's 2935 plus this test; python3 -I tools/gen_tables.py --check exit 0; no shell changed.

If this adds or changes a TV list

  • N/A — no list touched.

If this touches the launcher

  • N/A — nothing under launcher/ changed.

If this adds or changes a theme

  • N/A.

If this adds a theme key (a switch)

  • N/A.

If this adds an add-on

  • N/A.

Self-check: no red line in POLICY — tools/ argument handling only, no install restriction, no root, no uninstall, no launcher network, no default changed for any TV; one topic (the picture argument of the three card scripts); duplicate check: no open PR touches tools/readme_stats.py, tools/readme_featured.py, tools/readme_card.py or tests/test_card_out_path.py except #2569 and #2545, whose single hunk in readme_stats.py is the STATS line (@@ -71,7 +71,7 @@), so no shared line; Tested on says no TV because no TV is involved.

…empty

out_problem() judged a folder, a folder that is not there, a path through a file and a suffixless
name, so a name that came out empty fell through to the extension branch and answered

     has no extension, so the format to write is unknown: pass a name ending in .png

a sentence that starts with a space and names no argument at all. tools/screendiff.py already answers
this shape with the value in repr and the shell variable that was probably empty, so the three card
scripts do the same, before anything is read. Exit statuses are unchanged.
assert_refused() looks for the picture path in the message, and the empty string is in every string,
so that helper could not catch this shape. The empty and blank names ask for the argument in repr
instead, over all three scripts, and the module docstring records why the helper missed it.
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

maintainer-bot review · suggests merge (p3)

Thanks for spotting that str("") is in every string, which is why the old test could never catch this empty-name message. This small fix with its tests looks ready to merge, in line with the earlier card-script fixes.

Checks
  • Size: size/M (+61 -3, 4 files)

This is a suggestion; a maintainer makes the final call. A maintainer can comment /bot review to run it again.

Reviewed by maintainer-bot · runs on 0G Private Computer

@github-actions github-actions Bot added bot-suggests:merge p3 scripts build-and-install, disable, restore, tv.py and the other tools labels Nov 5, 2026
@Gathin23
Gathin23 merged commit b728cc8 into Gathin23:main Nov 6, 2026
4 checks passed
@Gathin23

Gathin23 commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Thanks @xbsheng, the three README card scripts now name an empty or blank picture argument before Pillow loads, still exiting 1, and the new test checks repr, exit code and empty stdout where the old assert_refused never could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-suggests:merge p3 scripts build-and-install, disable, restore, tv.py and the other tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants