refactor: Slim testapi.TestResult; metadata keys and UFM serialization#580
Draft
refactor: Slim testapi.TestResult; metadata keys and UFM serialization#580
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Submission Checklist
What does this PR do?
Narrows
testapi.TestResult: removes rich getters in favor ofGetMetadataValue/SetMetadatawith exportedMetadataKey*constants. Populates canonical metadata when building results from the API. UFM (jsonTestResult) drops duplicate top-level JSON fields; serialization usesShallowMetadataCopy(). Updates mocks, UFM/tests, and presenter templates that previously calledGetMetadata.Where should the reviewer start?
pkg/apiclients/testapi/testapi.go— interface andtestResultpkg/apiclients/testapi/test_result_metadata.go— keys and populationpkg/utils/ufm/json_test_result.go— wire shape andNewSerializableTestResultHow should this be manually tested?
go test ./...from repo root.Breaking changes
Yes. Removed from
TestResult:GetTestSubject,GetSubjectLocators,GetTestResources,GetBreachedPolicies,GetRawSummary,GetTestFacts,GetMetadata. Consumers must use metadata keys +GetMetadataValue; UFM persistence usesShallowMetadataCopy. New UFM JSON omits former top-level fields (old JSON with extra keys still unmarshals; those keys are ignored).Risk assessment
Medium — public interface and persisted/cached UFM payload shape; coordinated rollout with extensions, LS, and CLI.
Tickets
CLI-1301