Skip to content

[P1] Make editor diagnostics and IR preview accept valid Nano v1 programs #55

Closed

Description

@AetherAI3

Problem and evidence

At main d740bb530262c1c76a2b18c8a8aa47476f8b6b96, a valid typed Nano v1 program compiles successfully through compile_to_dict() but is reported invalid by the editor helpers.

strategy Typed {
  input close: series<float>
  every 1m { if close > 0 { observe() } }
}

compile_to_dict(source) emits IR 1.0.0. diagnostics(source) instead reports “uses v1.0 constructs that 0.1.0 IR cannot represent” at 1:1; ir_preview(source) renders the same error. Both helpers call the intentionally baseline-only compile_source().

Sources: diagnostics.py, preview.py. This is a reproduced integration defect, not a request to change the baseline compiler API.

Agent work packet

Use the version-neutral compilation path for editor diagnostics and add a deterministic readable v1 preview. Preserve the public helper signatures, baseline preview output, exact compiler error positions, and the baseline-only behavior of compile_source(). Keep the implementation offline and dependency-free.

Acceptance

  • The source above produces no diagnostic and a readable v1 IR preview.
  • Cover representative typed input, parameter, let/arithmetic, else and signature programs, plus invalid syntax and type errors.
  • v0.1 examples retain their current preview and JSON output.
  • Valid source produces canonical JSON identical to compile_to_dict; invalid source produces useful error text rather than an empty string.
  • Run focused editor/compiler tests, then the reference suite; report any pre-existing failures separately.

Delivery and limits

One focused PR from main, including tests and the minimal documentation adjustment. No model calls, QPU jobs or production deployment. This improves the authoring surface needed by both humans and local models; it does not add quantum syntax.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions