@teamscala/service-boot 0.23.310 → 0.23.312
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -58,6 +58,7 @@ import { getPlatformOrgId } from "@teamscala/db/registry/platform";
|
|
|
58
58
|
import * as v from "valibot";
|
|
59
59
|
import type { Prisma, WorkItem } from "./task-sync-router.ts";
|
|
60
60
|
import { authed, type Context } from "./auth-router.ts";
|
|
61
|
+
import { getAppLogger } from "@teamscala/logger/app-loggers";
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* The assignment input. `name` + `description` are REQUIRED TOGETHER at the
|
|
@@ -330,16 +331,27 @@ export const createBriefTaskHandler = authed.handler(async ({ input, context })
|
|
|
330
331
|
const ctx = context as Context;
|
|
331
332
|
const prisma = ctx.prisma as Prisma;
|
|
332
333
|
const data = input as v.InferOutput<typeof createBriefTaskInput>;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
334
|
+
try {
|
|
335
|
+
const userId = (ctx.user as { id: string }).id;
|
|
336
|
+
const task = await createTaskWithBriefComment(
|
|
337
|
+
prisma,
|
|
338
|
+
{
|
|
339
|
+
name: data.name,
|
|
340
|
+
description: data.description,
|
|
341
|
+
parent_id: data.parent_id,
|
|
342
|
+
organisation_id: resolveAssignOrg(data.organisation_id),
|
|
343
|
+
},
|
|
344
|
+
userId,
|
|
345
|
+
);
|
|
346
|
+
return { work_item_id: task.id };
|
|
347
|
+
} catch (err) {
|
|
348
|
+
// oRPC's default swallows a handler throw into a generic 500 with no stack;
|
|
349
|
+
// emit it so a mint failure is diagnosable, not a black box
|
|
350
|
+
// (a-component-may-not-report-a-state-it-has-not-verified).
|
|
351
|
+
getAppLogger().error("[task-sync] createBriefTask failed", {
|
|
352
|
+
error: err instanceof Error ? err.message : String(err),
|
|
353
|
+
stack: err instanceof Error ? err.stack : undefined,
|
|
354
|
+
});
|
|
355
|
+
throw err;
|
|
356
|
+
}
|
|
345
357
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @system service-boot
|
|
3
3
|
* @status handwritten
|
|
4
4
|
* @edit edit directly
|
|
5
|
+
* @indivisible-unit
|
|
5
6
|
*
|
|
6
7
|
* CLI-AGNOSTIC task-sync CORE — the bridge between a lane's native task list
|
|
7
8
|
* (Claude Code TodoWrite, OpenCode todowrite, future CLIs) and the `work_items`
|
|
@@ -442,6 +443,8 @@ export const taskSyncRouter = {
|
|
|
442
443
|
const pane = raw.lane?.pane ?? headerPane;
|
|
443
444
|
const headerSession = ctx.headers?.get("x-lane-session") ?? null;
|
|
444
445
|
const session = raw.lane?.session ?? headerSession;
|
|
446
|
+
// parent_id via header: bindLane has no .input() schema so ORPC does not parse the body (headers are the reliable transport, same as pane/session) — body parent_id was always undefined, which is why adoption silently never happened.
|
|
447
|
+
const headerWorkItem = ctx.headers?.get("x-lane-work-item") ?? null;
|
|
445
448
|
if (!session) {
|
|
446
449
|
const { ORPCError } = await import("@orpc/server");
|
|
447
450
|
throw new ORPCError("BAD_REQUEST", {
|
|
@@ -495,7 +498,7 @@ export const taskSyncRouter = {
|
|
|
495
498
|
// nothing. Falls through to create for an exploratory lane (no
|
|
496
499
|
// workItemId) or a project parent (kind:"project"), so existing behaviour
|
|
497
500
|
// is unchanged on those paths.
|
|
498
|
-
const adopted = await adoptAssignmentTask(prisma, raw.parent_id, {
|
|
501
|
+
const adopted = await adoptAssignmentTask(prisma, raw.parent_id ?? headerWorkItem, {
|
|
499
502
|
...lane,
|
|
500
503
|
session,
|
|
501
504
|
});
|