Skip to content

[TS PBT] Capture compiler-owned numeric DSL results - #580

Open
CaelmBleidd wants to merge 1 commit into
caelmbleidd/pbt-entry-refutation-basefrom
caelmbleidd/pbt-dsl-local-capture
Open

CaelmBleidd wants to merge 1 commit into
caelmbleidd/pbt-entry-refutation-basefrom
caelmbleidd/pbt-dsl-local-capture

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

The Kotlin DSL can now opt in to capture the numeric result of one shared direct function call and its original input operand. The existing FastCheck observation artifact and scalar inference consume those values; the ordinary generated boolean predicate remains plain TypeScript.

val compiled = compiler.compile(
    program,
    generatedModule = "generated.ts",
    resolveModule = { "./$it" },
    numericLocalCapture = DslNumericLocalCapture(localName = "result", checkName = "bound"),
)
val capture = requireNotNull(compiled.numericLocalCapture)
val result = backend.run(
    compiled.definition,
    configuration.copy(observationRequest = capture.observationRequest()),
)

The first supported form is a numeric shared local initialized by a direct call, used as one direct operand of an original named === or <= check; its other operand is an original numeric input. The compiler retains the program/node/local, predicate and companion exports, both generated assignment positions, selected source hash, and occurrence. Other requested forms are explicitly rejected.

The opt-in observation point declares a typed callback ABI. Only the generated diagnostic companion receives that callback, directly after its original const assignment. The normal public observation hook cannot write compiler-owned points. The original property/manifest function API is unchanged; no Symbol support, new recorder, second compiler or statement language is added. Shared calls keep their order and execute once across multiple checks; a declaration after a check remains rejected.

This is a capture prerequisite for #398. The descriptor is not proof of an arbitrary executable body: observation build status remains UNVERIFIED, and selected source hashes do not establish transitive import/build identity. Exact symbolic point binding and full native hypothesis refutation follow separately; this PR does not activate guidance from arbitrary callback names or source coordinates and does not close #398.

Review scope

13 files, +804/-18: +332/-18 production/package wiring and +472 tests. The PR targets the existing immutable dependency branch caelmbleidd/pbt-entry-refutation-base at 29bfd78fe53da23e7f4ed9fe3881b53a43606b38. It does not depend on the #576 entry-refutation feature; the shared base contains main and the already published #544/#566/#560 prerequisites. No campaign or selector changes are included.

Validation

  • All 236 usvm-ts-pbt tests and 51 relevant DSL/backend/inference Kotlin tests passed.
  • 55 native callback, entry-point and property execution tests passed. These cover NaN, signed zero, infinities, wrong ABI/program/export/source/occurrence/kind, missing/repeated/mismatched receipts, unavailable values, source drift and public-hook substitution attempts.
  • A real frontend fixture retains one selected local assignment in both the original predicate and the diagnostic companion.
  • An effectful native fixture reuses the result in multiple checks and independently checks that its underlying call executes once in both execution paths.
  • Strict Detekt passed for all changed Kotlin files; TypeScript compilation and diff checks passed.

These are local regression checks. No comparative experiment or benchmark campaign was run.

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