Repository navigation
Keep the clock's state in the served repository - #3
Merged
Merged
Conversation
The clock remembered what it had sent in a local state file, which tied delivery to one host: while that host slept every slot waited for GitHub's backstop, and a second host would have sent every slot again. A clock now claims a slot before sending it, by creating a ref under refs/github-cron-trigger-clock/ in the served repository. Ref creation is atomic, so of any number of clocks ticking at once exactly one sends each slot. A failed send releases its claim, so the next tick on any host retries. A line with no marks is baselined; a workflow that stops being enrolled loses its marks, so enrolling it again baselines it again; each line keeps its two newest marks. Marks of a workflow file that could not be read this tick are left alone. `--state` is gone: a host keeps nothing. Without `--send` a tick is a dry run that reports what it would do and writes nothing. The ledger's ref primitives (create with a note, delete, list) are shared with the marks. CI's live check runs two clocks at once against a workflow enrolled for it, clock-check.yml, and checks each slot is sent once. Closes #2.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2.
Why
The clock kept what it had sent in a local state file. That tied a repository's on-time delivery to one host, and a second host would have sent every slot again.
What changes
refs/github-cron-trigger-clock/<workflow file>/<cron line>/<slot>in the served repository (clock_marks.py).--stateis removed. A host keeps nothing. Without--senda tick is a dry run: it reports what it would do and writes nothing.slot_ledgergainscreate_ref,delete_refandlist_refs, and the ledger and the marks both use them. The ledger's behavior is unchanged.clock-check.ymlis a do-nothing workflow enrolled so the live check can run real clocks against this repository.tick --sendprocesses at once and checks that a line with no marks is baselined once with nothing sent, and that a due slot is sent exactly once. The clock reads the default branch, so on this pull request that part skips with a notice, sincemainhas noclock-check.ymlyet. Onmainand on scheduled runs it is required.Checked
ruff, strictmypyandactionlintare clean.