Skip to content

ghcide-tests' addDependentFile test #4194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
soulomoon opened this issue Apr 27, 2024 · 7 comments
Closed

ghcide-tests' addDependentFile test #4194

soulomoon opened this issue Apr 27, 2024 · 7 comments

Comments

@soulomoon
Copy link
Collaborator

soulomoon commented Apr 27, 2024

What is happenning

  • GetModificationTime dep-file.txt cache value in shake extra is cleanup
  • GetModificationTime dep-file.txt is dirty
  • shake restart
  • GetModificationTime dep-file.txt computed
  • GetModificationTime dep-file.txt cache value is added
  • but the new value is not flush the result to hls-graph (Hence its version step is not updated)
  • shake restart
  • computing GetModificationTime dep-file.txt
  • GetModificationTime dep-file.txt cache value is read (The source of the error) and returned
  • it's reverse dep compute, since its step is not updated in the last run, the value is considered as the old result, so it's reverse dep is not recomputed.

============================
After file change and index
The correct case

<-- {
    "jsonrpc": "2.0",
    "method": "$/progress",
    "params": {
        "token": "22",
        "value": {
            "kind": "end",
            "message": "Finished indexing 1 files"
        }
    }
}
<-- {
    "jsonrpc": "2.0",
    "method": "textDocument/publishDiagnostics",
    "params": {
        "diagnostics": [],
        "uri": "file:///private/var/folders/36/_743psv11gv2wrj9dclrpd500000gn/T/hls-test-root/extra-dir-52959961234/Foo.hs",
        "version": 0
    }

but we sometimes we have, never get the diganostic for file that have changed

<-- {
    "jsonrpc": "2.0",
    "method": "$/progress",
    "params": {
        "token": "23",
        "value": {
            "kind": "end",
            "message": "Finished indexing 1 files"
        }
    }
}
@soulomoon

This comment was marked as resolved.

@soulomoon
Copy link
Collaborator Author

soulomoon commented Apr 27, 2024

Odd is that even we restarting the session, we have

trans Dirty: TypeCheck; /private/var/folders/36/_743psv11gv2wrj9dclrpd500000gn/T/hls-test-root/extra-dir-12222126765/Foo.hs

But TypeCheck Foo.hs is not rerun

@soulomoon
Copy link
Collaborator Author

GetModificationTime in hls-graph is not updated correctly

@soulomoon
Copy link
Collaborator Author

soulomoon commented Apr 27, 2024

We should be deleting the GetModificationTime for watched file and update the state, but some how we did not always finish
https://github.com/soulomoon/haskell-language-server/blob/9dc0281413eb5cc92aa4d5d912691646ca142fa5/ghcide/src/Development/IDE/Core/FileStore.hs#L167

@soulomoon
Copy link
Collaborator Author

soulomoon commented Apr 27, 2024

One possiblity
Again, another dirty keys losing problem as in #4093
But different. It is incorrectly removed in the next session and already stored to the shakeExtra's cache values but it's new value is not flushed to the hls-graph before the next session.

defineEarlyCutoff' remove dirty GetModificationTime "dep-file.txt" and update itself to the cache value but it's value never reach to actually update hls-graph and hence out of sync. It is new but being considered as old value in hls-graph

@soulomoon
Copy link
Collaborator Author

soulomoon commented Apr 27, 2024

The solution would be the removal of dirty keys and the cache values update should go after hls-graph update the value or at least along side, and not the otherside around. Probably should be fixing it too in #4190.

soulomoon added a commit that referenced this issue May 10, 2024
…nd rule values [flaky test #4185 #4093] (#4190)

The main problem is the out of sync state in the build system. Several states involved, the shake database running result state for key. shake extra's dirty state for key and shake extra's rule values state.
To stablize the build system. This PR force some of the updates of these state into a single STM block.

1. collect dirtykeys and ship it to session restart directly. No more invalid removal before session restart. Fixing Flaky test failure result in error of GetLinkable #4093
2. move the dirtykey removal and rules values updating to hls-graph by adding a call back fucntion to RunResult. Properly handle the dirtykeys and rule value state after session start and closely followed by another session restart Fixing ghcide-tests' addDependentFile test #4194
3. properly handle clean up by wrapping the asyncWithCleanUp to refreshDeps

---------

Co-authored-by: wz1000 <zubin.duggal@gmail.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
@soulomoon
Copy link
Collaborator Author

fixed by #4190

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

No branches or pull requests

1 participant