Skip to content

test_util_format_with_options: formatWithOptions returns undefined instead of delegating to util.format #1002

Description

@proggeramlug

Symptom

test-files/test_util_format_with_options.ts is failing the parity gate
on every PR rebased onto current main (seen blocking #944, #947, #951,
#953, #956, #957, #958 — and now also #947 again after rebase). It has
been the sole entry in NEW FAILURES (not in known_failures.json) for
each of those runs since #952, after #958 cleared the
crypto.subtle.encrypt failure that was masking it.

Reproduction

cargo build --release -p perry-runtime -p perry-stdlib -p perry
PERRY_ALLOW_UNIMPLEMENTED=1 ./target/release/perry \
  test-files/test_util_format_with_options.ts -o /tmp/p
node --experimental-strip-types test-files/test_util_format_with_options.ts
/tmp/p

node (expected)

Hello world
x=k y=7

perry (actual)

undefined
undefined

Diagnosis pointer

util.formatWithOptions was added in #948 (b384b942 feat(util): add util.formatWithOptions (v0.5.970)). The PR description says:

The JS stub ignores the inspect-options bag and delegates to the
existing util.format — full options-passthrough is a follow-up.

The delegation isn't happening at runtime: every call returns
undefined. The HIR/manifest gate is being lifted correctly (no
compile error, no R005), but the runtime stub either isn't routed or
returns the wrong thing.

Likely suspects:

  • The formatWithOptions stub in crates/perry-stdlib doesn't
    actually invoke util.format (or returns before the call).
  • The function is registered but the dispatch tag returns
    undefined for the no-options-touching first-arg case.

test-files/fixtures/util_format_with_options/ may have additional
context if it exists.

Why fix this now

The parity gate's NEW-FAILURES check is exit 1 on a single uncategorized
new failure. With this regression undiagnosed, every PR maintainer has to
either admin-bypass or add the test to known_failures.json (which would
hide the real bug). Admin-bypass was already used to land #958 today.

Acceptance

  • formatWithOptions({}, "Hello %s", "world") returns "Hello world" at runtime.
  • formatWithOptions({ colors: false }, "x=%s y=%d", "k", 7) returns "x=k y=7".
  • test_util_format_with_options passes the parity comparison against node --experimental-strip-types.
  • No new entries in test-parity/known_failures.json (i.e. the fix lands, not a skip).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions