feat(FN-2624): surface task token usage on task cards

- Render a compact token usage indicator in TaskCard footer with accessible labeling and token-aware styling
- Track token usage fields in the TaskCard memo comparator and expose a comparator test helper for regression coverage
- Add TaskCard tests for token usage rendering behavior and comparator invalidation on token usage updates
- Configure runtime plugin Vitest setups with an @fusion/engine source alias for reliable workspace test resolution
- Keep restart integration child_process spawn mocking aligned with execSync-driven merge verification behavior
This commit is contained in:
Fusion
2026-04-26 21:45:46 -07:00
committed by gsxdsm
parent 27e72190a6
commit b56571e082
7 changed files with 146 additions and 6 deletions

View File

@@ -49,8 +49,8 @@ vi.mock("../agent-session-helpers.js", async () => {
};
});
vi.mock("node:child_process", () => {
const { promisify } = require("node:util");
const { EventEmitter } = require("node:events");
const { promisify } = require("node:util");
const execSyncFn = vi.fn().mockReturnValue(Buffer.from(""));
const execFn: any = vi.fn((cmd: any, opts: any, cb: any) => {
const callback = typeof opts === "function" ? opts : cb;
@@ -78,18 +78,19 @@ vi.mock("node:child_process", () => {
}
});
});
// spawn() is used by the merger's verification runner. Route it through the
// same execSyncFn mock so a single mockedExecSync.mockImplementation controls
// both git calls (execSync) and verification commands (spawn). Throwing from
// execSyncFn ⇒ child emits non-zero close; returning normally ⇒ exit 0.
const spawnFn: any = vi.fn((cmd: any, _opts: any) => {
const spawnFn: any = vi.fn((cmd: any, opts: any) => {
const child: any = new EventEmitter();
child.pid = 1234;
child.stdout = new EventEmitter();
child.stderr = new EventEmitter();
queueMicrotask(() => {
try {
const out = execSyncFn(cmd, _opts);
const out = execSyncFn(cmd, opts);
if (out !== undefined && out !== null) {
child.stdout.emit("data", Buffer.from(out.toString()));
}
@@ -102,6 +103,7 @@ vi.mock("node:child_process", () => {
});
return child;
});
return { execSync: execSyncFn, exec: execFn, spawn: spawnFn };
});
vi.mock("node:fs", () => ({