Skip to content

fix: return 409 Conflict for duplicate resources and parse profile tags#828

Merged
madhavilosetty-intel merged 1 commit intomainfrom
cira
Mar 19, 2026
Merged

fix: return 409 Conflict for duplicate resources and parse profile tags#828
madhavilosetty-intel merged 1 commit intomainfrom
cira

Conversation

@madhavilosetty-intel
Copy link
Contributor

@madhavilosetty-intel madhavilosetty-intel commented Mar 9, 2026

No description provided.

@madhavilosetty-intel madhavilosetty-intel changed the title fix: add connection status tracking with last connected/disconnected … fix: add connection status tracking with last connected/disconnected Mar 9, 2026
@madhavilosetty-intel madhavilosetty-intel force-pushed the cira branch 3 times, most recently from 83843fd to 948490b Compare March 10, 2026 17:40
@device-management-toolkit device-management-toolkit deleted a comment from codecov bot Mar 10, 2026
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.13%. Comparing base (bec829a) to head (d6698d3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/controller/httpapi/v1/error.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #828      +/-   ##
==========================================
+ Coverage   40.11%   40.13%   +0.01%     
==========================================
  Files         114      114              
  Lines       10886    10892       +6     
==========================================
+ Hits         4367     4371       +4     
- Misses       6117     6119       +2     
  Partials      402      402              

☔ 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.

Copy link

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

This PR introduces a connection-status update pathway for devices, including tracking “last connected” / “last disconnected” timestamps, and wires it into the CIRA (TCP) tunnel authentication flow. It also adjusts a couple of related behaviors around HTTP error handling and Vault/certificate handling (including additional tests).

Changes:

  • Add UpdateConnectionStatus(guid, status) to the devices usecase/repository interfaces and implement it in the SQL device repo (writes connectionstatus plus lastconnected/lastdisconnected).
  • Update CIRA tunnel registration to mark a device as connected on successful authentication, with new unit coverage.
  • Improve Vault/certificate fallback behaviors and add tests; adjust HTTP “not unique” handling to return 409 Conflict.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/usecase/sqldb/device.go Adds SQL repo method to update connectionstatus and set lastconnected/lastdisconnected.
internal/usecase/sqldb/device_test.go Extends devices test schema and adds tests for UpdateConnectionStatus.
internal/usecase/devices/interfaces.go Extends repository and feature interfaces with UpdateConnectionStatus.
internal/usecase/devices/repo.go Adds usecase wrapper method UpdateConnectionStatus.
internal/usecase/devices/repo_test.go Adds usecase-level test coverage for UpdateConnectionStatus.
internal/controller/tcp/cira/tunnel.go Marks device connected on successful CIRA authentication.
internal/controller/tcp/cira/tunnel_test.go Adds tests verifying registration triggers connection status updates (and continues on update failure).
internal/controller/ws/v1/interface.go Extends WS feature interface (adds UpdateConnectionStatus and SetLinkPreference).
internal/controller/httpapi/v1/error.go Changes not-unique handling to 409 Conflict with a default message when empty.
internal/certificates/generate.go Adds log messages when Vault store is nil (local-only storage).
internal/certificates/generate_test.go Adds Vault/local-file interaction tests for root + webserver cert flows (and nil-store cases).
cmd/app/main.go Logs when Vault is not configured and continues with local-only cert storage.
cmd/app/main_test.go Adds tests for CIRA cert setup disabled and Vault config error cases.
internal/mocks/wsv1_mocks.go Regenerated mocks (method ordering changes + adds UpdateConnectionStatus).
internal/mocks/devicemanagement_mocks.go Regenerated mocks to include UpdateConnectionStatus (and reorder SetLinkPreference).

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

You can also share your feedback on Copilot code review. Take the survey.

@madhavilosetty-intel madhavilosetty-intel force-pushed the cira branch 8 times, most recently from 1a3ec2a to 3bdb3bd Compare March 17, 2026 20:41
@madhavilosetty-intel madhavilosetty-intel changed the title fix: add connection status tracking with last connected/disconnected fix: return 409 Conflict for duplicate resources and parse profile tags Mar 18, 2026
@madhavilosetty-intel madhavilosetty-intel merged commit 476f798 into main Mar 19, 2026
20 checks passed
@madhavilosetty-intel madhavilosetty-intel deleted the cira branch March 19, 2026 00:06
@RosieAMT
Copy link

🎉 This PR is included in version 1.22.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants