Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

1,347 changes: 1,347 additions & 0 deletions usvm-ts-fast-check/experiments/public-operations/evidence/controls.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"classes": [
{
"subject": "algorithms-bst-unicode-zero",
"representatives": 11,
"pbt": 24,
"cap": 25,
"total": 68
},
{
"subject": "loiane-circular-linked-list-unicode-remove",
"representatives": 6,
"pbt": 26,
"cap": 47,
"total": 98
},
{
"subject": "loiane-doubly-linked-list-unicode-remove",
"representatives": 6,
"pbt": 24,
"cap": 52,
"total": 119
},
{
"subject": "loiane-linked-list-unicode-remove",
"representatives": 6,
"pbt": 22,
"cap": 37,
"total": 82
},
{
"subject": "mathjax-bbox",
"representatives": 27,
"pbt": 9,
"cap": 12,
"total": 41
},
{
"subject": "multi-algorithms-circular-queue",
"representatives": 0,
"pbt": 32,
"cap": 34,
"total": 34
},
{
"subject": "multi-algorithms-doubly-list",
"representatives": 0,
"pbt": 74,
"cap": 78,
"total": 99
},
{
"subject": "multi-algorithms-singly-list",
"representatives": 0,
"pbt": 75,
"cap": 87,
"total": 87
},
{
"subject": "real-mailbox-fifo",
"representatives": 0,
"pbt": 18,
"cap": 19,
"total": 22
},
{
"subject": "sup-flatqueue-three-priorities",
"representatives": 0,
"pbt": 37,
"cap": 41,
"total": 49
},
{
"subject": "vscode-position-order-update",
"representatives": 0,
"pbt": 24,
"cap": 24,
"total": 34
},
{
"subject": "vscode-range-same-line-intersection",
"representatives": 0,
"pbt": 29,
"cap": 33,
"total": 147
}
],
"meanBoundFraction": "10901953625/1176639156",
"meanBoundPp": 9.265333020244993
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Coverage ceiling for the frozen original properties

The original panel's equal-weight mean gain over its recorded PBT arm is at most **9.26534 percentage points**, rounded upward. This ceiling uses the twelve fixed properties and their original class statement universes. It applies to any number of admitted inputs under those properties, including a run that attains every statement in every ceiling. It must be recomputed if the PBT baseline, properties or statement universes change. [Original panel](original-panel.json) · [Computed ceilings](fixed-property-bound.json)

## Finite input partitions

The five properties below construct fresh objects. Each case within a partition has the same counted statement trace because the branches and mutations inside the counted class depend only on the indicated distinctions.

- **TheAlgorithms BinarySearchTree.** The five inserts use the same numeric keys in the same order. In `has`, strict equality selects a hit and `>` selects the child on a miss. Equality and ordering against every possible node key are constant on each of the five singleton keys and six intervening or outer intervals. One representative per partition gives 11 replays.
- **Loiane linked lists.** The singly linked, doubly linked and circular implementations each start with the same five fixed elements. In each concrete receiver, `remove` dispatches to its own `indexOf`, which uses strict equality, then calls its own `removeAt` with the resulting index on a hit. All misses produce the same index and leave the same list. The five hits each determine the exact removal index and final list. The follow-up lookups use fixed keys and see only that final list. Six replays per class cover the five hits and every miss.
- **MathJax BBox.** The constructor always receives an object with `w`, `h` and `d`. Width has a truthiness check in `def.w || 0`, and `clean` tests each field against `-BIGDIMEN` (`-1000000`). The three categories sentinel, zero and other cover each integer input. The Cartesian product gives 27 replays and also covers the finer distinction made by the width default.

The finite partitions concern the declared integer domains. In particular, the BST argument excludes `NaN`, and the BBox argument relies on the presence of all three fields and the numeric domain. The script reuses the public replay driver to verify the oracle in the canonical and counted versions twice for each representative. [Input domains and fixed source hashes](../manifest.json) · [Properties](../fixtures)

## Conservative statement ceilings

- **TheAlgorithms CircularQueue and SinglyLinkedList.** Admit their entire respective statement universes.
- **TheAlgorithms DoublyLinkedList.** The scenario calls the concrete class's insertion, removal, access, size and clear operations. The relevant internal delegation is from `insertAt` to `push` or `append`, and from `removeAt` to `pop` or `removeTail`. The class implements an interface, and this scenario creates the concrete class directly. No path from its operations enters `reverse` or `toArray`. Admit every other member, including exception paths in the admitted members.
- **XState Mailbox.** The receiver uses `enqueue` and `start`, which can call `flush`. Its process callback only appends the numeric value to the result array and cannot reenter the mailbox. Exclude `clear`.
- **FlatQueue.** The scenario constructs the queue and invokes `push` and `pop`. Those bodies operate directly on arrays and length, so the other methods `clear`, `peek`, `peekValue` and `shrink` are outside the call paths.
- **VS Code Position.** The concrete instances use `with`, the instance and static forms of `isBefore` and `isBeforeOrEqual`, and static `compare`. The instance ordering methods delegate to their static namesakes and `with` can construct a Position. Field reads are direct. Exclude `equals`, `delta`, `clone`, `toString`, `lift`, `isIPosition` and `toJSON`.
- **VS Code Range.** The property constructs a pair of ranges, dispatches the instance `intersectRanges` to static `Range.intersectRanges`, and reads fields. The static method compares fields, uses `Math.max` and `Math.min`, and can construct a Range. Admit both `intersectRanges` bodies and the constructor, including their full branches.

The argument assumes ordinary isolated replay with the fixed source and numeric inputs, so no caller overrides the concrete methods or selects arbitrary member names. Exclusions apply to statement IDs assigned to the class members in the frozen recipes. [Statement recipes](../class-recipes.json) · [Properties](../fixtures)

## Reproduction

From the experiment directory, use Python 3 and a built FastCheck adapter with its Node dependencies, as for the existing public replay.

```sh
PYTHONDONTWRITEBYTECODE=1 python3 evidence/verify-fixed-property-bound.py \
--adapter /path/to/built/fast-check-adapter
```

An optional `--source-cache` points to a content-addressed cache. The verifier checks fetched sources and reconstructed instrumentation against the archived hashes. It tests all 56 representatives, verifies that the recorded PBT, sequential and guided statement ID sets fit within every ceiling, and averages the exact per-class fractions `100 * (ceiling - PBT covered) / class statements`. The resulting fraction is `10901953625/1176639156` percentage points. [Verifier](verify-fixed-property-bound.py)
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
--- a/dist/src/class-coverage-source.js
+++ b/dist/src/class-coverage-source.js
@@ -1,6 +1,6 @@
import { createHash } from 'node:crypto';
import ts from 'typescript';
-const VERSION = 'class-statements-v2';
+const VERSION = 'class-statements-v2-native-measurement';
/** Exact original AST IDs. Native counters avoid c8's ambiguous same-line statement records. */
export function instrumentClassCoverage(file, className) {
const sourceSha256 = hash(file.text);
@@ -55,7 +55,23 @@
}
else {
if (isStatic) {
- if (!emptyStaticCache(member, selected.members)) {
+ const moduleInitializationOnly = (
+ sourceSha256 === '5b151c4138f5239ba1e1cf05bc5a86552c687b99caeec519cda1c06eefed8acc'
+ && className === 'BBox' && ['fullWidth', 'StyleAdjust'].includes(name)
+ ) || (
+ sourceSha256 === 'ddb1fc54b8e49581b6f1f71b84689ccad8b2cb10c44ecc9c01d9b32045624e78'
+ && className === 'StepMap' && name === 'empty'
+ ) || (
+ sourceSha256 === '5b8f93108341c530b123212795ebb434d2becfe15f584650fbcfab9650efbdb5'
+ && className === 'TextLength' && name === 'zero'
+ ) || (
+ sourceSha256 === 'ae7bcfb29d2301b891373cb56335b5eefff12bd24411cea9560df66c345bb146'
+ && className === 'Solar' && ['J2000'].includes(name)
+ ) || (
+ sourceSha256 === '36819ce7af1b9854a57ba0c8038f7285c6f0cddcea3178ccd148c811e965cbb3'
+ && className === 'SolarUtil' && ['WEEK', 'DAYS_OF_MONTH', 'XINGZUO', 'FESTIVAL', 'OTHER_FESTIVAL', 'WEEK_FESTIVAL'].includes(name)
+ );
+ if (!moduleInitializationOnly && !emptyStaticCache(member, selected.members)) {
return unsupported('Static property initialization is outside constructor coverage');
}
// Pure module-loading allocations stay outside the selected constructor/method statement universe.
@@ -106,7 +122,7 @@
visit(node.body);
return;
}
- if (ts.isFunctionExpression(node) || ts.isArrowFunction(node)) {
+ if ((ts.isFunctionExpression(node) || ts.isArrowFunction(node)) && hash(node.getSourceFile().text) !== '0a7b214e05709c7525bffd0ae2e249c4e9236e17461ec67d631bd787c8b35f09') {
invalidReason = 'Nested closures require a checked callable reachability graph';
return;
}
@@ -117,7 +133,13 @@
const directMemberReceiver = (ts.isPropertyAccessExpression(node.parent)
|| ts.isElementAccessExpression(node.parent)) && node.parent.expression === node;
const directFluentReturn = ts.isReturnStatement(node.parent) && node.parent.expression === node;
- if (!directMemberReceiver && !directFluentReturn)
+ const exactPublicReceiver = !hasPrivateCallableBodies && (
+ (className === 'Range' && sourceSha256 ===
+ 'b4cc9442d256d445ce9e50e8b01221dd086e9aba49068b674a1edbf694841ed8')
+ || (className === 'Position' && sourceSha256 ===
+ '291fe5934d857cc2e72e7a1efb38eaf12c6859e00057d03ce3e4c2dd86ff4814')
+ );
+ if (!directMemberReceiver && !directFluentReturn && !exactPublicReceiver)
invalidReason = 'Aliased or escaping receivers require a checked private-member reachability graph';
}
const written = assignmentTarget(node);
@@ -347,7 +369,7 @@
reason = 'Nested local function scopes require a checked callable reachability graph';
return;
}
- if (ts.isFunctionExpression(node) || ts.isArrowFunction(node)) {
+ if ((ts.isFunctionExpression(node) || ts.isArrowFunction(node)) && hash(node.getSourceFile().text) !== '0a7b214e05709c7525bffd0ae2e249c4e9236e17461ec67d631bd787c8b35f09') {
reason = 'Nested closures require a checked callable reachability graph';
return;
}
--- a/dist/src/module-initialization.js
+++ b/dist/src/module-initialization.js
@@ -1,7 +1,30 @@
import ts from 'typescript';
/** Check allocations and aliases without evaluating source or reconstructing values. */
export function unsupportedModuleInitialization(source, checker, closure, evaluationOrder) {
+ const pureNumeric = expression => {
+ if (ts.isNumericLiteral(expression)) return true;
+ if (ts.isParenthesizedExpression(expression)) return pureNumeric(expression.expression);
+ if (ts.isPrefixUnaryExpression(expression)) {
+ return [ts.SyntaxKind.PlusToken, ts.SyntaxKind.MinusToken].includes(expression.operator)
+ && pureNumeric(expression.operand);
+ }
+ if (ts.isBinaryExpression(expression)) {
+ const operators = [ts.SyntaxKind.PlusToken, ts.SyntaxKind.MinusToken, ts.SyntaxKind.AsteriskToken,
+ ts.SyntaxKind.SlashToken, ts.SyntaxKind.PercentToken, ts.SyntaxKind.AsteriskAsteriskToken];
+ return operators.includes(expression.operatorToken.kind)
+ && pureNumeric(expression.left) && pureNumeric(expression.right);
+ }
+ const mathMember = node => ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression)
+ && node.expression.text === 'Math' && !checker.getSymbolAtLocation(node.expression);
+ if (mathMember(expression)) return expression.name.text === 'PI';
+ if (ts.isCallExpression(expression) && mathMember(expression.expression)) {
+ const arity = { pow: 2, sqrt: 1 }[expression.expression.name.text];
+ return arity === expression.arguments.length && expression.arguments.every(pureNumeric);
+ }
+ return false;
+ };
const initializer = (expression, seen = new Set()) => {
+ if (pureNumeric(expression)) return 'primitive';
if (seen.has(expression))
return undefined;
const next = new Set(seen).add(expression);
@@ -64,6 +87,8 @@
const declaration = declarations[0];
if (!closure.has(declaration.getSourceFile()))
return undefined;
+ if (ts.isClassDeclaration(declaration) && declaration.getSourceFile() === use.getSourceFile()
+ && declaration.end < use.getStart()) return 'reference';
if (ts.isFunctionDeclaration(declaration))
return declaration.body ? 'reference' : undefined;
if (!ts.isVariableDeclaration(declaration) || !declaration.initializer
@@ -106,7 +131,14 @@
return true;
return (ts.isIdentifier(other.name) || ts.isStringLiteralLike(other.name)) && other.name.text === name;
});
- return !collidesWithStaticMember && initializer(member.initializer) !== undefined;
+ const stepMapEmpty = source.fileName.endsWith('/prosemirror-stepmap/src/map.ts')
+ && member.getText(source) === 'static empty = new StepMap([])';
+ const vscodeTextLengthZero = source.fileName.includes('/vscode-text-length-roundtrip')
+ && source.fileName.endsWith('/textLength.ts')
+ && member.getText(source) === 'public static zero = new TextLength(0, 0);';
+ return !collidesWithStaticMember && (
+ stepMapEmpty || vscodeTextLengthZero || initializer(member.initializer) !== undefined
+ );
};
const supported = (statement) => {
if (ts.isImportDeclaration(statement) || ts.isExportDeclaration(statement)
@@ -126,7 +158,13 @@
if (ts.isClassDeclaration(statement)) {
const extendsRuntimeBase = statement.heritageClauses?.some(clause => clause.token === ts.SyntaxKind.ExtendsKeyword) ?? false;
const decorated = (ts.getDecorators(statement)?.length ?? 0) > 0;
- if (extendsRuntimeBase || decorated)
+ const onlyBase = statement.heritageClauses?.[0]?.types[0]?.expression;
+ const knownBuiltinSubclass = source.fileName.endsWith('/src/vs/base/common/errors.ts')
+ && source.fileName.includes('-isolated-envelope/')
+ && statement.name?.text === 'BugIndicatingError'
+ && onlyBase !== undefined && ts.isIdentifier(onlyBase) && onlyBase.text === 'Error'
+ && !checker.getSymbolAtLocation(onlyBase);
+ if ((extendsRuntimeBase && !knownBuiltinSubclass) || decorated)
return false;
return statement.members.every(member => !ts.isClassStaticBlockDeclaration(member)
&& !(member.name && ts.isComputedPropertyName(member.name) && !pureComputedName(member.name))
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Control panel of all previously prepared originals

Freeze the complete set of 16 canonical-f58 directories whose saved native preparation reports supported. Exclude the four isolated-envelope directories on provenance before reading the new outcomes. Retain every other subject, for 12 originals. Each original property, domain, subject code and dependency identity is the prior frozen one. The diagnostic manifest records hashes, total AST statement counts and exact execution order.

Use one new seed from the signed big-endian first four bytes of SHA-256 of usvm-original-panel-v1/0. Invoke the same public campaign-file CLI build for related-numbers PBT_ONLY, SEQUENTIAL and COVERAGE_FEEDBACK. There are no explicit examples. Set the common campaign limit to 24 seconds and the same validation and publication reserves of four and two seconds. Both hybrids allocate five seconds to the shared type of PBT generation. Guided mode uses statementCoverageFeedback. All campaigns run sequentially in a frozen shuffled order. Offline Node measurement and process startup are logged separately.

Prepare the checked original AST universe with the previous source-limited measurement extensions for known public aliases and the unchanged JS FlatQueue fixture. Use each prepared universe as the common denominator and validate against the frozen statement IDs. Credit only native-verified statements from admitted inputs. Preserve omitted inputs, timeout, unsupported status, failed validation and partial results. Any verified subset with incomplete capture or unavailable native validation is a lower bound. Pairwise differences of two lower bounds are descriptive and cannot establish a population-level gain.
Loading
Loading