Feat/oxabl analyze phase6#52
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.