refs: keep plain-file fragments unverified and cover missing targets

A fragment on a verified non-program file is coverage the loaded catalog does
not have; report not_loaded instead of a file success. Add explicit-refs tests
for verified plain files, symlink refusal, encoded traversal, missing
unimported programs and lock snapshot digests.
This commit is contained in:
cflmy committed 2026-11-25 11:04:52 +08:00
1 parent 93e125e921
commit 0b7f238fd8
2 files changed
+109

No files matched your search

+6
View File
@@ -528,6 +528,12 @@ pub fn resolve_link(
.module_for(&source.instance, &candidate_path)
.cloned()
else {
// A plain local file can be verified to exist, but a fragment on it is
// not a Marqdo anchor: coverage remains unverified, never `missing`.
if !candidate_path.ends_with(".mq.md") && reference.fragment.is_some() {
reference.state = ReferenceState::NotLoaded;
return reference;
}
let key = (source.instance.clone(), candidate_path.clone());
if catalog.verified_files.contains(&key) {
reference.state = ReferenceState::Resolved;