Skip to content

[SC 8805] support config option for logging test results#337

Merged
AnilSorathiya merged 6 commits intomainfrom
anilsorathiya/sc-8805/allow-passing-block-config-options-to-result
Mar 19, 2025
Merged

[SC 8805] support config option for logging test results#337
AnilSorathiya merged 6 commits intomainfrom
anilsorathiya/sc-8805/allow-passing-block-config-options-to-result

Conversation

@AnilSorathiya
Copy link
Contributor

@AnilSorathiya AnilSorathiya commented Mar 13, 2025

Internal Notes for Reviewers

We now have configuration options that can be passed through result.log() to display and customize the test results block in UI documents.

Available config options:
- hideTitle
- hideText
- hideParams
- hideTables
- hideFigures

test = vm.tests.run_test(
    "validmind.data_validation.TabularDescriptionTables:raw_dataset",
    input_grid={
        "dataset": [vm_raw_dataset],
    },
)
test.log(config={"hideFigures": False, "hideTables": True})

External Release Notes

We now have configuration options that can be passed through result.log() to display and customize the test results block in UI documents.

Available config options:
- hideTitle
- hideText
- hideParams
- hideTables
- hideFigures

test = vm.tests.run_test(
    "validmind.data_validation.TabularDescriptionTables:raw_dataset",
    input_grid={
        "dataset": [vm_raw_dataset],
    },
)
test.log(config={"hideFigures": False, "hideTables": True})

@AnilSorathiya AnilSorathiya added chore Chore tasks that aren't bugs or new features documentation Improvements or additions to documentation enhancement New feature or request and removed chore Chore tasks that aren't bugs or new features labels Mar 13, 2025
@AnilSorathiya AnilSorathiya requested review from cachafla, johnwalz97 and juanmleng and removed request for johnwalz97 March 13, 2025 18:55
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.

Just a couple of questions but other than that lgtm

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.

Nice, looks good 👍

@github-actions
Copy link
Contributor

PR Summary

This pull request introduces several enhancements and bug fixes to the validmind project, specifically focusing on the API client and result logging functionalities.

Key Changes:

  1. Logging Configuration Enhancements:

    • Added a config parameter to the alog_test_result and log_async methods, allowing users to specify configuration options for displaying test results. This includes options to hide titles, text, parameters, tables, and figures in the document view.
    • Introduced a validate_log_config method to ensure that the configuration options provided are valid. This method checks for invalid keys and ensures all values are boolean, raising an InvalidParameterError if any issues are found.
  2. Error Handling Improvements:

    • Added a new InvalidParameterError class to handle cases where invalid parameters are provided.
  3. Code Refactoring:

    • Updated the log_metric function to return the result of run_async for better consistency and potential error handling.
    • Improved docstrings for better clarity and consistency across the codebase.
  4. Test Updates:

    • Modified the test case test_log_test_result to include the new config parameter, ensuring that the logging functionality is tested with the updated configuration options.

These changes aim to provide more flexibility and robustness in how test results are logged and displayed, while also improving error handling and code clarity.

Test Suggestions

  • Test logging with various valid configurations to ensure they are applied correctly.
  • Test logging with invalid configuration keys to verify that InvalidParameterError is raised.
  • Test logging with non-boolean configuration values to ensure InvalidParameterError is raised.
  • Test the default behavior when no configuration is provided to ensure it does not break existing functionality.
  • Test the log_metric function to ensure it returns the expected result and handles errors appropriately.

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.

Nice!

@AnilSorathiya AnilSorathiya merged commit 3be47b0 into main Mar 19, 2025
6 checks passed
@johnwalz97 johnwalz97 deleted the anilsorathiya/sc-8805/allow-passing-block-config-options-to-result branch August 20, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants