refactor(domain): charge resource allowances through one Budget owner (#11293)

This commit is contained in:
morluto authored and GitHub committed 2026-11-15 23:47:20 +08:00
1 parent c931ba43ab
commit 3d67404132
11 files changed
+215 -96

No files matched your search

@@ -500,5 +500,24 @@
"src/signals/SigrokRecordingProvider.ts": 1,
"src/signals/parseDecoderDiscovery.ts": 1,
"src/v8/V8CodeCache.errors.ts": 1
},
"budget-arithmetic": {
"src/application/investigation/EvidenceLedger.ts": 1,
"src/artifacts/UnityFsArtifactReader.ts": 1,
"src/artifacts/apple/InterfaceBuilderDecodeBudget.ts": 2,
"src/artifacts/bun/BunModuleGraphLayout.ts": 2,
"src/browser/PlaywrightScenarioEvents.ts": 3,
"src/browser/WebBundleAnalysisWorker.ts": 2,
"src/browser/execution/CdpRuntimeSources.ts": 2,
"src/desktop/DesktopContentStore.ts": 1,
"src/domain/analysisView/WebNetworkProjectionAccumulator.ts": 1,
"src/domain/apiContract/parseApiContract.ts": 1,
"src/domain/firmware/hexRecords.ts": 1,
"src/domain/firmware/uf2.ts": 1,
"src/domain/javascript/javascriptSemanticWorkAllowance.ts": 1,
"src/domain/javascript/javascriptSymbolicBindings.ts": 4,
"src/dotnet/ManagedDecodeBudget.ts": 1,
"src/javascript/analysis/JavaScriptAnalysisWorker.ts": 4,
"src/python/PythonPycParser.ts": 2
}
}
+13
View File
@@ -340,6 +340,19 @@ checkCounted(
[],
);
// A resource allowance is charged and refunded through `Budget` in
// src/domain/budget, which refuses malformed or oversized charges without
// changing the remainder. Hand-written `remaining -=` / `retained +=`
// arithmetic repeats that admission and drifts (charge-then-check, no
// safe-integer check).
checkCounted(
"hand-written budget arithmetic (use Budget from src/domain/budget)",
"budget-arithmetic",
files,
/this\.#?\w*(?:[Rr]emaining|[Rr]etained|[Uu]sed)\w*\s*[-+]=/gu,
["src/domain/budget.ts"],
);
// A deadline is a monotonic budget owned by `Deadline` in src/domain/deadline;
// a wall-clock sum moves with clock changes and has no finalize phase. The
// remaining copy converts a monotonic budget for a browser page, which can