generated from alex/base-template
Refactor sources fetchers #10
Labels
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Reference
alex/botium#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I believe most of source fetch scripts under scripts/ folder rewrite at least part or the same logic.
Let's factor that out into a shared lib to keep them DRY
/pi new PR
The four
update_*.crscripts share the same fetch → dedupe → serialize → compare → write tail. Let me check the toolchain and then refactor.Now I'll create a shared library and refactor the four scripts.Now refactor each script:Created PR #11: #11 — "refactor(scripts): extract shared SourceData lib for source fetchers"What it does:
scripts/lib/source_data.crwith two helpers shared by all source fetchers:SourceData.fetch(url, headers?)— upstream GET with a consistent abort-on-failure message.SourceData.write_if_changed(target_path, payload, label)— pretty JSON serialization, change detection against the bundledsrc/data/*.json,mkdir_p+ write, and the "Up to date (N …)" / "Updated …" logging.update_{dilbert,monkeyuser,quotes,workchronicles}.crscripts refactored onto it (net −63 lines), keeping their upstream-specific parsing/dedupe/normalization logic intact.Validation: all four scripts compile,
update_quotes.crran end-to-end against upstream,crystal tool format --checkandamebapass, and the unit suite is green (463 examples).View action run | Model: zai/glm-5.3-flash (thinking: low) | Time: 4m 9s | Tokens: 184.9K | Cost: $0.01 | Pi SDK v1.4.0 | Action v2.30.1-develop (develop @ 4ea2232)