Skip to content

[TS] Make empty strings falsy in symbolic conditions - #456

Open
CaelmBleidd wants to merge 5 commits into
caelmbleidd/ts-422-string-value-equalityfrom
caelmbleidd/ts-423-string-truthiness
Open

CaelmBleidd wants to merge 5 commits into
caelmbleidd/ts-422-string-value-equalityfrom
caelmbleidd/ts-423-string-truthiness

Conversation

@CaelmBleidd

@CaelmBleidd CaelmBleidd commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #423.

Stack

This PR is scoped to #423 and targets #455 / #422 at 127ecb5df35366c550a32725cf4e6af25208f673. Its head is df0b9afe4b6730b9e88a466c796fd7989b539b9a (four linear commits, no merge commit).

Change

  • Apply ECMAScript string truthiness to materialized strings: an empty UTF-16 backing is false and a nonempty backing is true. Ordinary non-null objects remain truthy.
  • Materialize uniquely typed string and string-literal fields with UTF-16 backing. Preserve written values and mark values beyond the configured bound explicitly unsupported.
  • For a dynamic reference that could be a string but has no modeled backing, fork that possibility to an explicit unsupported path. Continue supported nonstring paths instead of treating every non-null reference as truthy.

Verification

  • The direct symbolic-string regression checks empty and nonempty outcomes and replays generated witnesses in Node.js. Field regressions cover symbolic and literal string reads, writes, truthiness, equality, bound failures, and Node replay.
  • TsDynamicTruthinessTest checks that unbacked strings through any are recorded as unsupported. A source-level typeof value === "object" && value !== null guard forces a nonstring reference through if (value); the test requires a TsClass witness with result 1 and replays it in Node.js. An unrelated outer false branch produces an unbacked-string witness that the test resolver cannot render; the test requires and classifies this separately, without counting it as supported. The typed-object path is checked independently.
  • On JacoDB [TS PBT] Schedule assertion, coverage and hypothesis targets under one budget #399 b5e10a1a0c5d279492c373caf907f6387fff998f, the previous head 1c820b5a passed ./gradlew :usvm-ts:test :usvm-ts:detektMain :usvm-ts:detektTest -PuseLocalJacodb=/private/tmp/jacodb-ts-398-build --offline --no-daemon --console=plain --quiet: 1,110 tests, 143 skipped, 0 failures/errors, and both Detekt tasks succeeded. The final commit changes only the assertion for classified unsupported witnesses; its focused TsDynamicTruthinessTest and detektTest passed, including a forced rerun of the focused test. git diff --check passed.

These are local results. Pinned core correctness and AI code hygiene my-review passes on final head df0b9afe found no actionable defects. GitHub reports no automatic checks for this stacked PR; the final #460 stack runs manual CI separately.

Boundary

The source-level Boolean(input.value) call stops at unknown-call resolution (POINTER_TARGET_NOT_FOUND) before truthiness conversion. This PR covers directly executed condition operators.

Comment thread usvm-ts/src/main/kotlin/org/usvm/machine/expr/ExprUtil.kt Fixed
@CaelmBleidd
CaelmBleidd marked this pull request as ready for review October 2, 2026 21:36
@CaelmBleidd
CaelmBleidd marked this pull request as draft October 2, 2026 22:18
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-423-string-truthiness branch from 38041dd to b57c27f Compare October 2, 2026 22:25
@CaelmBleidd
CaelmBleidd changed the base branch from caelmbleidd/ts-421-symbolic-string to caelmbleidd/ts-422-string-value-equality October 2, 2026 22:25
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-422-string-value-equality branch from 7927e93 to 127ecb5 Compare October 3, 2026 05:21
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-423-string-truthiness branch from 2c08f04 to 9d511c1 Compare October 3, 2026 05:26
@CaelmBleidd
CaelmBleidd marked this pull request as ready for review October 3, 2026 06:43
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.

2 participants