fix(dashboard): close 7 review findings on extended-status hardening

Settings inheritance (high):
  - Restored the value !== initialProjectValue gate on the non-model
    project branch. Previously every effective/inherited project key was
    persisted as an explicit override on every save.

Git Manager UI lie in remote-only mode:
  - "Local <branch> vs origin" card now renders "no local tracking"
    instead of a green "Synced" badge when integrationTipSource ===
    "remote-only" (no local branch to compare).
  - New dedicated "HEAD vs origin/<branch>" card surfaces a meaningful
    distance in remote-only mode.

isIndexStale correctness:
  - Walks up to 16 reflog entries so multi-hop misses (A→B→C without
    sync) are detected; the prior check only consulted @{1}.
  - Gated on isOnIntegrationBranch === true so a feature-branch worktree
    whose HEAD happens to descend from <integration>@{1} no longer trips
    the FN-INDEX-DESYNC warning.

Enumeration-failed events surfaced:
  - collectRecentMergeAdvances pairs events with (taskId, newSha) when
    both are present, falls back to taskId-only for early-failure events
    (e.g. "enumeration-failed") that have neither path nor newSha. The
    diagnostic outcome now surfaces on the matching advance instead of
    being silently dropped.

aheadOfIntegration semantics no longer shift:
  - Split into three distinct fields: aheadOfIntegration (HEAD vs local),
    aheadOfIntegrationRemote (HEAD vs origin/<branch>),
    aheadOfOriginIntegration (local vs origin). Consumers no longer have
    to read integrationTipSource to know which comparison they got.

currentBranch failure no longer masks wrong-branch state:
  - Distinguish "command threw" (transient git error) from "command
    succeeded with empty stdout" (legitimate detached HEAD). New
    currentBranchDetectionFailed field lets the UI surface "branch
    detection unavailable" on a real failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-23 17:31:39 -07:00
parent 408e20bdc6
commit d5cfa92c23
5 changed files with 207 additions and 58 deletions

View File

@@ -2583,14 +2583,27 @@ export interface GitStatus {
integrationBranch?: string;
integrationBranchSource?: "settings" | "origin-head" | "fallback";
isOnIntegrationBranch?: boolean;
/** True when `git branch --show-current` failed (transient git error,
* permission, etc.). Distinct from detached HEAD (command succeeds with
* empty stdout). UI surfaces "branch detection unavailable" rather than
* silently hiding the wrong-branch warning. */
currentBranchDetectionFailed?: boolean;
integrationTipSha?: string | null;
/** "local" = `refs/heads/<branch>` exists; "remote-only" = only
* `refs/remotes/origin/<branch>` exists and was used as fallback;
* "missing" = neither ref exists. */
integrationTipSource?: "local" | "remote-only" | "missing";
originIntegrationTipSha?: string | null;
/** HEAD vs the **local** integration tip. Undefined when the branch
* exists only as a remote-tracking ref. */
aheadOfIntegration?: number;
behindIntegration?: number;
/** HEAD vs `origin/<integrationBranch>`. Defined whenever the remote
* tracking ref exists, regardless of whether the local ref does. */
aheadOfIntegrationRemote?: number;
behindIntegrationRemote?: number;
/** Local integration tip vs `origin/<integrationBranch>`. Defined only
* when both refs exist. */
aheadOfOriginIntegration?: number;
behindOriginIntegration?: number;
dirtyDetails?: {