Conversation
- Introduced options for fetching documents published before and after specified dates. - Updated acceptance tests to verify the new publication date options functionality.
There was a problem hiding this comment.
Pull request overview
Adds publication-date cutoff filtering to the relaton CLI fetch flows (top-level fetch, db fetch, and collection fetch), including input parsing/validation and documentation updates.
Changes:
- Add
--publication-date-before/--publication-date-afteroptions to fetch commands and forward them to the DB layer. - Implement shared date parsing + range validation (
YYYY,YYYY-MM,YYYY-MM-DD) and add acceptance coverage for the top-levelfetch. - Update CLI docs and add repository guidance (
CLAUDE.md) + ignore Claude working directory.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
lib/relaton/cli/command.rb |
Adds fetch options; implements shared date parsing + validation and applies it in fetch_document. |
lib/relaton/cli/subcommand_db.rb |
Adds date cutoff options to db fetch (forwarded via fetch_document). |
lib/relaton/cli/subcommand_collection.rb |
Adds date cutoff options and explicit parsing/forwarding in collection fetch. |
spec/acceptance/relaton_fetch_spec.rb |
Adds acceptance specs for date option forwarding and validation errors. |
docs/README.adoc |
Documents the new CLI flags for fetch and collection fetch. |
CLAUDE.md |
Adds repo/architecture guidance (tooling + conventions). |
.gitignore |
Ignores .claude/ directory. |
Comments suppressed due to low confidence (1)
lib/relaton/cli/subcommand_db.rb:50
- New CLI options
--publication-date-before/afterare added fordb fetch, but there’s no test coverage ensuring they are accepted, parsed intoDateobjects, validated for range, and forwarded to the DB layer. Please extendspec/relaton/cli/subcommand_db_spec.rbwith cases similar to the top-levelfetchacceptance tests.
option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)"
option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)"
def fetch(code)
io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
opts = options.merge(fetch_db: true)
io.puts(fetch_document(code, opts) || supported_type_message)
end
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | ||
| option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" |
There was a problem hiding this comment.
These option description strings are very long and likely violate the project’s RuboCop line-length rule. Please wrap/split the desc: string across multiple lines (consistent with other option declarations in this file).
| option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | |
| option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" | |
| option :"publication-date-before", | |
| desc: "Fetch only documents published before the specified date " \ | |
| "(e.g. 2008, 2008-02, or 2008-02-02)" | |
| option :"publication-date-after", | |
| desc: "Fetch only documents published after the specified date " \ | |
| "(e.g. 2002, 2002-01, or 2002-01-01)" |
| option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | ||
| option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" |
There was a problem hiding this comment.
These option description strings are very long and likely violate the project’s RuboCop line-length rule. Please wrap/split the desc: string across multiple lines (consistent with other option declarations in this file).
| option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | |
| option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" | |
| option :"publication-date-before", desc: "Fetch only documents " \ | |
| "published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | |
| option :"publication-date-after", desc: "Fetch only documents " \ | |
| "published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" |
| def fetch(code) # rubocop:disable Metrics/AbcSize | ||
| doc = Relaton.db.fetch(code, options[:year]&.to_s) | ||
| opts = {} | ||
| if options[:"publication-date-before"] | ||
| opts[:publication_date_before] = parse_date_option(options[:"publication-date-before"], "--publication-date-before") | ||
| end | ||
| if options[:"publication-date-after"] | ||
| opts[:publication_date_after] = parse_date_option(options[:"publication-date-after"], "--publication-date-after") | ||
| end | ||
| validate_date_range opts[:publication_date_after], opts[:publication_date_before] | ||
| doc = Relaton.db.fetch(code, options[:year]&.to_s, **opts) |
There was a problem hiding this comment.
New behavior: collection fetch now parses/validates --publication-date-before/after and forwards publication_date_* to Relaton.db.fetch, but the existing unit spec for collection fetch doesn’t cover these new options or the range validation error. Please add specs that assert the parsed Date values are forwarded and invalid inputs raise ArgumentError.
| option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | ||
| option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" |
There was a problem hiding this comment.
These option description strings are very long and likely violate the project’s RuboCop line-length rule (Ribose OSS guide). Please wrap/split the desc: string across multiple lines using concatenation (as done for other options in this file).
| option :"publication-date-before", desc: "Fetch only documents published before the specified date (e.g. 2008, 2008-02, or 2008-02-02)" | |
| option :"publication-date-after", desc: "Fetch only documents published after the specified date (e.g. 2002, 2002-01, or 2002-01-01)" | |
| option :"publication-date-before", | |
| desc: "Fetch only documents published before the specified date " \ | |
| "(e.g. 2008, 2008-02, or 2008-02-02)" | |
| option :"publication-date-after", | |
| desc: "Fetch only documents published after the specified date " \ | |
| "(e.g. 2002, 2002-01, or 2002-01-01)" |
No description provided.