Resolve the API contract path when it is served, not when it is compiled `/api/contracts/repositories-v1.json` answers 500 in production and staging both, and has since it shipped. The path lived in a module attribute, so `Application.app_dir/2` ran at compile time and froze the build machine's `_build` directory into the module. A release is built in one container and run in another, where that path does not exist, so `File.read!/1` raised. Nothing caught it because the failure needs compilation and execution to happen in different places, and in a test suite they never do -- it answers 200 in development for the same reason it answers 500 in a release. So the guard is source-level: no module attribute may resolve an application directory. Every other caller in `lib/` already resolves inside a function; this was the only one. Verified by restoring the defect and watching the guard fail.
Resolve the API contract path when it is served, not when it is compiled
Deploy story
What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.
Not deployed through the forge lane
No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.
Changed files
-
modified
lib/openagents_web/controllers/api_contract_controller.ex -
added
test/openagents_web/release_paths_test.exs
Diff
2 files changed, +65 -5
lib/openagents_web/controllers/api_contract_controller.ex modified +9 -5
@@ -3,13 +3,10 @@ defmodule OpenAgentsWeb.ApiContractController do
| 3 | 3 |
|
| 4 | 4 |
|
| 5 | 5 |
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 6 |
|
|
| 10 | 7 |
|
| 11 | 8 |
|
| 12 |
|
|
| 9 |
|
|
| 13 | 10 |
|
| 14 | 11 |
|
| 15 | 12 |
|
@@ -18,6 +15,13 @@ defmodule OpenAgentsWeb.ApiContractController do
| 18 | 15 |
|
| 19 | 16 |
|
| 20 | 17 |
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 21 | 25 |
|
| 22 | 26 |
|
| 23 | 27 |
|
test/openagents_web/release_paths_test.exs added +56
@@ -0,0 +1,56 @@
| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|