{"record":{"id":"526d04d19d55354f","repo":"facebook/relay","slug":"interface-b-not-found","errorCode":null,"errorMessage":"interface B not found","messagePattern":"interface B not found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/schema-set/src/build_schema_document.rs","lineNumber":943,"sourceCode":"    #[test]\n    fn test_extensions_print_after_definitions() {\n        let doc = parse_schema_document(\n            indoc! {r#\"\n                extend type A implements B {\n                  id: ID\n                }\n\n                interface B {\n                  id: ID\n                }\n            \"#},\n            SourceLocationKey::generated(),\n        )\n        .unwrap();\n        let set = SchemaSet::from_schema_documents_with_extensions(&[], &[doc]).unwrap();\n        let sdl = format!(\"{}\", set.to_sdl_definition());\n\n        let interface_pos = sdl.find(\"interface B\").expect(\"interface B not found\");\n        let extension_pos = sdl.find(\"extend type A\").expect(\"extend type A not found\");\n        assert!(\n            interface_pos < extension_pos,\n            \"Definitions should print before extensions: {}\",\n            sdl,\n        );\n    }\n\n    #[test]\n    fn test_object_fields_sorted_alphabetically() {\n        let sdl = schema_sdl(indoc! {r#\"\n            type Foo {\n              zebra: String\n              apple: Int\n              mango: Boolean\n            }\n        \"#});\n        // Fields should be sorted alphabetically","sourceCodeStart":925,"sourceCodeEnd":961,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/schema-set/src/build_schema_document.rs#L925-L961","documentation":"Panic from `.expect(\"interface B not found\")` in `test_extensions_print_after_definitions` (compiler/crates/schema-set/src/build_schema_document.rs:943). The test builds a SchemaSet containing `extend type A implements B` plus `interface B`, prints it with `set.to_sdl_definition()`, then searches the printed SDL for the substring `interface B`. The panic means the printed SDL contains no `interface B` definition at all — the printer dropped the interface, printed it under a different name/keyword, or the schema build failed to retain it.","triggerScenarios":"Calling `SchemaSet::from_schema_documents_with_extensions` with a document containing an `interface B` definition, then calling `to_sdl_definition()` and finding that the interface definition is absent from the output string (e.g. interfaces are only emitted when implemented-and-registered, or the printer skips unextended interfaces).","commonSituations":"A change in the SDL printer's emission order or filtering rules that drops interface definitions; building the set only from extension documents without registering base definitions; the interface renamed in the test input while the assertion still searches for the old string.","solutions":["Print/debug the SDL string on failure (the adjacent assert already embeds `{}` — temporarily print `sdl` before `.find`) and check how `interface B` is actually rendered (maybe `interface B implements` or different spacing).","Verify the document passed to `from_schema_documents_with_extensions` still declares `interface B` and that the set build `.unwrap()` succeeded.","Inspect `to_sdl_definition`'s printer to confirm interfaces are emitted as base definitions before extensions; fix the printer if it drops or reorders them.","If rendering changed legitimately (e.g. keyword/spacing), update the test's search string accordingly."],"exampleFix":"// before\nlet interface_pos = sdl.find(\"interface B\").expect(\"interface B not found\");\n// after\nlet interface_pos = sdl\n    .find(\"interface B\")\n    .unwrap_or_else(|| panic!(\"interface B not found in SDL:\\n{}\", sdl));","handlingStrategy":"validation","validationCode":"// Validate the set retains the interface before printing:\nlet sdl = format!(\"{}\", set.to_sdl_definition());\nassert!(sdl.contains(\"interface B\"), \"SDL missing interface B:\\n{}\", sdl);","typeGuard":"fn prints_interface(sdl: &str, name: &str) -> bool {\n    sdl.contains(&format!(\"interface {}\", name))\n}","tryCatchPattern":"// Prefer explicit failure with context over a bare expect:\nlet interface_pos = match sdl.find(\"interface B\") {\n    Some(p) => p,\n    None => panic!(\"interface B not found in printed SDL:\\n{}\", sdl),\n};","preventionTips":["Always include the printed SDL in the panic/assert message when testing printed output.","Verify schema-set construction succeeded (check the `.unwrap()` before printing) before blaming the printer.","When changing printer emission rules, run the full schema-set test suite — ordering/printing tests are string-sensitive.","Keep search substrings minimal but stable (avoid depending on incidental whitespace)."],"tags":["rust","panic","sdl-printer","graphql-schema"],"backgroundTag":"expect-panic-not-found","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}