mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
fix: tighten as any usage in performanceShim and clarify fileHistory cap
- performanceShim: replace 'as any' on the onresourcetimingbufferfull getter/setter and the globalThis install guard with typed intersection casts, per the project's TS guideline. - fileHistory: clarify the MAX_SNAPSHOTS comment so it reflects that checkpointing is throttled (cap reduced from 100 to 20), not disabled.
This commit is contained in:
@@ -51,8 +51,9 @@ export type FileHistoryState = {
|
||||
snapshotSequence: number
|
||||
}
|
||||
|
||||
// Disabled: file checkpointing causes unbounded memory growth (100 snapshots × full file backups).
|
||||
// See heap snapshot analysis — re-enable only after switching to incremental diffs.
|
||||
// Throttled: file checkpointing remains enabled (gated by fileHistoryEnabled())
|
||||
// but capped to mitigate unbounded memory growth (full file backups x N snapshots).
|
||||
// See heap snapshot analysis; only raise this cap after switching to incremental diffs.
|
||||
const MAX_SNAPSHOTS = 20
|
||||
export type DiffStats =
|
||||
| {
|
||||
|
||||
@@ -145,10 +145,11 @@ const shim = {
|
||||
return original.timeOrigin
|
||||
},
|
||||
get onresourcetimingbufferfull() {
|
||||
return (original as any).onresourcetimingbufferfull
|
||||
return (original as Performance & { onresourcetimingbufferfull?: unknown })
|
||||
.onresourcetimingbufferfull
|
||||
},
|
||||
set onresourcetimingbufferfull(_v: any) {
|
||||
// no-op — prevent accumulation
|
||||
set onresourcetimingbufferfull(_v: unknown) {
|
||||
// no-op to prevent accumulation
|
||||
},
|
||||
toJSON() {
|
||||
return original.toJSON()
|
||||
@@ -161,8 +162,11 @@ const shim = {
|
||||
* native Performance reference.
|
||||
*/
|
||||
export function installPerformanceShim(): void {
|
||||
if ((globalThis as any).__performanceShimInstalled) return
|
||||
;(globalThis as any).__performanceShimInstalled = true
|
||||
const g = globalThis as typeof globalThis & {
|
||||
__performanceShimInstalled?: boolean
|
||||
}
|
||||
if (g.__performanceShimInstalled) return
|
||||
g.__performanceShimInstalled = true
|
||||
globalThis.performance = shim
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user