Whole file
hongdangmoo49/Trinity
The author described this change as “fix(tui): address code quality review for SacredGeometryAnimator”. It counts as a record because the checks below fail on the code as it stood at 3c545dc82 and pass on 39c942aa2, with nothing else changed between the two runs.
Projecthongdangmoo49/Trinity
Fix saved2026-06-05
Sharing licenceMIT · LICENSE
Change size+10 −5
What the code was meant to do, written into the code itself as a save note
fix(tui): address code quality review for SacredGeometryAnimator
The change
| 7 | 7 | from __future__ import annotations | |
| 8 | 8 | ||
| 9 | 9 | import math | |
| 10 | - | from dataclasses import dataclass, field | |
| 10 | + | from dataclasses import dataclass | |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | @dataclass(frozen=True) | |
| ⋯ | |||
| 15 | 15 | """Character palette for a given render mode.""" | |
| 16 | 16 | ||
| 17 | 17 | circle: str | |
| 18 | - | diamond: str | |
| 19 | 18 | vline: str | |
| 20 | 19 | bslash: str | |
| 21 | 20 | fslash: str | |
| ⋯ | |||
| 29 | 28 | _GLYPH_MODES: dict[str, _GlyphSet] = { | |
| 30 | 29 | "modern": _GlyphSet( | |
| 31 | 30 | circle="○", | |
| 32 | - | diamond="◆", | |
| 33 | 31 | vline="│", | |
| 34 | 32 | bslash="╲", | |
| 35 | 33 | fslash="╱", | |
| ⋯ | |||
| 41 | 39 | ), | |
| 42 | 40 | "unicode": _GlyphSet( | |
| 43 | 41 | circle="○", | |
| 44 | - | diamond="◆", | |
| 45 | 42 | vline="│", | |
| 46 | 43 | bslash="╲", | |
| 47 | 44 | fslash="╱", | |
| ⋯ | |||
| 53 | 50 | ), | |
| 54 | 51 | "ascii": _GlyphSet( | |
| 55 | 52 | circle="o", | |
| 56 | - | diamond="+", | |
| 57 | 53 | vline="|", | |
| 58 | 54 | bslash="\\", | |
| 59 | 55 | fslash="/", | |
| ⋯ | |||
| 86 | 82 | """ | |
| 87 | 83 | ||
| 88 | 84 | def __init__(self, width: int = 40, height: int = 13, mode: str = "modern") -> None: | |
| 85 | + | if width < 1 or height < 1: | |
| 86 | + | raise ValueError(f"Dimensions must be >= 1, got width={width}, height={height}") | |
| 87 | + | if mode not in _GLYPH_MODES: | |
| 88 | + | raise ValueError(f"Unsupported render mode: {mode!r}. Valid modes: {sorted(_GLYPH_MODES)}") | |
| 89 | 89 | self._width = width | |
| 90 | 90 | self._height = height | |
| 91 | 91 | self._mode = mode | |
| ⋯ | |||
| 151 | 151 | ||
| 152 | 152 | Args: | |
| 153 | 153 | mode: One of ``"modern"``, ``"unicode"``, or ``"ascii"``. | |
| 154 | + | ||
| 155 | + | Raises: | |
| 156 | + | ValueError: If *mode* is not a recognised glyph mode. | |
| 154 | 157 | """ | |
| 158 | + | if mode not in _GLYPH_MODES: | |
| 159 | + | raise ValueError(f"Unsupported render mode: {mode!r}. Valid modes: {sorted(_GLYPH_MODES)}") | |
| 155 | 160 | self._mode = mode | |
| 156 | 161 | self._glyphs = _GLYPH_MODES[mode] | |
| 157 | 162 | ||
The check that tells the two apart
fail→pass·tests/test_tui_sacred_geometry.py::test_animator_rejects_invalid_mode
fail→pass·tests/test_tui_sacred_geometry.py::test_animator_rejects_zero_dimensions
fail→pass·tests/test_tui_sacred_geometry.py::test_animator_update_mode_rejects_invalid
Check file tests/test_tui_sacred_geometry.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it3c545dc824e14f1690232240daa3e657c4488572
Broken version dated2026-06-05
Moduletrinity.tui.sacred_geometry
Units changedSacredGeometryAnimator, _GlyphSet
Fingerprint3c98f09e98f2971b
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in hongdangmoo49/Trinity
- 2026-06-17fix: avoid missing workflow events traceback
- 2026-06-06fix: reuse target workspace for workflow followups
- 2026-06-03fix: make rotation/warning thresholds configurable instead of hardcoded
- 2026-06-03fix(security): prevent path traversal in ManagedHome read/write_config
- 2026-06-02fix: sanitize surrogate characters in SharedContextEngine.write()