feat(sessions): switch writes to GraphQL upsertEntity mutation #53

Merged
rock merged 1 commits from harness/52-sessions-gql-mutations into main 2026-09-28 02:24:12 +00:00
Owner

Closes #52

Summary

Migrates all session/milestone writes from REST /memory/ingest to GraphQL upsertEntity mutation — direct, typed, no LLM extraction lag.

Changes

  • Removed: memoryURL field, defaultMemoryURL const, ingest() REST helper, "io" import
  • Added: upsertEntity() GraphQL mutation helper
  • Added: fetchEntitySummary() helper — reads current entity before patch for read-modify-write
  • handlePatch: now fetches current summary, merges patch fields, re-upserts full blob — no data loss on partial updates
  • handleCreate / handleCreateMilestone: json.Marshal error now returns 500 instead of silently ignoring
  • 29 tests pass, 85.4% coverage

Mutation used

mutation {
  upsertEntity(input: {
    project: "session-<uuid>"
    name: "<sessionID | milestoneID>"
    entityType: SESSION | MILESTONE
    summary: "{...json blob...}"
  }) { id created }
}

Single upstream

All reads and writes now go through graphqlURL (poimen-graphql:8090). MEMORY_UPSTREAM_URL env var no longer read by this adapter.

Closes #52 ## Summary Migrates all session/milestone writes from REST `/memory/ingest` to GraphQL `upsertEntity` mutation — direct, typed, no LLM extraction lag. ## Changes - **Removed**: `memoryURL` field, `defaultMemoryURL` const, `ingest()` REST helper, `"io"` import - **Added**: `upsertEntity()` GraphQL mutation helper - **Added**: `fetchEntitySummary()` helper — reads current entity before patch for read-modify-write - **handlePatch**: now fetches current summary, merges patch fields, re-upserts full blob — no data loss on partial updates - **handleCreate / handleCreateMilestone**: `json.Marshal` error now returns 500 instead of silently ignoring - 29 tests pass, 85.4% coverage ## Mutation used ```graphql mutation { upsertEntity(input: { project: "session-<uuid>" name: "<sessionID | milestoneID>" entityType: SESSION | MILESTONE summary: "{...json blob...}" }) { id created } } ``` ## Single upstream All reads and writes now go through `graphqlURL` (poimen-graphql:8090). `MEMORY_UPSTREAM_URL` env var no longer read by this adapter.
rock added 1 commit 2026-09-28 02:18:31 +00:00
Remove REST /memory/ingest dependency. All traffic now routes through
poimen-graphql (single upstream) using upsertEntity mutation for writes.

Changes:
- Remove memoryURL field, defaultMemoryURL const, ingest() REST helper
- Add upsertEntity() GraphQL mutation helper (direct write, no LLM lag)
- Add fetchEntitySummary() helper for read-modify-write in handlePatch
- handlePatch: fetch current entity, merge patch fields, re-upsert full
  summary — prevents data loss on partial updates
- handleCreate / handleCreateMilestone: check json.Marshal errors (500)
- 29 tests pass, 85.4% coverage

Mutation shape:
  mutation { upsertEntity(input:{project,name,entityType,summary}){id created} }

Closes #52
rock merged commit 50bcd19634 into main 2026-09-28 02:24:12 +00:00
rock deleted branch harness/52-sessions-gql-mutations 2026-09-28 02:24:13 +00:00
Sign in to join this conversation.