feat(api): 🦺 improve NewHiveLayout and empty dataset semantics #41
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.