Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ updates:
# implementation and changes only through an explicit compatibility
# decision, so it is excluded from automated updates.
- package-ecosystem: npm
directory: /compatibility/oracle
directory: /tools/overpy/oracle
schedule:
interval: monthly
ignore:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ jobs:
- name: Build internal compatibility evidence target
run: cargo build --locked -p opy-cli --features compatibility --bin opy-compat

- name: Run compatibility harness tests
run: python3 -B -m unittest discover -s compatibility/tests
- name: Run OverPy evidence harness tests
run: python3 -B -m unittest discover -s tools/overpy/tests

- name: Run native compiler compatibility gate
run: >-
python3 -B compatibility/run_native.py
python3 -B tools/overpy/run_native.py
--binary target/debug/opy-cli
--semantic-binary target/debug/opy-compat
--results target/opy-rs-compiler-results
Expand All @@ -83,7 +83,7 @@ jobs:

- name: Run independent conformance baseline
run: >-
python3 -B compatibility/conformance.py
python3 -B tools/overpy/conformance.py
--binary target/debug/opy-cli
--semantic-binary target/debug/opy-compat
--report target/opy-rs-conformance-report.json
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
**/*.rs.bk
.DS_Store
.env
# Pinned oracle installs (pnpm install --dir compatibility/oracle)
compatibility/oracle/node_modules/
# Pinned oracle installs (pnpm install --dir tools/overpy/oracle)
tools/overpy/oracle/node_modules/
# Python harness caches
__pycache__/
*.pyc
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ opy-cli check main.opy
opy-cli compile main.opy
opy-cli compile --format json main.opy
opy-cli inspect main.opy
opy-cli support --json
opy-cli completion bash
opy-cli version
```
Expand Down Expand Up @@ -107,10 +106,9 @@ compatibility corpus and pinned OverPy reference evidence.
| OPY → Workshop compilation | 🟡 Partial | The versioned library/CLI compile contract and bounded lowering surface are supported; remaining corpus gaps stay explicit |
| Workshop → OPY reconstruction | ⏳ Not yet | Will consume canonical `workshop-rs` semantics and remain owned by `opy-rs` |

Exact per-feature evidence remains available in the
[canonical human-readable support contract](docs/language-support.md). Internal
fixture and implementation metadata remains in
[compatibility/support-matrix.json](compatibility/support-matrix.json).
The exhaustive per-feature evidence and pinned denominator are maintained in
the [canonical human-readable support contract](docs/language-support.md) and
its linked inventories.

## Relationship with Wright

Expand All @@ -127,7 +125,7 @@ capability that `opy-rs` itself should own.
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-targets --all-features
python3 -m unittest discover -s compatibility/tests
python3 -m unittest discover -s tools/overpy/tests
```

CI additionally exercises the JavaScript macro runtime on macOS and Windows.
Expand Down
808 changes: 0 additions & 808 deletions compatibility/support-matrix.json

This file was deleted.

131 changes: 0 additions & 131 deletions compatibility/tests/test_support_matrix.py

This file was deleted.

2 changes: 1 addition & 1 deletion crates/opy-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
description = "Standalone OPY CLI: check, compile, inspect, support-matrix, version."
description = "Standalone OPY CLI: check, compile, inspect, and version."

[features]
compatibility = ["dep:workshop-rs"]
Expand Down
13 changes: 0 additions & 13 deletions crates/opy-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ pub(crate) enum Command {
Compile(CompileArgs),
/// Print the resolved program model as JSON.
Inspect(FileArgs),
/// Print the compatibility support matrix or a filtered slice as JSON.
Support(SupportArgs),
/// Generate static shell completion from this command model.
Completion(CompletionArgs),
/// Show the top-level help.
Expand Down Expand Up @@ -85,17 +83,6 @@ pub(crate) struct FileArgs {
pub(crate) main: PathBuf,
}

#[derive(Debug, Args)]
pub(crate) struct SupportArgs {
/// Explicitly request the existing JSON output (output is JSON by default).
#[arg(long)]
pub(crate) json: bool,

/// Filter by category or feature id.
#[arg(value_name = "CATEGORY|FEATURE-ID")]
pub(crate) filter: Option<String>,
}

#[derive(Debug, Args)]
pub(crate) struct CompletionArgs {
/// Shell to generate completion for.
Expand Down
46 changes: 1 addition & 45 deletions crates/opy-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ use std::process::ExitCode;

use clap::{CommandFactory, Parser, error::ErrorKind};
use clap_complete::{generate, shells};
use opy_rs::support::{self, SupportMatrixError};
use opy_rs::tooling::{CheckOutcome, Diagnostic as OpyDiagnostic, check};
use opy_rs::{CompileDiagnostic, CompileStatus, Compiler};
use opy_rs::{LANGUAGE_NAME, LANGUAGE_VERSION};
use serde::Serialize;

use crate::cli::{CheckArgs, Cli, Command, CompileArgs, FileArgs, OutputFormatArg, SupportArgs};
use crate::cli::{CheckArgs, Cli, Command, CompileArgs, FileArgs, OutputFormatArg};
use crate::present::{
CheckView, DiagnosticSeverity, DiagnosticView, PositionView, Presentation, SpanView,
};
Expand Down Expand Up @@ -56,7 +55,6 @@ fn main() -> ExitCode {
Some(Command::Check(args)) => cmd_check(&args, presentation),
Some(Command::Compile(args)) => cmd_compile(&args, presentation),
Some(Command::Inspect(args)) => cmd_inspect(&args, presentation),
Some(Command::Support(args)) => cmd_support(&args),
Some(Command::Completion(args)) => cmd_completion(args.shell),
Some(Command::Help) => {
print!("{}", Cli::command().render_help());
Expand Down Expand Up @@ -186,43 +184,6 @@ fn cmd_inspect(args: &FileArgs, presentation: Presentation) -> ExitCode {
}
}

fn cmd_support(args: &SupportArgs) -> ExitCode {
let _json_flag_is_accepted_for_compatibility = args.json;
let matrix = match support::SupportMatrix::builtin() {
Ok(matrix) => matrix,
Err(error) => return matrix_error_exit(error),
};
let value = match args.filter.as_deref() {
None => serde_json::to_value(matrix).expect("the matrix is serializable"),
Some(filter) => {
if let Some(feature) = matrix.feature(filter) {
serde_json::to_value(feature).expect("a feature is serializable")
} else if matrix
.categories()
.iter()
.any(|category| category == filter)
{
let features = matrix.features_by_category(filter);
serde_json::json!({
"category": filter,
"count": features.len(),
"features": features,
})
} else {
eprintln!(
"opy-cli: unknown feature id or category '{filter}' \
(see `opy-cli support` for the declared matrix)"
);
return ExitCode::from(2);
}
}
};
match print_json(&value) {
Ok(()) => ExitCode::SUCCESS,
Err(code) => code,
}
}

fn cmd_completion(shell: cli::ShellArg) -> ExitCode {
let mut command = Cli::command();
let mut stdout = std::io::stdout();
Expand Down Expand Up @@ -338,8 +299,3 @@ fn print_json<T: Serialize>(value: &T) -> Result<(), ExitCode> {
}
}
}

fn matrix_error_exit(error: SupportMatrixError) -> ExitCode {
eprintln!("opy-cli: the embedded support matrix is invalid: {error}");
ExitCode::from(2)
}
48 changes: 9 additions & 39 deletions crates/opy-cli/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const MULTI_MAIN: &str = concat!(
);
const BASIC_RULE: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../compatibility/fixtures/synthetic/basic-rule/source.opy"
"/../opy-rs/tests/fixtures/corpus/synthetic/basic-rule/source.opy"
);
const LITERAL_DICT_LOOKUP_FIXTURE: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../compatibility/fixtures/synthetic/dictionary-lookup/source.opy"
"/../opy-rs/tests/fixtures/corpus/synthetic/dictionary-lookup/source.opy"
);
fn run(args: &[&str]) -> std::process::Output {
run_with_env(args, &[])
Expand Down Expand Up @@ -247,42 +247,6 @@ fn inspect_reports_diagnostics_and_exits_one() {
let _ = std::fs::remove_dir_all(&dir);
}

#[test]
fn support_prints_the_embedded_matrix_as_json() {
let output = run(&["support", "--json"]);
assert_eq!(output.status.code(), Some(0));
let json: serde_json::Value = serde_json::from_slice(&output.stdout).expect("matrix JSON");
assert_eq!(json["schemaVersion"], 1);
assert_eq!(json["reference"]["name"], "overpy");
assert!(json["features"].as_array().expect("features").len() >= 30);
}

#[test]
fn support_filters_by_feature_id_and_category() {
let by_id = run(&["support", "compilation/workshop-lowering"]);
assert_eq!(by_id.status.code(), Some(0));
let feature: serde_json::Value = serde_json::from_slice(&by_id.stdout).expect("feature JSON");
assert_eq!(feature["state"], "lowering-dependent");

let by_category = run(&["support", "syntax"]);
assert_eq!(by_category.status.code(), Some(0));
let slice: serde_json::Value =
serde_json::from_slice(&by_category.stdout).expect("category JSON");
assert_eq!(slice["category"], "syntax");
let features = slice["features"].as_array().expect("filtered features");
assert_eq!(slice["count"], features.len());
assert!(!features.is_empty());
assert!(
features
.iter()
.all(|feature| feature["category"] == "syntax")
);

let unknown = run(&["support", "nope/nothing"]);
assert_eq!(unknown.status.code(), Some(2));
assert!(String::from_utf8_lossy(&unknown.stderr).contains("unknown feature id or category"));
}

#[test]
fn version_prints_crate_and_protocol_identity() {
let output = run(&["version"]);
Expand All @@ -303,6 +267,13 @@ fn unknown_command_is_a_usage_error() {
assert!(String::from_utf8_lossy(&output.stderr).contains("unknown command"));
}

#[test]
fn retired_support_command_is_a_usage_error() {
let output = run(&["support"]);
assert_eq!(output.status.code(), Some(2));
assert!(String::from_utf8_lossy(&output.stderr).contains("unknown command"));
}

#[test]
fn help_and_parse_are_driven_by_the_structured_command_model() {
let help = run(&["--help"]);
Expand All @@ -313,7 +284,6 @@ fn help_and_parse_are_driven_by_the_structured_command_model() {
"check",
"compile",
"inspect",
"support",
"completion",
"--renderer",
"--color",
Expand Down
Loading