Skip to content

Fix Achiever/Dynamics course pages breaking in local dev - #2608

Open
A-Wheeto wants to merge 4 commits into
mainfrom
eng-2175-online-course-templates-broken-in-local-dev
Open

Fix Achiever/Dynamics course pages breaking in local dev#2608
A-Wheeto wants to merge 4 commits into
mainfrom
eng-2175-online-course-templates-broken-in-local-dev

Conversation

@A-Wheeto

Copy link
Copy Markdown
Contributor
  • Fixed a Faraday config bug (connection.rb) - PROXY_URL='' (no proxy) was passed straight to Faraday, which tried to parse the empty string as a URI and crashed on nil.hostname. .presence fixes it.
  • Refreshed stale local Achiever fixtures (spec/support/achiever/local_templates/*.json) - these hadn't been regenerated since the ACHIEVER_USE_LOCAL_TEMPLATES flag was introduced. course/occurrence IDs were years stale and didn't resolve against current preprod data.
  • Added dev-only persistent caching for live Achiever requests (request.rb, connection.rb) - Rails.cache is a null store in development, so every course page round-tripped to preprod live on every request. Added a FileStore-backed cache scoped to Rails.env.development? only (staging/production/test behavior is unchanged)
  • Flipped ACHIEVER_USE_LOCAL_TEMPLATES to false by default (.env.defaults) now that live preprod + caching is the intended default dev path. Anyone without preprod VPN/Dynamics access can set it back to true locally to keep using the static fixtures.

ENV.fetch("PROXY_URL") returns "" locally (no proxy needed); Faraday tried to parse that empty string as a URI and crashed on nil.hostname. .presence turns it into nil, which Faraday correctly treats as "no proxy."

ENG-2175
Fixtures hadn't been regenerated since the ACHIEVER_USE_LOCAL_TEMPLATES flag was introduced (single commit, years ago) - course/occurrence IDs were stale and didn't resolve against preprod

ENG-2175
Rails.cache is a null store in development, so every course-related request round-tripped to preprod live. Added a persistent dev-only file cache. Flips ACHIEVER_USE_LOCAL_TEMPLATES to false by default now that live preprod + caching is the intended default dev path

ENG-2175
@tc-deploybot
tc-deploybot temporarily deployed to teachcomputing-pr-2608 August 18, 2026 13:11 Inactive
Achiever::Course::Template::_all passes cache: false to skip Rails.cache (it's wrapped in its own outer cache in prod/staging), but perform_request was checking that flag before the dev file cache branch, so it also skipped the new dev-only cache.

Moved the development check ahead of the cache flag so the dev cache applies unconditionally in development, while leaving Rails.cache behaviour in other environments unchanged.

ENG-2175
@sonarqubecloud

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

2 participants