Repository navigation
docs(skills): add perf-review and hot-path V8, DOM, and scheduling rules - #1868
Conversation
Agent-written PRs now get one place that states the hot-path rules and one skill that checks a diff against them. - performance-audit gains three references grounded in runtime code: V8 shapes and allocation, DOM work without forced layout, and microtask/task scheduling (the #1864 megatask findings). It also gains an evidence table per kind of change and the local-load rule. - New perf-review skill: classify the diff hot or cold, read the mechanical candidates, judge each dimension, and require evidence. - scripts/perf-review-scan.mjs is the advisory scan behind it. Two invariants hold on main with zero hits: hot classes assign every declared field unconditionally in the constructor, and writes through Block/Scope receivers only target declared fields. On pre-#990 runtime the second finds all 13 shape-forking writes #990 fixed. Over the last 150 source commits the line rules report 44 candidate lines in 11 commits. - octane-core-extend, core-engineering, and create-a-pr route hot-path diffs through perf-review; the root rule lists its trigger. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ares A pasted PR diff is scanned against the local checkout's runtime.ts. A PR that correctly declares a new BlockImpl field would then get a false hot-field-write for writing it, and the structural check would inspect the checkout instead of the reviewed head. Fields declared in the diff now count as known, and --diff leaves hot-class-shape to --head. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Benchmark report🟢 No budget breaches, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 60 measured values. Public-import reachability bundles (bytes)No changes across 111 measured values. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Head scan uses wrong merge base
- Added resolveMainRef() that returns the branch ref name (origin/main or main) instead of using resolveBase() which returns a checkout-dependent merge-base commit, so --head now computes merge-base(origin/main, head) correctly.
Or push these changes by commenting:
@cursor push 90c6ffd787
Preview (90c6ffd787)
diff --git a/scripts/perf-review-scan.mjs b/scripts/perf-review-scan.mjs
--- a/scripts/perf-review-scan.mjs
+++ b/scripts/perf-review-scan.mjs
@@ -476,6 +476,16 @@
return execFileSync('git', args, { cwd: ROOT, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
}
+function resolveMainRef() {
+ for (const ref of ['origin/main', 'main']) {
+ try {
+ git(['rev-parse', '--verify', ref]);
+ return ref;
+ } catch {}
+ }
+ throw new Error('Could not resolve main; pass --base <ref> or --diff <file>.');
+}
+
function resolveBase(ref) {
for (const candidate of [ref, 'origin/main', 'main'].filter(Boolean)) {
try {
@@ -513,7 +523,7 @@
}
const unified = `--unified=${CONTEXT_LINES}`;
if (options.head !== undefined) {
- const base = git(['merge-base', options.base ?? resolveBase(), options.head]).trim();
+ const base = git(['merge-base', options.base ?? resolveMainRef(), options.head]).trim();
return {
text: git([
'diff',You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 615fd9f. Configure here.
Without --base, --head took the merge-base of the current checkout and main, then a second merge-base with the target. A checkout older than the target's fork point pulled unrelated main commits into the scanned diff. The base is now the merge-base of the target itself and main (or --base). The scan also resolves its repository from the working directory, so it runs from any subdirectory and against any checkout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1868 added .rulesync/skills/perf-review without mapping it in REPO_SKILLS, so octane_skill could not reach it and the MCP server test that compares the map with the directory fails. It fails on main too (37a1c14, test shard 3/4), and so on every PR merged with main. Map it and list it in the README. Co-Authored-By: Claude Opus 5.5 <[email protected]>
domgan-oai
left a comment
There was a problem hiding this comment.
Agent-authored retrospective review (Codex). The advisory scanner tests pass, including the corrected --head merge-base case. One integration regression remains: the new skill is missing from the MCP skill registry, and the existing catalog test is now failing on main.
| @@ -0,0 +1,151 @@ | |||
| --- | |||
| targets: ['*'] | |||
| name: perf-review | |||
There was a problem hiding this comment.
[P1] Register the new skill in the MCP catalog. Adding this directory without adding perf-review to REPO_SKILLS in packages/octane-mcp-server/src/index.js leaves octane_skill unable to serve a skill the new maintainer workflow requires: its input enum is built from that registry. It also breaks the existing serves every RuleSync skill, and only skills that exist test at index.test.js:410. This is confirmed on main 37a1c14847920eeaf97b12af8355f90ff825ff3b in the failed test shard, whose only assertion failure is the missing perf-review entry. Add the registry mapping and run the owning MCP test; also run the catalog consistency check for lightweight RuleSync-only changes, since that classification skipped the check on this PR.
…tly (#1730) * chore: make the native catalog's TypeScript 7.1 nightly the repository's only TypeScript 7 The native catalog now holds one entry, `typescript-native`, an alias of the pinned 7.1 nightly, so a package can keep the classic `typescript` (default catalog, 5.9) beside it. octane-tsc and base-ui's and base-ui-utils' native pristine type lanes use it; those lanes ran TypeScript 7.0.2 through their own `typescript-pristine-native` alias, and the root typecheck now calls the native tsc by path instead of the package's ambiguous `.bin/tsc`. Both pristine lanes pass on the nightly, and UPSTREAM.md says the lane no longer runs upstream's 7.0.2. With that alias gone, nothing installs TypeScript 7.0.2. The optional `typescript` peers that pnpm had filled with it (@tsrx/ripple, vue, i18next, valibot, cosmiconfig) resolve to the classic 6.0.3 or 5.9.3 already in the workspace; every other locked version is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(react-port): build type evidence on the native TypeScript 7 API `createNativeTypeEvidenceProgram(rootNames, project)` builds the react-port type-evidence program on `typescript-native` (the native catalog's 7.1 nightly) through `typescript/unstable/sync`. A sibling wrapper tsconfig, as in octane-tsc, enables @tsrx/content-mapper with Octane's Volar compiler, so `.tsrx` imports are typed instead of `any`; the new test fails without the mapper. octane-tsc's native compiler path, `.tsrx` content-mapper entry and TypeScript 5.9 compatibility options move to scripts/octane-tsc/native.mjs, which both share. The classic `createTypeEvidenceProgram` stays for evidence.mjs and generate-public-contract-tests.mjs until they move to the TypeScript 7 AST and checker. Over base-ui's adapted type specs (575 files, 4,227 exports) the native program builds in about half the time and gives every export the same type, apart from union member order (213) and literal quote style (4) in `typeToString` text. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(react-port): check type evidence on the TypeScript 7 API evidence.mjs, pinned-public-types.mjs and generate-public-contract-tests.mjs now read the react-port type-evidence program through TypeScript 7's `typescript/unstable/sync` API, and the classic Volar-proxied program is removed. `createTypeEvidenceProgram(rootNames, project)` builds it from the project's tsconfig with the `.tsrx` content mapper, and throws when the mapper cannot resolve (TS100031) instead of checking imported TSRX as `any`. TypeScript 7 differs from the classic API in ways that would otherwise read as `undefined` rather than fail, so scripts/react-port/native-types.mjs keeps them in one place: symbols, types and signatures refer to each other by id behind getters (`getSymbol()`, `getTypes()`, `getParameters()`); declarations are handles to resolve; `getTarget()` throws for a type without a target; alias type arguments are `[]` rather than absent; index infos carry `valueType`; a type parameter's default is `defaultType`; boolean literals carry `value` rather than an intrinsic name; TypeScript's own declarations live in the native platform package, which has no `hasNoDefaultLib`; and modifiers are read by `SyntaxKind`. Classic TypeScript remains only to parse tsconfig files and upstream sources, never program nodes. The regenerated base-ui and base-ui-utils published contracts keep every assertion; four gain members from TypeScript 7.1's newer DOM and Temporal lib declarations (`customElementRegistry`, `moveBefore`, `oncommand`, `toTemporalInstant`), the same libs octane-tsc checks them with, and group numbering follows TypeScript 7's export order. Test fixtures outside the repository link @tsrx/content-mapper and octane, as a workspace package resolves them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(mcp-server): serve the perf-review RuleSync skill #1868 added .rulesync/skills/perf-review without mapping it in REPO_SKILLS, so octane_skill could not reach it and the MCP server test that compares the map with the directory fails. It fails on main too (37a1c14, test shard 3/4), and so on every PR merged with main. Map it and list it in the README. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Dominic Gannaway <[email protected]>


Summary
Agent-written PRs now have one place that states the low-level hot-path rules (V8 shapes, DOM work, scheduling), and a validator skill that checks a diff against them and asks for the evidence each risk needs. Nothing under
packages/*/srcchanges. The scheduling rules defer to #1864 and do not change the documented contract indocs/differences-from-react.md§Scheduler.New and changed skills
perf-review(new)packages/octane/src, compiler output, or binding hot paths; when reviewing agent-written code. Routed from the root rule.--head <branch>, orgh pr diff <n>), classify hot or cold, read the scan's candidates, judge shapes, allocation, DOM, scheduling, and React divergences, then require evidence. Report withmust-fix/needs-evidence/note; every candidate is either a finding or dismissed with a reason.BlockImpl/ScopeImpl/LiteBlockImpl, HMRwrapper(argumentson a cold branch),schedulePostPaint,actCheckpoint,resumeOnSettle,createResizeObserver,drainPassivesBeforeRender, §Scheduler, #990performance-audit(changed)references/v8-shapes.md(new)performance-audit,perf-review, andoctane-core-extend.%HaveSameMap,%GetOptimizationStatus,--trace-deopt,--log-ic/--log-maps, file-backed stdout).BlockImpldoc comment anddeclarefields,Scope.slots,bag0–bag16/makeBag, bothForSlotliterals'plainDeopt,template()'sLazyTemplateRecord,getFirstChild/initDomOperationscached accessors,seedExpando/delegateEvents,unmountSlot's single__kindread,$$ctxDepsEpoch-1poison,ReactiveFlags/revision(signals/graph.ts),hookMemoCreate.fill(null), compile.js dense slot indices,PINNED_HOST_BATCH_SHAPES(universal-core.ts),hydration-flag.tsguard forms,compiler/pure-factories.js,benchmarks/runtime-object-shapes,benchmarks/client-hot-paths/functions.{mjs,md},delete p.keyin 894d51creferences/dom-work.md(new)ResizeObserverloops, rAF running before paint, after-paint work.vtMeasureElements,dom-stage.tsPROJECTED_PROPERTIES,scripts/check-staged-dom.mjsNATIVE_READS,template()/parseTemplate/clone(),delegateEvents/dispatchDelegated/TARGET_ONLY_DELEGATED/delegatedListenerOptions,maybeFlushDiscrete,createResizeObserver,schedulePostPaint/schedulePassiveFlush,.github/workflows/pr-bench.ymlDOM-mutation gatereferences/scheduling.md(new)testing.md), Event Timing in Chromium viaoctane-events-browser, and the scheduling suites.scheduleRender→queueMicrotask(flush),flush/flushWork/drainQueue,commitEffects,schedulePassiveFlush,drainPassivesBeforeRender, the four ad-hoc posters, nested-update chain reset, #1864 measurementsoctane-core-extend(changed)packages/octane/src).perf-reviewand "owning suite only"; three new risk checks.BlockImpl,scope.slots, #990's 13 shape-forking writes,scheduleRender, §Schedulercreate-a-pr(changed)perf-reviewbefore the firstgh pr readywhen the diff touchespackages/octane/src, compiled-output transforms, or a binding hot path. Report in the PR body; no openmust-fix. Template line and readiness gate added.core-engineeringrule (changed)perf-reviewhandoff requirement.BlockImpl/ScopeImpl/LiteBlockImpl, #1864perf-reviewrouting line. To stay under the 8,000-byte budget (7,982 now), it trims a sentence that repeated the code block's comments.scripts/perf-review-scan.mjs(advisory, not a CI gate)It reads a unified diff and scans only added lines, with comments and strings blanked. With
--diff(a pastedgh pr diff), fields the diff declares count as known, and the structural check is left to--head, which reads the head'sruntime.ts. The default scope ispackages/octane/srcminuscompiler/; bindings are opt-in by path. It always exits 0.hot-class-shape:BlockImpl(72 fields),ScopeImpl(22), andLiteBlockImpl(11) aredeclare-only, and each field is assigned unconditionally in the constructor.hot-field-write: every write through a Block or Scope receiver, including casts like(b as any).x =, targets a declared field.delete-operator,conditional-shape,shape-mutation,holey-array,rest-or-arguments,layout-read(noting an earlier DOM write in the hunk),microtask-hopandschedule-render(noting an enclosing loop),await-as-yield,animation-frame, andtask-poster(zero-delay or delay-lesssetTimeoutonly).False-positive evidence, measured before deciding to ship it:
packages/*/src: 44 candidate lines in 11 commits, and 0 hits from either invariant.Object.freezelines inuniversal-core.ts, from perf(octane): ship universal host bindings and template programs only to renderers that use them #1652 and perf(three): update retained meshes faster than React Three Fiber again #1665. perf(three): update retained meshes faster than React Three Fiber again #1665 addedPINNED_HOST_BATCH_SHAPESbecause per-update frozen batch maps were collected at full GC and deoptimized readers.queueMicrotask/setTimeout(…, 0)/scheduleRendersites, a colddelete, anargumentsread, and cold options spreads.delete p.keyadded tocreateElementin 894d51c, which regressed memo'sshallowEqualProps.hot-field-writefinds all 13(block as any).__trySlot-style writes that perf: stabilize client block shapes across boundaries #990 fixed.Its 17
node:testcases run inci:workflow:test(lint job), including an end-to-end--headrun against a temporary repository. Mutation checks: 12 of 14 deliberate breakages turned the suite red. The other two were dead guards that no input could reach, and were removed.scripts/classify-ci-change.mjslists the scan and its test as lightweight helpers, alongsideformat-files/typecheck-files. They can't affect shipped code, and the universal lint job still runs their tests.Validation
pnpm sync(vianpx [email protected] run sync): exit 0, all generated changes committed;rulesync generate --checkup to datenode scripts/check-context-budget.mjs: CLAUDE.md 165 lines / 7,982 bytes; perf-review description 367 charspnpm format:files:checkon the changed files: cleannode --test scripts/perf-review-scan.test.mjs scripts/classify-ci-change.test.mjs scripts/ci-workflow.test.mjs: 98/98 passnode scripts/check-typecheck-coverage.mjs: passes. The new scripts are in no TS project, same asclassify-ci-change.mjspnpm format:check,pnpm typecheck,pnpm test: not run locally (load rule; no package source changed). CI classifies this diff as lightweight.perf-review: not applicable. No shipped package source changed, andnode scripts/perf-review-scan.mjsreports no candidates.Risk / follow-ups
postHostTask(packages/octane/src/host-task.ts). Once it merges, pointreferences/scheduling.md,perf-review, and thetask-posterrule's message at it, and update them again if Investigate microtask megatasks in streams, hydration, actions, and deferred rendering #1864 settles the G1/G2 guarantees.postActivationTaskinindependent-island.ts(task-poster, lines 104–112), functionally identical to fix(octane): run useDeferredValue's deferred render in a later task #1867'spostHostTask. Whichever merges second should import the other's poster. fix(hydration): activate ready independent islands one per task #1866 also adds two coldconditional-shapeoptions spreads (lines 266–267).block,scope,b,*Block, or*Scopeescapeshot-field-write; the skill's manual checklist covers what the scan cannot see.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Documentation and agent workflow only; no changes under
packages/*/src. Misapplied scan rules could slow PRs or miss edge cases, but shipped behavior is unchanged.Overview
Adds agent-facing perf-review workflow and codifies Octane hot-path rules (V8 shapes, DOM commit discipline, microtask scheduling) without changing shipped runtime code.
A new
perf-reviewskill walks diffs throughscripts/perf-review-scan.mjs, classifies hot vs cold paths, triages scan candidates, and requires evidence before PRs are marked ready.performance-auditgains three reference docs (v8-shapes,dom-work,scheduling) plus an evidence table and expanded harness guidance.octane-core-extend,create-a-pr, andcore-engineering(and mirrored.agents/.claude/.cursor/.gemini/Copilot copies) wire in hot-path preflight, validation checklists, and a performance review gate on PRs that touch runtime, compiler output, or binding hot paths. Root project rules addperf-reviewrouting;classify-ci-changetreats the scan scripts as lightweight CI helpers.Reviewed by Cursor Bugbot for commit 2af46c7. Bugbot is set up for automated code reviews on this repo. Configure here.