Skip to content

Migrate SCMS Status Endpoint#313

Merged
mcook42 merged 72 commits intodevelopfrom
feat/migrate-iss-scms-status-endpoint
Apr 23, 2026
Merged

Migrate SCMS Status Endpoint#313
mcook42 merged 72 commits intodevelopfrom
feat/migrate-iss-scms-status-endpoint

Conversation

@dmccoystephenson
Copy link
Copy Markdown

@dmccoystephenson dmccoystephenson commented Mar 31, 2026

PR Details

Description

  • The SCMS status endpoint has been migrated from the python API to the Java intersection API
  • The webapp has been updated to call the new intersection API endpoint
  • The old SCMS status endpoint has been removed from the python API

How Has This Been Tested?

  • Verified intersection API tests pass
  • Verified python API tests pass
  • Verified webapp tests pass
  • Ran solution locally
    • Verified no relevant errors occur in IAPI or webapp when clicking on an RSU on the map
  • Deployed solution to CDOT's dev environment
    • Verified that SCMS statuses for RSUs are visible when clicking on RSUs on the map
    • Verified that clicking on 'SCMS Status' in the 'Filter RSUs' UI section does not throw an error and updates colors on the map as expected

Data Used To Test Locally

Run the following statement to insert relevant test data into the database for the already-provided RSUs:

INSERT INTO public.scms_health(
	timestamp, health, expiration, rsu_id)
	VALUES
	(CURRENT_TIMESTAMP, B'1', CURRENT_TIMESTAMP + INTERVAL '30 days', 1),
	(CURRENT_TIMESTAMP, B'0', CURRENT_TIMESTAMP - INTERVAL '7 days', 2);

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • My changes require new environment variables:
    • I have updated the docker-compose, K8s YAML, and all dependent deployment configuration files.
  • My changes require updates to the documentation:
    • I have updated the documentation accordingly.
  • My changes require updates and/or additions to the unit tests:
    • I have modified/added tests to cover my changes.
  • All existing tests pass.

@dmccoystephenson dmccoystephenson marked this pull request as ready for review March 31, 2026 16:43
Copilot AI review requested due to automatic review settings March 31, 2026 16:43
@dmccoystephenson dmccoystephenson marked this pull request as draft March 31, 2026 16:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Migrates the legacy ISS SCMS status endpoint out of the Flask-based services/api service and into the Spring-based services/intersection-api, updating the webapp to call the new /scms-status endpoint and treating SCMS health as a boolean.

Changes:

  • Add /scms-status endpoint in services/intersection-api (controller/service/repository + mapper/DTO + tests).
  • Update webapp SCMS status types/rendering and switch the SCMS status API call to use authApiHelper against CVIZ_API_SERVER_URL.
  • Remove legacy Flask resource iss_scms_status.py and its tests, and unregister the old route.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
webapp/src/pages/Map.tsx Updates SCMS health handling from '0'/'1' to boolean in map UI.
webapp/src/models/RsuApi.d.ts Changes IssScmsStatus.health typing to boolean.
webapp/src/features/menu/DisplayRsuErrors.tsx Updates SCMS status handling toward boolean in the RSU errors/status UI.
webapp/src/EnvironmentVars.tsx Points SCMS status endpoint to relative /scms-status for CVIZ auth helper usage.
webapp/src/components/RsuMarker.tsx Updates marker prop type and SCMS color logic to boolean.
webapp/src/components/RsuMarker.test.tsx Updates snapshot tests for boolean SCMS status.
webapp/src/components/snapshots/RsuMarker.test.tsx.snap Snapshot updates for new SCMS marker rendering.
webapp/src/apis/rsu-api.ts Switches getIssScmsStatus to authApiHelper.invokeApi (CVIZ base URL + Bearer token).
webapp/src/apis/rsu-api.test.ts Updates expected URL + Authorization header format for SCMS status call.
services/intersection-api/api/src/test/resources/application-integration-test.yaml Adjusts JPA ddl-auto to support integration testing schema creation.
services/intersection-api/api/src/test/java/.../ScmsHealthServiceTest.java Integration tests for repository/service behavior retrieving latest status per RSU/org.
services/intersection-api/api/src/test/java/.../ManufacturerRepository.java Test-only JPA repository added to support integration test setup.
services/intersection-api/api/src/test/java/.../ScmsHealthMapperTest.java Unit tests for DTO/map transformation behavior.
services/intersection-api/api/src/test/java/.../ScmsHealthControllerTest.java Controller tests for /scms-status response behavior.
services/intersection-api/api/src/main/java/.../ScmsHealthService.java New service layer to fetch SCMS status projections.
services/intersection-api/api/src/main/java/.../ScmsHealthRepository.java Adds JPQL query to fetch latest SCMS health per RSU in an org.
services/intersection-api/api/src/main/java/.../ScmsHealthDto.java DTO for SCMS status response payload.
services/intersection-api/api/src/main/java/.../ScmsHealth.java Adjusts health column mapping for SCMS health table.
services/intersection-api/api/src/main/java/.../ScmsHealthRsuProjection.java Projection to pair RSU + SCMS health record.
services/intersection-api/api/src/main/java/.../ScmsHealthMapper.java Maps projections into the response shape keyed by RSU IP.
services/intersection-api/api/src/main/java/.../ScmsHealthController.java New /scms-status REST endpoint.
services/api/tests/src/test_iss_scms_status.py Removes Flask endpoint tests.
services/api/tests/data/iss_scms_status_data.py Removes Flask endpoint test data.
services/api/src/middleware.py Removes old /iss-scms-status path from middleware config.
services/api/src/main.py Unregisters the old Flask route.
services/api/src/iss_scms_status.py Removes the legacy Flask resource implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread webapp/src/features/menu/DisplayRsuErrors.tsx
Comment thread webapp/src/components/RsuMarker.test.tsx Outdated
@dmccoystephenson dmccoystephenson changed the title Feat/migrate iss scms status endpoint Migrate SCMS Status Endpoint Apr 2, 2026
@drewjj drewjj requested a review from jacob6838 April 17, 2026 17:37
jacob6838
jacob6838 previously approved these changes Apr 17, 2026
Copy link
Copy Markdown
Collaborator

@jacob6838 jacob6838 left a comment

Choose a reason for hiding this comment

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

1 suggestion, otherwise looks great

- Updated test cases in `ScmsHealthControllerTest` and `ScmsHealthMapperTest` to validate health values as Booleans instead of Strings.
- Modified `ScmsHealthDto` to reflect Boolean type for health field.
- Removed `healthToString` mapper method and updated mappings in `ScmsHealthMapper`.
- Adjusted tests for inactive and active health scenarios to align with Boolean logic.
mcook42 added 12 commits April 17, 2026 14:39
- Deleted `DateTimeConfig` and related timezone configuration properties from the application.
- Updated `ScmsHealthDto` to replace `String expiration` with `Instant expiration` for ISO-8601 UTC compatibility.
- Refactored `ScmsHealthMapper` to simplify mapping logic by removing timezone-based date formatting.
- Adjusted tests for SCMS health mappings and projections to accommodate changes in `Instant` expiration type.
- Eliminated `APP_TIMEZONE` variable from `sample-full.env` and `docker-compose-intersection.yml` as it is no longer required.
- Introduced `formatScmsExpiration` utility for human-readable SCMS expiration dates.
- Updated components and selectors to use standardized expiration display logic.
- Replaced raw ISO-8601 strings with localized date formats in SCMS status and expiration views.
- Enhanced maintainability by centralizing date formatting logic in `scmsApiSlice`.
…sStatusQuery`

- Removed lazy querying logic and updated SCMS status retrieval to auto-fetch based on `organization`.
- Simplified components by eliminating explicit trigger calls for SCMS status data.
- Updated `ScmsHealthDto` to use `boolean` for `health` field instead of `'0' | '1' | null`.
- Replaced `'0' | '1' | null` SCMS status with `boolean | null` for consistency and clarity.
- Updated components, tests, and filters to handle the boolean SCMS status.
- Simplified related logic in `DisplayRsuErrors` and `RsuMarker`.
…anagement

- Added `@BeforeEach` and `@AfterEach` methods for test database cleanup and security context management to prevent test data bleeding from one suite to another.
- Added detailed test cases for `DisplayRsuErrors` covering SCMS statuses, snapshots, and edge cases.
- Improved `RsuFirmwareMenu` tests to validate success/error message rendering for single and batch RSU upgrades.
- Introduced mock configurations for realistic test scenarios.
- Regenerated snapshots for `DisplayRsuErrors` to reflect updated SCMS status, UI structure, and table contents.
@mcook42
Copy link
Copy Markdown

mcook42 commented Apr 20, 2026

I've made some updates to move to RTK in the UI, remove unnecessary code from the ScmsHealthMapper, add more test coverage, and change the data type of health from String to Boolean.

@drewjj @jacob6838 ready for re-review whenever you have time

Recording.2026-04-20.142620.mp4

@mcook42 mcook42 requested review from drewjj and jacob6838 April 20, 2026 21:06
Copy link
Copy Markdown
Collaborator

@drewjj drewjj left a comment

Choose a reason for hiding this comment

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

Tests great! Thanks for updating this

Copy link
Copy Markdown
Collaborator

@jacob6838 jacob6838 left a comment

Choose a reason for hiding this comment

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

Great updates!

@mcook42 mcook42 dismissed their stale review April 23, 2026 17:28

i've adopted this PR as my own

@mcook42 mcook42 dismissed payneBrandon’s stale review April 23, 2026 17:35

All feedback addressed. Two approvals from others. The reviewer is out for a few days, so dismissing to allow this PR to be merged in a timely manner

@mcook42 mcook42 merged commit e01bdae into develop Apr 23, 2026
9 checks passed
@mcook42 mcook42 deleted the feat/migrate-iss-scms-status-endpoint branch April 23, 2026 17:38
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.

6 participants