fix: always build purple client - #1390
Conversation
jennifer-richards
left a comment
There was a problem hiding this comment.
Comments (which I've mostly given you offline already) inline.
If this is indeed fixing the issue with startup in the dev container, I suspect it's by preventing the app-init.sh script from bombing out if the sed or /bin/cp commands (lines 50 and 53 in app-init.sh) fail.
| @@ -0,0 +1,55 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
This script is largely redundant with the existing update-rpcapi script. That other script also generates the Python client used to interact with datatracker. Breaking that into separate scripts is not a bad choice, but it should be updated to reduce redundancy if we do that.
The update-rpcapi does handle the situation that a datatracker is not available and will still generate the purple API client even in that case.
| # Sanity check: every operationId in the schema should have a matching method | ||
| # in the client (schema is snake_case, client methods are camelCase). This is | ||
| # what catches the "... is not a function" class of drift before runtime does. |
There was a problem hiding this comment.
I don't think this sanity check section is a particularly useful addition at this point. It's just checking that the code generator generated the code it was told to do, and we only reach it if the code generator ran successfully.
| # The generated client is gitignored, so it does NOT survive a container | ||
| # rebuild and must be rebuilt from the running code. This is also the recovery | ||
| # path whenever the frontend reports "api.<something> is not a function": that | ||
| # error means the generated client is out of sync with the backend. Safe to | ||
| # re-run any time (e.g. after a rebuild or a branch switch). |
There was a problem hiding this comment.
I don't think this is accurate if you're mounting the workspace in the dev container. The generated client will be written into your working directory, where it will persist even though it's gitignored. Tearing down the container won't delete it.
The generated client would not be present on a clean checkout, though. The comment would also be true if you're using a workspace entirely inside a docker volume.
No description provided.