fix: float wire precision, native stack safety, refs diagnostics and fixtures

Findings from the conformance corpus workstream, all fixed at the source:

- value/wire: enable serde_json's float_roundtrip so typed wire floats keep
  their exact digits across foreign/plugin boundaries (Python pi*9 now stays
  28.274333882308138).
- host: default interpreter stack budget lowered to 128 frames so deeply
  recursive documents hit a structured resource.exhausted instead of exhausting
  the native debug-build Rust stack; --stack remains available.
- frontend/map: calling an external HTTP(S) link is reported as ref.unresolved
  (consistent with other unresolvable call targets) instead of math.unsupported.
- frontend/analyze: invalid front matter emits a single frontmatter.invalid
  diagnostic (the YAML error is not repeated by the imports pass).
- spec/mapping: clarify that would-be execution nodes outside any function body
  are inert with a markdown.inert_executable warning (no "return outside a
  function" hard-error claim).
- tests: add the conformance corpus and harness (150 AST goldens, 36 semantic
  goldens, 48 hard-error + 6 warning + 10 runtime-error negatives, CLI/module/
  plugin integration tests, prose-invariance properties) and update the
  three reported observations to the fixed behaviour.
This commit is contained in:
cflmy committed 2026-11-20 10:54:16 +08:00
1 parent 33341a0e92
commit 847c2c1580
511 files changed
+11678 -26

No files matched your search

+21 -21
View File
@@ -48,34 +48,34 @@ pub fn analyze_source(module_id: &str, source: &str) -> AnalysisResult {
// Explicit front matter imports. Nothing is inferred.
let mut imports: Vec<ImportDecl> = Vec::new();
if let Some(frontmatter) = document.frontmatter() {
if let Err(error) = &frontmatter.yaml {
diagnostics.push(
match &frontmatter.yaml {
Err(error) => diagnostics.push(
Diagnostic::error(
codes::FRONTMATTER_INVALID,
Some(frontmatter.yaml_span),
format!("invalid YAML front matter: {error}"),
)
.with_hint("front matter must be valid YAML between `---` delimiters"),
);
}
match frontmatter.imports() {
Ok(mapping) => {
for (alias, target) in mapping {
imports.push(ImportDecl {
alias,
target,
span: frontmatter.span,
});
}
}
Err(error) => diagnostics.push(
Diagnostic::error(
codes::FRONTMATTER_INVALID,
Some(frontmatter.span),
format!("invalid import declaration: {error}"),
)
.with_hint("imports are an explicit mapping: `import: { alias: \"@module\" }`"),
),
Ok(_) => match frontmatter.imports() {
Ok(mapping) => {
for (alias, target) in mapping {
imports.push(ImportDecl {
alias,
target,
span: frontmatter.span,
});
}
}
Err(error) => diagnostics.push(
Diagnostic::error(
codes::FRONTMATTER_INVALID,
Some(frontmatter.span),
format!("invalid import declaration: {error}"),
)
.with_hint("imports are an explicit mapping: `import: { alias: \"@module\" }`"),
),
},
}
}
+1 -1
View File
@@ -475,7 +475,7 @@ impl<'a> Mapper<'a> {
})
} else if url.starts_with("http://") || url.starts_with("https://") {
self.error_with_hint(
codes::MATH_UNSUPPORTED,
codes::REF_UNRESOLVED,
Some(span),
"external links cannot be called",
"link targets used as calls must resolve to a Marqdo function",