Skip to content

Add a main (tip) mode to the Skia upstream sync - #4254

Merged
mattleibow merged 1 commit into
mainfrom
mattleibow-dev-skia-sync-main-tip-mode
Jun 26, 2026
Merged

mattleibow merged 1 commit into
mainfrom
mattleibow-dev-skia-sync-main-tip-mode

Conversation

@mattleibow

Copy link
Copy Markdown
Contributor

Summary

Adds a new main (tip) mode to the auto-skia-sync gh-aw workflow so we can sync from the very tip of upstream Skia (google/skia main HEAD) instead of only chrome/m<N> milestone branches. This is a bleeding-edge sync: it may include new APIs/binding changes (regenerated + built + tested as normal) but is NOT a version bump — the target milestone stays equal to main's current milestone (no soname/nuget/milestone changes). It uses a distinct head branch (skia-sync/main) so it never collides with the current milestone sync branch.

main mode is dispatch-only — the cron schedule never selects it.

Changes

.github/scripts/skia-sync-detect.sh — UPSTREAM_REF generalization

  • Accepts main as a valid --mode.
  • Introduces an UPSTREAM_REF concept (the google/skia ref we merge from), resolved alongside TARGET:
    • --milestone N → chrome/m${N} (mode explicit)
    • mode=main → main (tip), TARGET=MAIN_MS
    • mode=latest → chrome/m${LATEST}
    • mode=current → chrome/m${MAIN_MS}
    • else (next) → chrome/m${NEXT}
  • For mode=main, head branch is skia-sync/main (distinct from skia-sync/m${TARGET}); IS_RELEASE=false, base main/skiasharp. Release-detection stays skipped because TARGET == MAIN_MS. current == target (not a bump).
  • Emits a new upstream_ref output, and the --gate upstream lookup now uses ${UPSTREAM_REF} instead of a hardcoded chrome/m${TARGET}.

.github/workflows/auto-skia-sync.md

  • Adds main to the workflow_dispatch mode options and explains it in the input description.
  • Surfaces upstream_ref as a pre-activation output, in the prompt header, and in the skia-sync-env.sh heredoc the agent writes.
  • Phase 1 now fetches the resolved ${upstream_ref} (milestone branch or main tip) instead of a hardcoded chrome/m${target}, with a note on tip-mode semantics. Recompiled the lock.

.github/scripts/skia-sync-push-prs.sh

  • Reads UPSTREAM_REF (defaults to chrome/m${TARGET} for backward compat) and makes PR titles/bodies tip-aware:
    • SkiaSharp PR: [skia-sync] Merge upstream Skia main (tip)
    • mono/skia PR: [skia-sync] Merge upstream Skia main (tip)
    • Otherwise keeps the existing milestone titles/bodies.

Validation

  • gh aw compile auto-skia-sync → 0 errors (4 pre-existing warnings: storage.googleapis.com ecosystem hint + 3 fixed cron times). Lock still pins claude-opus-4.7 and reflects the new option/output. Model and native-build setup unchanged.
  • shellcheck --severity=style clean on all three scripts.
  • Stub smoke test of skia-sync-detect.sh (faked gh/git, GITHUB_REPOSITORY=mono/SkiaSharp, GITHUB_REF=main): current/next/latest/main/default/--milestone N/empty-milestone all resolve correctly; unknown-arg exits 2; mode=main yields upstream_ref=main, head_branch=skia-sync/main, target==current==main's milestone; the main gate path proceeds (no skip).

The release-branch skill is out of scope.

Co-authored-by: Copilot [email protected]

Introduce an UPSTREAM_REF concept so the sync can merge from the very tip of
upstream Skia (google/skia main HEAD) instead of only chrome/m<N> milestone
branches.

- skia-sync-detect.sh: accept --mode main; resolve UPSTREAM_REF (main vs
  chrome/m<TARGET>); for main mode use a distinct head branch skia-sync/main so
  it never collides with the current milestone sync; emit upstream_ref; gate on
  the resolved upstream ref. main mode is not a version bump (target==current).
- auto-skia-sync.md: add main to the dispatch mode options, surface upstream_ref
  as a pre-activation output and in skia-sync-env.sh, fetch the resolved upstream
  ref in Phase 1, and document the tip/bleeding-edge semantics.
- skia-sync-push-prs.sh: make PR titles/bodies UPSTREAM_REF-aware (tip vs
  milestone), defaulting to chrome/m<TARGET> for backward compat.
- Recompiled the lock (0 errors).

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4254

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4254"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-4254/packages --name skiasharp-pr-4254
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-4254

@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Site
🔗 View Staging Docs
🔗 View Staging Gallery (Blazor)
🔗 View Staging Gallery (Uno Platform)
🔗 View Staging SkiaFiddle

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new dispatch-only main (“tip”) mode to the Skia upstream sync automation so the workflow can merge directly from google/skia’s main HEAD (bleeding edge) while keeping the target milestone unchanged (i.e., not a version bump). This extends the existing milestone-based modes (current/next/latest/explicit milestone) by introducing a generalized upstream_ref concept and making the agent prompt + PR creation logic upstream-ref aware.

Changes:

  • Extend skia-sync-detect.sh to resolve both TARGET (milestone) and UPSTREAM_REF (merge-from ref), including mode=main → UPSTREAM_REF=main, HEAD_BRANCH=skia-sync/main, and emitting upstream_ref as a workflow output.
  • Update the auto-skia-sync workflow template and compiled lock to expose upstream_ref and guide the agent to fetch the resolved upstream ref (milestone branch or main tip).
  • Make PR titles/bodies in skia-sync-push-prs.sh tip-aware via UPSTREAM_REF (fallback to chrome/m${TARGET} for backward compatibility).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
.github/workflows/auto-skia-sync.md Adds main dispatch option, surfaces upstream_ref output, and updates prompt/env heredoc to fetch/record the upstream ref.
.github/workflows/auto-skia-sync.lock.yml Regenerated lock to reflect the new dispatch option and upstream_ref plumbing.
.github/scripts/skia-sync-push-prs.sh Introduces UPSTREAM_REF (with backward-compatible default) and adjusts PR titles/bodies for tip vs milestone syncs.
.github/scripts/skia-sync-detect.sh Generalizes merge-from ref selection via UPSTREAM_REF, adds main mode behavior, and emits upstream_ref output used by the workflow/prompt.

@mattleibow
mattleibow merged commit 4c37102 into main Jun 26, 2026
12 checks passed
@mattleibow
mattleibow deleted the mattleibow-dev-skia-sync-main-tip-mode branch June 26, 2026 18:14
mattleibow added a commit that referenced this pull request Jun 29, 2026
…ne skill, honest run signal (#4258)

Harden Skia upstream-sync: conflict policy, durable gn args, standalone skill, honest run signal (#4258)

Follow-up to the mode=main tip work (#4254) and release-line targeting
(#4239). The first real tip runs exposed three rough edges in the
auto-skia-sync automation, plus that key Skia-update knowledge lived only
in the workflow prompt where the update-skia skill couldn't reach it.

~~ Verify-upstream-or-reapply conflict resolution ~~

A tip merge runs ~291 commits ahead of our submodule base and conflicts on
every file carrying an [M1xx] fork cherry-pick. The old "keep ours / resolve
what you reasonably can" guidance risked silently dropping a not-yet-
upstreamed patch (--theirs) or freezing a stale form of one upstream had
since refined (--ours; e.g. our SDF-LCD patch used getMaxScale() while
upstream relanded it as sk_ieee_float_divide(1.f, getMinScale())).

Replace it with an explicit, auditable policy: classify each fork patch on a
conflicted file as upstreamed (take upstream's form, record the SHA) or not
upstreamed (re-apply ours on top) -- never a blanket --theirs/--ours, never
a silent drop. A mandatory before-merge fork-patch snapshot is cross-checked
so every patch lands in the resolution table as upstreamed or re-applied; a
patch that is neither is a lost patch -> stop and fix. Applied across gotcha
#15, SKILL.md Phase 5, and the workflow tip note.

~~ Allow a required new gn arg through build.cake ~~

The tip build needed skia_use_partition_alloc=false because upstream now
defaults it to is_clang while our DEPS deliberately omits partition_alloc;
Skia ships an official zero-overhead noop raw_ptr for exactly this case, so
=false is the supported embedder path, not a hack. The rule banned all
build.cake edits, forcing a one-off --gnArgs CLI flag and leaving durable
config non-durable.

Split the rule into two tiers: still forbid changing compiler/linker flags
(or scripts/infra/native/**) to silence a host build error, but allow adding
a genuinely required new upstream gn arg to the affected platforms'
native/**/build.cake gn-args lists, flagged in both PR summaries for cross-
platform review. Sequencing is honored: the toggle doesn't exist in m150, so
the relaxed rule lets the next milestone merge add it in-context rather than
breaking the current build. Recommendation for the eventual bump (gotcha #23):
keep partition_alloc disabled via the supported noop, not by vendoring the
Chromium allocator.

~~ Make the skill standalone; reduce the workflow to CI overrides ~~

main/tip mode and the required-new-gn-arg rule were documented only in the
workflow prompt, so the update-skia skill couldn't drive them locally. Move
both into the skill: tip mode becomes a first-class third option in Phase 1
(new {UPSTREAM_REF} variable, merge-base..upstream/main milestone diffs,
generalized Phase 5 merge command), and the gn-arg rule lands in Phase 7
backed by gotcha #23. Trim the workflow's duplicated build.cake/mode prose to
short pointers, keeping only genuinely CI-specific guardrails (can't apt-
install in the sandbox; a missing host dep is a workflow bug, not a flag hack;
Linux-only-build cross-platform review). These are prompt-body edits, so the
lock stays byte-identical.

~~ Stop mislabeling a real sync as a no-op ~~

A sync that merged upstream, built, tested, and opened both PRs was reported
by the gh-aw conclusion job as a no-op, which then failed trying to file a
no-op issue (the workflow has no issues: write). Cause: safe-outputs staged
mode blocks the agent from creating anything directly -- the real PRs are
opened by the host post-step skia-sync-push-prs.sh with the autobump token --
so noop was the agent's only completion signal and every run, real or not,
signalled noop.

Give the agent an honest signal: declare create-pull-request in safe-outputs,
kept staged (preview-only; the safe_outputs job is ubuntu-slim with
permissions:{} and never touches the workspace) so a real sync registers as a
pull-request output, while real PRs still come only from the post-step. Set
noop: report-as-issue: false so noop is reserved for genuine no-work runs and
no longer files an uncreatable issue; drop the unused create_issue offer; and
add a "Completion signal" section to the prompt. This is the one frontmatter
edit in the PR, so auto-skia-sync.lock.yml is regenerated.

Validated end-to-end by run 28269474099 (mode=main, real 2-commit merge): the
agent emitted a staged create_pull_request, the conclusion logged no noop with
no failed issue step, and the post-step still pushed skia-sync/main to both
repos and updated the real PRs (#4263 + #269). Rebased on main to pick up the
#4260 workflow rename (lock recompiled to a 0-diff) and confirm consistency
with the #4267 support-status model.

Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: Copilot <[email protected]>
@mattleibow mattleibow added this to the 4.150.0-rc.1 milestone Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants