Skip to content

Feat/oxabl analyze phase6#52

Merged
evanbrobertson merged 2 commits into
masterfrom
feat/oxabl-analyze-phase6
May 1, 2026
Merged

Feat/oxabl analyze phase6#52
evanbrobertson merged 2 commits into
masterfrom
feat/oxabl-analyze-phase6

Conversation

@evanbrobertson
Copy link
Copy Markdown
Contributor

No description provided.

evanbrobertson and others added 2 commits April 17, 2026 23:53
New `oxabl_analyze` workspace crate that serializes the
`oxabl_semantic::Semantic` model to stable, versioned JSON. Also wires
`oxabl analyze <path>` into the CLI so the full pipeline (parse →
analyze → lint → dump) is reachable from the command line.

`oxabl_analyze` depends on `oxabl_semantic` + `oxabl_lint` + `serde_json`.
Kept separate from `oxabl_semantic` so the semantic crate stays free of
JSON-encoder dependencies; formatter / LSP consumers pull only the side-
table model.

Envelope shape (per-section versioned):

    {
      "envelope": 1,
      "sections": { "scopes": 1, "symbols": 1, "types": 1,
                    "references": 1, "diagnostics": 1 },
      "schema_revision": 0,
      "scopes": [...],
      "symbols": [...],
      "references": [...],
      "types": [...],
      "diagnostics": [...]   // tagged source: "semantic" | "lint"
    }

Breaking changes to a single section bump only its version, not the
whole envelope.

CLI: `oxabl analyze FILE --format json|text [--no-lint] [--preprocess]
[--include-path DIR]`. JSON is the stable contract; text is an
interactive human format (not stability-guaranteed).

Tests: 20 total
- 8 library unit tests on the dump itself (envelope shape, builtin
  serialization, round-trip JSON, diagnostic source tagging,
  duplicate-decl SEM0001 surfaces through).
- 12 fixture-driven property tests in `tests/fixture_tests.rs` over 5
  canonical fixtures (simple_variable, procedure_with_params,
  function_with_return, unused_variable, undefined_symbol). Tests
  assert *shape invariants* — envelope sections, 5 seeded builtins,
  procedure scope contains its parameters, OUTPUT param skipped by
  LINT0002, function return type rendered as "decimal", LINT0001
  fires on unknown identifiers, etc.

Fixture goldens went shape-based rather than exact-JSON because NodeIds
aren't stable across parser growth. Adding a `.p` file to
`tests/fixtures/` automatically extends the cross-fixture property
checks (every_fixture_has_file_scope, every_fixture_seeds_five_builtins,
every_fixture_round_trips_as_json_string).

Workspace total: 933 → 953 passing, all green. `cargo clippy
--workspace --tests -- -D warnings` clean.

Deferred to follow-up:
- `corpus_lint_audit` over pcna-erp (scope creep for v1 ship).
- Exact-JSON goldens once the parser's NodeId minter is deterministic
  under feature growth.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@evanbrobertson evanbrobertson merged commit acbed7e into master May 1, 2026
6 checks passed
@evanbrobertson evanbrobertson deleted the feat/oxabl-analyze-phase6 branch May 1, 2026 01:55
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.

1 participant