Repository navigation
Add TaskResultLog, TokenStore, and Okta display_name regression specs - #467
Conversation
Cover nightly API update logging status/payload persistence, token cache expiry and failure paths, and Okta SAML display_name mapping on omniauth callback so auth/name regressions are caught early. Co-authored-by: rsmoke <rsmoke@umich.edu>
There was a problem hiding this comment.
🟡 Changes recommended
The fallback spec preserves an unhelpful literal error message, and blank-payload coverage only tests nil.
2 open findings
What changed in this PR
Adds regression coverage for nightly sync logging, token acquisition, and Okta SAML display names.
Changes:
- Tests
TaskResultLogpersistence, structured payloads, and fallback logging. - Expands token caching, expiry, and failure coverage.
- Verifies Okta
display_namemapping.
| File | Description |
|---|---|
spec/lib/task_result_log_spec.rb |
Covers update-log behavior and fallback logging. |
spec/lib/um_api_spec.rb |
Covers token refresh and failures. |
spec/requests/users/omniauth_callbacks_spec.rb |
Covers Okta display-name persistence. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| expect(logger).to receive(:debug).with( | ||
| "api_update_log, error: Could not save: record.errors.full_messages" | ||
| ) |
| end | ||
|
|
||
| it "does not append a structured report section when payload is blank" do | ||
| described_class.new.update_log("plain summary only", false, nil) |
…sages when save fails.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b1bf929. Configure here.
| @log.api_logger.debug "api_update_log, error: Could not save: record.errors.full_messages" | ||
| @log.api_logger.debug( | ||
| "api_update_log, error: Could not save: #{record.errors.full_messages.join(', ')}" | ||
| ) |
There was a problem hiding this comment.
Stale fallback log spec assertion
Medium Severity
The save-failure fallback now interpolates record.errors.full_messages into the debug message, but the TaskResultLog example still expects the previous uninterpolated text. That spec will fail, so the ApiLog fallback path is no longer covered.
Reviewed by Cursor Bugbot for commit b1bf929. Configure here.
* Update tailwindcss dependencies, modify Procfile for CSS watch command, and enhance support info modal with improved accessibility and styling. * Add DepartmentApi and SentryMetrics regression specs (#462) Cover department lookup success/failure shaping used by BuildingsApi room updates, and ensure Sentry metric failures are swallowed so jobs/rake keep running. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add stale-room deactivation regression specs for media preservation. (#463) Cover the success path that hides rooms via visible=false while keeping contacts, characteristics, and Active Storage panoramas/images, plus the already-hidden fail-closed invariant in BuildingsApi and ClassroomApi. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add ApiUpdateDatabase PhaseResult/RunResult regression specs (#464) Cover structured phase/run reporting and runner early-exit when auth token acquisition fails, so nightly classroom sync failures stay visible in ApiUpdateLog without continuing later phases. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Bump rubyzip from 3.2.2 to 3.4.0 in the bundler group across 1 directory (#465) Bumps the bundler group with 1 update in the / directory: [rubyzip](https://github.com/rubyzip/rubyzip). Updates `rubyzip` from 3.2.2 to 3.4.0 - [Release notes](https://github.com/rubyzip/rubyzip/releases) - [Changelog](https://github.com/rubyzip/rubyzip/blob/main/Changelog.md) - [Commits](rubyzip/rubyzip@v3.2.2...v3.4.0) --- updated-dependencies: - dependency-name: rubyzip dependency-version: 3.4.0 dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rsmokeUM <rsmoke@umich.edu> * Add TaskResultLog, TokenStore, and Okta display_name regression specs (#467) * Add TaskResultLog, TokenStore, and Okta display_name regression specs Cover nightly API update logging status/payload persistence, token cache expiry and failure paths, and Okta SAML display_name mapping on omniauth callback so auth/name regressions are caught early. Co-authored-by: rsmoke <rsmoke@umich.edu> * Improve error logging in ApiUpdateLog by including detailed error messages when save fails. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add ApplicationHelper api_status/api_log_text regression specs (#470) * Add ApplicationHelper api_status and api_log_text regression specs. Cover the admin header banner signals for missing nightly runs, error vs success recency, and blank log fallback so false-positive or missed API failure alerts are less likely to regress. Co-authored-by: rsmoke <rsmoke@umich.edu> * Potential fix for pull request finding 'Test does not verify log recency filtering' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add FloorPolicy authorization regression specs (#471) * Add FloorPolicy authorization regression specs. Lock viewer show vs admin mutation permissions and deny show when membership groups are empty outside production. Co-authored-by: rsmoke <rsmoke@umich.edu> * Improve error logging in TaskResultLog specs by including specific error messages for invalid records --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add AnalyticsDashboard and ApiUpdateLog policy regression specs. (#476) Lock admin-only index/show/refresh gates so non-admin viewers cannot access API update logs or refresh the analytics dashboard. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * restore allowed_clock_drift in saml attributes (#478) Co-authored-by: rsmokeUM <rsmoke@umich.edu> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Margarita Barvinok <56089936+britaumich@users.noreply.github.com>
…480) * Update tailwindcss dependencies, modify Procfile for CSS watch command, and enhance support info modal with improved accessibility and styling. * Add DepartmentApi and SentryMetrics regression specs (#462) Cover department lookup success/failure shaping used by BuildingsApi room updates, and ensure Sentry metric failures are swallowed so jobs/rake keep running. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add stale-room deactivation regression specs for media preservation. (#463) Cover the success path that hides rooms via visible=false while keeping contacts, characteristics, and Active Storage panoramas/images, plus the already-hidden fail-closed invariant in BuildingsApi and ClassroomApi. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add ApiUpdateDatabase PhaseResult/RunResult regression specs (#464) Cover structured phase/run reporting and runner early-exit when auth token acquisition fails, so nightly classroom sync failures stay visible in ApiUpdateLog without continuing later phases. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Bump rubyzip from 3.2.2 to 3.4.0 in the bundler group across 1 directory (#465) Bumps the bundler group with 1 update in the / directory: [rubyzip](https://github.com/rubyzip/rubyzip). Updates `rubyzip` from 3.2.2 to 3.4.0 - [Release notes](https://github.com/rubyzip/rubyzip/releases) - [Changelog](https://github.com/rubyzip/rubyzip/blob/main/Changelog.md) - [Commits](rubyzip/rubyzip@v3.2.2...v3.4.0) --- updated-dependencies: - dependency-name: rubyzip dependency-version: 3.4.0 dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rsmokeUM <rsmoke@umich.edu> * Add TaskResultLog, TokenStore, and Okta display_name regression specs (#467) * Add TaskResultLog, TokenStore, and Okta display_name regression specs Cover nightly API update logging status/payload persistence, token cache expiry and failure paths, and Okta SAML display_name mapping on omniauth callback so auth/name regressions are caught early. Co-authored-by: rsmoke <rsmoke@umich.edu> * Improve error logging in ApiUpdateLog by including detailed error messages when save fails. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add ApplicationHelper api_status/api_log_text regression specs (#470) * Add ApplicationHelper api_status and api_log_text regression specs. Cover the admin header banner signals for missing nightly runs, error vs success recency, and blank log fallback so false-positive or missed API failure alerts are less likely to regress. Co-authored-by: rsmoke <rsmoke@umich.edu> * Potential fix for pull request finding 'Test does not verify log recency filtering' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add FloorPolicy authorization regression specs (#471) * Add FloorPolicy authorization regression specs. Lock viewer show vs admin mutation permissions and deny show when membership groups are empty outside production. Co-authored-by: rsmoke <rsmoke@umich.edu> * Improve error logging in TaskResultLog specs by including specific error messages for invalid records --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * Add AnalyticsDashboard and ApiUpdateLog policy regression specs. (#476) Lock admin-only index/show/refresh gates so non-admin viewers cannot access API update logs or refresh the analytics dashboard. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: rsmoke <rsmoke@umich.edu> * restore allowed_clock_drift in saml attributes (#478) Co-authored-by: rsmokeUM <rsmoke@umich.edu> * Count already-hidden rooms as deactivated so the API sync can finish. A stale classroom that was already hidden aborted the rooms phase and skipped the rest of the update. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Margarita Barvinok <56089936+britaumich@users.noreply.github.com>




Risky behavior now covered
display_namemapping whenauth.info.nameis nil (regression from Switch shibboleth authentication to okta #461 shibboleth→Okta switch).Test files added/updated
spec/lib/task_result_log_spec.rb(new)spec/lib/um_api_spec.rbspec/requests/users/omniauth_callbacks_spec.rbWhy these tests materially reduce regression risk
Nightly sync depends on correct token refresh/failure signaling and durable success/error logs. A wrong status or dropped structured report hides production failures. Okta’s attribute shape differs from Shibboleth (
display_namevsname); without an end-to-end callback assertion, users can be created with blank display names again.Validation
bundle exec rspec spec/lib/task_result_log_spec.rb spec/lib/um_api_spec.rb spec/requests/users/omniauth_callbacks_spec.rb→ 34 examples, 0 failures (SimpleCov minimum on subset runs is expected noise).Note
Low Risk
Changes are mostly specs plus clearer debug logging on a failed
ApiUpdateLogsave; no production auth or sync behavior changes beyond that log message.Overview
Adds regression coverage around nightly API update logging, UM API token acquisition, and Okta SAML user creation, plus a small fix when
ApiUpdateLogpersistence fails.TaskResultLog#update_log(inlib/auth_token_api.rb) now logs real ActiveRecord validation messages via interpolation instead of a static placeholder string. New specs assert success/error status from the debug flag, structured JSON appended to the stored result, no structured section when the payload is blank, and fallback to the API logger when save fails.UmApi::TokenStore#fetchspecs gain shared stubs and cases for post-expiry refresh, success responses withoutaccess_token, explicit API failures, and wrapped exceptions (e.g.SocketError).Okta SAML callback request specs mock
auth.info.display_name(withnamenil) and assert users get a non-blankdisplay_nameafter sign-in, matching the post–#461 attribute shape.Reviewed by Cursor Bugbot for commit b1bf929. Bugbot is set up for automated code reviews on this repo. Configure here.