feat(phase-36): automatic Tempo time tracking via workflow buttons + fix campaign test management

- Add red_started_at/blue_started_at timing fields to Test model with Alembic migration

- Modify workflow transitions to auto-create integrity-hashed worklogs: Start Execution records red_started_at, Submit to Blue Team stops Red timer and creates worklog then starts Blue timer, Submit for Review stops Blue timer and creates worklog

- Auto-sync worklogs to Tempo when test has a Jira link

- Add LiveTimer component showing real-time elapsed counter during active phases

- Clear timing fields on test reopen

- Fix campaign test management: replace broken navigate-to-tests flow with AddTestToCampaignModal that lets users search and add existing tests directly from the campaign detail page
This commit is contained in:
2026-02-17 16:59:19 +01:00
parent 005a09b42f
commit febf460580
10 changed files with 461 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ import {
ShieldCheck,
} from "lucide-react";
import type { Test, TestState, User } from "../../types/models";
import LiveTimer from "./LiveTimer";
// ── Progress steps ─────────────────────────────────────────────────
@@ -235,6 +236,30 @@ export default function TestDetailHeader({
);
};
// ── Live timer ───────────────────────────────────────────────────
const renderLiveTimer = () => {
if (test.state === "red_executing" && test.red_started_at) {
return (
<LiveTimer
startedAt={test.red_started_at}
label="Red Team Timer"
variant="red"
/>
);
}
if (test.state === "blue_evaluating" && test.blue_started_at) {
return (
<LiveTimer
startedAt={test.blue_started_at}
label="Blue Team Timer"
variant="blue"
/>
);
}
return null;
};
// ── Render ───────────────────────────────────────────────────────
return (
@@ -263,7 +288,10 @@ export default function TestDetailHeader({
</div>
</div>
{renderActions()}
<div className="flex flex-col items-end gap-2">
{renderLiveTimer()}
{renderActions()}
</div>
</div>
{/* Progress bar */}