Skip to content

Conversation

@nibalizer
Copy link
Contributor

@nibalizer nibalizer commented Dec 19, 2025

Pull Request Description

What and why?

Exposed the log_test_result function as a public API in validmind.api_client, validmind.client, and the top-level validmind package. This allows users to programmatically log test results without using the internal alog_test_result async function directly.

How to test

import validmind as vm
import pandas as pd
import uuid

# Setup model and auth to validmind
vm.init(
    api_host="...",
    api_key="...",
    api_secret="...",
    model="...",
)

# Create a simple DataFrame
df = pd.DataFrame({
    'Message': ['Hello', 'World'],
    'Number': [1, 2]
})

# Construct a payload for the ValidMind API
result_dict = {
    "test_name": "My Data Test",
    "ref_id": str(uuid.uuid4()),
    "passed": True,
    "inputs": [],
    "params": {},
    # The 'summary' field holds a list of tables
    "summary": [
        {
            "type": "table",
            "data": df.to_dict(orient='records'),
            "metadata": {"title": "My Results Table"} # Optional title
        }
    ]
}

# Log the result directly
vm.log_test_result(result=sas_result_dict)

What needs special review?

None.

Dependencies, breaking changes, and deployment notes

None.

Release notes

Exposed validmind.log_test_result (and vm.log_test_result) to allow logging test result dictionaries directly to the API synchronously.

Checklist

  • What and why
  • Screenshots or videos (Frontend)
  • How to test
  • What needs special review
  • Dependencies, breaking changes, and deployment notes
  • Labels applied
  • PR linked to Shortcut
  • Unit tests added (Backend)
  • Tested locally
  • Documentation updated (if required)
  • Environment variable additions/changes documented (if required)

@github-actions
Copy link
Contributor

Pull requests must include at least one of the required labels: internal (no release notes required), highlight, enhancement, bug, deprecation, documentation. Except for internal, pull requests must also include a description in the release notes section.

@nibalizer nibalizer added the enhancement New feature or request label Jan 2, 2026
@nibalizer
Copy link
Contributor Author

image

This allows a user to skip most of the vm-library machinery and just
send results to ValidMind.

Amp-Thread-ID: https://ampcode.com/threads/T-0d15caf4-4ac4-4ff4-b7e1-9be6ed2590f7
Co-authored-by: Amp <amp@ampcode.com>
@nibalizer nibalizer force-pushed the nibz/sc-xxx/expose-log-test-result branch from 39ee4dd to dc4e341 Compare January 2, 2026 18:40
@nibalizer nibalizer requested review from AnilSorathiya, cachafla and johnwalz97 and removed request for johnwalz97 January 2, 2026 18:40
Copy link
Contributor

@johnwalz97 johnwalz97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice 👌

Copy link
Contributor

@cachafla cachafla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I'd suggest a minor version bump since we're adding a new method to the API.

@nibalizer nibalizer merged commit 3bc3f8a into main Jan 2, 2026
15 checks passed
@nibalizer nibalizer deleted the nibz/sc-xxx/expose-log-test-result branch January 2, 2026 22:42
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2026

PR Summary

This PR introduces a new function, log_test_result, in the API client, which allows logging of test result information. The function acts as a synchronous wrapper around its asynchronous counterpart, alog_test_result, using run_async. The update ensures that log_test_result is also imported in the package's init.py and exposed as part of the public API. This enhancement enables users to log test results with additional metadata such as section ID, position, and configuration flags to handle sensitive data. Overall, the changes integrate test result logging into the existing API in a manner consistent with the current design.

Test Suggestions

  • Write unit tests for log_test_result ensuring it correctly delegates to alog_test_result and returns the expected response.
  • Test the behavior of the function with various combinations of parameters, including with and without section_id, position, and config.
  • Verify that the unsafe flag is properly handled, and check that potentially sensitive data is treated according to application security policies.
  • Simulate API failure scenarios to ensure that exceptions are raised and handled appropriately.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants