Skip to content

fix(ApiWeb): set compile-time variable for stop_events_route#990

Merged
runkelcorey merged 5 commits intomasterfrom
fix-api-web-config
Apr 1, 2026
Merged

fix(ApiWeb): set compile-time variable for stop_events_route#990
runkelcorey merged 5 commits intomasterfrom
fix-api-web-config

Conversation

@runkelcorey
Copy link
Copy Markdown
Contributor

@runkelcorey runkelcorey commented Mar 31, 2026

Summary of changes

  1. Remove feature flag for stop events endpoints, exposing stop events to API requests
  2. Remove references to said feature flag
  3. Mark stop_events as experimental

Background

Asana Ticket: 📸↩︎ construct database query (ApiWeb.StopEventController + ApiWeb.StopEventView.location + router)

#987 failed to deploy to dev and dev-blue. Splunk showed

ERROR! the application :api_web has a different value set for path [:stop_events_route]
inside key :features during runtime compared to compile time. Since this application
environment entry was marked as compile time, this difference can lead to different
behavior than expected
  1. I didn't realize that mix would check for compile-time values as well as runtime
  2. I assumed that dev compiled with dev as MIX_ENV but it actually uses PROD

How were these changes validated?

  1. Successfully deployed to dev-green

@runkelcorey runkelcorey self-assigned this Mar 31, 2026
@runkelcorey runkelcorey requested a review from a team as a code owner March 31, 2026 15:21
@runkelcorey runkelcorey added bug Something isn't working elixir Pull requests that update Elixir code labels Mar 31, 2026
@runkelcorey runkelcorey requested review from lemald and removed request for a team March 31, 2026 15:21
@lemald
Copy link
Copy Markdown
Member

lemald commented Mar 31, 2026

question: is the idea that we want to be able to set the application environment variable at runtime to enable / disable the feature, not just at compile time? If so, then the use of Application.compile_env will have to change. In any event, if I understand correctly, the STOP_EVENTS_ROUTE environment variable could be set differently on the prod environment versus where the application gets built, which would surface this error again.

@runkelcorey
Copy link
Copy Markdown
Contributor Author

runkelcorey commented Mar 31, 2026

question: is the idea that we want to be able to set the application environment variable at runtime to enable / disable the feature, not just at compile time?

Yes. For example, I would like dev-green to use true for STOP_EVENTS_ROUTE, while prod uses false. This would let us see and use the stop_events route for testing without exposing that route and its docs to the prod API.

If so, then the use of Application.compile_env will have to change. In any event, if I understand correctly, the STOP_EVENTS_ROUTE environment variable could be set differently on the prod environment versus where the application gets built, which would surface this error again.

Are the environment variables not available to the GH Action task builds the application?

@lemald
Copy link
Copy Markdown
Member

lemald commented Mar 31, 2026

Are the environment variables not available to the GH Action task builds the application?

There are environment variables available to the GH Action task, but those are different from the environment variables available in the container. We could of course manually keep them in sync, but they're not actually the same thing.

@runkelcorey
Copy link
Copy Markdown
Contributor Author

runkelcorey commented Mar 31, 2026

@lemald how about this? let all the modules compile, and expose StopEvents as an available path, but—lacking a native experimental or unstable tag—change the summary to experimental with clear docs saying that it will return nothing
Screenshot 2026-03-31 at 3 52 23 PM

@runkelcorey runkelcorey requested a review from lemald March 31, 2026 19:53
@lemald
Copy link
Copy Markdown
Member

lemald commented Mar 31, 2026

@lemald how about this? let all the modules compile, and expose StopEvents as an available path, but—lacking a native experimental or unstable tag—change the summary to experimental with clear docs saying that it will return nothing Screenshot 2026-03-31 at 3 52 23 PM

Hmm, this is better but I still don't love it... unfortunately because of the compile-time nature of a lot of the stuff involved via macros it's a little bit hard to make a good feature flag for it. Let me sleep on this and revisit tomorrow morning.

Copy link
Copy Markdown
Member

@lemald lemald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the best approach we're likely to get. Let's try to get the remaining work out the door relatively promptly so that prod isn't in this state for long.

@runkelcorey runkelcorey merged commit f12b480 into master Apr 1, 2026
30 checks passed
@runkelcorey runkelcorey deleted the fix-api-web-config branch April 1, 2026 13:29
@runkelcorey
Copy link
Copy Markdown
Contributor Author

runkelcorey commented Apr 1, 2026

@lemald I spent a good chunk of yesterday trying to find a better solution but...compiled languages + if-else macros, man! this approach seemed the least risky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working elixir Pull requests that update Elixir code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants