mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 21:53:51 +00:00
* test(limits): check documented limit defaults against code instead of per-file pins The numeric-limit script now reads every default, floor, and maximum in docs/design/rea-limit-inventory.md and compares it with ANALYSIS_SETTINGS or the owner constant the parser enforces. A mismatch names the limit and both values. Pins that only restated a covered value are removed. Pwntools input bytes and the Kuna timeouts now use the shared exports, so the registry value is the one the parser applies. * fix(limits): reject a fractional documented limit cell The cell parser treated a dot as the end of the integer, so 5000.5 compared equal to 5000. A documented number is now one complete integer, with prose only after whitespace. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
120 lines
3.6 KiB
TypeScript
120 lines
3.6 KiB
TypeScript
/** Statically declared environment seeds owned by ANALYSIS_SETTINGS. */
|
|
export function parseRuntimeSettingEnvironments(source: string): Set<string>;
|
|
|
|
/** Parse static registry declarations, including external-reader provenance. */
|
|
export function parseNumericLimitRegistry(source: string): Array<{
|
|
name: string;
|
|
update_mode: "restart";
|
|
policy: "restart-only";
|
|
read: "startup" | "per-call" | "construction";
|
|
reason: string;
|
|
provenance?: {
|
|
kind: "external-reader" | "generated-control";
|
|
source: string;
|
|
witness: string;
|
|
generator?: string;
|
|
generatorWitness?: string;
|
|
};
|
|
}>;
|
|
|
|
/** Producer paths for numeric limits. Registry text, comments, and allowlists are omitted. */
|
|
export function discoverNumericLimitUses(
|
|
files: readonly { readonly path: string; readonly source: string }[],
|
|
): Map<
|
|
string,
|
|
{
|
|
readonly path: string;
|
|
read: "module" | "construction" | "unknown";
|
|
readonly sites: Array<{
|
|
readonly path: string;
|
|
readonly read: "module" | "construction" | "unknown";
|
|
readonly offset: number;
|
|
readonly evidence: "direct" | "candidate";
|
|
}>;
|
|
}
|
|
> & {
|
|
readonly unresolved: readonly {
|
|
readonly path: string;
|
|
readonly offset: number;
|
|
readonly line: number;
|
|
readonly column: number;
|
|
readonly reason: string;
|
|
}[];
|
|
};
|
|
|
|
/** A required runtime limit that is missing or is not an analysis setting. */
|
|
export type RequiredRuntimeLimitFailure = {
|
|
readonly code:
|
|
| "required_runtime_limit_missing"
|
|
| "required_runtime_limit_not_analysis_setting";
|
|
readonly name: string;
|
|
};
|
|
|
|
/**
|
|
* Classify one required runtime limit.
|
|
* Absence from source, the exception registry, and ANALYSIS_SETTINGS is
|
|
* `required_runtime_limit_missing`.
|
|
*/
|
|
export function requiredRuntimeLimitFailure(
|
|
name: string,
|
|
presence: {
|
|
readonly inSource: boolean;
|
|
readonly inRuntime: boolean;
|
|
readonly inRegistry: boolean;
|
|
},
|
|
): RequiredRuntimeLimitFailure | undefined;
|
|
|
|
/** One default, floor, and maximum from the numeric inventory tables. */
|
|
export type DocumentedNumericLimit = {
|
|
readonly name: string;
|
|
readonly section: string;
|
|
readonly defaultCell: string;
|
|
readonly floorCell: string;
|
|
readonly maximumCell: string;
|
|
};
|
|
|
|
/** Default, floor, and maximum exported by the analysis-setting registry or an owner. */
|
|
export type ExportedNumericLimit = {
|
|
readonly name: string;
|
|
readonly aliases?: readonly string[];
|
|
readonly defaultValue: number | null;
|
|
readonly minimum: number;
|
|
readonly maximum: number;
|
|
};
|
|
|
|
/** Read default, floor, and maximum from the three numeric inventory tables. */
|
|
export function parseDocumentedNumericLimits(
|
|
markdown: string,
|
|
): DocumentedNumericLimit[];
|
|
|
|
/**
|
|
* Read one documented cell.
|
|
* A fraction is unreadable. Prose is allowed only after a complete integer and whitespace.
|
|
*/
|
|
export function documentedLimitCell(
|
|
cell: string,
|
|
names: Readonly<Record<string, number>>,
|
|
):
|
|
| { readonly ok: true; readonly value: number | null }
|
|
| { readonly ok: false; readonly reason: string };
|
|
|
|
/**
|
|
* Compare documented limits with exported bounds.
|
|
* Each failure names the limit and both values.
|
|
*/
|
|
export function compareDocumentedNumericLimits(
|
|
rows: readonly DocumentedNumericLimit[],
|
|
bounds: readonly ExportedNumericLimit[],
|
|
names: Readonly<Record<string, number>>,
|
|
): string[];
|
|
|
|
/**
|
|
* Bounds ANALYSIS_SETTINGS and the restart-only owners export.
|
|
* `failures` names a registry entry that has no exported bound.
|
|
*/
|
|
export function loadExportedNumericLimitBounds(): Promise<{
|
|
readonly bounds: readonly ExportedNumericLimit[];
|
|
readonly names: Readonly<Record<string, number>>;
|
|
readonly failures: readonly string[];
|
|
}>;
|