Repository navigation
fork-ci: ci-demand, a read-only CI demand measure - #113
Conversation
… and cancelled/failed share per day Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: correctness · reviewer: opus high (t3lens113) · read at: 91c22b5 covered: checks:
finding: MAJOR · ci_demand.py:70 · "Works on any OS" (PR body) is false: finding: minor · ci_demand.py:69 (README.md:37 "made 0700", docstring line 20 "a 0700 folder") · An existing cache folder is never made private: finding: minor · ci_demand.py:86-91 · Corrupt or newer-format files are not fully handled, and there is no format version. A file whose key matches but whose finding: minor · ci_demand.py:350 · The default finding: minor (docs) · README.md "What it prints" · The two attribution choices change before/after comparisons and should be stated plainly. (1) A re-run days later adds its hours to the day the run was created, and a re-run of a run created before finding: minor (tests) · ci_demand.test.py · These 5 mutations still pass all 26 tests: (a) verdict: NOT SAFE. One major: the Windows crash breaks the stated any-OS promise, and the fix is two lines. Without it the numbers, GET-only, rate-limit and resume logic are correct, and this would be SAFE with minors for follow-up. |
…rom damaged files - No os.getuid (Windows): the owner and mode checks are skipped instead of a crash before the first request. - An existing cache folder is made 0700 (or refused when that does not hold). - Cache files carry a format version; a file with a bad date, a body that is not an object, or an older or newer format is fetched again. A failed write is reported once and the run goes on; writes stay atomic. - The default --reserve is 20% of X-RateLimit-Limit, so a workflow GITHUB_TOKEN (1000 an hour) works. - gh output and the config file are read as UTF-8, not the locale's code page. - README: re-runs count on the day the run was created; queue wait includes approval time. - Tests for each, plus today's run list not cached, the reserve hit on a jobs page, a write killed half-way, an unfinished job on a completed run, and a cache folder of another user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
not a lens: fix note All in f753027. Each new test failed on 91c22b5, or (where the old code was right) on a mutant of the new code.
36/36 pass offline. The reviewer's three kept tests pass. Format check is clean, and so are fork-ci-tests.cjs and the full fork-ci list. 🤖 Generated with Claude Code |
|
lens: correctness · reviewer: opus high (t3lens113q) · read at: f753027 covered: the fix round checks:
follow-up (minor, an issue, not another round):
verdict: SAFE. The round-1 major and all five minors are fixed at the root, and new tests catch them. No new blocker or major. Five follow-ups above. |
A small, read-only command,
fork-ci/actions/ci-demand/ci_demand.py, that measures the CI demand of a repo, so a CI change has before and after numbers.What it prints
For each UTC day in a range (
--days Nor--since/--until), plus a total:It prints text, or JSON with
--json.Two counting choices matter when comparing: a re-run's hours count on the day the run was created, and queue wait includes time a job waits for an environment approval.
Rate limit and state
gh api -X GET --include, and it never writes to GitHub.--max-requestscaps the calls (default 2000).--reservestops it while that much of the hourly limit is left (default 20% of the limit, so a workflowGITHUB_TOKENwith 1000 an hour also works).--cachefolder the caller gives. Where the OS has user ids, it refuses a folder someone else owns and makes the folder 0700, also when it existed before; on Windows these checks are skipped. A page is cached only when it can no longer change: the run window ended over an hour ago and every run and job in it is completed. Writes go to a temp file, then a rename, so a half-written file is never read. Cache files carry a format version.INCOMPLETE ...and exits 3. Run it again with the same--cacheand it goes on from there; no stored page is asked for twice.Tests
ci_demand.test.pyhas 36 tests. They use a fakeghon PATH that plays recorded API pages, so there is no network. They cover:.part-file;The test is listed in
.github/fork-ci-tests.txt.General vs project
owner/repoas--repo, or readsciDemand.repofrom a project config file given with--config. It works on any OS with Python 3 andgh(owner and mode checks only where the OS has them). Nothing in it names a project, a host or a runner.🤖 Generated with Claude Code