Skip to content

[P3][lens] Auto-generated document ids #56

Description

@cevheri

Summary

Roadmap item (DESIGN.md section 6.1 honest deferrals: auto-generated ids are out of v1). Today every put(id, doc) requires a caller-chosen id; a put(doc)/add(doc) overload that generates one is standard document-store ergonomics.

Scope sketch

  • Generation scheme must be deliberate: ids become kernel key bytes and therefore SORT — a time-ordered scheme (ULID-like) makes all() return insertion order for free, while random UUIDs scatter. Decide and document.
  • Determinism constraint: the DST/test story needs seedable generation (inject a generator, default to crypto randomness) so tests stay reproducible.
  • Validation unchanged: generated ids must pass the same well-formedness rules as caller ids (trivially true for ASCII schemes).
  • Return the generated id from the write ({ id, changed }), extending WriteResult carefully or via a distinct return shape.

Constraints

  • Kernel unchanged; a lens-level convenience only.
  • Changeset (minor); gate green.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions