FN-6714: backfill commit-association diff stats

Backfill historical commit-association diff stats so Command Center LOC can use real persisted git data.

- Add a core backfill API that inspects local git commits for associations with missing additions/deletions and supports dry-run reporting.
- Expose an authenticated Command Center productivity backfill endpoint and route it through the legacy API shim.
- Keep productivity LOC/hour sentinels safe for legacy payloads and document the backfill contract.
- Cover the backfill path, auth gate, productivity analytics, and route registration with tests.

Files changed:
 .changeset/fn-6714-command-center-loc-backfill.md  |   5 +
 docs/architecture.md                               |   4 +-
 docs/storage.md                                    |   4 +-
 ...mmit-association-diff-backfill.real-git.test.ts | 140 +++++++++++++++++++++
 packages/core/src/index.ts                         |   1 +
 packages/core/src/store.ts                         |  76 ++++++++++-
 packages/core/src/types.ts                         |   9 ++
 packages/dashboard/app/api/legacy.ts               |  16 +++
 .../command-center/areas/ProductivityArea.tsx      |   8 +-
 .../register-command-center-routes.auth.test.ts    |  48 ++++---
 .../register-command-center-routes.test.ts         |  49 +++++++-
 .../src/routes/register-command-center-routes.ts   |  20 +++
 12 files changed, 354 insertions(+), 26 deletions(-)

Fusion-Task-Id: FN-6714

Fusion-Task-Lineage: 657c7789-bbe4-4611-abca-127af05b0300
This commit is contained in:
gsxdsm
2026-06-22 03:42:24 -07:00
parent 3b4daf3e66
commit 8dd9697468
12 changed files with 354 additions and 26 deletions

View File

@@ -92,6 +92,7 @@ import type {
WorkflowSettingOption,
WorkflowSettingRender,
WorkflowSettingRejection,
CommitAssociationDiffBackfillReport,
} from "@fusion/core";
import type { PlanningQuestion, PlanningSummary } from "@fusion/core";
import type { GithubIssueAction, ScheduledTask, ScheduledTaskCreateInput, ScheduledTaskUpdateInput, AutomationRunResult, Routine, RoutineCreateInput, RoutineUpdateInput, RoutineExecutionResult } from "@fusion/core";
@@ -113,6 +114,7 @@ export type FetchOptions = DedupeOptions;
// Re-export skills types for use by hooks and components
export type { DiscoveredSkill, CatalogEntry, CatalogFetchResult, ToggleSkillResult, SkillContent, SkillFileEntry };
export type { CommitAssociationDiffBackfillReport };
export class ApiRequestError extends Error {
readonly status: number;
@@ -7673,6 +7675,20 @@ export function backfillMissionAssertions(
);
}
/** Backfill historical Command Center LOC stats for commit associations. Defaults to dry-run. */
export function backfillCommitAssociationDiffStats(
options?: { dryRun?: boolean },
projectId?: string,
): Promise<CommitAssociationDiffBackfillReport> {
return api<CommitAssociationDiffBackfillReport>(
withProjectId("/command-center/productivity/backfill-loc", projectId),
{
method: "POST",
body: JSON.stringify({ dryRun: options?.dryRun ?? true }),
},
);
}
/** Query options for paginated mission event logs. */
export interface MissionEventQueryOptions {
limit?: number;