Skip to content

Import fetch jobs#543

Merged
irees merged 9 commits intomainfrom
import-fetch-jobs
Jan 6, 2026
Merged

Import fetch jobs#543
irees merged 9 commits intomainfrom
import-fetch-jobs

Conversation

@irees
Copy link
Copy Markdown
Contributor

@irees irees commented Dec 28, 2025

Introduces a job-based architecture for fetch and import commands, enabling programmatic specification of operations with per-job URLs. Also improves logging with structured fields.

Changes

New Job Types

  • FetchJob{FeedID, FeedURL} - Allows each fetch to specify its own URL
  • ImportJob{FeedVersionID} - Explicit import job specification
  • Replaces FeedIDs []string with FetchJobs []FetchJob and ImportJobs []ImportJob

New CLI Flag

  • --jobs-file for fetch command: reads tab-separated feed_id<tab>url lines

Structured Logging

  • Workers now use structured log fields (feed_onestop_id, feed_id, url, duration, etc.)
  • Context propagated to child operations via log.WithLogger(ctx, jobLog)

Removed

  • --date and --fetched-since flags from import command
  • MainImportFeedVersion() wrapper function (callers use ImportFeedVersion directly)

Refactored

  • Validation for --feed-url moved to Parse() for earlier error detection
  • Import query logic separated into: resolve SHA1s → build jobs → apply filters
  • Flags reorganized alphabetically by category

Tests

  • Added TestFetchCommand_FetchJobs covering multiple jobs and CreateFeed scenarios
  • Updated E2E test to use new FetchJobs API

Breaking Changes

  • FetchCommand.FeedIDsFetchCommand.FetchJobs
  • Removed --date, --fetched-since import flags
  • Removed importer.MainImportFeedVersion()

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 28, 2025

Generated Code Check ✅

All generated code is up to date.

@irees irees marked this pull request as ready for review January 5, 2026 23:37
Copilot AI review requested due to automatic review settings January 5, 2026 23:37
Copy link
Copy Markdown
Contributor

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

This PR introduces a job-based architecture for fetch and import commands, enabling programmatic specification of operations with per-job configuration. The changes improve code flexibility by replacing simple feed ID lists with structured job types, and enhance observability through structured logging with contextual fields.

Key Changes:

  • Introduced FetchJob and ImportJob types to enable per-operation URL/feed version specification
  • Added --jobs-file flag for fetch command to support tab-separated job definitions
  • Migrated to structured logging with contextual fields (feed_id, url, duration, etc.) and context propagation
  • Removed deprecated --date and --fetched-since flags from import command and MainImportFeedVersion() wrapper function

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
cmds/fetch_cmd.go Implements FetchJob type with per-job URL support, adds --jobs-file flag parsing, moves --feed-url validation to Parse(), and adds structured logging with job context
cmds/import_cmd.go Implements ImportJob type, refactors query logic into separate phases (resolve SHA1s → build jobs → filter/validate), removes --date and --fetched-since flags, and adds structured logging
cmds/fetch_cmd_test.go Adds tests for FetchJobs API covering multiple jobs and CreateFeed scenarios
cmds/e2e_test.go Updates E2E test to use new FetchJobs API instead of FeedIDs
doc/cli/transitland_fetch.md Documents new --jobs-file flag
doc/cli/transitland_import.md Removes documentation for deprecated --date and --fetched-since flags
importer/importer.go Removes MainImportFeedVersion() wrapper function
server/finders/actions/fv.go Updates function call from MainImportFeedVersion to ImportFeedVersion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@irees irees merged commit 5efff7c into main Jan 6, 2026
6 checks passed
@irees irees deleted the import-fetch-jobs branch January 6, 2026 01:17
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.

2 participants