Skip to content

Auto-generate entity IDs from the facts table row ID #3

Description

@verberktstan

Problem

Entities are currently caller-supplied (e.g. "user/alice"), which means there is no way to create a new entity without knowing its identity upfront. Upserting an empty map produces nothing — but it should be a valid operation that allocates a new entity and returns it.

Solution

Entity IDs should be auto-generated from the id column of the facts table. Upserting any map — including an empty one — inserts at least one fact row, and the resulting entity is derived from that row's ID. The new entity is returned to the caller.

Implications

  • Caller-supplied string entities like "user/alice" are no longer valid. All entities are now system-generated.
  • Existing tests that seed or assert against named entities (e.g. "user/alice", "user/1") must be updated to work with auto-generated IDs.
  • Test DB seeding logic needs to be adapted accordingly — seed calls should capture and thread through the returned entity rather than constructing one upfront.

Out of scope

Schemas or entity namespacing conventions. This project intentionally uses a free, grab-bag schema.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions