Register kartka, leetcode, todoimpl icons
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (mypy, mypy) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (pylint, pylint) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (rest, ) (push) Waiting to run
Pre-commit checks / pre-commit (${{ matrix.group }}) (shellcheck, shellcheck) (push) Waiting to run
Python tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / lib-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run

Port the three shipped family glyphs verbatim so the generator can
regenerate them unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-19 14:42:54 +01:00
parent b1432c1171
commit e43500a950
8 changed files with 221 additions and 35 deletions

View File

@ -0,0 +1,15 @@
{
"title": "Register kartka, leetcode and todoimpl in app_icons",
"objective": "The app_icons generator can regenerate the family icons kartka, leetcode-guard/app and todoImplementer/app already ship, with the same glyph shape, accent and field.",
"acceptance_criteria": [
"apps.get_app returns kartka, leetcode and todoimpl with glyph, icon_name and linux flag taken from disk facts",
"Each renders the standard 1024px svg+png layer set into a temp dir without error; linux-flagged ones render the hicolor sizes",
"Regenerated icon.png matches the shipped one side by side",
"python_pkg/app_icons stays at 100% branch coverage"
],
"out_of_scope": [
"Writing into any sibling repo",
"betting_sim's dead registry path and the shared track-bars glyph"
],
"verifier": "python -m pytest -q python_pkg/app_icons --cov=python_pkg.app_icons --cov-branch"
}

View File

@ -0,0 +1,38 @@
{
"intent": "Register kartka, leetcode-guard/app and todoImplementer/app in python_pkg/app_icons so the generator can regenerate the family icons they already ship, with no visible change.",
"scope": [
"python_pkg/app_icons/_glyph_art_code.py (new), glyphs.py, _apps_more.py, labels.py, tests/test_registry_code_apps.py (new)",
"Non-goal: no sibling repo is touched or regenerated; betting_sim and the shared track-bars glyph are untouched"
],
"changes": [
"Three glyphs ported verbatim from each app's shipped assets/icon/icon_foreground.svg: document-split (kartka), code-brackets (leetcode), screen-tick-play (todoimpl); literal accent replaced by the accent marker",
"Registry entries and launcher labels Kartka / LeetGuard / TodoImpl (taken from each AndroidManifest android:label)",
"Linux flags: kartka=True (desktop/install_desktop_entry.sh installs a hicolor set from desktop/icons, built with --linux-out); leetcode=True (tool/install_desktop.sh writes leetcode-guard-app.desktop, so icon_name=leetcode-guard-app; it currently points Icon= at assets/icon/icon.png); todoimpl=False (no linux/ target or desktop entry in the Flutter app; the desktop board is the separate web/ TS app)"
],
"verification": [
{
"command": "python -m pytest -q python_pkg/app_icons --cov=python_pkg.app_icons --cov-branch",
"result": "pass",
"evidence": "144 passed; Total coverage: 100.00%. New tests were red first (12 failed, KeyError on the unregistered keys)"
},
{
"command": "regenerate the three apps into a temp dir with generate.write_assets on a repo-replaced AppIcon, then paste shipped vs new icon.png side by side",
"result": "pass",
"evidence": "Every new icon.png is 1024x1024 (shipped leetcode/todoimpl were 640x640). Side-by-side sheet shows the same glyph shape, gold #B8862E accent and charcoal field for all three"
},
{
"command": "python -m python_pkg.app_icons list; git -C ~/src/{kartka,leetcode-guard,todoImplementer} status --short",
"result": "pass",
"evidence": "list shows kartka document-split +linux, leetcode code-brackets +linux, todoimpl screen-tick-play; sibling repos show only their pre-existing untracked .claude/ and tools/errors/"
}
],
"risks": [
"Follow-up: leetcode-guard/app and todoImplementer/app ship 640px icon.png (drift); regenerating there will write the standard 1024px set",
"Follow-up, not changed: betting_sim's registry path ~/src/betting-sim/app does not exist",
"Follow-up, not changed: kuhylog and betting_sim share the track-bars glyph"
],
"rollback": [
"git revert the commit",
"python -m pytest python_pkg/app_icons passes and list no longer shows the three keys"
]
}

View File

@ -1,35 +0,0 @@
{
"intent": "main goes green again: 'Pre-commit checks' and 'dependency freshness' failed on 2026-10-09 only because pins fell behind new upstream releases.",
"scope": [
"meta/requirements.txt, meta/requirements-test.txt",
"Non-goal: pre-commit hook revs (not checked by the freshness gate)"
],
"changes": [
"anthropic 1.12.1 -> 1.13.0 (both files), pyupgrade 3.21.2 -> 3.22.0, reorder-python-imports 3.17.0 -> 3.18.0",
"black 26.10.0 -> 26.10.1, pipdeptree 4.2.5 -> 4.2.6, ruff 0.16.10 -> 0.17.0, selenium 4.50.0 -> 4.51.0 (went stale since the red run)"
],
"verification": [
{
"command": "scripts/check_dependency_freshness.sh meta/requirements.txt meta/requirements-test.txt",
"result": "pass",
"evidence": "exit 0 (only the existing typescript transitive exception listed)"
},
{
"command": "pip install --dry-run -r meta/requirements.txt -r meta/requirements-test.txt",
"result": "pass",
"evidence": "resolves, exit 0"
},
{
"command": "pytest python_pkg/code_tutor (fresh venv from meta/requirements-test.txt, anthropic 1.13.0)",
"result": "pass",
"evidence": "217 passed"
}
],
"risks": [
"ruff 0.17.0 from requirements.txt may flag new rules when run outside pre-commit (pre-commit pins its own ruff rev)"
],
"rollback": [
"git revert this commit",
"Re-run scripts/check_dependency_freshness.sh: it will report the old pins as behind again"
]
}

View File

@ -52,4 +52,34 @@ MORE_APPS: Final[tuple[AppIcon, ...]] = (
# Android only: no linux/ target and no desktop entry. # Android only: no linux/ target and no desktop entry.
linux=False, linux=False,
), ),
AppIcon(
key="kartka",
repo=_HOME / "src/kartka",
accent="#B8862E",
glyph="document-split",
icon_name="kartka",
# desktop/install_desktop_entry.sh installs desktop/icons/<size>/
# kartka.png into hicolor; its header names `--linux-out desktop/icons`.
linux=True,
),
AppIcon(
key="leetcode",
repo=_HOME / "src/leetcode-guard/app",
accent="#B8862E",
glyph="code-brackets",
icon_name="leetcode-guard-app",
# tool/install_desktop.sh writes leetcode-guard-app.desktop. It points
# Icon= at assets/icon/icon.png today, not at a hicolor set.
linux=True,
),
AppIcon(
key="todoimpl",
repo=_HOME / "src/todoImplementer/app",
accent="#B8862E",
glyph="screen-tick-play",
icon_name="todoimpl",
# Android only: no linux/ target and no desktop entry. The desktop
# board is the separate web/ TypeScript app, not this Flutter build.
linux=False,
),
) )

View File

@ -0,0 +1,49 @@
"""Glyphs of apps that shipped a family icon before they were registered here.
kartka, leetcode-guard and todoImplementer each drew their icon by hand in the
family style and committed it with no registry entry, so the generator could
not regenerate them. Each fragment below is ported verbatim from that app's
``assets/icon/icon_foreground.svg``, with only the hand-applied transform and
stroke width dropped (the renderer refits every fragment) and the literal
accent replaced by the marker, so regenerating changes nothing visible.
"""
from __future__ import annotations
# A document with a folded corner over a split lower panel -- kartka, a
# character sheet: the sheet itself. From ~/src/kartka/assets/icon.
#
# Geometry: page x=320..704, y=256..768 with the corner cut at (576,256) ->
# (704,384); the fold is a filled triangle. The lower panel starts at y=544
# and splits at x=464, so the smallest cell is 144x224 on the centreline,
# far clear of MIN_NEGATIVE_SPACE=36.
_DOCUMENT_SPLIT = """\
<path d="M 320 256 L 576 256 L 704 384 L 704 768 L 320 768 Z"/>
<path fill="{{ACCENT}}" d="M 576 256 L 576 384 L 704 384 Z"/>
<path d="M 320 544 L 704 544"/>
<path d="M 464 544 L 464 768"/>"""
# ``</>`` code brackets -- leetcode-guard, which gates on solving a LeetCode
# problem: the code being written. From ~/src/leetcode-guard/app/assets/icon.
#
# Geometry: chevrons from x=208 / x=816 to their tips at x=352 / x=672, height
# y=344..680, with the slash x=472..552 between them; 120px between a chevron
# and the slash at mid-height.
_CODE_BRACKETS = """\
<path d="M 352 344 L 208 512 L 352 680"/>
<path d="M 672 344 L 816 512 L 672 680"/>
<path d="M 552 344 L 472 680"/>"""
# A screen holding a tick and a play triangle -- todoImplementer, which drives
# backlog items through to done: the item run and ticked off. From
# ~/src/todoImplementer/app/assets/icon.
#
# Geometry: rounded screen x=208..816, y=272..752, corner r=72; tick
# (345,525)->(410,590)->(515,465); filled play triangle x=615..712,
# y=430..610. The tick and the triangle sit 100px apart.
_SCREEN_TICK_PLAY = """\
<path d="M 280 272 L 744 272 A 72 72 0 0 1 816 344 L 816 680 \
A 72 72 0 0 1 744 752 L 280 752 A 72 72 0 0 1 208 680 L 208 344 \
A 72 72 0 0 1 280 272 Z"/>
<path d="M 345 525 L 410 590 L 515 465"/>
<path fill="{{ACCENT}}" stroke="none" d="M 615 430 L 712 520 L 615 610 Z"/>"""

View File

@ -29,6 +29,11 @@ from python_pkg.app_icons._glyph_art import (
_SHIELD_CUTLERY, _SHIELD_CUTLERY,
_STORAGE_BOX, _STORAGE_BOX,
) )
from python_pkg.app_icons._glyph_art_code import (
_CODE_BRACKETS,
_DOCUMENT_SPLIT,
_SCREEN_TICK_PLAY,
)
from python_pkg.app_icons._glyph_art_extra import ( from python_pkg.app_icons._glyph_art_extra import (
_CAMERA, _CAMERA,
_HEADPHONES, _HEADPHONES,
@ -112,6 +117,17 @@ GLYPHS: Final[dict[str, Glyph]] = {
_PROMPT_BUBBLE, _PROMPT_BUBBLE,
), ),
Glyph("camera", "Camera body with a viewfinder hump and a lens", _CAMERA), Glyph("camera", "Camera body with a viewfinder hump and a lens", _CAMERA),
Glyph(
"document-split",
"Page with a filled folded corner over a split lower panel",
_DOCUMENT_SPLIT,
),
Glyph("code-brackets", "Angle brackets around a slash: </>", _CODE_BRACKETS),
Glyph(
"screen-tick-play",
"Rounded screen holding a tick and a filled play triangle",
_SCREEN_TICK_PLAY,
),
) )
} }

View File

@ -49,6 +49,9 @@ LABELS: Final[dict[str, str]] = {
"tunedeck": "TuneDeck", "tunedeck": "TuneDeck",
"sufler": "Sufler", "sufler": "Sufler",
"macro_cam": "MacroCam", "macro_cam": "MacroCam",
"kartka": "Kartka",
"leetcode": "LeetGuard",
"todoimpl": "TodoImpl",
} }

View File

@ -0,0 +1,70 @@
"""Tests for the kartka, leetcode and todoimpl registry entries.
Those three apps shipped family icons before they were registered here; the
glyphs are ports of the shipped ``icon_foreground.svg`` fragments, so these
tests render each one through the real pipeline into ``tmp_path`` (never the
app's own repo) and check the standard-size set comes out.
"""
from __future__ import annotations
import dataclasses
from typing import TYPE_CHECKING
from PIL import Image
import pytest
from python_pkg.app_icons import apps, generate, glyphs, labels, style
if TYPE_CHECKING:
from pathlib import Path
# key -> (glyph, icon_name, linux, repo path under ~)
_EXPECTED: dict[str, tuple[str, str, bool, str]] = {
"kartka": ("document-split", "kartka", True, "src/kartka"),
"leetcode": ("code-brackets", "leetcode-guard-app", True, "src/leetcode-guard/app"),
"todoimpl": ("screen-tick-play", "todoimpl", False, "src/todoImplementer/app"),
}
@pytest.mark.parametrize("key", sorted(_EXPECTED))
class TestCodeAppEntries:
def test_entry_matches_disk_facts(self, key: str) -> None:
glyph, icon_name, linux, repo = _EXPECTED[key]
app = apps.get_app(key)
assert app.glyph == glyph
assert app.icon_name == icon_name
assert app.linux is linux
assert app.repo == apps.Path.home() / repo
assert glyphs.get_glyph(glyph).name == glyph
def test_label_is_valid(self, key: str) -> None:
assert labels.label_problems(apps.get_app(key).label) == []
def test_renders_standard_size_set(self, key: str, tmp_path: Path) -> None:
app = dataclasses.replace(apps.get_app(key), repo=tmp_path / key)
written = generate.write_assets(app)
assert sorted(path.name for path in written) == sorted(
f"{stem}.{ext}"
for stem in ("icon", "icon_foreground", "icon_monochrome")
for ext in ("svg", "png")
)
for path in written:
if path.suffix == ".png":
with Image.open(path) as image:
assert image.size == (style.CANVAS, style.CANVAS)
@pytest.mark.parametrize("key", ["kartka", "leetcode"])
def test_renders_linux_set(key: str, tmp_path: Path) -> None:
icons = generate.write_linux_icons(apps.get_app(key), tmp_path)
assert len(icons) == len(style.LINUX_ICON_SIZES)
for size, path in zip(style.LINUX_ICON_SIZES, icons, strict=True):
with Image.open(path) as image:
assert image.size == (size, size)
def test_filled_parts_take_the_accent_marker() -> None:
"""Folded corner and play triangle recolour on the monochrome layer."""
for name in ("document-split", "screen-tick-play"):
assert f'fill="{style.ACCENT_MARKER}"' in glyphs.get_glyph(name).body