Skip to content

refactor(optimiser): code quality improvements#4372

Open
thejus03 wants to merge 13 commits intonusmodifications:masterfrom
thejus03:code-quality-improvements
Open

refactor(optimiser): code quality improvements#4372
thejus03 wants to merge 13 commits intonusmodifications:masterfrom
thejus03:code-quality-improvements

Conversation

@thejus03
Copy link
Copy Markdown
Contributor

@thejus03 thejus03 commented Mar 21, 2026

Summary

No logic changes

  • Decouples Solve from http.ResponseWriter — solver now returns (SolveResponse, error) and the HTTP handler owns response writing. Introduces SolveError to carry HTTP status codes back to the handler without coupling the solver to net/http
  • Renames GenerateNUSModsShareableLink to FillDefaultsAndGenerateShareableLinks to make the in-place mutation of assignments and lessonToSlots explicit
  • Adds a 10-second timeout to the HTTP client to prevent hung upstream requests from consuming the entire serverless budget
  • Replaces repeated Weeks.([]any) type assertions and float64 casts in hasConflict with direct WeeksSet map iteration — cleaner and avoids redundant work in the beam search hot path
  • Fixes week-unaware collision check in validateTimetable — two slots overlapping in time but on different weeks are not a conflict; test now mirrors the solver's WeeksSet intersection logic
  • Changes Coordinates fields from float32 to float64, removing the lossy widening cast when passing to the haversine function
  • Fixes incorrect DayDistance comment ("Squared" → accurate description)
  • Replaces two strings.Split calls on the same key with a single strings.SplitN

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 21, 2026

PR author is not in the allowed authors list.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 21, 2026

@thejus03 is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.39%. Comparing base (988c6fd) to head (9e6b01c).
⚠️ Report is 220 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4372      +/-   ##
==========================================
+ Coverage   54.52%   56.39%   +1.87%     
==========================================
  Files         274      308      +34     
  Lines        6076     6963     +887     
  Branches     1455     1680     +225     
==========================================
+ Hits         3313     3927     +614     
- Misses       2763     3036     +273     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant