mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 05:02:40 +00:00
refactor(javascript): charge the worker's retained result bytes through an over-committing Budget (#11399)
* refactor(javascript): charge the worker's retained result bytes through an over-committing Budget Static checkpoints may retain past the result budget up to the static capacity, and the worker reports that exhaustion itself. Budget.chargeOverCommitting records the excess (overCommitted) and reports no remainder until refunds bring use back under the maximum. The budget-arithmetic baseline is now empty. * refactor(domain): charge hand-written allowances through Budget and count limit-checked fields (#11405) * refactor(domain): charge hand-written allowances through Budget and count limit-checked fields Pyc report and key-walk tallies, reverse-engineering capture admission, Playwright trace fact retention and semantic alias selections now charge a Budget. The budget-arithmetic guard also counts a field outside Budget classes that is adjusted by hand and compared with a limit-named value; the eleven remaining sites are a counted baseline. * fix(verify): scope limit-checked fields to their class and match limit names in any case
This commit is contained in:
1 parent
d1034867ff
commit
28332d43ca
10 files changed
+269
-96
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type { JavaScriptSemanticPropertyPath } from "./javascriptSemanticPropertyPaths.js";
|
||||
import { JAVASCRIPT_SEMANTIC_PRECISION_DEFAULTS } from "./javascriptSemanticPrecision.js";
|
||||
import { Budget } from "../budget.js";
|
||||
|
||||
type PropertyKey = JavaScriptSemanticPropertyPath[number];
|
||||
|
||||
@@ -73,13 +74,15 @@ const joinSelections = (
|
||||
/** Preserve correlated selector alternatives while coalescing complete grids. */
|
||||
export class SemanticAliasSelections {
|
||||
#paths = new WeakMap<object, Map<number, SemanticAliasSelectionPath[]>>();
|
||||
#calls = 0;
|
||||
readonly #calls: Budget;
|
||||
#limited = false;
|
||||
|
||||
constructor(
|
||||
readonly onLimit: () => void,
|
||||
readonly maxSelections: number = JAVASCRIPT_SEMANTIC_PRECISION_DEFAULTS.alias_selections,
|
||||
) {}
|
||||
) {
|
||||
this.#calls = new Budget(maxSelections);
|
||||
}
|
||||
|
||||
get limited(): boolean {
|
||||
return this.#limited;
|
||||
@@ -98,7 +101,7 @@ export class SemanticAliasSelections {
|
||||
);
|
||||
const covered = paths.find((prior) => pathCovers(prior, candidate));
|
||||
if (covered !== undefined) return covered;
|
||||
if (existing !== undefined && ++this.#calls > this.maxSelections) {
|
||||
if (existing !== undefined && !this.#calls.tryCharge(1)) {
|
||||
this.#limited = true;
|
||||
this.#paths = new WeakMap();
|
||||
this.onLimit();
|
||||
|
||||
Reference in new issue
Block a user