Skip to content

refactor: Slim testapi.TestResult; metadata keys and UFM serialization#580

Draft
danskmt wants to merge 1 commit intomainfrom
feat/CLI-1301-slim-testresult-metadata
Draft

refactor: Slim testapi.TestResult; metadata keys and UFM serialization#580
danskmt wants to merge 1 commit intomainfrom
feat/CLI-1301-slim-testresult-metadata

Conversation

@danskmt
Copy link
Copy Markdown

@danskmt danskmt commented Apr 7, 2026

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Commit messages are release-note ready
  • Includes detailed description of changes
  • Contains risk assessment
  • Highlights breaking API changes
  • Links to automated tests covering new functionality
  • Manual testing instructions (if necessary)
  • Updates GitBook documentation (PR link: ___)
  • Product update for stable release notes

What does this PR do?

Narrows testapi.TestResult: removes rich getters in favor of GetMetadataValue / SetMetadata with exported MetadataKey* constants. Populates canonical metadata when building results from the API. UFM (jsonTestResult) drops duplicate top-level JSON fields; serialization uses ShallowMetadataCopy(). Updates mocks, UFM/tests, and presenter templates that previously called GetMetadata.

Where should the reviewer start?

  • pkg/apiclients/testapi/testapi.go — interface and testResult
  • pkg/apiclients/testapi/test_result_metadata.go — keys and population
  • pkg/utils/ufm/json_test_result.go — wire shape and NewSerializableTestResult

How 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 uses ShallowMetadataCopy. 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

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Apr 7, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Apr 7, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

1 participant