Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

Numeric ids for runs, jobs and workflows, so gh run and gh workflow work #325

Mergedtest-botagenton behalf of cnbrkdmrcimerged into main from claude/numeric-run-ids
test-botagenton behalf of cnbrkdmrciopened Author

Requested by Can · project thread

What this changes

GitHub issues codician-team/diffinery#4 and #5 reported that gh run list and gh workflow list crash with cannot unmarshal string into Go struct field Run.workflow_runs.ID of type int64. gh expects GitHub's numeric ids, and Diffinery answered with hex strings and workflow paths.

  • Numeric ids in REST answers. A run's and a job's id, a job's run_id, a run's workflow_id and check_suite_id, check suites' id, and the run_id returned by dispatch and re-run are now numbers.
    • Runs and jobs get 16 digits, made from 52 random bits of their UUID with the version digit skipped. Shorter numbers keep meaning run numbers (github.run_id, diffinery run view 42).
    • Workflows get a hash of their path.
    • External check suites get a hash of app-<login>-<sha>.
  • Paths take the numbers back. Run, job, artifact, attempt, log, cancel, re-run, pending-deployment, check-run and check-suite paths accept the numbers. They also still accept the hex ids, run numbers and workflow paths or file names they took before.
    • Runs and jobs are found with a prefix GLOB on the primary key, so no schema change or backfill is needed.
    • html_url keeps the hex id, and the web pages accept either form.
  • Dispatch also answers with workflow_run_id and run_url, as GitHub does with return_run_details.
  • Run logs zip now has GitHub's layout: a file per job plus job/N_step.txt per step. gh run view --log shows each line under its step instead of UNKNOWN STEP.
  • Docs: Actions overview, REST API IDs table, checks and statuses, and the gh CLI page.

How it was tested

  • New unit tests in test/unit/rerun.test.ts cover the number mapping, lookups, run numbers still working, logs, and artifacts by run number. All 1130 unit tests pass and typecheck is clean.
  • These e2e tests pass locally: "git hosting, Actions, protected PR flow and MCP", job graph, re-runs, workflow_run, older runner's artifacts over REST, and the Octokit REST compatibility test.
  • Real gh 2.89 ran against a local server with a self-hosted runner.
    • Working commands: gh run list (also --workflow), gh run view (with --job, --log per step and --json with databaseId and workflowDatabaseId), gh run watch, gh run rerun, gh run cancel, gh workflow list, gh workflow view and gh workflow run --ref.
    • Also checked: gh api reads of check-runs/<job id>, check suites by number, and an external app's suite by number.

Checklist

  • Docs updated
  • No workflow files changed

🤖 Generated with Claude Code

https://claude.ai/code/session_015ALxdbMU5hpZXjGpL2jhC4

Intentwhat this change is meant to do

Make gh run list/view/watch/rerun/cancel and gh workflow list/view/run work against Diffinery by answering with GitHub's numeric ids and accepting them back, as reported on GitHub #4 and #5.

test-bot merged commit 310c083 into main
Pull request successfully merged and closed
test-bot merged 310c083 into main
Sign in to join the conversation.