Merged
Conversation
…e fields
- add alt_name, descriptors, lineage columns
- add thiols (low/medium/high)
- add agronomic: yield_min/max, maturity, wilt_disease, downy_mildew, powdery_mildew, aphid
- rename aroma_miscellaneous -> aroma_misc
- change substitutes from flat array to {brewhouse, dryhopping} JSON object
- update Hop model fillable, casts and docblock accordingly
- MapHopData: extract alt_name, descriptors, lineage, thiols, all agronomic fields
- MapHopData: store substitutes as {brewhouse, dryhopping} nested structure
- UpsertHop: add validation rules for all new fields (thiols: in:low,medium,high)
- UpsertHop: buildAttributes stores substitutes with brewhouse/dryhopping keys preserved
- ImportHopVarietyJobTest: assert aroma_misc (renamed from aroma_miscellaneous)
- ImportHopVarietyJobTest: assert substitutes as nested brewhouse/dryhopping structure
- HopFactory: add all missing fields (alt_name, descriptors, lineage, thiols, agronomic)
- HopFactory: fix substitutes to use correct nested {brewhouse, dryhopping} format
- HopFactory: use countryCode() instead of country() for realistic 2-letter codes
Storage::fake() creates real files in this directory during tests and does not clean them up automatically after each run.
There was a problem hiding this comment.
Pull request overview
This pull request implements the hop dataset import functionality requested in issue #6. It adds an Artisan command hops:import that loads hop variety data from JSON/JSON5 files stored in the local disk, processes them asynchronously via queued jobs, and stores them in the database with proper validation. The implementation includes comprehensive test coverage for both success and error scenarios.
Changes:
- Added
hops:importArtisan command to scan and dispatch import jobs for JSON/JSON5 files - Implemented queued job to parse, validate, and upsert individual hop varieties
- Created actions for data mapping (JSON structure to internal format) and database upsertion
- Extended database schema and model to support additional hop attributes (lineage, thiols, agronomic data, disease resistance)
- Renamed
Rangevalue object toRangeOrNumberfor clarity - Added JSON5 parser helper to support unquoted keys in data files
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| app/Console/Commands/HopsImportCommand.php | New command to scan storage directory and dispatch import jobs |
| app/Jobs/ImportHopVarietyJob.php | Queued job to process individual hop variety files with error logging |
| app/Actions/MapHopData.php | Maps JSON structure to internal data format |
| app/Actions/UpsertHop.php | Validates and upserts hop data with comprehensive validation rules |
| app/Helpers/Json5Parser.php | Simple JSON5 parser to handle unquoted keys |
| app/Models/Hop.php | Extended model with new fields and proper PHPDoc annotations |
| app/ValueObjects/RangeOrNumber.php | Renamed from Range for better semantic clarity |
| database/migrations/2026_02_18_224936_create_hops_table.php | Added new columns for hop attributes and renamed aroma_miscellaneous to aroma_misc |
| database/factories/HopFactory.php | Updated factory to generate data for new fields |
| tests/Helpers/HopFixture.php | Test fixtures providing sample JSON5 hop data |
| tests/Feature/Jobs/ImportHopVarietyJobTest.php | Comprehensive job tests including error scenarios |
| tests/Feature/Console/Commands/HopsImportCommandTest.php | Command tests verifying job dispatch and file filtering |
| tests/Feature/RangeOrNumberTest.php | Updated tests for renamed class |
| .gitignore | Added pattern to ignore test disk storage |
| storage/framework/testing/.gitignore | Removed (replaced by root gitignore entry) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kamilpiech97
reviewed
Mar 3, 2026
kamilpiech97
reviewed
Mar 3, 2026
kamilpiech97
reviewed
Mar 5, 2026
kamilpiech97
reviewed
Mar 9, 2026
kamilpiech97
approved these changes
Mar 9, 2026
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.
This should close #6