Commit c80be27
authored
Fix generate-enums workflow: live logs, drop Sources line, camelCase protocolSpecifics (#2084)
A few related fixes to the `generate-enums` workflow and its generated
output.
### 1. Stream fetch logs live in CI
The `Fetch server data` step appeared to hang with no output, because
Python block-buffers stdout when it's a pipe (as in GitHub Actions).
Setting `PYTHONUNBUFFERED=1` forces unbuffered output so progress
streams live. (Does not make the step faster — it's intentionally serial
and rate-limited.)
### 2. Drop the `Sources:` line from generated docs
`generate_device_catalog.py` emitted an internal `Sources:
atlantic_cozytouch, somfy_europe` line into the `device-types.md` header
note. It doesn't belong in user-facing docs — removed.
### 3. camelCase `protocolSpecifics` keys
The nested keys inside `protocolSpecifics` (`clusterId`, `attributeIds`,
`commandIds`, `manufacturerId`) were snake_case in the committed JSON —
a leftover from the v1 fetch path that ran responses through
`humps.decamelize`. Every other key in the data files is camelCase.
Regenerated both `somfy_europe.json` and `atlantic_cozytouch.json` so
they're consistent (pure casing change, no data differences).
The catalog generator read the old snake_case `cluster_id`; updated to
`clusterId` so cluster annotations aren't silently dropped. With both
the data and generator on camelCase, `device-types.md` regenerates
identically to `main` — verified.
This also makes the weekly automated regeneration PR produce clean diffs
instead of thousands of casing-flip lines (the symptom seen in #2083).
### 4. Trailing newline in fetched JSON
The data files lacked a final newline, which `end-of-file-fixer`
requires — so the auto-generated PR would fail the lint workflow.
`fetch_server_data.py` now writes the trailing newline, and the
committed files were corrected.
### 5. Format generated files before opening the PR
Added a step that runs prek's auto-fixers (ruff, trailing whitespace,
end-of-file) on the generated outputs *before* `create-pull-request`.
This keeps the weekly auto-PR green instead of landing red and needing a
manual formatting fix — exactly the failure mode that #4 would otherwise
cause every week. Scoped to the generated files; type checks and the
branch guard are skipped since it's a formatting pass, not a gate.
(Note: the full lint matrix still runs separately on the opened PR via
`lint.yaml`.)1 parent 29bca8b commit c80be27
5 files changed
Lines changed: 7450 additions & 7436 deletions
File tree
- .github/workflows
- docs/data
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
49 | 66 | | |
50 | 67 | | |
51 | 68 | | |
| |||
0 commit comments