config: require schema assertion on main

This commit is contained in:
2026-08-15 00:21:46 +09:00
parent 99b08e0f0c
commit c5c89795e1
6 changed files with 207 additions and 48 deletions
+21 -2
View File
@@ -584,7 +584,7 @@ impl WorkspaceConfigSchemaBundle {
}
}
let source = if contributions.is_empty() {
"{}".to_string()
"{ ...Unknown }".to_string()
} else {
contributions
.iter()
@@ -1012,7 +1012,10 @@ impl SnapshotEnvironment {
&error.to_string(),
)]);
}
let service = LanguageService::new(self);
let analysis_environment = self
.clone()
.with_schema_bundle(contract.schema_bundle.clone());
let service = LanguageService::new(&analysis_environment);
let diagnostics = self
.snapshot
.entries
@@ -1847,6 +1850,22 @@ mod tests {
assert_eq!(left.digest, right.digest);
}
#[test]
fn entrypoint_can_assert_empty_workspace_schema_global() {
let snapshot = ConfigTreeSnapshot::from_entries(
1,
[entry(
"main.dcdl",
"{ answer = 42; } as WorkspaceConfigSchema",
)],
)
.unwrap();
let contract = ToolchainContract::new(1, vec![path("main.dcdl")], 1);
SnapshotEnvironment::new(snapshot)
.evaluate_contract(&contract)
.unwrap();
}
#[test]
fn schema_completion_tracks_only_asserted_config_object_paths() {
assert_eq!(config_field_completion_context("{ pro", 5), None);