Skip to content

feat(api): 🦺 improve NewHiveLayout and empty dataset semantics #41

Merged
justapithecus merged 7 commits into
mainfrom
andrew/feat/api/more-pre-release-hardening
Feb 3, 2026
Merged

feat(api): 🦺 improve NewHiveLayout and empty dataset semantics #41
justapithecus merged 7 commits into
mainfrom
andrew/feat/api/more-pre-release-hardening

Conversation

@justapithecus

Copy link
Copy Markdown
Member

No description provided.

- Change NewHiveLayout to return (layout, error) instead of panic
- Fix FS store List to return empty list for non-existent prefix
- Add comprehensive tests for empty dataset behavior
- Update examples and docs for new error handling

Changes support contract compliance for empty dataset/storage semantics
per CONTRACT_ERRORS.md. Public constructors now validate early and return
errors rather than deferring to runtime panics.
The example assumes the S3 bucket exists. Added explicit note with
example command to create it via AWS CLI.
- Add WithHiveLayout(keys...) Option that validates on apply
- Validation occurs in applyDataset/applyReader, not at construction
- Enables single-error-check fluent API pattern
- Keep NewHiveLayout(keys...) (layout, error) for advanced use
- Update examples and docs to prefer WithHiveLayout

Fluent callsites now look like:
  ds, err := lode.NewDataset("events", factory,
      lode.WithHiveLayout("day"),
      lode.WithCodec(lode.NewJSONLCodec()),
  )
NewDataset/NewReader already wrap errors with "lode:" prefix, so
the error from NewHiveLayout shouldn't include it. This avoids
"lode: lode: NewHiveLayout requires..." in error messages.
- Replace context.Background() with t.Context() in all test files
- Remove unused context imports
- Add testing conventions to AGENTS.md

t.Context() is preferred as it's automatically cancelled when the
test ends, preventing resource leaks in tests.
@justapithecus justapithecus merged commit 0a084d4 into main Feb 3, 2026
4 checks passed
@justapithecus justapithecus deleted the andrew/feat/api/more-pre-release-hardening branch February 3, 2026 05:01
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