feat: multiple editable modules#429
Conversation
3cab5e9 to
93a7d48
Compare
|
@dhess I'm seeing a unrelated (I think) rel8 test suite failure: https://buildkite.com/hackworthltd/primer/builds/603#67bb9eff-aadb-4da6-8710-a0476d028ce0, which says I'll restart the test to see if it is reproducible. |
|
Hmm, that used to occur from time to time due to a race condition in |
c52eb00 to
74f738f
Compare
74f738f to
e4a2bc7
Compare
|
This is ready for review. This implements the FR #321 |
|
There is something a bit odd in CI: https://buildkite.com/hackworthltd/primer/builds/650#e19733c0-f807-45f2-b4ba-26b67caaf831 "Unexpected lambda in case", and then some GHC Core is output (but CI still passed). I'll investigate, but I don't think this should delay review. Since CI still passed, I'm not sure whether this is a new symptom. It was just luck that I happened to look at CI to check progress at the right time to notice it. Edit: Looks like it only occured on the last commit (3d54b9f) |
e42b7a0 to
4511478
Compare
3d54b9f to
9cdcda3
Compare
We consistently handle "not found" errors. This is in preparation for adding multiple editable modules. Thus we add some new errors `ModuleNotFound` and `ModuleReadonly` and use these as appropriate. Note that this may change some errors the API returns.
2516fb8 to
b4e0d3b
Compare
Currently they will return an error if they target anything other than the one editable module. However, we will shortly enable multiple editable modules, at which point we need to explicitly state what module they should affect. BREAKING CHANGE: this change requires a database migration, as it changes the representation of `Log`. However, since this is just serialised to json and stored as a blob in the DB, it requires no schema changes. Since we have no programs we need to preserve, we decided not to bother with a migration. This means that DBs created before this commit will not load with a primer containing this commit. This commit also changes Primer's API.
Previously we only viewed the contents of the one editable module. We now give the contents of every module, and also tag them with whether they are editable or imported. BREAKING CHANGE: this changes the response to an api endpoint, and this is reflected in the generated openapi schema.
NB: lots of this commit is fairly trivial testsuite churn BREAKING CHANGE: this change requires a database migration, as it changes the representation of `Prog`. However, since this is just serialised to json and stored as a blob in the DB, it requires no schema changes. Since we have no programs we need to preserve, we decided not to bother with a migration. This means that DBs created before this commit will not load with a primer containing this commit.
|
I have rebased onto 69cce80 and it looks like the GHC message has disappeared:
I wonder what change caused this (edit: from some investigation, it seems that multiple GHCs will emit this message in certain circumstances, and it is rather sensitive to small code changes.) |
|
For anyone who reviews this after me (including @georgefst), this is one PR where I found it very helpful to turn on GitHub's "Hide whitespace" option, as there are otherwise large chunks of code that are unchanged save for indentation. |
|
I'm afraid I'm too far removed now from Primer core to have anything particularly interesting to say, but this all looks fine to me. Let's obviously wait for @georgefst to weigh in. |
I think there is nothing wrong with our code, and am filing it as a ghc issue: https://gitlab.haskell.org/ghc/ghc/-/issues/21555 |
Support multiple editable modules. Previously one could import as many modules as wanted, but only had one module to write code in. This is now relaxed so writing larger, multi-module programs is possible without abusing imports.
Closes PRIM-23 and PRIM-76