Skip to content

Conversation

@bethanyaconnor
Copy link
Contributor

@bethanyaconnor bethanyaconnor commented Dec 11, 2025

Now that Courses 1-4 and 20-hour (also known as accelerated) have been deprecated for a couple months, this PR removes some of the extra business logic we had for those courses.

This PR was generated largely by Claude Code, with a human (me) in the loop, to more quickly find and remove references to these courses. I'm mostly relying on test coverage to ensure no unintended breakages.

@bethanyaconnor bethanyaconnor force-pushed the bethany/clean-up-deprecated-k5-courses branch from 73a69c7 to 8b7c6e9 Compare December 11, 2025 15:09
assert_redirected_to "/s/#{new_unit.name}"
end

test "should render deprecated course page for deprecated courses" do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turned out there wasn't a unit test confirming the deprecated course error page actually works, so I added one.

@alex-m-brown alex-m-brown changed the base branch from staging-next to staging December 15, 2025 15:26
bethanyaconnor and others added 11 commits December 16, 2025 09:26
This commit removes references to the deprecated curricula: course1,
course2, course3, course4, and 20-hour (also known as "accelerated").

Changes include:
- Remove course constants and categories from ScriptConstants
- Remove course recommendation mappings for deprecated courses
- Remove certificate logic for 20-hour/accelerated courses
- Remove course block helpers for deprecated courses
- Remove deprecated unit helper methods (course1_unit, twenty_hour_unit)
- Remove legacy course validation logic
- Remove deprecated course cards from certificate flow
- Remove legacy course components from CourseBlocks UI
- Simplify CourseBlocksIntl to always show modern courses

Note: Config files, i18n files, and deprecated_course view remain for
backward compatibility until final removal in September 2025.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update tests to remove references to deprecated courses:
- Remove course1-4 and accelerated mappings from csf_next_course_recommendation test
- Remove course1/course2 banner image assertions
- Remove course4 from tracking pixel and HOC finish URL tests
- Remove entire test for 20-hour script routing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The csf_international category was removed as it only contained
deprecated courses (course1-4). This removes:
- csf_international? method definition
- has_banner? check for csf_international courses
- View conditional for csf_international courses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace remaining references to removed twenty_hour_unit method
with hoc_2014_unit in controller tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removed course2, course3, and course4 from the test since these
courses were deprecated and their cards were removed from the codebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixed remaining references to the deprecated twenty_hour_unit method:
- Updated header fallback script
- Updated API controller fallback
- Updated test references in script_level_test and api_controller_test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed test to create a unit with known structure instead of relying
on hoc_2014_unit, which has a different structure than the deprecated
twenty_hour_unit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Removed tests for 20-hour and accelerated courses
- Removed tests for course1-4
- Updated tests to use coursea-2025 as example CSF course
- Updated setup to create coursea-2025 instead of deprecated courses
- All tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removed empty if block that was causing 500 errors when viewing course unit overview pages.
Also updated db_query_test to reflect correct query count after fixing the view syntax error.
These constants (COURSE1_NAME, COURSE2_NAME, COURSE3_NAME, COURSE4_NAME, TWENTY_HOUR_NAME)
are still needed by the deprecated_course.html.haml view to display appropriate messages
when users visit deprecated courses. Added them back as standalone constants with a comment
explaining they're kept for the deprecated course page rendering.
Tests that when a course is marked as deprecated, the scripts controller
renders the deprecated_course error page with the correct curriculum name.
@bethanyaconnor bethanyaconnor force-pushed the bethany/clean-up-deprecated-k5-courses branch from 1f2fdf6 to 23273e1 Compare December 16, 2025 17:27
@bethanyaconnor bethanyaconnor marked this pull request as ready for review December 17, 2025 17:06
@bethanyaconnor bethanyaconnor requested review from a team, davidsbailey and lfryemason and removed request for a team December 17, 2025 17:06
Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

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

LGTM. Excited to see us further deprecate things! I think you can remove the skipped test.

Comment on lines 154 to 156
test 'user should prefer working on 20hour instead of hoc' do
# TODO figure out if we still need this test
skip
Copy link
Member

Choose a reason for hiding this comment

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

This test looks safe to remove to me because it is validating behavior that we don't actually want and probably don't care if it breaks.

this test is just validating the sort order of the results of working_on_units, which mostly comes from here:

has_many :user_scripts, -> {order Arel.sql("-completed_at asc, greatest(coalesce(started_at, 0), coalesce(assigned_at, 0), coalesce(last_progress_at, 0)) desc, user_scripts.id asc")}

strangely, the behavior it is validating is that when there is no timestamp field to sort by (most recent first), we fall back to id, showing LEAST recent first.

We usually do set a timestamp when we create a UserScript object, but in the case where we don't (such as here) I can't imagine it being important that the less-recent entry shows up first -- more likely we just need the id field to make sure that there is a deterministic sort order of some kind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great! And thanks for catching - I was planning on returning to this test but obviously missed it 🙈

@bethanyaconnor bethanyaconnor merged commit 1f783f4 into staging Jan 5, 2026
6 checks passed
@bethanyaconnor bethanyaconnor deleted the bethany/clean-up-deprecated-k5-courses branch January 5, 2026 19:39
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.

3 participants