Skip to content

Feature/cut off dates issue 109#122

Open
andrew2net wants to merge 2 commits intomainfrom
feature/cut-off-dates-issue-109
Open

Feature/cut off dates issue 109#122
andrew2net wants to merge 2 commits intomainfrom
feature/cut-off-dates-issue-109

Conversation

@andrew2net
Copy link
Contributor

No description provided.

- Introduced options for fetching documents published before and after specified dates.
- Updated acceptance tests to verify the new publication date options functionality.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-after options 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-level fetch.
  • 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/after are added for db fetch, but there’s no test coverage ensuring they are accepted, parsed into Date objects, validated for range, and forwarded to the DB layer. Please extend spec/relaton/cli/subcommand_db_spec.rb with cases similar to the top-level fetch acceptance 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.

Comment on lines +105 to +106
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)"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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)"

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +44
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)"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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)"

Copilot uses AI. Check for mistakes.
Comment on lines 112 to +121
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)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +36
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)"
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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)"

Copilot uses AI. Check for mistakes.
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