fix(session): allow clearing archived timestamp via HTTP API#27510
fix(session): allow clearing archived timestamp via HTTP API#27510kjhq wants to merge 3 commits into
Conversation
The internal session schema (UpdatedTime) supports null for the archived field, but the HTTP API UpdatePayload schema rejects it. This means you can archive a session via the API but cannot unarchive it. This aligns the HTTP API schema with the internal domain model by accepting null for the archived field in: - UpdatePayload (httpapi/groups/session.ts) - SetArchivedInput (session/session.ts) - setArchived function signature (session/session.ts) Unblocks anomalyco#16030
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, here are the potentially related PRs: Potentially Related PRs:
However, PR #27510 (the current PR) appears to be a focused fix addressing a specific API schema alignment issue (allowing |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #12393
Unblocks #16030
Type of change
What does this PR do?
The internal session schema (
UpdatedTimeatsession.ts:302) supportsnullfor thearchivedfield, but the HTTP APIUpdatePayloadschema rejects it. You can archive a session via the API but cannot unarchive it.This aligns the HTTP API schema with the internal domain model by accepting
nullforarchivedin:UpdatePayload(httpapi/groups/session.ts:51)SetArchivedInput(session/session.ts:261)setArchivedfunction signature and implementation (session/session.ts:729)The
setArchivedimplementation also coalescesundefinedtonullbecause the projector rejectsundefined(it requires explicitnullto clear a field).How did you verify your code works?
PATCHwithtime: { archived: null }clears the timestamp and returnsarchived: undefinedlistGlobaldefault resultsbun typecheckinpackages/opencode— passesbun test test/server/httpapi-session.test.ts— 13 pass, 0 failbun test test/server/global-session-list.test.ts— 4 pass, 0 failScreenshots / recordings
N/A — not a UI change.
Checklist