Skip to content

Add ApiUpdateDatabase PhaseResult/RunResult regression specs - #464

Merged
rsmoke merged 2 commits into
stagingfrom
cursor/api-update-result-coverage-bd09
Oct 14, 2026
Merged

rsmoke merged 2 commits into
stagingfrom
cursor/api-update-result-coverage-bd09

Conversation

@cursor

@cursor cursor Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Risky behavior now covered

  • ApiUpdateDatabase::PhaseResult counter/warning/error/metadata aggregation and structured to_h serialization used by nightly classroom sync logs
  • ApiUpdateDatabase::RunResult overall success rollup and phase payload reporting
  • Runner early-exit when auth token acquisition fails (later phases must not run; ApiUpdateLog stays error with structured report)
  • Runner records a phase failure when an API returns a truthy debug/failure signal without its own errors

Test files added/updated

  • spec/lib/api_update_database/phase_result_spec.rb (added)
  • spec/lib/api_update_database/run_result_spec.rb (added)
  • spec/lib/api_update_database/runner_spec.rb (updated)

Why these tests materially reduce regression risk

Nightly Buildings/Classroom API updates depend on these result objects for operator-visible success/failure reporting. Without unit coverage, a broken counter/status payload or a token-failure path that continues subsequent phases can silently corrupt sync outcomes or obscure failures in ApiUpdateLog.

Validation

  • bundle exec rspec spec/lib/api_update_database/{phase_result,run_result,runner}_spec.rb — 13 examples, 0 failures
  • Note: subset runs still trip SimpleCov's 40% floor; example results were green.
Open in Web View Automation 

Note

Low Risk
Test-only changes; no production code modified.

Overview
Adds RSpec coverage for nightly API DB sync reporting: new unit specs for ApiUpdateDatabase::PhaseResult (counters, idempotent finish, success?, structured to_h) and RunResult (all-phases success rollup and nested phase payloads).

Runner specs gain two regression cases: auth token failure must abort the run (no later phase factories), surface token errors in the phase/ApiUpdateLog structured report; and when an API returns a truthy failure signal without last_result errors, the runner must still record the phase failure (including log file hint).

Reviewed by Cursor Bugbot for commit b218fd0. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 2 commits October 1, 2026 10:20
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: rsmoke <rsmoke@umich.edu>
@rsmoke
rsmoke marked this pull request as ready for review October 14, 2026 16:32
Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused test-only changes correctly exercise the documented regression scenarios without introducing unresolved issues.

0 open findings

What changed in this PR

Adds regression coverage for API database update result aggregation, serialization, and runner failure handling.

Changes:

  • Tests phase and run result reporting.
  • Verifies token failures stop subsequent phases.
  • Verifies truthy API failure signals record errors.
File Description
phase_result_spec.rb Covers counters, completion, success, and serialization.
run_result_spec.rb Covers success rollup and structured reports.
runner_spec.rb Covers early exits and fallback errors.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rsmoke
rsmoke merged commit 10d8d17 into staging Oct 14, 2026
7 checks passed
@rsmoke
rsmoke deleted the cursor/api-update-result-coverage-bd09 branch October 14, 2026 17:01
rsmoke added a commit that referenced this pull request Oct 14, 2026
* 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>
rsmoke added a commit that referenced this pull request Oct 21, 2026
…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>
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