Skip to content

Feat: Add Configurable Discovery Validation Capabilities#37

Draft
ClassicMMT wants to merge 1 commit into
typed-safe-data-previewfrom
configurable-discovery-validation
Draft

Feat: Add Configurable Discovery Validation Capabilities#37
ClassicMMT wants to merge 1 commit into
typed-safe-data-previewfrom
configurable-discovery-validation

Conversation

@ClassicMMT

@ClassicMMT ClassicMMT commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Required for datamasque-cli PR.

Requires PR 36 being merged first or this branch merged into it.

@ClassicMMT
ClassicMMT marked this pull request as draft July 19, 2026 22:45
@ClassicMMT ClassicMMT self-assigned this Jul 19, 2026
@ClassicMMT ClassicMMT changed the title Add Configurable Discovery Validation Capabilities Feat: Add Configurable Discovery Validation Capabilities Jul 19, 2026
@ClassicMMT
ClassicMMT force-pushed the configurable-discovery-validation branch 2 times, most recently from 8b85d87 to ab9865a Compare July 20, 2026 03:15
@ClassicMMT
ClassicMMT requested a review from kanewilliams July 20, 2026 19:55
@ClassicMMT
ClassicMMT force-pushed the configurable-discovery-validation branch from ab9865a to 922e121 Compare July 20, 2026 20:10
@ClassicMMT
ClassicMMT changed the base branch from main to typed-safe-data-preview July 20, 2026 20:12
@ClassicMMT
ClassicMMT requested review from kw-datamasque and removed request for kanewilliams July 20, 2026 21:22
@kw-datamasque

Copy link
Copy Markdown

Some preliminary comments for now. Will give it a proper review once a few other PRs settle.

Comment on lines +152 to +153
timeout: float = 60.0,
poll_interval: float = 1.0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Magic numbers: Can we make these named constants with units in base.py and share with validate_discovery_config?

Suggested change
timeout: float = 60.0,
poll_interval: float = 1.0,
timeout_seconds: float = VALIDATION_TIMEOUT_SECONDS,
poll_interval_seconds: float = VALIDATION_POLL_INTERVAL_SECONDS,

"""Validation status; may be `in_progress` briefly after creating a large config."""
validation_error: Optional[str] = Field(default=None, exclude=True)
"""Human-readable validation error, or `None` when valid."""
validation_error_details: list[ValidationErrorDetails] = Field(default_factory=list, exclude=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ruleset_library.py has a very similar looking field (of list[ValidationErrorDetails]) named validation_errors

Although I prefer validation_error_details since it aligns with the type, for consistency should we rename to match?

Suggested change
validation_error_details: list[ValidationErrorDetails] = Field(default_factory=list, exclude=True)
validation_errors: list[ValidationErrorDetails] = Field(default_factory=list, exclude=True)

Comment on lines +34 to +50
def promote_error_locations(data: object) -> object:
"""Flatten a server `errors` payload into a `validation_error_details` list."""

if not isinstance(data, dict) or "errors" not in data:
return data
data = dict(data)
raw_errors = data.pop("errors")
entries: list[object] = []
if isinstance(raw_errors, dict):
for value in raw_errors.values():
if isinstance(value, list):
entries.extend(value)
elif isinstance(raw_errors, list):
entries = raw_errors
if entries:
data["validation_error_details"] = entries
return data

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we declare the shape when defining validation_error_details and let pydantic do the parsing for us?

validation_error_details: list[ValidationErrorDetails] = Field(
    default_factory=list,
    exclude=True,
    validation_alias=AliasChoices(AliasPath("errors", "config_yaml"), "validation_error_details"),
)

(docs to pydantic aliasing) - Does this work?

Comment thread datamasque/client/base.py
try:
delete()
except DataMasqueException:
logger.warning('Failed to clean up %s; remove it manually.', description)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The warning drops the underlying error, so finding the cause of it may be guesswork after it happens.

Suggestion: catch as e and include it in the message

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.

2 participants