Skip to content

refactor: unify record/payload naming + ContentBlock.Source field#20

Merged
yanmxa merged 1 commit into
trace/1-persistencefrom
trace/2-schema-rename
May 15, 2026
Merged

refactor: unify record/payload naming + ContentBlock.Source field#20
yanmxa merged 1 commit into
trace/1-persistencefrom
trace/2-schema-rename

Conversation

@yanmxa
Copy link
Copy Markdown
Member

@yanmxa yanmxa commented May 15, 2026

PR 2 of 5 — stacked on #19.

Schema cleanup. No behavior change.

  • `transcript.` record types → `session.`
  • `TranscriptID` → `SessionID` (Go field + JSON tag) across all commands and `Record`/`ListItem`/`fileIndexEntry`
  • `SystemRecord` → `SessionRecord` (struct holds lifecycle metadata, not system-prompt content)
  • `Record.System` → `Record.Session`, JSON tag `"system"` → `"session"`
  • `ContentBlock.Source string` added for provenance (populated in PR 3). Image-data field renamed to `ImageSource` / `"imageSource"` to free the namespace.
  • `applyStatePatch` ignores unknown patch paths instead of erroring (forward-compat for new patch types).

Test

  • `go build ./...` clean
  • `go test ./...` — 50 packages pass, 0 FAIL

🤖 Generated with Claude Code

Naming rule: every record type follows <entity>.<verb> past tense, lowercase,
dot-separated. Payload key matches the first segment of type.

Renames:
  transcript.started/forked/.compacted (JSON value)  → session.*
  RecordStarted/Forked/Compacted                     → SessionStarted/Forked/Compacted
  RecordMessageAppended/RecordStatePatched           → MessageAppended/StatePatched
  SystemRecord (lifecycle payload)                   → SessionRecord
    (the struct holds provider/model/parentId/boundaryId — name now matches
     intent; it never carried system-prompt data)
  Record.System field                                → Record.Session
  Record.TranscriptID + json tag                     → SessionID / "sessionId"
  *Command.TranscriptID                              → SessionID
  ForkCommand.Source/NewTranscriptID                 → Source/NewSessionID
  ListItem.TranscriptID, fileIndexEntry.TranscriptID → SessionID

ContentBlock gains a Source string field for provenance attribution
(populated in a later commit). The existing inline-image data field,
which used JSON tag "source", is renamed to ImageSource / "imageSource"
to free the namespace.

Projector's applyStatePatch now ignores unknown patch paths
(default: continue) instead of returning an error — keeps the projector
forward-compatible with patch paths added by later schema iterations.
The error-expecting test becomes IsIgnored, asserting subsequent ops
still apply.
@yanmxa yanmxa force-pushed the trace/2-schema-rename branch from 238e838 to e714a07 Compare May 15, 2026 14:29
@yanmxa yanmxa merged commit 47789e7 into trace/1-persistence May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant