Skip to content

Conversation

@MAG-SamBirley
Copy link
Contributor

@MAG-SamBirley MAG-SamBirley commented Oct 24, 2025

The Issue

A CSP client app developer recently reported a crash when attempting to enter a space. Turns out it was due to there being an asset collection/prototype in the space that did not conform to the types CSP expects, which caused CSP to fire an assert.

The Fix

To fix, we follow the same pattern as with Asset.cpp and emit an Error log message instead of an assert (see here).

The Tests

Initial test implementation to validate type parsing for the DTO came in here. Then refined that to use the test matrix approach here.

Bonus

The tests highlighted that CSP was (not unreasonanbly) assuming certain fields would always exist on prototype DTOs. Problem was if they didn't exist, it would lead to an uncaught exception. To fix, we now follow the same pattern for all prototype DTO fields, first testing for then existence, and only then retrieving their value.

Added bonus, whilst in the area I elected to nuke the Charity DTO type CSP was checking for, as it was agreed we should remove it in a recent CSP working group session.

Both bonus changes can be seen here.

Previously, we invoked an assert when encountering
an asset collection type not known to CSP.

Similar to what we're doing elsewhere, this change
removes the assertion in favor of an error log message
instead.
Roughed out test for validating asset collection DTO parsing.
A new set of test permutations to validate CSP parses
DTO types to expected CSP types, and that parsing invalid
DTO types returns the default result.
CSP assumed certain fields would always be present on
prototype DTOs. Not unreasonable, but also a source of
uncaught exceptions if they weren't.

Fixed by following the same pattern as with other fields, and
only setting the properties following a check to see if the DTO has
them.

Also, removed the 'Charity' DTO type, as this was agreed in a recent
CSP working group session.
@MAG-SamBirley MAG-SamBirley requested a review from a team as a code owner October 24, 2025 15:08
@github-actions
Copy link

🚀 Pull Request Review Guidelines

Thank you for taking the time to review this Pull Request. The following is a summary of our Pull Request guidelines. The full guidelines can be found here.

💬 How to Provide Feedback

We use a comment ladder when leaving review comments to avoid any ambiguity.

Tag Is response required? Is a change required? May the PR author resolve?
[Fix] ✔️ ✔️
[Consider] ✔️ ✔️
[Question] ✔️
[Nit] ✔️
[Comment] ✔️

All comments should be prefixed with one of the above tags, for example:
[fix] Your editor is still set to use tabs instead of spaces, or this file is old and needs to be reformatted.

⚠️ Reviewers should be sure to resolve conversations if they feel their feedback has been addressed sufficiently.

🎯 PR Author Focus Areas

  • Link Commits to Conversations After making a change in response to a reviewer's comment, link the specific commit in the comment thread. This will allow the reviewer to view the change without having to hunt the codebase for it.
  • Breaking Changes Any breaking changes made to the public interface must be specifically called out in the PR. The preferred format is a bullet list enumerating the specific nature of the change/s, as well as the types and method signatures that are affected. If necessary, migration guidance should also be provided here.

Thanks again for taking the time to review this Pull Request.

Validating that in the case of an unknown asset type, CSP
emits the expected log message.
@MAG-SamBirley MAG-SamBirley enabled auto-merge (squash) October 29, 2025 13:21
@MAG-SamBirley MAG-SamBirley merged commit 7a6b6b3 into main Oct 30, 2025
9 checks passed
@MAG-SamBirley MAG-SamBirley deleted the NT-0_remove_asset_collection_assertion branch October 30, 2025 10:21
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