Skip to content

@qwitwa's V8 REPL concern #5156

Closed
Closed

Description

@avivkeller

@avivkeller Apologies for abusing this PR for an off topic DM, but I would appreciate some guidance in what, if anything, should be done to raise the issue I encountered, and if so, where. I had a look on the chromium issue tracker and found a few similarish discussions but was honestly intimidated by it. In my own app, I've fixed this by stripping the contents of the backticks and only completing on an empty string. That approach works for me and I expect it would work in a statistical majority of cases, but it doesn't seem actually Correct (there's nothing actually preventing an empty template argument to a tag function from side-effecting, never mind the fact that I'm assuming "my" code is handling nesting complexities right with acorn, but it's vibecoded and I haven't reviewed it properly.)

Is this worth filing a node issue for? V8 only? Is there a chat room that would make sense for me to visit to get pointed in the right direction? Feel free to ignore this if you don't have the spoons, since it isn't relevant to this PR as you've said. I just figured whilst I have the motivation for this it might be worth making it bureaucratically visible.

Originally posted by @qwitwa in nodejs/node#64034 (comment)

Activity

  1. avivkeller commented on Jun 28, 2026

    @avivkeller
    MemberAuthor

    Can you make a minimal reproduction without relying on external libraries? Here's how to check if a function has side effects:

    import { Session } from 'node:inspector/promises';
    
    const session = new Session();
    session.connect();
    
    async function hasSideEffects(expression) {
      const { exceptionDetails } = await session.post('Runtime.evaluate', {
        expression,
        throwOnSideEffect: true,
        returnByValue: true,
      });
    
      if (!exceptionDetails) return false;
    
      const desc = exceptionDetails.exception?.description ?? exceptionDetails.text ?? '';
      if (/[Pp]ossible side-effect/.test(desc)) return true;
      throw new Error(`evaluation failed: ${desc}`);
    }
  2. avivkeller commented on Jun 30, 2026

    @avivkeller
    MemberAuthor

    Actually, I rewrote the completion logic to accomodate those changes, and will update the PR

  3. qwitwa commented on Jul 1, 2026

    @qwitwa

    Sick. I did have a go at compiling your PR but I'm on a steam deck and with make -j2 to avoid running out of ram it's been 2 hours already. The dax pattern is a tag function that returns a side-effectful thennable, so assuming I found a repro, I was going to go look for the details of how await gets handled behind the scenes, but honestly I'm probably out of my depth - ideally I'd have a much more solid and total grasp of semantics nooks and crannies before trying to trace "is this safe to eval" code. .

  4. avivkeller commented on Jul 1, 2026

    @avivkeller
    MemberAuthor

    Wow! Compiling node on a steam deck is certainly not something that happens often. Thank for your help identifying this bug, and I'm so glad my PR fixes yet another wacky quirk of the REPL!

  5. qwitwa commented on Jul 2, 2026

    @qwitwa

    I did end up managing to follow (badly, wish I'd started using ninja) the build/test instructions, and after an age ended up with this; is this expected? I'm sleep deprived right now, I'll have more spoons to take stuff in maybe in a day or two.

    Node.js v27.0.0-pre
    Command: out/Release/node /home/deck/Code/external/node/test/parallel/test-snapshot-reproducible.js
    
    
    [14:14|% 100|+ 5726|-   1]: Done
    
    Failed tests:
    out/Release/node /home/deck/Code/external/node/test/parallel/test-snapshot-reproducible.js
    make[1]: *** [Makefile:322: jstest] Error 1
    make: *** [Makefile:359: test-only] Error 2
    

    Full (well, up to what was printed to the console) verbose assertion failure at https://gist.github.com/qwitwa/baf4d4099aa38942af9edd7abda699c0

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

    needs more infoissues that need more info from the author

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions