Skip to content

Malformed cvar_export is misreported by native and silently accepted by the Python interpreter #1353

Open

Description

@ciaranra

A malformed cvar_export that uses variable instead of the required variables array is handled differently by each path:

src = {"format": "PHIR/JSON", "version": "0.1.0", "ops": [
    {"data": "cvar_define", "data_type": "u32", "variable": "m", "size": 2},
    {"data": "cvar_export", "variable": "m"},
]}
  • Native (run_phir_sim): Failed to parse PHIR JSON: missing data_type. The AST decodes it as a variable definition, so the message points at the wrong field.
  • HybridEngine with the Rust interpreter: Failed to parse: missing data_type.
  • HybridEngine with the Python interpreter (phir_validate=False): accepted silently, returns {'m': ['00']}.

Direction

Reject a data directive that is not a declaration and has no variables array on every path, with an error naming the directive and the missing variables field. On the #1314 branch the AST already does this when variable is also missing. Stop decoding unknown or non-declaration data ops as VariableDefinition.

Found during the review of the #1314 work.

Activity

  1. added
    bugSomething isn't working
    rustPull requests that update rust code
    severity:lowCosmetic, docs, or rare edge case
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrustPull requests that update rust codeseverity:lowCosmetic, docs, or rare edge case

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions