Skip to content

Add initial vite-plus new command - #14

Merged
wan9chi merged 6 commits into
mainfrom
feat/vite-new
Jun 26, 2025
Merged

Add initial vite-plus new command#14
wan9chi merged 6 commits into
mainfrom
feat/vite-new

Conversation

@webpro

@webpro webpro commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

Added basic vite-plus new command with two minimal templates (TS and JS: "JSDoc TS")

It's not great that we probably need dependencies for a nice way to ask questions. For now I've added clack, but it's just to keep going. Quick impression:

Screenshot 2025-06-25 at 3 21 28 PM

@wan9chi
wan9chi merged commit 54b4e78 into main Jun 26, 2025
@wan9chi
wan9chi deleted the feat/vite-new branch June 26, 2025 03:19
fengmk2 added a commit that referenced this pull request Aug 10, 2026
The Docker preview job now fails outright:

  #14 exporting to GitHub Actions Cache
  #14 ERROR: error writing layer blob: failed to reserve cache
  #13 exporting to image ... CANCELED
  ERROR: failed to build: failed to solve: error writing layer blob

The cache export is fatal to the build, so it cancelled the image push. My
optimization broke the job it was meant to speed up, and the npm preview for
PR #2328 published fine while its Docker image did not.

Reverting rather than fixing it. Making it work would need `actions: write`
on the one job that installs and executes the preview package, which is the
job SR-5 says to keep as unprivileged as possible, and this was the only
`type=gha` usage in the repo so there was no working precedent to copy. The
benefit was 60-90s of apt on a path that already waits on a human approval
measured in minutes to days, so it was buying almost nothing.

`ignore-error=true` would keep the build green but the export would keep
failing, leaving a dead directive and a stack trace in every log.
fengmk2 added a commit that referenced this pull request Aug 10, 2026
Two fixes to `main`, both found by the first real runs of the publishing
workflow. It could not be exercised before merge, because `workflow_run`
only fires for workflow files already on the default branch.

**First, the good news: the design works.** PR #2328 published end to
end through the new path with an OIDC token, no admin token involved.
`authorize`, `Pkg Preview`, and the sticky comment all succeeded, and
`commit.a7180fa85c06fad48` is on the bridge:

```
commit.a7180fa85c06fad48 | pr: .../pull/2328 | at: 2026-08-10T07:35:31.617Z
```

## 1. Fork PRs could not be resolved at all

#2391 (from `liangmiQwQ`) failed in `authorize` with `no open PR of
voidzero-dev/vite-plus has head c7e51be…` while that PR was open with
exactly that head.

`listPullRequestsAssociatedWithCommit` returns **empty** for a fork PR's
head commit. Confirmed against the live API:

| commit | result |
| --- | --- |
| #2387 head (same-repo) | returns `#2387` |
| #2391 head (fork) | **empty** |

So it worked for every case reachable before merge and failed for the
only case this feature exists for. `workflow_run.pull_requests` is empty
for forks too, which is what sent me to the commit endpoint originally —
I swapped one fork-blind source for another.

Now resolves via `pulls?state=open&head=<head_owner>:<head_branch>`,
both GitHub-signed payload fields. The head-sha match is a separate step
so the message distinguishes "no such PR" from "the PR moved on":

```
fork PR 2391 (real failure) -> OK: #2391 labeled=true fork=true
stale head                  -> FAIL: PR #2391 now at c7e51be, built 0000000
no such branch              -> FAIL: no open PR from liangmiQwQ:does-not-exist
```

I re-checked the rest of the publishing workflow for the same blind
spot. Everything else keys off the PR number or the run id, which are
base-repo objects and fork-safe: the post-approval `pulls.get` re-check
returns correct state, head and labels for #2391, and the artifact
download and the `listWorkflowRunArtifacts` precondition both see that
run's 148MB `bridge-packages`.

## 2. The Docker gha cache broke the image push

```
#14 exporting to GitHub Actions Cache
#14 ERROR: error writing layer blob: failed to reserve cache
#13 exporting to image ... CANCELED
```

The cache export is fatal to the build, so it cancelled the push. I
added this in the cleanup pass; it broke the job it was meant to speed
up, and #2328's npm preview published while its Docker image did not.

Reverted rather than repaired. Making it work needs `actions: write` on
the one job that installs and executes the preview package, which is the
job SR-5 says to keep unprivileged, and this was the only `type=gha`
usage in the repo so there was no working precedent. It was saving
60-90s of apt on a path that already waits on a human approval measured
in minutes to days.

## 3. Terminology

"Trusted leg" and "build leg" were my own coinage and meant nothing to a
reader who was not in the design conversation. The two workflows are now
described as **the build workflow** and **the publishing workflow**, and
where trust was the point the property is stated rather than encoded in
a name.

This also surfaced something worth fixing later: `publish-preview.yml`
is named "Publish preview build" and no longer publishes anything.
Renaming it is the real fix, but the publishing workflow matches it by
`name:`, so that has to be a coordinated change. The header says so
outright for now.

The same terminology fix for the RFC and bridge docs is
voidzero-dev/pkg-pr-registry-bridge#93, which also corrects SR-1 for the
fork-blind endpoint above.

## After merging

Re-label #2391 to get the first genuine fork preview.
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.

2 participants