feat(FN-5351): add merge audit telemetry with typed events and integration

FN-5351 adds structured telemetry for merge audit events and integration worktree state, including typed ref-advance tracking, terminal handoff fallback audit, and integration state probes with corresponding reliability backstop tests and documentation updates.

Fusion-Task-Id: FN-5351
This commit is contained in:
Fusion (runfusion.ai)
2026-05-21 14:34:12 -07:00
committed by gsxdsm
parent caeb6a7e00
commit 5a76a89071
13 changed files with 541 additions and 69 deletions

View File

@@ -166,8 +166,58 @@ export type GitMutationType =
| "merge:reuse-fallback-reused-existing-registration"
| "merge:reuse-worktree-fresh-acquire"
| "merge:reuse-worktree-fresh-acquired"
| "merge:reuse-integration-branch-advanced"
| "merge:reuse-integration-branch-advance-failed"
/**
* Metadata shape:
* ```ts
* {
* taskId: string;
* integrationBranch: string;
* integrationMode: "reuse-task-worktree" | "cwd-integration";
* integrationRootDir: string;
* taskWorktreePath: string | null;
* userCheckout: {
* worktreePath: string;
* dirty: boolean;
* untrackedCount: number;
* dirtyPathSample: string[];
* } | null;
* dirtyFingerprint: string | null;
* }
* ```
*/
| "merge:integration-worktree-state"
/**
* Metadata shape:
* ```ts
* {
* taskId: string;
* integrationBranch: string;
* refusedGate: string;
* refusedReason: string;
* requestedMode: "reuse-task-worktree" | "cwd-integration";
* taskWorktreePath: string | null;
* parkOutcome: "in-review-failed";
* }
* ```
*/
| "merge:cwd-integration-fallback-refused"
/**
* Metadata shape:
* ```ts
* {
* taskId: string;
* integrationBranch: string;
* refName: string;
* fromSha: string | null;
* toSha: string;
* advanceMode: "fast-forward" | "non-fast-forward" | "update-ref";
* aiResolved?: boolean;
* succeeded: boolean;
* error?: string;
* }
* ```
*/
| "merge:integration-ref-advance"
| "merge:audit-failure"
| "branch:auto-reclaim"
| "branch:auto-canonicalize-case"