-
-
Notifications
You must be signed in to change notification settings - Fork 0
chore: pin Bun 1.4.0 and isolate tests #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Reference — evidence artifact schema | ||
|
|
||
| The skill runs `bun run upgrade-packages:evidence` (default `--out scripts/upgrade-packages/artifact.json`). Phase 1 of [`SKILL.md`](./SKILL.md) owns network, cache TTLs, and the never-touch-registry rule. | ||
|
|
||
| Each outdated package gets **one** delta: the published tarball span `current → latest`. There is no per-tag GitHub release walk. | ||
|
|
||
| Cutter caps (`tarball-delta.ts`): `PATCH_PATH_CAP` 40 paths on the second `bun pm diff`, `FILE_LIST_CAP` 80 files in the artifact, `HINT_CAP` 8 hints per bucket, `PATCH_MAX_CHARS` 8000, `RELEASE_NOTES_MAX_CHARS` 1200. A missing `*.d.ts` patch means it lost the cap, not that the API is unchanged. `source: "none"` sets `tarball: null`. | ||
|
|
||
| ## Artifact shape | ||
|
|
||
| ```jsonc | ||
| { | ||
| "generatedAt": "ISO timestamp", | ||
| "inventory": { | ||
| "direct": [{ "name", "version", "range": "exact|caret|tilde", "dev" }], | ||
| "transitiveDuplicates": [{ "pkg", "versions": [...] }] // direct-dep conflicts + semver-major splits only | ||
| }, | ||
| "outdated": [{ | ||
| "pkg", "current", "latest", | ||
| "bumpClass": "patch|minor|major|prerelease|no-op", | ||
| "coupledWith": [], // naive; agent confirms peer/dep coupling from deltas | ||
| "dev" | ||
| }], | ||
| "audit": { | ||
| "bunAudit": <raw bun audit --json payload>, | ||
| "ghsa": [{ "pkg", "advisories": [{ | ||
| "id", "cveId", "severity", | ||
| "vulnerableRange", "fixedIn", | ||
| "installedInRange": bool, // script-computed vs installed version | ||
| "verdict": "priority-bump|needs-higher-target|cleared-at-current|unpatched|check-failed", | ||
| "url", // github.com/advisories/<id>; empty + id:"error" on check-failed | ||
| "error" // optional — message on check-failed (gh/parse/cache failure) | ||
| }] }] | ||
| }, | ||
| "deltas": { | ||
| "<pkg>": [{ | ||
| "version", "date", // target; date from changelog hunk if present | ||
| "breaking": [...], "deprecations": [...], "features": [...], | ||
| "security": [...], "peerEngine": [...], // notes + changelog/package.json hints | ||
| "releaseNotes": "changelog added-lines, truncated", | ||
| "changelogUrl": "npmjs.com/package/<pkg>/v/<target>", | ||
| "tarball": { | ||
| "from", "to", | ||
| "notes": [...], // bun summary: engines, deps, install scripts, dangerous imports | ||
| "totals": { "files", "added", "deleted", "linesAdded", "linesRemoved", "formattingOnly" }, | ||
| "files": [{ "path", "status", "linesAdded", "linesRemoved", "formattingOnly", "patch" }] | ||
| // patch only for paths that won PATCH_PATH_CAP (named keep + symbol-boosted .d.ts + extras) | ||
| }, | ||
| "source": "bun-pm-diff|none", | ||
| "error": null | "reason" | ||
| }] | ||
| }, | ||
| "usage": { | ||
| "<pkg>": { | ||
| "importedSymbols": [...], "typeOnlySymbols": [...], // parsed imports (codemap) — type-only included | ||
| "sites": ["file:line", ...], // import locations | ||
| "callSites": ["file:line", ...], // reference locations (codemap only — blast radius) | ||
| "source": "codemap|grep" // grep = fallback when codemap unavailable | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## How to read it | ||
|
|
||
| - **Verdict a package**: read `outdated[].bumpClass` + `audit.ghsa[].verdict` + `tarball.notes` + `deltas[<pkg>][].breaking`/`security` + `usage[<pkg>].importedSymbols`. Cite `tarball.notes`, a kept `patch`, `changelogUrl`, or advisory `url`. | ||
| - **`features`/`breaking` arrays are hints** — when a hint is empty but the delta is minor/major, read `releaseNotes` and kept patches before concluding "no changes". | ||
| - **`error` on a delta** means `bun pm diff` failed for that span. `changelogUrl` is still the npm version page. Re-run evidence before marking **blocked**. | ||
| - **`cleared-at-current`** = the GHSA advisory's fix already ships at the installed version — no bump needed, record the URL as evidence. | ||
| - **Citations are artifact fields** — `tarball.notes`, kept `tarball.files[].patch`, `changelogUrl`, `url`. Do not invent GitHub compare URLs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| --- | ||
| name: upgrade-packages | ||
| description: >- | ||
| Delta-driven dependency upgrades — a script gathers the evidence, you read the artifact and judge. Use when the user asks to upgrade, bump, or CVE-audit dependencies. | ||
| --- | ||
|
|
||
| # Upgrade packages | ||
|
|
||
| A script gathers every tarball delta (`bun pm diff`), GHSA advisory, and codebase-usage site into one JSON artifact; you read it and judge. **Never touch the registry, GitHub, or GHSA directly** — every citation comes from the artifact (`tarball.notes`, kept `tarball.files[].patch`, `changelogUrl`, advisory `url`), so no model priors sneak in. Sources of truth: the artifact, then the codebase. Cite where you read every claim. | ||
|
|
||
| This repo uses **bun** with **exact** pins in `package.json` — `bun update` alone bumps nothing. Lift an exact pin with `bun update <pkg>@<target>` (or `bun update <pkg> --latest` per package) / a `package.json` edit. Never `bun update --latest` across the board. The `check-updates` script is inventory-only. | ||
|
|
||
| ## Phase 1 — Gather evidence | ||
|
|
||
| Run `bun run upgrade-packages:evidence` (defaults to `--out scripts/upgrade-packages/artifact.json`; pass `--out <path>` to override). **Requires network access** — the script calls `bun pm diff` (registry tarballs) and `gh api` (GHSA advisories only). A sandbox that blocks `api.github.com` fails GHSA (`check-failed`); deltas still land. Cache: `scripts/upgrade-packages/.cache/` (GHSA 1h, tarball diffs 7d). Read the artifact. Schema + how-to-read: [`REFERENCE.md`](./REFERENCE.md). | ||
|
|
||
| **Done when:** the artifact exists and you've read `inventory`, `outdated`, `audit`, `deltas`, and `usage`. | ||
|
|
||
| ## Phase 2 — Triage (judge the artifact) | ||
|
|
||
| For each `outdated` package, produce a cited verdict + band: | ||
|
|
||
| - **band** = `bumpClass` (patch/minor/major/prerelease). **Coupled deps:** if a patch bump's peer/dep requires a minor+ bump of another direct dep (check `deltas[<pkg>][].peerEngine` + the other package's `bumpClass`), move the coupled set up a band. | ||
| - **priority-bump** if `audit.ghsa` verdict is `priority-bump` — goes first within its band. | ||
| - **check-failed** if `audit.ghsa` verdict is `check-failed` (gh/parse/cache failure, `id:"error"`) — inconclusive, not a vuln; re-run evidence before treating as blocked. | ||
| - **blocked** if any `deltas[<pkg>][].error` leaves the span uncovered (retry evidence; `changelogUrl` is the npm version page) OR a `breaking`/`security`/`peerEngine` delta is a break-risk you can't resolve (see Phase 3). | ||
| - **deferred-major** for a major with an unresolved break — unless it clears a high/critical advisory, in which case surface the tradeoff to the user. | ||
|
|
||
| Cite `tarball.notes` / kept patches / `changelogUrl` / advisory `url` for every verdict. | ||
|
|
||
| **Done when:** every outdated package has a cited verdict, a band, and a coupled-set tag; every `priority-bump` is flagged for Phase 3. | ||
|
|
||
| ## Phase 3 — Fact-check break-risk against the codebase | ||
|
|
||
| For every **break-risk delta** (`breaking`, `deprecations`, `peerEngine`, or a behavior-changing fix in `security`/`features` — e.g. callback debounce, CVE patch altering semantics), read `tarball.notes` plus kept patches (`package.json`, `*.d.ts`, changelog, top-churn extras) and cross-check `usage[<pkg>]`. Use `callSites` (codemap) for **blast radius** — where the symbol is actually called, not just imported; `importedSymbols` + `typeOnlySymbols` for what's in scope; `sites` for import locations. Classify: **no usage** / **code-aligned** / **breaks** (needs a code change first). Cite `callSites`/`sites` (file:line). A `breaks` with no code change → the bump is **blocked** or **deferred**. | ||
|
|
||
| **Done when:** every break-risk delta has a citation-backed `no usage | aligned | breaks` verdict; every `breaks` has a proposed code change. | ||
|
|
||
| ## Phase 4 — Apply, gated by risk | ||
|
|
||
| Bands: patch → minor → major, verify after each per [`verify-after-each-step`](../../rules/verify-after-each-step.md). Within each band, **priority-bump** packages first; **coupled sets** move up together; **prereleases** go in the patch band (moving-target, same-major-line gate). | ||
|
|
||
| 1. **Patch** — bump together (`bun update <pkg>@<target>` per package); run the CI mirror (below). | ||
| 2. **Minor** — bump together; same checks. | ||
| 3. **Major** — one at a time; land its `breaks` code change _first_, bump, then checks. Defer unresolved majors (cited reason) unless they clear a high/critical advisory. | ||
|
|
||
| A bumped adapter peer (react / vue / svelte / solid / lit / alpine / angular / preact) can change DOM-suite behavior — re-run `bun run test:dom`. Re-run `bun run check:deps` after workspace bumps (sherif). Re-run `bun audit` after each band — a **new** advisory → revert that bump and re-research. Commit per band **only when the user asked to commit**. | ||
|
|
||
| **Done when:** CI mirror (`bun run check` + `bun run build`) green for patch + minor; every major green-and-committed/staged or deferred with a cited reason; no `breaks` unaddressed; final `bun audit` clean or every remaining advisory documented. | ||
|
|
||
| ## Phase 5 — Verify (local CI mirror) | ||
|
|
||
| `package.json` `check` and `.github/workflows/ci.yml` are the SSOT. Do not restate their job lists here. | ||
|
|
||
| - `bun run check` | ||
| - `bun run build` — **do not skip** — dep upgrades break the bundler/codegen far more often than types | ||
| - `bun audit` — CI's audit job blocks on **high/critical**; treat a red high/critical audit as **blocking-with-triage**, lower severities as documented | ||
|
|
||
| ## Phase 6 — Report | ||
|
|
||
| Produce: **security** (advisories → verdict, with GHSA id + URL + fixed-in), **consolidated changeset** (rolled up from `deltas` — per package `current → target` from the single tarball span, bucketed breaking/deprecations/features/fixes/peer-engine, one line per hint or note), **adoption opportunities** (top ~5 `features` deltas the codebase isn't using — `usage` verdict + file:line + one-line why-adopt + follow-up; non-blocking), bumped packages (band → version → why-safe), deferred/blocked (cited reason + file:line), verification results. Every citation from the artifact. If the user asked to commit/PR, hand off to [`harden-pr`](../harden-pr/SKILL.md) full mode. | ||
|
|
||
| **Done when:** report accounts for every non-no-op package and advisory; every citation is real — no `possibly`, `likely`, or unstated assumptions. | ||
|
|
||
| ## Anti-patterns | ||
|
|
||
| - ❌ Touching the registry/GitHub/GHSA directly — run the script, read the artifact. | ||
| - ❌ `bun update --latest` across the board — per-package `--latest`/`package.json` edit for exact pins. | ||
| - ❌ Treating `bun audit` as pass/fail — every advisory needs a cited verdict; a high/critical audit is blocking-with-triage. | ||
| - ❌ `bun audit fix`. It treats exact pins as `^version` and rewrites `package.json`. | ||
| - ❌ Isolated linker. Do not set `linker = "isolated"`. Existing lockfiles stay hoisted. | ||
| - ❌ bunfig `[test]` for isolate. `--isolate` is CLI-only. `--parallel` implies isolate. | ||
| - ❌ Skipping `bun run build` — bundler/codegen breakage beats type breakage for dep upgrades. | ||
|
|
||
| ## Reference | ||
|
|
||
| - [`REFERENCE.md`](./REFERENCE.md) — evidence artifact schema + how to read it | ||
| - [`verify-after-each-step`](../../rules/verify-after-each-step.md) — per-band checks | ||
| - [`harden-pr`](../harden-pr/SKILL.md) — full mode before PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.