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.
ProjectAr9av/obsidian-wiki
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
| 12 | 12 | result["missing"].append(key) | |
| 13 | 13 | continue | |
| 14 | 14 | 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 | + | ) | |
| 16 | 20 | if entry is None: | |
| 17 | 21 | result["new"].append(key) | |
| 18 | 22 | elif entry.get("content_hash") != current_hash: | |
| ⋯ | |||
| 20 | 24 | else: | |
| 21 | 25 | result["unchanged"].append(key) | |
| 22 | 26 | ||
| 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)) | |
| 25 | 35 | 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(): | |
| 27 | 38 | result["missing"].append(key) | |
| 28 | 39 | ||
| 29 | 40 | return result | |
The check that tells the two apart
fail→pass·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
- 2026-07-03needs_extraction