Skip to content

FIX BED-8687: Replace fields that use type Any with fixed types to fix DLT schema validation errors #14

Open
d3vzer0 wants to merge 16 commits into
mainfrom
fix/BED-8687
Open

FIX BED-8687: Replace fields that use type Any with fixed types to fix DLT schema validation errors #14
d3vzer0 wants to merge 16 commits into
mainfrom
fix/BED-8687

Conversation

@d3vzer0

@d3vzer0 d3vzer0 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Replaced the Any field type with stable types to prevent DLT schema validation issues (when different field types are collected during the same run) for the following models:

  • WorkflowJob
  • WorkflowStepDefinition
  • WorkflowJobDefinition

@d3vzer0 d3vzer0 marked this pull request as draft June 18, 2026 10:13
@d3vzer0 d3vzer0 requested a review from Copilot June 18, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GitHub Actions workflow-related models to replace Any-typed fields with more stable, explicitly typed structures in order to reduce DLT schema validation errors caused by type variance across extracted rows.

Changes:

  • Tightened workflow YAML parsing models (WorkflowStepDefinition, WorkflowJobDefinition, WorkflowDocument) by replacing several Any fields with explicit unions / mappings.
  • Introduced a Container model and updated job/workflow permission typing.
  • Updated WorkflowJob to normalize runs_on into a stable string when emitting graph node properties.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/openhound_github/models/workflow.py Replaces Any in workflow YAML parsing models and adds a Container model.
src/openhound_github/models/workflow_job.py Narrows runs_on typing and adds a normalization property used when building graph nodes.
Comments suppressed due to low confidence (1)

src/openhound_github/models/workflow.py:59

  • with_/env are now typed as dict[str, str], but the shared validator still returns dict[str, Any] and doesn't coerce values. If YAML contains non-string scalars (or other types), this can either fail validation or reintroduce mixed DLT types. Consider normalizing keys/values to strings in the validator and updating the return type accordingly.
    env: dict[str, str] = Field(default_factory=dict)

    @field_validator("with_", "env", mode="before")
    @classmethod
    def dict_or_empty(cls, value: Any) -> dict[str, Any]:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/openhound_github/models/workflow.py Outdated
Comment thread src/openhound_github/models/workflow.py Outdated
Comment thread src/openhound_github/models/workflow.py
Comment thread src/openhound_github/models/workflow.py Outdated
Comment thread src/openhound_github/models/workflow.py Outdated
Comment thread src/openhound_github/models/workflow_job.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/openhound_github/models/workflow.py:60

  • with_/env are now typed as dict[str, str], but this validator still returns the raw mapping (dict[str, Any]) without coercing keys/values. YAML commonly produces non-string scalars (including null for empty values), which can cause Pydantic validation to fail and the whole workflow document to be dropped. Normalize keys/values to str here (consistent with the job-level env/secrets normalization).
    with_: dict[str, str] = Field(default_factory=dict, alias="with")
    env: dict[str, str] = Field(default_factory=dict)

    @field_validator("with_", "env", mode="before")
    @classmethod
    def dict_or_empty(cls, value: Any) -> dict[str, Any]:
        return value if isinstance(value, dict) else {}

Comment thread src/openhound_github/models/workflow.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/openhound_github/models/workflow.py:60

  • with_/env are now typed as dict[str, str], but this validator still returns dict[str, Any] and doesn't normalize values. If a workflow YAML contains non-string scalars (e.g., null for an empty value), WorkflowDocument.model_validate() can now fail and document becomes None, dropping all workflow-derived rows. Coerce keys/values to strings here (and map YAML null to an empty string) to keep parsing robust and the emitted schema stable.
    @field_validator("with_", "env", mode="before")
    @classmethod
    def dict_or_empty(cls, value: Any) -> dict[str, Any]:
        return value if isinstance(value, dict) else {}

Comment thread src/openhound_github/models/workflow.py
Comment thread src/openhound_github/models/workflow.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/openhound_github/models/workflow.py:60

  • with_/env are now typed as dict[str, str], but the pre-validator still returns dict[str, Any] without coercion. This can lead to Pydantic validation errors (e.g., numeric YAML scalars) and also defeats the goal of keeping the extracted schema stable.

Consider normalizing both keys and values to strings here (mirroring the WorkflowJobDefinition normalizer).

    @field_validator("with_", "env", mode="before")
    @classmethod
    def dict_or_empty(cls, value: Any) -> dict[str, Any]:
        return value if isinstance(value, dict) else {}

Comment thread src/openhound_github/models/workflow_job.py
@d3vzer0 d3vzer0 marked this pull request as ready for review June 18, 2026 14:29
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