fix: parse transcripts with pydantic models in ticket-cost script
CI / checks (pull_request) Successful in 13s

json.loads returned untyped data, which failed strict type checking. pyright never reported it because it skips the .claude/ folder.
This commit is contained in:
kasun committed 2026-11-15 21:44:33 +01:00
1 parent e91d05497d
commit eb49c71937
4 files changed
+220 -35

No files matched your search

+2 -2
View File
@@ -11,9 +11,9 @@ One entry per finished roadmap step, newest first. The agent drafts the entry, t
- **Agent mistakes and what caught them:**
- Redundant `.replace("Z", "+00:00")` before `datetime.fromisoformat` (not needed since Python 3.11) → caught by lint (ruff FURB162)
- `main()` too complex (cognitive complexity 31 of 15) → caught by the IDE's SonarLint diagnostics; per-line parsing moved into its own function
- First pyright run was not strict (no project config yet) → caught by agent review; `# pyright: strict` added to the script
- PR claimed "strict pyright passes" on the script, but pyright never analyzed it: it skips dot directories like `.claude/`, and "0 errors" hid "no source files". The untyped `json.loads` access had 18 strict-mode errors → caught by human review (editor diagnostics), after the merge; fixed by parsing with pydantic models
- **What worked well:** Checking the transcript format before writing the parser: each response appears on several lines with the same usage, so summing naively would have counted about three times too many tokens.
- **Learned:** Until the skeleton ticket adds `pyproject.toml`, ruff and pyright run with defaults, so scripts need explicit settings (`# pyright: strict`, line length) to be checked like the product code.
- **Learned:** A green check only counts if it checked something: look for the file count, not just "0 errors".
- **Workflow change proposed:** none
## 2026-11-15 · Setup: Add project docs and agent workflow setup