Skip to content

fix: skip pre-releases so latest works; allow git push and gh pr create/comment in OpenCode - #43

Merged
linghengqian merged 4 commits into
mainfrom
chore/opencode-project-permissions
Nov 3, 2026
Merged

linghengqian merged 4 commits into
mainfrom
chore/opencode-project-permissions

Conversation

@linghengqian

@linghengqian linghengqian commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Three changes, in separate commits so that they can be read apart. The pull request began as the OpenCode config. Its E2E jobs then failed for two reasons that come from outside it, and that main would hit as well, so the fixes are here:

  1. fix(available): Available skips pre-releases, so that latest is not 27.0.0-alpha.0.0.0.
  2. test(e2e): the @latest probe is skipped when a mirror lists the newest release but has no SHASUMS256.txt for it.
  3. chore(opencode), two commits: a project-level opencode.jsonc that allows git push *, gh pr create * and gh pr comment * for OpenCode sessions in this repository.

All 12 checks pass on the last commit, see "Checks" at the end.

The fix: latest and the pre-release

Since 2026-10-29 the index of nodejs.org has a pre-release as its newest entry, v27.0.0-alpha.0.0.0. Available listed every entry and sorted them by number, so the alpha came first and vfox install nodejs@latest resolved to it. PreInstall only takes releases of three numbers:

Using latest version: 27.0.0-alpha.0.0.0
plugin [PreInstall] method error: .../hooks/pre_install.lua:39: version not found for provided version 27.0.0-alpha.0.0.0

Release 0.5.3 is affected for latest; nodejs@26 and the other shorthands are not. Available now lists only what util.is_semver_simple accepts, the form PreInstall takes as it is. Of the 878 entries in the index on 2026-11-03 the alpha is the only one dropped, and 0.1.14 to 26.13.0 stay.

The docs follow docs/development.md for a change that only main has: an "Unreleased" entry in docs/changes.md, remarks about release 0.5.3 in docs/versions.md (which said that the index holds releases of three numbers and nothing else) and in docs/troubleshooting.md, and the README paragraph that explains the mark, each with its translation.

The E2E mirror gap

With the alpha out of the way, three jobs were still red: Linux and Linux musl on ubuntu-latest, and Windows on windows-latest. All three failed the same case, TestE2E/latest-https___npmmirror_com_mirrors_node. The mirror combination only runs on amd64, which is why the arm jobs were green, and so was WSL, which runs with MIRROR=default.

plugin [PreInstall] method error: .../hooks/pre_install.lua:109: get checksum failed: HTTP 404 from https://npmmirror.com/mirrors/node/v26.13.0/SHASUMS256.txt

The index.json of npmmirror is the same as that of nodejs.org and lists 26.13.0, so latest picks it. But its v26.13.0 directory has SHASUMS256.txt.asc and SHASUMS256.txt.sig and no SHASUMS256.txt. On 2026-11-03, six days after the release, it was still missing, while v26.12.1 on the mirror and v26.13.0 on nodejs.org have all three files. So the plugin is right to say 404: it is a gap of the mirror.

The @latest probe is skipped, as it already is for a missing ARM64 musl build, when the install failed on exactly that 404, the mirror is not nodejs.org, and nodejs.org serves the same file (common.MirrorLagsBehind). Any other failure, and an unclear answer from nodejs.org, still fails, and the pinned and LTS releases still install through the mirror. The Windows suite gets the same (version, ok) shape as the Linux one. docs/e2e.md and its translation say so. Once the mirror has the file, the probe runs again.

The OpenCode config

Adds a project-level opencode.jsonc that allows three shell commands for OpenCode sessions in this repository:

  • git push *
  • gh pr create *
  • gh pr comment *

The author's global OpenCode config denies them, which blocks them here too. Nothing else changes: gh pr merge * and every other global rule still apply. The file is .jsonc so that the rules can be explained in comments. license-eye exempts **/*.json but not .jsonc, and fails on a .jsonc file without a header, so the file carries the same Apache header as the other source files.

OpenCode appends a project's permissions after the global ones, and the last matching rule wins (permissions). So these three rules override a global deny and leave the rest of the global rules in place.

Before merging

Project configuration outranks global configuration. Once this is merged, anyone who uses OpenCode in this repository has these three commands allowed here, even if their own global config denies them. If that is unwelcome, "effect": "ask" keeps a prompt for each use instead; the three rules are all the file contains.

How it was checked

With OpenCode 2.2.5, opencode debug agents shows the resolved rules of the build agent: 17 before and 20 after in the author's setup. The three new allow rules come last, after the global deny rules for the same commands, and the other global rules are unchanged. In a session whose global config denies all four commands below:

command without the file with it
gh pr create --help permission.rejected prints the help
gh pr comment --help permission.rejected prints the help
git push --dry-run file:///nonexistent-repo HEAD permission.rejected git's own "not a git repository" error
gh pr merge --help permission.rejected permission.rejected

Checks

CI on the last commit (bec2e87, E2E run): all 12 checks pass, release is skipped. Windows container (windows-11-arm) failed once in tests/e2e/windows/run.ps1, where Remove-Item of PortableGit.7z.exe was denied during the tool fetch, before any test ran. It passed on a rerun, and this pull request does not touch that script. The log of windows-latest has PASS node v26.13.0 (windows/x64) for @latest and, for the npmmirror combination, SKIP @latest install: mirror https://npmmirror.com/mirrors/node lists 26.13.0 but has no SHASUMS256.txt for it, nodejs.org does.

Locally:

  • Hook tests: 53 cases, one new. It feeds Available the first three entries of the index, fails on main (the list starts with 27.0.0-alpha.0.0.0) and passes with the fix. StyLua 2.5.2 and LuaLS 3.19.1 (Warning) are clean.
  • The real hook against the real index, 878 entries: 877 are listed, the newest is 26.13.0, and the one dropped is v27.0.0-alpha.0.0.0. The hook of main lists all 878 and starts with the alpha.
  • E2E on Ubuntu and Alpine with VFOX_VERSION=latest MIRROR=default: passes, and @latest installs 26.13.0. With MIRROR=https://npmmirror.com/mirrors/node: passes, with the SKIP line above, and the pinned release still installs through the mirror.
  • gofmt, go vet ./... and go test -short ./... in tests/e2e: clean. Two new unit tests cover each branch of MirrorLagsBehind.
  • license-eye (apache/skywalking-eyes:0.9.0 header check, the command from docs/e2e.md): passes with the header in opencode.jsonc, fails without it.

Add a project-level opencode.json that allows three shell commands for
OpenCode sessions in this repository, even where a contributor's global
OpenCode config denies them:

- git push *
- gh pr create *
- gh pr comment *

OpenCode appends a project's permission rules after the global ones and
the last matching rule wins, so these rules override a global deny while
every other global rule stays, including a deny on `gh pr merge *`.

Project configuration outranks global configuration, so this applies to
everyone who uses OpenCode here, including those whose global config
denies these commands on purpose.
Rename opencode.json to opencode.jsonc and explain in comments why the
file exists, how it combines with a contributor's global config and why
`gh pr merge *` is left out. The rules themselves do not change.

license-eye exempts `**/*.json` but not `.jsonc`, and fails on a .jsonc
file without a header (checked with apache/skywalking-eyes:0.9.0, the
image CI and docs/e2e.md use). The file therefore carries the same
Apache header as the other source files.
@linghengqian linghengqian added the enhancement New feature or request label Nov 3, 2026
…0.0.0

nodejs.org's index.json has listed the pre-release v27.0.0-alpha.0.0.0 as
its newest entry since 2026-10-29. Available listed every entry and sorted
by number, so the alpha came first and `vfox install nodejs@latest`
resolved to it. PreInstall only takes x.y.z, so the install ended in
`version not found for provided version 27.0.0-alpha.0.0.0`. That turned
the Linux e2e jobs red, for the latest and the main vfox alike.

Available now lists only what util.is_semver_simple accepts, the form
PreInstall takes as it is. Of the 878 entries in the index today the alpha
is the only one dropped. `nodejs@26` and the other shorthands were not
affected.

The new hook test feeds Available the first three entries of today's
index. docs/changes.md gets an "Unreleased" entry, and versions.md, which
said the index holds releases of three numbers and nothing else, and
troubleshooting.md carry a remark about release 0.5.3, as do their
translations.
@linghengqian linghengqian changed the title chore(opencode): allow git push and gh pr create/comment in this project fix: skip pre-releases so latest works; allow git push and gh pr in the OpenCode config Nov 3, 2026
…t its checksums

npmmirror's v26.13.0 directory has SHASUMS256.txt.asc and .sig but no
SHASUMS256.txt, six days after the release, while its index.json lists
26.13.0 and nodejs.org serves all three files. `vfox install
nodejs@latest` through that mirror picks 26.13.0, and the plugin ends in
`get checksum failed: HTTP 404 from
https://npmmirror.com/mirrors/node/v26.13.0/SHASUMS256.txt`.

The npmmirror combination only runs on amd64, so it failed the two Linux
jobs on ubuntu-latest and the Windows job on windows-latest. The alpha
that broke `latest` had hidden it until then.

Like the missing ARM64 musl build, this is a gap upstream and no failure
of the plugin, so the @latest probe is skipped when the install failed on
exactly that 404, the mirror is not nodejs.org, and nodejs.org does serve
the same file. Any other failure, and an unclear answer from nodejs.org,
still fails. The pinned and LTS releases still install through the mirror.

The Windows suite gets the same (version, ok) shape as the Linux one. The
WSL job runs with MIRROR=default and is left alone.
@linghengqian linghengqian changed the title fix: skip pre-releases so latest works; allow git push and gh pr in the OpenCode config fix: skip pre-releases so latest works; allow git push and gh pr create/comment in OpenCode Nov 3, 2026
@linghengqian
linghengqian merged commit 678b35e into main Nov 3, 2026
19 of 20 checks passed
@linghengqian
linghengqian deleted the chore/opencode-project-permissions branch November 3, 2026 05:25
linghengqian added a commit that referenced this pull request Nov 4, 2026
… LTS line (#47)

* docs: list the 0.5.4 changes under the release and drop the "Unreleased" remarks

Release 0.5.4 is published, so the pages stop marking its behavior as newer
than the last release. This is the procedure of "Releasing" in
docs/development.md, in English and Chinese:

- changes.md: "Unreleased" becomes "0.5.4 (2026-11-04)", every entry gets its
  pull request (#43, #45, #44), the sentence about the newest release "at the
  time of writing" goes, and the User-Agent is `vfox/1.0.13 vfox-nodejs/0.5.4`.
- README, README_CN: the paragraph that explains "Unreleased" goes, and the
  `.nvmrc` paragraph describes one behavior.
- lts, nvmrc, scenarios, versions, mirror: the "Unreleased: release 0.5.3 ..."
  remarks go. The tables that set 0.5.3 against "Unreleased" (nvmrc.md, and
  two in scenarios.md) keep the one column that is 0.5.4.
- troubleshooting, mirror, nvmrc: where a reader of an older plugin looks up
  a message or a symptom, a short "Before 0.5.4" / "Since 0.5.4" sentence
  stays (`version not found ... 27.0.0-alpha.0.0.0`, `checksum error` through
  Huawei Cloud, TUNA, USTC and BFSU, `.nvmrc` not applied after a `cd`).
  mirror.md no longer names the mirrors that worked before 0.5.4, only the
  four that failed, which is what was checked.
- scenarios.md: the outputs are from "the code that became release 0.5.4"
  (hooks/ and lib/ of the PR branch equal the release), and the sentence that
  gave the fresh shell per directory of the Windows e2e suite as a result of
  the `cd` limit now says only what the suite covers.
- source-build.md: the example URL of a released zip is 0.5.4.

Checked with vfox 1.0.13 in an isolated HOME, using the published zip (sha256
0e2cbadc...): `vfox info` says 0.5.4. Against the live nodejs.org, `vfox
search` lists 877 releases and no pre-release although the index starts with
27.0.0-alpha.0.0.0, and `.lts-cache` holds the 12 lines up to lithium. Against
a local mirror whose index starts with a pre-release, `install nodejs@latest`
takes the newest release, and the index, SHASUMS256.txt and the download all
carry `User-Agent: vfox/1.0.13 vfox-nodejs/0.5.4`; with small stand-in
tarballs, the 8-row table of nvmrc.md and the 7-row table of scenarios.md come
out as written, and the three .nvmrc encodings select 22.23.4. The links and
anchors of all pages resolve.

* docs(versions): Node.js 26 is an LTS line since 2026-10-28

"A line that is not in long-term support yet, such as 26 today" stopped being
true when 26.13.0 (Lithium) came out on 2026-10-28; the index of nodejs.org
shows it with `lts: Lithium`, and it is the newest release, so `latest` is an
LTS release now. The sentence is about why `latest` is not "the LTS", and the
table above it is from 2026-10-21, when 26 was still the line that was not in
long-term support. It says so now, in English and Chinese.

This is not caused by release 0.5.4. It is a separate commit so that it can
be dropped alone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant