Type-soundness and formatting cleanup on top of #80#81
Conversation
Three issues introduced by the kernel-allocations PR (commits 11bbbee, 94dba65, 08a1f25), no perf changes: 1. Replace `(target as any)[…]` casts with proper typing through `ReactiveTagged`: - `collections.ts`: two casts in `createReactiveMap` / `createReactiveSet` for the intrusive `$PROXY` lookup. - `read.ts`: one cast in `getMutatorCache` for the `$MUTATORS` lookup. These regressed the type-soundness sweep landed in #76. Fixing them required adding `[$MUTATORS]?` to the `ReactiveTagged` interface in `core.ts` so the cast resolves to a real type. 2. `package.json`: revert the accidental 2-space → 4-space indent in `packages/js-krauset/package.json` (the rest of the workspace's package.json files use 2-space). 3. `perf-stats.ts`: oxfmt formatting cleanup of two `stats(...)` calls added with the `--trim` feature in 08a1f25 — they exceeded the line width and `pnpm format` reformats them on a clean run. No behavior changes, no perf claims.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## copilot/reduce-kernel-allocations #81 +/- ##
====================================================================
Coverage ? 99.46%
====================================================================
Files ? 31
Lines ? 1317
Branches ? 260
====================================================================
Hits ? 1310
Misses ? 2
Partials ? 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR removes newly introduced as any casts by routing intrusive symbol-cache access through the existing ReactiveTagged type, and applies formatting-only fixes (JSON indentation + line wrapping) to reduce churn.
Changes:
- Replace
as anyaccess to[$PROXY]/[$MUTATORS]withReactiveTagged-typed access and extendReactiveTaggedto include[$MUTATORS]?. - Reformat
perf-stats.tsto match the formatter’s wrapping for longstats(...)calls. - Revert
packages/js-krauset/package.jsonto consistent 2-space indentation.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/kernel/src/read.ts | Removes as any from $MUTATORS access by using ReactiveTagged. |
| packages/kernel/src/core.ts | Extends ReactiveTagged to include optional [$MUTATORS] for type-safe symbol access. |
| packages/kernel/src/collections.ts | Removes as any from $PROXY intrusive cache reads via ReactiveTagged. |
| packages/js-krauset/perf-stats.ts | Wraps long stats(...) calls to match formatter output and avoid future reformat churn. |
| packages/js-krauset/package.json | Restores workspace-consistent 2-space JSON indentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Correctness and formatting cleanup on top of the kernel-allocations work in #80. No perf changes — strictly type-soundness, formatting, and one accidental indentation regression.
What this fixes
1.
as anycasts regressing #76's type-soundness sweepThree casts to
anywere introduced when adding intrusive symbol storage:packages/kernel/src/collections.ts—createReactiveMapandcreateReactiveSetuse(rawTarget as any)[$PROXY]to read the intrusive cache.packages/kernel/src/read.ts—getMutatorCacheuses(target as any)[$MUTATORS].The codebase already has a
ReactiveTaggedinterface incore.tsfor exactly this purpose, and #76 deliberately removedas anyfrom this surface. Reintroducing them here was a regression.Fix: route all three through
ReactiveTagged, and add[$MUTATORS]?to the interface so the cast resolves to a real type instead of needing anotheras anyto land somewhere.2.
packages/js-krauset/package.jsonindent regressionThe base reformatted this file from 2-space to 4-space indentation. Every other
package.jsonin the workspace uses 2-space, so this looks accidental. Reverted.3.
perf-stats.tsformattingTwo
stats(...)calls added with--trimexceed the line width.pnpm formatreformats them on a clean run, so committing them in formatted shape avoids future churn.What this is not
$MUTATORScache, the pre-created Map/Set methods — all kept exactly as the base has them.Validation
pnpm test— kernel 175 / mill 52 passpnpm run typecheck— cleanpnpm lint— cleanpnpm format— clean (no further reformatting needed)pnpm run test:validate— cleanhttps://claude.ai/code/session_01VDVFSh8xJqvYp61dZQ8q4o
Generated by Claude Code