Skip to content

fix(server): use --relative in wiki diff so subdir vaults report unsynced entries correctly#75

Merged
sourcehawk merged 1 commit into
mainfrom
fix/wiki-unsynced-subdir-path
Jun 17, 2026
Merged

fix(server): use --relative in wiki diff so subdir vaults report unsynced entries correctly#75
sourcehawk merged 1 commit into
mainfrom
fix/wiki-unsynced-subdir-path

Conversation

@sourcehawk

Copy link
Copy Markdown
Owner

Description

When wiki_path in a profile points to a subdirectory of the clone root (e.g. "wikis/"), git diff --name-only origin/HEAD HEAD returns paths relative to the repo root (wikis/entries/foo.md) while all callers look up vault-relative keys (entries/foo.md). The key never matched, so every entry in a subdir vault appeared synced — disabling the push button even for entries that were locally committed but never pushed.

Fix: add --relative to both git diff calls in unsyncedWikiFiles. With --relative, git outputs paths relative to the working directory (vaultPath), so the keys match what callers expect regardless of whether vaultPath is the repo root or a subdirectory.

Changes

  • unsyncedWikiFiles: add --relative to both git diff calls (the origin/HEAD primary and the origin/main fallback).
  • Add TestUnsyncedWikiFiles_SubdirVaultPath: sets up a repo with a wikis/ subdir vault, commits a local entry, and asserts the vault-relative key (entries/inv-test.md) appears in the unsynced set while the repo-root-relative key (wikis/entries/inv-test.md) does not.

Challenges

The failure was silent by design — unsyncedWikiFiles returns an empty map on any git error and the comment explicitly calls this "preferable to a false alarm." The subdir mismatch wasn't an error though; git succeeded and returned paths, they just didn't match the lookup keys. No log, no badge — the push button was simply disabled with "no locally-committed-but-unpushed files to push."

Testing

Confirmed against the camunda profile vault (~/.config/triagent/camunda/wiki/), which has wiki_path: wikis via its base profile. Before the fix: git diff --name-only origin/HEAD HEAD from wiki/wikis/ returned wikis/entries/inv-gateway-gcs-permission-misdiagnosis.md; the lookup for entries/inv-gateway-gcs-permission-misdiagnosis.md missed. After: --relative strips the prefix, key matches, entry shows as unsynced and the push button becomes active. New regression test covers the subdir case end-to-end. Full server test suite passes with -race.

…nced entries correctly

When wiki_path points to a subdirectory of the clone root (e.g. "wikis/"),
git diff returns paths relative to the repo root ("wikis/entries/foo.md")
while callers look up vault-relative keys ("entries/foo.md"). The mismatch
caused every entry in a subdir vault to appear synced, disabling the push
button even for locally-committed-but-unpushed entries.

Add --relative to both git diff calls in unsyncedWikiFiles so paths are
always relative to vaultPath regardless of where .git lives. Add a
regression test that sets up a subdir vault, commits a local entry, and
asserts the vault-relative key appears in the unsynced set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 16, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@sourcehawk sourcehawk merged commit 2791e06 into main Jun 17, 2026
5 checks passed
@sourcehawk sourcehawk deleted the fix/wiki-unsynced-subdir-path branch June 17, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants