Repository navigation
fix(badge): read workflow status from the default branch when no branch is set - #504
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
comark-annotate
comark-badge
comark-bundle
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chat
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-comments
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-git-graph
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-magic-move
comark-mark
markdown-it-to-comark
marked-to-comark
comark-mathml
comark-media
comark-metrics
migrate-to-comark
comark-motion
comark-outline
comark-properties
comark-qr
comark-quiz
comark-reading-time
remark-to-comark
comark-social
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-time
comark-ui
comark-xref
comark-zoom
commit: |
There was a problem hiding this comment.
Important
A fork branch named main can still override the upstream workflow badge, and the new repository lookup breaks an existing CI test.
Approach: Resolving the default branch in the shared badge resolver is the right place for the fix, but a completed run with a matching branch name is not necessarily a run on the upstream default branch.
Reviewed changes across the badge resolver, its consumers, and its tests:
- Workflow selection: Without
branch, the resolver fetches repository metadata and tries the default branch before falling back to all branches. Explicit branches keep the previous query. - Public visibility: Authenticated requests check repository metadata before looking up runs and retain the selected run’s visibility check.
- Docs and coverage: The PR updates the badge docs and editor metadata and adds tests for branch priority and fallback. The workspace build and all 65 badge tests passed; the docs parser integration suite had one failure.
⚠️ The static badge download test fails
P2 · Class: stale GitHub response fixture. The docs parser integration still responds to every GitHub request with workflow_runs JSON. The new repository lookup needs default_branch, so the renderer leaves a hosted badge URL in the HTML and the existing static-download assertion fails in pnpm test.
Technical details
# Fix the repository response fixture
## Affected sites
- [packages/ui/test/browser-plugins.test.ts:13–20](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/packages/ui/test/browser-plugins.test.ts#L13-L20) — the mock does not distinguish the repository endpoint from the workflow-runs endpoint.
- [packages/ui/test/browser-plugins.test.ts:39–44](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/packages/ui/test/browser-plugins.test.ts#L39-L44) — reproduced the failure at line 43 after building the workspace and running docs prepare.
## Required outcome
- Stub repository metadata and workflow runs separately so the test still verifies that the static render embeds the badge rather than falling back to its hosted URL.ℹ️ The badge builder and skill still promise all-branch results
P2 · Class: stale branch-default guidance. The builder’s empty branch field says All branches, and the bundled agent reference says omitting branch returns the latest run across branches. Both can lead users and agents to omit branch expecting a result that the new resolver won’t select.
Technical details
# Keep branch guidance consistent
## Affected sites
- [docs/badges/index.html:65–68](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/docs/badges/index.html#L65-L68) — the empty input says `All branches`.
- [skills/comark-ui/references/badge.md:38](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/skills/comark-ui/references/badge.md#L38) — the shipped reference promises an unfiltered lookup.
## Required outcome
- Explain that an omitted branch prefers the repository’s default branch and only falls back across branches under the documented condition.gpt-6.2-sol(high) | 𝕏
Latest result Pull request merged. Final answersSession Pull request merged. Pushed 1c216de to fix the P1 badge regression and resolved the review thread. Five-run default-branch pages now have a 320 KiB cap; other responses retain the 64 KiB limit. All 69 badge tests passed, including both response-size cases. Repository lint exited successfully with warnings. Hosted checks are pending. CI reconciliation completed; model work is waiting for host admission. Pushed 9eaa78b and resolved the P1 review thread. The badge now distinguishes upstream default-branch runs from same-name forks and won’t fall back while the first upstream run is in progress. Fixed both P2 findings: the stale CI fixture and misleading branch guidance. All 104 focused tests passed, and lint passed with warnings outside the changed files. Awaiting hosted checks. |
There was a problem hiding this comment.
Important
The new five-run query can make a passing workflow badge show unavailable when branch is omitted.
Approach: Checking run ownership and status fixes the previous selection logic, but the new page size exceeds the existing response limit for some ordinary GitHub responses.
Reviewed changes in 9eaa78b7 since the previous review. All 104 focused badge and browser plugin tests passed; live GitHub responses exposed the regression below.
- Distinguished upstream runs: Checked the head repository while paging and separated a first in-progress default-branch run from a workflow with no upstream runs.
- Updated coverage and guidance: Fixed the static-download fixture, added handler tests for fork and in-progress runs, and updated the badge builder and bundled skill.
gpt-6.2-sol(high) | 𝕏
There was a problem hiding this comment.
✅ No new issues found. No P0 or P1 findings remain.
Reviewed changes in 1c216de8 since the prior Pullfrog review. All 69 badge tests passed, and both previously failing live GitHub workflows now render passing without an explicit branch.
- Raised the response limit for workflow pages: Increased the limit to 320 KiB for five-run default-branch pages while keeping the 64 KiB limit for other requests.
- Added handler coverage: Verified that a realistic page above the old limit renders correctly and that a page above the new limit is still rejected.
gpt-6.2-sol(high) | 𝕏

The README's
buildbadge reads skipped, even though every recentrelease.yamlrun onmainpassed.When a badge has no
branch, the resolver showed the latest finished run from any branch.release.yamlalso runs onpull_request: closed, and when the merged PR isn't a release PR it skips every job. So after each normal merge, the newest run is a skipped one from a feature branch:release.yamlrunspull_requestonfeat/social-conversationpushonmainpushonmainThe badge now picks a run the way GitHub's own badge does: the latest finished run on the default branch, or on any branch when the workflow never runs on the default branch (a workflow that only runs on PRs, such as
pkg-pr-new.yml). An explicitbranchworks as before.That costs one extra GitHub call, the repository, which is cached with the result for 60 seconds. With a token, that call also returns early for a repository that isn't public, so the default branch name of a private repository never decides anything.
The same fix applies to other READMEs using this badge without
branch:onmax/tinyreadsskippednow, andonmax/fleetrcwould after its next merge. None of them need changes.main's passing run instead of a newer skipped run from another branch. It fails on the old resolver.🤖 Generated with Claude Code