Repository navigation
test: add source-backed IQ and MEX conformance baseline #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7be1924
test: add source-backed IQ and MEX conformance baseline
jlucaso1 1b9286d
ci: run offline conformance fixture checks independently
jlucaso1 585ff93
fix: update rustls for RUSTSEC-2026-0285
jlucaso1 ebbfaed
test: bind conformance AST capture to verified bytes
jlucaso1 d6dbc66
Merge commit '9b8bc4e05eec14fa49b488c8eb8e56ce8ac5bfdb' into test/ind…
jlucaso1 11f0252
test: validate baseline capture on merged quality base
jlucaso1 9356dee
test: pin reviewed baseline provenance records
jlucaso1 3cb0863
test: close independent oracle coverage and fixture inventory gaps
jlucaso1 8581d29
test: assert complete presence keys and mirrored IQ contracts
jlucaso1 4352b88
Merge remote-tracking branch 'origin/main' into test/independent-conf…
jlucaso1 a7b0cde
test: pin pilot exports, captured catalog and archive origins
jlucaso1 b36fd17
test: assert complete captured MEX catalog and variable shape
jlucaso1 700310f
test: compare complete MEX presence nodes
jlucaso1 33c2b3d
test: bind MEX input triage to reviewed operation identity
jlucaso1 e9a1fb0
test: pin outer IQ guards, parser identities and fragment diagnostics
jlucaso1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| //! Presence is a serialization property, separate from inferred type/nullability. | ||
| use std::path::Path; | ||
| use wa_ir::{TypeNode, VariablePresence}; | ||
|
|
||
| fn source(version: &str, module: &str) -> String { | ||
| std::fs::read_to_string( | ||
| Path::new(env!("CARGO_MANIFEST_DIR")) | ||
| .join("../../tests/conformance") | ||
| .join(version) | ||
| .join(format!("{module}.js")), | ||
| ) | ||
| .unwrap() | ||
| } | ||
|
|
||
| #[test] | ||
| fn verified_call_sites_keep_presence_separate_from_boolean_type() { | ||
| for version in ["2.3000.1045368834", "2.3000.1047483476"] { | ||
| let source = source(version, "WAWebMexFetchNewsletterJobQuery.graphql") | ||
| + &source(version, "WAWebMexFetchNewsletterJob"); | ||
| let ir = wa_mex::extract_mex(&source, version); | ||
| let op = &ir.operations["FetchNewsletter"]; | ||
| reviewed_presence(op); | ||
| } | ||
| } | ||
|
|
||
| fn reviewed_presence(op: &wa_ir::MexOperation) { | ||
| for (key, expected) in [ | ||
| ("fetch_creation_time", VariablePresence::Always), | ||
| ("fetch_full_image", VariablePresence::Always), | ||
| ("fetch_status_metadata", VariablePresence::Always), | ||
| ("fetch_wamo_sub", VariablePresence::Always), | ||
| ("fetch_viewer_metadata", VariablePresence::Conditional), | ||
| ("fetch_pinned_messages", VariablePresence::Undetermined), | ||
| ] { | ||
|
jlucaso1 marked this conversation as resolved.
Outdated
|
||
| assert_eq!(op.variables_presence[key].presence, expected, "{key}"); | ||
| // The scalar-name heuristic types these fetch_* names as boolean. | ||
| // That does not establish call-site nullability or key presence. | ||
| assert_eq!(op.variables_shape[key], TypeNode::Leaf("boolean".into())); | ||
|
jlucaso1 marked this conversation as resolved.
Outdated
|
||
| } | ||
| assert_eq!( | ||
| op.variables_presence["input"].presence, | ||
| VariablePresence::Always | ||
| ); | ||
| assert_eq!( | ||
| op.variables_presence["input"].fields["key"].presence, | ||
| VariablePresence::Conditional | ||
| ); | ||
| assert_eq!( | ||
| op.variables_presence["input"].fields["view_role"].presence, | ||
| VariablePresence::Conditional | ||
| ); | ||
| assert_eq!( | ||
| op.variables_presence["input"].fields["type"].presence, | ||
| VariablePresence::Always | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn presence_oracle_rejects_regressions_in_all_reviewed_keys() { | ||
| let source = source( | ||
| "2.3000.1047483476", | ||
| "WAWebMexFetchNewsletterJobQuery.graphql", | ||
| ) + &source("2.3000.1047483476", "WAWebMexFetchNewsletterJob"); | ||
| let ir = wa_mex::extract_mex(&source, "fixture"); | ||
| for key in ["fetch_status_metadata", "fetch_wamo_sub", "view_role"] { | ||
| let mut op = ir.operations["FetchNewsletter"].clone(); | ||
| if key == "view_role" { | ||
| op.variables_presence | ||
| .get_mut("input") | ||
| .unwrap() | ||
| .fields | ||
| .get_mut(key) | ||
| .unwrap() | ||
| .presence = VariablePresence::Always; | ||
| } else { | ||
| op.variables_presence.get_mut(key).unwrap().presence = VariablePresence::Undetermined; | ||
| } | ||
| assert!( | ||
| std::panic::catch_unwind(|| reviewed_presence(&op)).is_err(), | ||
| "accepted {key} regression" | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn null_undefined_and_unresolved_calls_have_distinct_presence_verdicts() { | ||
| // Hand-authored perturbations of a real operation, not extra claims about | ||
| // which arguments the server accepts. Expectations follow JSON object-key | ||
| // serialization: null survives, undefined disappears, calls are unresolved. | ||
| let query = source( | ||
| "2.3000.1047483476", | ||
| "WAWebMexFetchNewsletterJobQuery.graphql", | ||
| ); | ||
| for (expression, expected) in [ | ||
| ("null", VariablePresence::Always), | ||
| ("false", VariablePresence::Always), | ||
| ("void 0", VariablePresence::Conditional), | ||
| ("t.flag", VariablePresence::Conditional), | ||
| ("t.flag === true", VariablePresence::Always), | ||
| ("o(\"External\").flag()", VariablePresence::Undetermined), | ||
| ] { | ||
| let caller = format!( | ||
| r#"__d("ConformanceCaller",["WAWebMexClient","WAWebMexFetchNewsletterJobQuery.graphql","External"],(function(t,n,r,o,a,i,l){{function f(t){{return o("WAWebMexClient").fetchQuery(n("WAWebMexFetchNewsletterJobQuery.graphql"),{{fetch_viewer_metadata:{expression}}})}}l.run=f}}),98);"# | ||
| ); | ||
| let ir = wa_mex::extract_mex(&(query.clone() + &caller), "fixture"); | ||
| let op = &ir.operations["FetchNewsletter"]; | ||
| assert_eq!( | ||
| op.variables_presence["fetch_viewer_metadata"].presence, expected, | ||
| "{expression}" | ||
| ); | ||
| assert_eq!( | ||
| op.variables_shape["fetch_viewer_metadata"], | ||
| TypeNode::Leaf("boolean".into()), | ||
| "presence does not establish nullability: {expression}" | ||
| ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.