You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5128910
Browse filesBrowse the repository at this point in the historyBrowse files
fix(metadata-protocol): a migrate-stored pass records the user who ran it, or nobody
PutOptions.actor is the acting user's id or null, never a label. The
migrate-stored pass and its three doors passed a label instead, and it
landed in sys_metadata_history.recorded_by and the rewritten row's
updated_by, both lookup('sys_user') columns.
- protocol: migrateStoredMetadata forwards request.actor only when one
is given; with none, saveMetaItem records null. The pass's name stays
on source: 'migrate-stored'.
- rest: POST /_migrate-stored takes the actor from resolveMetaWriteActor,
the producer every /meta write door shares (user id or nothing).
- runtime: POST /metadata/_migrate-stored passes the caller's user id or
nothing.
- cli: os migrate meta --stored passes no actor; it has no user.
- metadata-core: MetadataItemSchema.authoredBy's describe states the
same rule as PutOptions.actor.
Claude-Session: https://claude.ai/code/session_01ADzJtzYTLUfgrRZHxkagkX
Co-authored-by: Claude <noreply@anthropic.com>
fix(metadata-protocol): a stored-metadata migration records the user who ran it, or nobody, never a label
10
+
11
+
Clause-②: no
12
+
13
+
-**What was wrong.** The stored-metadata migration pass (`os migrate meta --stored`, `POST /api/v1/meta/_migrate-stored`, the runtime dispatcher's `POST /metadata/_migrate-stored`, and `migrateStoredMetadata()` called in process) recorded a label as the writer of every row it rewrote: `'os migrate meta --stored'`, `'<user id> (POST /api/v1/meta/_migrate-stored)'`, `'POST /api/v1/meta/_migrate-stored'`, or `'migrate-stored'`. The writer lands in `sys_metadata_history.recorded_by` and in the row's `updated_by`. Both columns are references to `sys_user`, so the label pointed at no user. Nothing refused it, because metadata writes run as the system.
14
+
-**What it does now.** The pass records the id of the user who ran it, exactly as every other metadata write does. A REST or runtime call by a signed-in user with `manage_metadata` records that user's id. A run with no user records `null`, which means "system-initiated". That covers the CLI, which opens the database directly with no session, and a system caller. The pass still names itself on each history row's `source` (`migrate-stored`), as it did before.
15
+
-**What an operator sees.** History rows and rewritten rows written by a migration from this release on name the person who ran it, or nobody. They never name a command or a route. Rows a migration rewrote before this release keep the label they were given.
16
+
-**Contract text.**`MetadataItem.authoredBy`'s description now gives the same rule as `PutOptions.actor`: the acting user's id, or `null` for a system-initiated write, never a label such as `"system"` or `"cli"`. The schema accepts the same values as before.
parentHash: z.string().nullable().describe('Hash this version was derived from; null for first version'),
102
-
authoredBy: z.string().nullable().describe('Identity of the writer (user id, "cli", "ai:claude", …); null = system-initiated, no actor'),
102
+
authoredBy: z.string().nullable().describe('Identity of the writer: the acting user id, as PutOptions.actor records it; null = system-initiated, no actor — never a label such as "system" or "cli"'),
0 commit comments