Skip to content

fix(config): silently infer tracker_remote from git remotes (GH#611)#613

Merged
dollspace-gay merged 1 commit into
developfrom
fix/611-infer-tracker-remote
May 18, 2026
Merged

fix(config): silently infer tracker_remote from git remotes (GH#611)#613
dollspace-gay merged 1 commit into
developfrom
fix/611-infer-tracker-remote

Conversation

@dollspace-gay
Copy link
Copy Markdown

Summary

  • Closes GH#611 — WARN no tracker_remote configured in .../hook-config.json, defaulting to "origin" was firing on every process invocation in any project that hadn't explicitly set tracker_remote.
  • Replaces the WARN-and-default with silent inference from git remote. Common case (single origin remote, no config) now resolves silently with zero output.
  • Keeps explicit hook-config.json values winning unconditionally, and keeps the "(text)" corruption sentinel (#739) — but now falls through to inference instead of blindly returning "origin".

Why this matters beyond the noise

Per #611 the WARN piles up across kickoff agents, hooks, and interactive use, and apparently triggers a downstream auto-mutation in some environments that has been observed to corrupt other keys in hook-config.json. Removing the WARN removes the trigger without changing the semantics for already-correct configs.

Resolution order (new behavior)

  1. Explicit tracker_remote in hook-config.json → use verbatim (unchanged).
  2. "(text)" placeholder (GH#739) → one-shot WARN, fall through to inference (was: return "origin").
  3. Inference from git remote:
    • exactly one remote → use it
    • multiple including "origin" → prefer "origin"
    • multiple without "origin" → first alphabetical (deterministic across machines)
    • zero remotes → one-shot WARN + "origin" (the one case where a real diagnostic is warranted, since sync won't work)

Changes

  • sync/mod.rs — new infer_tracker_remote + list_git_remotes helpers; read_tracker_remote reroutes through them. Module gains a std::process::Command import (was pure config read, now invokes git remote on the missing-field path). Doc-block on read_tracker_remote rewritten to describe the new resolution order.
  • sync/tests.rs — 5 new tests covering single-origin (silent), single non-origin, multi-with-origin, multi-without-origin (alphabetical), and explicit-config-wins. The 4 pre-existing tests are unchanged and still pass.

Test plan

  • 5 new unit tests added covering all inference branches.
  • All 4 pre-existing read_tracker_remote tests still pass.
  • cargo test --lib — 1904 passed, 0 failed.
  • cargo clippy -- -D warnings -W clippy::unwrap_used -W clippy::expect_used clean.
  • cargo fmt --check clean.
  • Manual smoke test: ./target/debug/crosslink session status against this repo no longer emits the WARN (this repo has no tracker_remote set but has an origin remote).

🤖 Generated with Claude Code

`read_tracker_remote` used to emit a one-shot WARN on every process
invocation when `hook-config.json` lacked `tracker_remote`, then
default to "origin":

    WARN no tracker_remote configured in /.../hook-config.json,
         defaulting to "origin"

Per #611 the WARN is noise for the >99% of projects whose remote is
just "origin", piles up across kickoff agents / hook runs / interactive
shells, and apparently triggers a downstream auto-mutation in some
environments that has been seen to corrupt other keys in the same
file. The cleanest fix is to make the WARN unnecessary.

This change replaces the WARN-and-default with silent inference from
git remotes:

  - single remote (any name) → use it
  - multiple remotes including "origin" → use "origin"
  - multiple remotes without "origin" → first alphabetical (deterministic)
  - zero remotes → keep a single WARN (this is the one case where a
    real diagnostic is warranted, since sync won't work without a remote)

Explicit `hook-config.json` values still win unconditionally. The
GH#739 `"(text)"` corruption sentinel still emits its own one-shot
WARN, but now falls through to inference rather than blindly using
"origin".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dollspace-gay dollspace-gay self-assigned this May 18, 2026
@dollspace-gay dollspace-gay added the bug Something isn't working label May 18, 2026
@dollspace-gay dollspace-gay merged commit 7d1b357 into develop May 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

config: auto-infer tracker_remote from git remotes, drop the 'no tracker_remote configured' WARN noise

1 participant