Skip to content

[TS PBT] Register original assertions and bounded joint generator support - #407

Draft
CaelmBleidd wants to merge 2 commits into
caelmbleidd/issues-351-352-usvm-property-searchfrom
caelmbleidd/pbt-395-property-observations
Draft

CaelmBleidd wants to merge 2 commits into
caelmbleidd/issues-351-352-usvm-property-searchfrom
caelmbleidd/pbt-395-property-observations

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Problem

The shared PBT manifest names an original TypeScript predicate and independent input domains, but it has no stable assertion/operand identity or a declared joint generator relationship. This prevents downstream observation from linking facts to a specific user assertion and permits an invalid array/index combination outside a dependent generator's support.

Behavior

  • Carry author-assigned property, assertion, operand, generator and source/build-input identities through PropertyDefinition and PropertyManifest. Source/build hashes are registrant-supplied; runtime hash verification is not implemented.
  • Represent a bounded nonempty array and its valid index as one explicit joint construction. Fast-check rejects incompatible array/index domain declarations before sampling, constructs the pair together, checks explicit examples against the relationship, and USVM constrains the index by the symbolic array length.
  • Register a pinned real fast-check ArrayArbitrary.spec.ts callback with its original expect(filtered).toHaveLength(new Set(filtered).size) assertion. A narrow toHaveLength shim preserving AssertionError and a boolean completion wrapper adapt the callback to the existing execution contract. The deliberately faulty identity implementation fails; the Set implementation passes. The bounded development support and manual adaptation cost are documented.
  • Preserve the original predicate/precondition invocation, clone boundary, and distinction between hard support, preconditions, generation bias, and observations. Existing relational, bounded, precondition and array examples run through the same backend.

Verification

Checked at 8b3c3f8dd0cd16cbfa34eb24c273fe66d57ab16d:

  • npm test in usvm-ts-fast-check/fast-check-adapter: 63 passed, including incompatible manifest rejection and assertion shim class/order/throw checks.
  • ./gradlew :usvm-ts-pbt:test --tests '*UsvmCollectionDomainProjectorTest' :usvm-ts-fast-check:test --tests '*ExamplePropertiesTest' --tests '*RealSuiteRegistrationTest' :usvm-ts-pbt:detekt :usvm-ts-fast-check:detekt --offline: passed, zero Detekt findings.
  • ./gradlew :usvm-ts-fast-check:test --tests '*ExamplePropertiesTest' :usvm-ts-fast-check:detekt --offline: passed after adding execution of all four existing examples.

Limits

This is a bounded registration contract, not a general native fast-check or Vitest importer. Record construction, arbitrary dependent closures/combinators, generator-choice search, value instrumentation and empirical observations remain outside this PR. The declared source/build-input hashes are transported but not verified against the loaded/transpiled runtime. The test fixture hashes the direct TypeScript input bytes and records that scope explicitly. Downstream exact-input shrinking must use the joint arbitrary helper when #353 is integrated.

Closes the reviewable core registration stage of #395. Depends on #387; base should change to main after #387 merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant