diff --git a/src/app/actions/log-work.ts b/src/app/actions/log-work.ts index 39a6a29..008b49f 100644 --- a/src/app/actions/log-work.ts +++ b/src/app/actions/log-work.ts @@ -100,7 +100,12 @@ export async function logWorkAction(input: { sha: `manual-${randomUUID()}`, short_sha: "manual", message, - subject: message, + // subject has a 300-character limit at the schema level (it exists to + // hold a short git commit subject line). A logged entry's summary is + // always populated, so subject here is only ever a fallback that will + // in practice never be read — but it is still validated on write, so + // it must be truncated to fit rather than holding the full message. + subject: message.slice(0, 300), type: "", scope: "", author_name: "", @@ -124,7 +129,13 @@ export async function logWorkAction(input: { source: "manual", manual_minutes: Math.round(input.hours * 60), }); - } catch { + } catch (error) { + // The client only ever sees the generic message below — a validation + // constraint is not sensitive, but there is no reason to expose + // PocketBase's internals to the browser. The real reason still needs to + // be discoverable without re-deriving it by hand, so it goes to the + // server log. + console.error("[log-work] commit create failed:", error); return { ok: false, message: "Could not save that entry" }; }