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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions crates/pons-cli/tests/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,52 @@ fn inventory_accounts_for_supported_unsupported_excluded_and_parse_error() {
}
assert_eq!(v["scanned"]["coverage_status"], "partial");
}

#[test]
fn only_parse_errors_are_partial_coverage_not_no_applicable_input() {
let t = Temp::new();
fs::write(t.0.join("invalid.jsx"), "const view = <svg in= />;").unwrap();
let out = t.scan(&["--format", "json", "--fail-on-skips"]);
assert_eq!(out.status.code(), Some(2));
let mut report: Value = serde_json::from_slice(&out.stdout).unwrap();
assert_eq!(report["scanned"]["files"], 0);
assert_eq!(report["scanned"]["coverage_status"], "partial");
assert_eq!(report["scanned"]["inventory"][0]["outcome"], "parse-error");
assert!(pons_core::report::validate::validate(&report.to_string()).is_ok());
report["scanned"]["coverage_status"] = "no-applicable-input".into();
assert!(pons_core::report::validate::validate(&report.to_string()).is_err());
}

#[test]
fn jsx_keyword_attributes_reach_analysis_and_validate() {
let t = Temp::new();
fs::write(
t.0.join("filter.jsx"),
r#"const view = <svg><feMergeNode in="SourceGraphic" /></svg>;"#,
)
.unwrap();
let out = t.scan(&[
"--format",
"json",
"--fail-on-skips",
"--require-language",
"javascript",
]);
assert_eq!(
out.status.code(),
Some(0),
"{}",
String::from_utf8_lossy(&out.stderr)
);
let report: Value = serde_json::from_slice(&out.stdout).unwrap();
assert_eq!(report["scanned"]["files"], 1);
assert_eq!(
report["scanned"]["coverage_status"],
"complete-within-policy"
);
assert!(report["scanned"]["skipped"].as_array().unwrap().is_empty());
assert!(pons_core::report::validate::validate(&report.to_string()).is_ok());
}
#[test]
fn absent_required_language_cannot_be_suppressed() {
let t = Temp::new();
Expand Down
5 changes: 4 additions & 1 deletion crates/pons-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ toml.workspace = true
serde = { workspace = true }
serde_json = { workspace = true }
tree-sitter = "=0.27.0"
tree-sitter-javascript = "=0.25.0"
# 0.25.0 rejects legal JSX keyword attributes such as SVG's `in`.
# Keep the compatible grammar until upstream fixes that regression; the
# parser_adversarial corpus protects both keyword attributes and rejection.
tree-sitter-javascript = "=0.23.1"
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
tree-sitter-python = "=0.25.0"
tree-sitter-rust = "=0.24.2"
tree-sitter-typescript = "=0.23.2"
Expand Down
10 changes: 9 additions & 1 deletion crates/pons-core/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ pub struct ScanReport {

impl ScanReport {
pub fn coverage_status(&self) -> &'static str {
if self.files_scanned == 0 {
if self.files_scanned == 0
&& self.coverage_failures.is_empty()
&& self.inventory.iter().all(|entry| {
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
matches!(
entry.outcome,
Outcome::Unsupported | Outcome::ExcludedByPolicy
)
})
{
"no-applicable-input"
} else if !self.skipped.is_empty()
|| !self.coverage_failures.is_empty()
Expand Down
3 changes: 2 additions & 1 deletion crates/pons-core/src/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ impl Lang {

pub fn parser_version(self) -> &'static str {
match self {
Lang::Python | Lang::JavaScript => "0.25.0",
Lang::Python => "0.25.0",
Lang::JavaScript => "0.23.1",
Lang::TypeScript | Lang::Tsx => "0.23.2",
Lang::Rust => "0.24.2",
Lang::Php => "0.25.1",
Expand Down
9 changes: 8 additions & 1 deletion crates/pons-core/src/report/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ fn validate_value(v: Value) -> Result<String> {
);
}
}
let status = if analysed == 0 {
let status = if analysed == 0
&& failures.is_empty()
&& inventory.iter().all(|entry| {
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
matches!(
entry.outcome,
Outcome::Unsupported | Outcome::ExcludedByPolicy
)
}) {
"no-applicable-input"
} else if !skipped.is_empty()
|| !failures.is_empty()
Expand Down
31 changes: 31 additions & 0 deletions crates/pons-core/tests/parser_adversarial.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
// SPDX-License-Identifier: MPL-2.0
//! Deterministic bounded mutation smoke corpus, not a claim of exhaustive fuzzing.
use pons_core::{lang::Lang, parse, source::SourceFile};

#[test]
fn jsx_keyword_attributes_are_valid_javascript() {
// Reduced from echo-types' warrant debugger. `in` is an SVG attribute,
// not JavaScript's binary operator. The 0.25.0 grammar rejects it.
for text in [
r#"const view = <svg><feMergeNode in="SourceGraphic" /></svg>;"#,
r#"const view = <label for="field" class="hint" default="yes" />;"#,
] {
let source = SourceFile {
path: "keyword-attributes.jsx".into(),
lang: Lang::JavaScript,
text: text.into(),
transcoded: false,
};
let tree = parse::parse(&source).expect("legal JSX keyword attributes must parse");
assert!(!tree.root_node().has_error());
}
}

#[test]
fn malformed_jsx_is_not_accepted_as_a_parser_fallback() {
let source = SourceFile {
path: "invalid.jsx".into(),
lang: Lang::JavaScript,
text: r#"const view = <svg><feMergeNode in= /></svg>;"#.into(),
transcoded: false,
};
assert!(parse::parse(&source).is_err());
}

#[test]
fn fixed_seed_parser_mutations() {
let mut seed = 0x504f4e53u64;
Expand Down
14 changes: 13 additions & 1 deletion docs/PLAN.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ truth thereafter.
| crate | purpose | pin (fill at M0)
| `tree-sitter` | core parsing/query API | `=0.27.0`
| `tree-sitter-python` | Python grammar (T0 + T1 + T2) | `=0.25.0`
| `tree-sitter-javascript` | JS grammar (T0) | `=0.25.0`
| `tree-sitter-javascript` | JS/JSX grammar (T0) | `=0.23.1` (compatibility pin below)
| `tree-sitter-typescript` | TS + TSX grammars (T0) | `=0.23.2`
| `tree-sitter-rust` | Rust grammar (T0) | `=0.24.2`
| `serde` / `serde_json` | JSON + SARIF serialisation | `=1.0.229` / `=1.0.151` (M1+)
Expand All @@ -378,6 +378,18 @@ truth thereafter.
| `ignore` / `walkdir` | file discovery + `.ponsignore` | `=0.4.33` (ignore, direct); `walkdir` `2.5.0` pulled in transitively, not a direct dependency
|===

Compatibility correction, 2026-11-07 (echo-types#362): JavaScript grammar
0.25.0 rejects valid JSX keyword attribute names, including SVG
`<feMergeNode in="SourceGraphic" />`. Pin 0.23.1, whose JavaScript/JSX
grammar accepts that syntax, and retain the separate TypeScript/TSX mapping.
The source is not rewritten and recovered error trees are still rejected.
Parser and CLI regressions check valid keyword attributes, malformed JSX,
real analysis and report validation. Revisit newer grammar releases only
when these and the complete existing corpus pass; support for syntax unique
to a newer grammar is not claimed by this compatibility pin. Parser receipts
record the actual selected version. A supported source that fails parsing
has partial coverage even when no file was analysed; it is not no-applicable-input.

Resolved 2026-09-14 via `cargo add tree-sitter tree-sitter-python
tree-sitter-javascript tree-sitter-typescript tree-sitter-rust -p pons-core`
against the real workspace; confirmed no duplicate `tree-sitter` core-version
Expand Down
46 changes: 46 additions & 0 deletions docs/echo-362-verification.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
= Echo Types scanner follow-up — 7 November 2026

== Scope and correction

The baseline is PONS `b9ab55c6973514a731c7659a2fbee21b5037b1ef`.
The source reproducer is echo-types `ebde9ac4e1a9f115b441c642c82aced1316c5983`,
`docs/echo-types/prototypes/warrant_debugger_prototype.jsx`.
Its valid SVG keyword attribute `in="SourceGraphic"` fails with JavaScript
grammar 0.25.0. The compatible 0.23.1 grammar parses that file without source
rewriting or accepting recovered syntax-error trees. This is a deliberate
compatibility pin, not a claim of support for newer grammar-only syntax.
The shared tree-sitter core and TypeScript/TSX grammar remain unchanged.

When every supported source fails parsing, the report now says `partial`,
not `no-applicable-input`. Report validation independently rejects the old
misclassification. Unsupported Agda inputs remain explicitly unsupported;
this repair does not add an Agda analyser or constitute browser execution.

== Executed local evidence

Rust 1.99.1 on a case-sensitive Linux filesystem:

* `cargo test --workspace --locked`: 255 test executions passed.
* `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed.
* The exact JSX source above: one file analysed, zero findings, zero skips,
complete-within-policy for that single-file invocation, exit 0, with
`--no-speculative --fail-on error --fail-on-skips --require-language javascript`.
* New parser controls accept JSX keyword attributes and reject malformed JSX.
CLI controls check real analysis, partial coverage on parsing failure,
report validity and rejection of a forged no-applicable-input status.

Hosted CI and review results are recorded by the change's pull request;
these local results are not a claim that those checks already completed.

== Formal verification plan and trust boundary

Creusot with Pearlite contracts: `OPEN`, not run for this repair.
Verus: `OPEN`, not run for this repair. The Rust regressions above are tests,
not formal proofs of parser correctness or the coverage classification.
Pearlite is Creusot's specification language, not a third verifier.

The third-party grammar's JavaScript/JSX semantics remain a dependency
assumption (`ASSUMED`), with its exact version and lockfile checksum pinned.
No third-party code or licence was rewritten. A future grammar update must
pass these regressions and the complete existing suite before adoption.
Loading