Skip to content

Ide rebuild can create invalid JS with outdated cache #3323

@kritzcreek

Description

@kritzcreek
  1. Compile and load these 2 modules into the ide server:
module A where

fn :: Int -> String
fn x = show x
module B where

import A (fn)

bFn :: String
bFn = fn 1
  1. Change module A.fn to
fn :: String -> String
fn s = s <> "hi!"
  1. Recompile A without letting the server know (start it with the --editor-mode flag and recompile module A from the cmdline with purs compile src/A.purs)

  2. Make a change to module B and fast-rebuild through ide, it does not show any errors, and it continues to generate code for B that assumes the old signature of A.fn is still valid, but instead the code fails at runtime.

This is a known issue, and I do not have a satisfying solution for the problem at hand. It basically boils down to cache invalidation between the FS and the ide servers internal state. Empirically file watching misses changes, and doesn't interact well with adding and removing files and avoiding it by polling creates too much overhead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions