Skip to content

fix(ci): read complete Swift blobs over 1 MB in the UI approval guard - #24487

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/ui-approval-large-swift-blobs
Nov 3, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/ui-approval-large-swift-blobs

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Requested by David

What changed and why

The UI author approval guard reads changed Swift sources through the GitHub Contents API. For files over 1 MB, such as the generated desktop/macos/Desktop/Sources/Generated/OmiApi.generated.swift, that API returns no body, and the guard fails with "Incomplete Swift source evidence". Any PR that regenerates the OpenAPI types hits this, for example #24477. The guard now fetches the complete blob by its immutable SHA when the Contents API omits the body. Source scanning and fail-closed behavior don't change: if the blob still can't be read, the guard fails as before.

The approval workflow runs from trusted main, so this has to land on main before PRs that touch the generated client can pass.

Product invariants affected

None.

How it was verified

.github/scripts/tests/ui-author-approval.test.cjs, with new cases for a Contents response with no body that falls back to the blob, and for a blob fetch failure that still fails closed.

Tests

The existing UI approval tests plus the new cases.

Failure class

Failure-Class: none

UI evidence

UI-Evidence: none -- CI guard only

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

@Git-on-my-level Git-on-my-level self-assigned this Nov 3, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Confidence score: 4/5

  • ui-author-approval.cjs rejects valid 10–100 MB Swift blobs without fetching them, even though GitHub supports getBlob up to 100 MB. Raise the ceiling to the API limit in both size checks.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/scripts/ui-author-approval.cjs">

<violation number="1" location=".github/scripts/ui-author-approval.cjs:69">
P2: The new 10 MB ceiling leaves valid 10–100 MB Swift blobs unhandled: the guard rejects them without calling `getBlob`, although GitHub supports that endpoint through 100 MB. Use the API's supported bound in both size checks, or explicitly define and justify a 10 MB policy.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

// Contents omits the body above 1 MB (including generated API clients).
// Read that exact immutable blob instead; generated files still undergo
// the same UI scan as every other Swift file, on both sides of the diff.
if (data.encoding === 'none' && data.size > 1000000 && data.size <= 10000000

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new 10 MB ceiling leaves valid 10–100 MB Swift blobs unhandled: the guard rejects them without calling getBlob, although GitHub supports that endpoint through 100 MB. Use the API's supported bound in both size checks, or explicitly define and justify a 10 MB policy.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/scripts/ui-author-approval.cjs, line 69:

<comment>The new 10 MB ceiling leaves valid 10–100 MB Swift blobs unhandled: the guard rejects them without calling `getBlob`, although GitHub supports that endpoint through 100 MB. Use the API's supported bound in both size checks, or explicitly define and justify a 10 MB policy.</comment>

<file context>
@@ -62,8 +62,25 @@ async function evidence(github, repo, pr) {
+          // Contents omits the body above 1 MB (including generated API clients).
+          // Read that exact immutable blob instead; generated files still undergo
+          // the same UI scan as every other Swift file, on both sides of the diff.
+          if (data.encoding === 'none' && data.size > 1000000 && data.size <= 10000000
+            && /^[a-f0-9]{40}$/.test(data.sha)) {
+            const metadata = data;
</file context>

@Git-on-my-level
Git-on-my-level merged commit ece71c1 into main Nov 3, 2026
53 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/ui-approval-large-swift-blobs branch November 3, 2026 09:34
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.

1 participant