Skip to content

ci: resume snapshot from batch-archive and publish with a patch tag - #15

Merged
gacevicljubisa merged 9 commits into
mainfrom
ci/batch-sync-resume-archive
Aug 31, 2026
Merged

ci: resume snapshot from batch-archive and publish with a patch tag#15
gacevicljubisa merged 9 commits into
mainfrom
ci/batch-sync-resume-archive

Conversation

@gacevicljubisa

@gacevicljubisa gacevicljubisa commented Aug 31, 2026

Copy link
Copy Markdown
Member

Follows up on the workflow skeleton from #12 (merged): replaces its failing Sync TODO with the real publish flow.

What it does

  • Checks out ethersphere/batch-archive (full history + tags) and resumes the export from the snapshot at a selectable tag — new archive_tag input, defaulting to the latest semver tag when left empty; a nonexistent tag fails with a clear error.
  • Runs export --resume … --output … --slim=true (--slim passed explicitly so the snapshot shape does not silently follow a CLI default change). The export always runs to the latest finalized block — see input changes below.
  • Commits to batch-archive main as a conventional commit titled with the last block number — chore: update snapshot to block number <N> (decimal, extracted from the last NDJSON entry, matching the archive's history) — with a body naming the resume tag and linking the workflow run. Tags the next patch version and pushes commit + tag atomically.

Input changes

Removed Why
start_block the resume cursor pins the start
end_block the export always runs to the latest finalized block: a hand-picked end past the finalized head can commit logs from a block that later reorgs (unfixable in an append-only archive), and an end below main's last block can tag a shorter snapshot than its predecessor
output destination is fixed: archive/export.ndjson.gzip
compress a resumed .gzip stays gzip; the CLI ignores the flag on resume

max_request, block_range_limit (default raised to 10000), verbosity survive.

Hardening (post-review)

  • Dispatch inputs are routed through env: instead of ${{ inputs.* }} interpolation in run scripts, closing a shell-injection path on the self-hosted runner.
  • git push --atomic — a rejected main push cannot leave an orphaned tag that a later run would resume from.
  • Tag resolution and the patch bump only consider strict vX.Y.Z tags, so a pre-release or non-semver tag can neither become the resume default nor corrupt the bump. The new tag is bumped from the highest existing semver tag, not the resume tag, so resuming an older tag can never collide.

Notes

  • GHA_PAT_BASIC must have contents: write on batch-archive — in ethersphere/bee it is only used for repository-dispatch, so its scope should be verified; if it is read-only, the fix is a one-line secret-name swap.
  • The commented-out schedule trigger stays commented; the workflow is manual-only for now. Before ever enabling it, the inputs need ${{ inputs.x || 'default' }} fallbacks — the inputs context is empty on schedule events.

🤖 Generated with Claude Code

https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr

darkobas2 and others added 4 commits August 26, 2026 20:20
Adds a manually-triggered Batch Sync workflow exposing every batch-export flag
as a typed input: start/end block, max requests per second, block range limit,
output path, compression and verbosity.

The job runs on the self-hosted bee runners, whose egress addresses are inside
the RPC provider's allowlist, so no credential is needed there. If it is ever
moved to a hosted runner the endpoint requires HTTP Basic auth, so the Compose
endpoint step builds an authenticated URL when a user and password are
available and falls back to the bare URL when they are not. The composed value
is masked and passed through the environment rather than echoed, and the
endpoint itself comes from a secret so no infrastructure hostname is committed
here.

The final sync step is deliberately a failing TODO: the export half is
runnable, but the publish destination has not been decided yet.
Replaces the skeleton's failing Sync TODO with the real flow: check out
ethersphere/batch-archive, resume the export from the snapshot at a
selectable tag (latest semver tag by default), and push the refreshed
file back as a conventional chore commit titled with the last block
number, tagged with the next patch version.

The start_block, output and compress inputs are gone: resuming pins the
start to the archive's cursor, the destination path is fixed by the
archive layout, and a resumed .gzip stays gzip. --slim=true is passed
explicitly so the snapshot shape does not silently follow a CLI default
change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr
@gacevicljubisa
gacevicljubisa changed the base branch from ci/batch-sync-workflow to main August 31, 2026 12:09
gacevicljubisa and others added 5 commits August 31, 2026 14:30
- route dispatch inputs through env instead of interpolating them into
  the run script, closing a shell-injection path on the runner
- push commit and tag with --atomic so a rejected main push cannot leave
  an orphaned tag that a later run would resume from
- restrict tag resolution and the patch bump to strict vX.Y.Z tags via
  grep + sort -V, so a pre-release or non-semver tag can neither become
  the resume default nor corrupt the bump

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr
The export now always runs to the latest finalized block: a hand-picked
end past the finalized head could commit logs from a block that later
reorgs, which an append-only archive can never shed, and an end below
main's last block could tag a shorter snapshot than its predecessor.
Removing the input makes both mistakes impossible instead of guarded.

The snapshot commit body now names the resume tag and links the
workflow run that produced it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr
# Conflicts:
#	.github/workflows/batch-sync.yml
Deduplicate rationale stated in both the header and at steps, drop
narration of plainly visible code, and hoist the input-injection rule to
the header where it covers every step. Adds the two facts that were
missing: the full secrets list an operator needs, and why
cancel-in-progress must stay false.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr
The workflow run link in the commit body expires with Actions log
retention; naming the actor keeps attribution in the archive itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WoaRY6SZi2gUPPmQEhJgr
@gacevicljubisa
gacevicljubisa merged commit 06bd66d into main Aug 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants