cccc icon indicating copy to clipboard operation
cccc copied to clipboard

actor_list / group_show omit `generation` for actors registered before generations existed

Open chriscoveries opened this issue 3 weeks ago • 2 comments

Actor.generation is serialized with skip_serializing_if = "String::is_empty" (crates/cccc-contracts/src/actor.rs around line 270 at v0.4.50 and current main). Actors registered before generations were introduced keep an empty field, so actor_list and group_show return no generation for them.

Inside the daemon those actors still have a stable identity: cccc_core::actors::generation_identity() returns legacy:<created_at>, and runtime switches, delivery workers, workspace bindings and local sessions all compare against that value. A client cannot see it, so it cannot tell "same registration" from "recreated" for those rows, and has to fall back to weaker checks.

Observed on a live v0.4.46 group: 13 of 14 stored actors carry a UUID generation; the one registered in September has an empty one, so it serializes without the field.

Ask (either is enough)

  1. Read surfaces (actor_list, group_show, and any other actor projection) emit generation_identity(actor), i.e. legacy:<created_at> when the stored field is empty. No storage change.
  2. Or backfill: on load, give an actor with an empty generation the value legacy:<created_at> and persist it, so stored and computed identity agree.

Option 1 is the smaller change and keeps every existing comparison byte-identical (they already use generation_identity).

Test

A round-trip test: an actor with an empty generation and a fixed created_at serializes to "generation": "legacy:<created_at>" in actor_list, and a recreated actor with the same id gets a different value.

How this was checked

Observed on a live group running v0.4.46; the serialization and generation_identity() were re-read in source at v0.4.50 and main (2736b359). Proposal only; a PR follows whichever option you prefer, tested by the project's CI on GitHub-hosted runners.

chriscoveries avatar Nov 08 '26 15:11 chriscoveries

Thanks for tracing this; you're right that rows for Actors registered before generations existed carry no generation. Their identity is defined in the daemon IPC standard (https://github.com/ChesterRa/cccc/blob/main/docs/standards/CCCC_DAEMON_IPC_V1.md, the rule for Actor records): a record without generation uses legacy:<created_at> until the Actor is recreated, and runtime switches already take that value as expected_actor_generation. actor_list and group_show return created_at in the same row, so a client can compute the identity the daemon compares: identity = generation if it is non-empty, else "legacy:" + created_at

A recreated Actor gets a fresh UUID, so it never matches its predecessor. We'd rather not put a non-UUID value into generation, which the standard describes as an opaque UUID, or rewrite stored records, so we'll leave the projections as they are.

ChesterRa avatar Nov 09 '26 02:11 ChesterRa

Closing: the documented identity for records without a generation (legacy:<created_at> until the actor is recreated) covers what we needed. Thanks for spelling it out.

chriscoveries avatar Nov 11 '26 03:11 chriscoveries