Skip to content

Reservation error handling - #265

Merged
JensVandewalle merged 15 commits into
mainfrom
45799_reservation-backend
Aug 13, 2026
Merged

Reservation error handling#265
JensVandewalle merged 15 commits into
mainfrom
45799_reservation-backend

Conversation

@JensVandewalle

@JensVandewalle JensVandewalle commented Aug 12, 2026

Copy link
Copy Markdown
Member

PR Classification

Refactor and expand error handling logic by extracting and enhancing the ResourceManagerTraceDataHandler class.

PR Summary

The ResourceManagerTraceDataHandler class has been moved from CoreJobHandler.cs to its own file, made internal, and its functionality has been significantly expanded to provide robust translation of core ResourceManager errors into DevPack job resource errors. Deterministic unit tests have been added to verify the new behavior.

  • ResourceManagerTraceDataHandler.cs: Introduced as a new file with an expanded, internal implementation handling specific error types and resource ID mapping.
  • ResourceManagerTraceDataHandlerTests.cs: Added comprehensive unit tests for the new handler.
  • CoreJobHandler.cs: Removed the previous inner class and all related logic.
  • Updated using statements and namespaces to support the new structure.

AB#45799

Replaced obsolete ResourceManagerTraceDataHandler in CoreJobHandler.cs with a new, robust version in its own file. The new handler translates core ResourceManager errors to DevPack job resource errors, mapping resource, capacity, and capability IDs to Resource Studio (DOM) equivalents. It handles specific error types and falls back to raw messages for unknown errors. Added deterministic, simulation-backed unit tests to verify translation logic and fallback behavior.
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Skyline Quality Gate: ✅ Passed

Sub-gate Status Summary
Unit Tests All tests passed
SonarCloud Quality gate passed

SonarCloud: new-code dashboard for 265/merge

See the Actions run for full logs.

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.

Pull request overview

This PR refactors and expands the translation of core ResourceManager errors into DevPack job resource errors by extracting ResourceManagerTraceDataHandler into its own file and adding deterministic simulation-backed unit tests to validate the new mappings.

Changes:

  • Added an internal ResourceManagerTraceDataHandler implementation that maps specific ResourceManagerErrorData.Reason values to typed DevPack job resource errors (including core→DOM resource ID resolution).
  • Removed the previous placeholder inner handler from CoreJobHandler.
  • Added deterministic unit tests covering quarantine/capacity/capability translations and unknown-reason fallback behavior.

Reviewed changes

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

File Description
DevPack/API/Handlers/Workflow/Jobs/ResourceManagerTraceDataHandler.cs New extracted handler that translates core ResourceManager trace errors into DevPack trace errors keyed by reservation ID, including core→DOM resource ID mapping.
DevPack/API/Handlers/Workflow/Jobs/CoreJobHandler.cs Removes the old inner ResourceManagerTraceDataHandler implementation and its incomplete translation logic.
DevPack.Tests/Workflow/Jobs/ResourceManagerTraceDataHandlerTests.cs Adds deterministic simulation-backed tests validating the new translation behavior and fallback behavior.

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

Comment thread DevPack.Tests/Workflow/Jobs/ResourceManagerTraceDataHandlerTests.cs
JensVandewalle and others added 10 commits August 12, 2026 13:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Added FilePropertySetting for file value management, including attachment handling via IPropertyAttachmentStore. Updated property collections for file support, serialization, and validation (size, count, type). Exposed configurable max document size. Added tests for file properties and error cases. Refactored persistence and cleanup logic for attachments.
- Disallow separator and invalid characters in file names; add unit tests
- Track stored files in FilePropertySetting to delete only uploaded files
- Track removed file settings in PropertySettingCollection for cleanup
- Update cleanup logic to handle current and removed file settings, clear removed list after cleanup
- Return persisted instances after create/update for accurate reporting
- Add tests for attachment deletion and structured error reporting on upload failure
Builds domResourceIdByCoreId using three error lists via BuildDomResourceIdByCoreId. Passes the mapping to HandleReservationUpdateCausedReservationsToGoToQuarantine for further processing.
- Retain attachments when updating collections with same file property
- Copy file content when copying settings between collections
- Refine cleanup to delete only orphaned attachments
- Update constructors to accept destination collection ID
- Add and update tests for attachment retention and copying
- Remove explicit attachment deletion on collection removal
Replaced Path methods with explicit handling of '/' and '\' as directory separators and a custom invalid character set for cross-platform consistency. Enhanced validation to reject empty, ".", "..", and control character file names. Added unit tests to verify stripping of directory info and exception handling for invalid names.
…racking removed file settings

Co-authored-by: JensVandewalle <102030104+JensVandewalle@users.noreply.github.com>
…eview-suggestion

Reconcile property attachments against stored names to prevent orphans on file setting removal
@JensVandewalle

Copy link
Copy Markdown
Member Author

@copilot can you revert the last merge that has been done in this branch?

Co-authored-by: JensVandewalle <102030104+JensVandewalle@users.noreply.github.com>

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@copilot can you revert the last merge that has been done in this branch?

Done — the merge of PR #269 (copilot/fix-code-review-suggestion) has been reverted in commit 3acaec0.

}

FilterElement<DomInstance> Filter(Guid coreResourceId) =>
DomInstanceExposers.DomDefinitionId.Equal(SlcResource_StudioIds.Definitions.Resource.Id)

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.

You could make use of a select query here as you only require the DOM instance ID.

Update SlcResourceStudioHelper with GetResourceStudioFields to fetch partial DOM instances based on selected fields and filters. Refactor ResourceManagerTraceDataHandler to use this method, retrieving only required fields (e.g., Resource_Id) for improved performance. Add null checks and support for SelectedFields and PartialObject types.
Introduce DomInstanceSelectStore to handle partial object select read requests in unit tests, simulating DataMiner Agent behavior. Update SimulatedDms.cs to use this handler before the default DOM handler. Update package references and versions; remove dependency on Skyline.DataMiner.Files.SLNetTypes.
@JensVandewalle
JensVandewalle merged commit cdb33fb into main Aug 13, 2026
17 checks passed
@JensVandewalle
JensVandewalle deleted the 45799_reservation-backend branch August 13, 2026 12:17
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.

4 participants