Skip to content

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

Closed
yanmxa wants to merge 1 commit into
trace/1-persistencefrom
trace/2-schema-rename
Closed

refactor: unify record/payload naming + ContentBlock.Source field#14
yanmxa wants to merge 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 #13.

Cleanup pass on the transcript schema. No new behavior.

Naming rule: every record type follows <entity>.<verb> past tense.

  • transcript.*session.* (record type values and Go constants)
  • TranscriptIDSessionID everywhere (struct field + JSON tag), including all *Command types and ListItem / fileIndexEntry
  • SystemRecordSessionRecord (the struct holds lifecycle metadata, not system-prompt data — name now matches intent)
  • Record.SystemRecord.Session, JSON tag "system""session"

ContentBlock gains a Source string field for content provenance (populated in PR 6's predecessor). The existing image-data field, which previously used JSON tag "source", is renamed to ImageSource / "imageSource" to free up the namespace.

Projector's applyStatePatch now ignores unknown patch paths (default: continue) instead of returning an error, for forward compatibility with future patch types.

Test

  • go test ./internal/session/... passes — all rename callers updated

🤖 Generated with Claude Code

Naming convention (see docs/tracing.md): every record type follows
<entity>[.<sub-entity>].<past-tense-verb>, lowercase, dot-separated.
Payload key matches the first segment of `type`.

Renames:
  RecordStarted/Forked/Compacted   → SessionStarted/Forked/Compacted
  RecordMessageAppended            → MessageAppended
  RecordStatePatched               → StatePatched
  transcript.started/forked/.compacted (JSON value) → session.*
  SystemRecord (lifecycle payload) → SessionRecord (name now matches
    intent — that struct never held system-prompt data anyway)
  Record.System field              → Record.Session, JSON tag "system"→"session"
  Record.TranscriptID              → Record.SessionID, JSON tag
    "transcriptId"→"sessionId"
  *Command.TranscriptID            → SessionID (all five commands)
  ForkCommand.Source/NewTranscriptID → Source/NewSessionID
  ListItem.TranscriptID, fileIndexEntry.TranscriptID → SessionID

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

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.
@yanmxa
Copy link
Copy Markdown
Member Author

yanmxa commented May 15, 2026

Closing — the file-level split produced commits that don't compile standalone. Reopening as a proper hunk-aware re-split. See follow-ups.

@yanmxa yanmxa closed this May 15, 2026
@yanmxa yanmxa deleted the trace/2-schema-rename branch May 15, 2026 09:45
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