One function

check_sources in Ar9av/obsidian-wiki

The author described this change as fix(cache): resolve vault-relative manifest keys in cache-check. It counts as a record because the check below fails on the code as it stood at 50a8edfb6 and passes on 95424e4b9, with nothing else changed between the two runs.

Fix saved2026-07-14
Sharing licenceMIT · LICENSE
Change size+15 4

What the code was meant to do, written into the code itself as a docstring

Classify each source as new / modified / unchanged vs. the manifest. Also reports manifest entries whose source file no longer exists on disk.

The change

1212 result["missing"].append(key)
1313 continue
1414 current_hash = compute_hash(path)
15- entry = sources.get(key) or sources.get(os.path.abspath(key))
15+ entry = (
16+ sources.get(key)
17+ or sources.get(os.path.abspath(key))
18+ or sources.get(os.path.relpath(path, vault))
19+ )
1620 if entry is None:
1721 result["new"].append(key)
1822 elif entry.get("content_hash") != current_hash:
2024 else:
2125 result["unchanged"].append(key)
2226
23- # Report manifest keys that no longer exist on disk (not in source_paths scan)
24- checked = {str(p) for p in source_paths} | {os.path.abspath(p) for p in source_paths}
27+ # Report manifest keys that no longer exist on disk (not in source_paths scan).
28+ # Manifest keys may be stored absolute or vault-relative, so match each passed
29+ # path in all three forms and resolve relative keys against the vault root.
30+ checked: set[str] = set()
31+ for p in source_paths:
32+ checked.add(str(p))
33+ checked.add(os.path.abspath(p))
34+ checked.add(os.path.relpath(p, vault))
2535 for key in sources:
26- if key not in checked and not Path(key).exists():
36+ resolved = Path(key) if os.path.isabs(key) else (vault / key)
37+ if key not in checked and not resolved.exists():
2738 result["missing"].append(key)
2839
2940 return result

The check that tells the two apart

failpass·tests/test_cache.py::TestCheckSources::test_relative_manifest_key_unchanged_for_abs_path

Check file tests/test_cache.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it50a8edfb60fdb9d8c2673987367fa26ea75206e1
Broken version dated2026-07-12
Moduleobsidian_wiki.cache
Units changedcheck_sources
Fingerprintfdc533f920d6d010
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in Ar9av/obsidian-wiki