Skip to content

JavaScript/TypeScript: a regex literal containing \/\/ (/^https?:\/\//) is read as a // comment, code after it on the line is lost #9452

Backlog

Description

@squid-protocol

Found by the SOP-002 gap-cell decoy suite (protocol SOP-002-v1, epic #8863).

Construct: a regular-expression literal that contains an escaped slash pair, /^https?:\/\//. Prism reads the // inside the regex literal as the start of a line comment, so the rest of the line is moved to the comment stream and real code after the literal is lost (recall loss in every family on that line).

Snippet (javascript and typescript, family telemetry): if (/^https?:\/\//.test(u)) logger.info("x");

Expected: 1 telemetry hit (the logger call is code). Actual: 0 hits. const r = /a/; logger.info("x") gives 1, and moving the call to the next line gives 1, so only the remainder of the line after the regex literal is lost.

This is the regex-literal twin of the string-to-comment boundary ("http://x" // kw), which passes. Matching a URL scheme with /^https?:\/\// is a common idiom.

Locked in tests/decoys/test_decoy_javascript.py and tests/decoys/test_decoy_typescript.py as xfail(strict=True).

Activity

  1. added
    bug
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions