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.

Fix main's red checks: live-test webhook shape and a timing-sensitive highlight test (#24)

* Live test: read the webhook's delivery from GitHub's hook shape

The hooks API now returns GitHub's shape (#19): the target is config.url
and the last delivery's status is last_response.code. The live test still
read lastDeliveryAt, so it waited for a field that no longer exists.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AizKXSsengXZRegJxRATkL

* Warm the TypeScript grammar before asserting on its tokens

The first tokenization compiles the grammar's regexes. On a busy CI runner
that alone can pass shiki's 200 ms tokenize limit, which leaves the rest of
the line as one plain token, so 'const' was never a token of its own and
the test failed on main since #23.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AizKXSsengXZRegJxRATkL

---------

Co-authored-by: Claude <noreply@anthropic.com>
Canberk Demirci authored · GitHub committed signed1 parent 388e5b4commit 66dd3faa001bce1ff25d45803584ab0c9252b069Browse files
2 files changed+8−3
modified.github/workflows/live-test.yml+4−3View file
@@ -272,11 +272,12 @@
272272 set -euo pipefail
273273 for i in $(seq 1 30); do
274274 hook=$(curl -fsS "$DIFFINERY/api/v3/repos/$OWNER/$REPO/hooks" -H "Authorization: Bearer $TOKEN" | jq -c '.[0]')
275- [ "$(jq -r '.lastDeliveryAt // empty' <<<"$hook")" != "" ] && break
275+ # GitHub's hook shape: the target is config.url, the last delivery's status last_response.code.
276+ [ "$(jq -r '.last_response.code // empty' <<<"$hook")" != "" ] && break
276277 sleep 5
277278 done
278- echo "$hook" | jq '{url, lastStatus, lastDeliveryAt}'
279- [ "$(jq -r '.lastDeliveryAt // empty' <<<"$hook")" != "" ] || { echo "::error::the push webhook was never delivered"; exit 1; }
279+ echo "$hook" | jq '{target: .config.url, last_response, updated_at}'
280+ [ "$(jq -r '.last_response.code // empty' <<<"$hook")" != "" ] || { echo "::error::the push webhook was never delivered"; exit 1; }
280281
281282 - name: Agent sandbox
282283 if: steps.token.outputs.skip != 'true'
modifiedapps/diffinery/test/unit/highlight.test.ts+4−0View file
@@ -72,6 +72,10 @@
7272
7373 describe("tokens", () => {
7474 it("tokenizes with both themes as CSS variables and leaves default text bare", async () => {
75+ // The first tokenization compiles the grammar's regexes, which can use up the
76+ // 200 ms tokenize time limit on a slow runner (the rest of the line is then left
77+ // plain, by design). Warm the grammar so the assertions below don't race it.
78+ await highlightLines(["const warm = 0;"], "typescript");
7579 const out = await highlightLines(["const a = 1; // one", "", "export {};"], "typescript");
7680 expect(out).toHaveLength(3);
7781 expect(out!.map(text)).toEqual(["const a = 1; // one", "", "export {};"]);