Merged
Conversation
Generated Code Check ✅All generated code is up to date. |
Contributor
There was a problem hiding this comment.
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
FetchJobandImportJobtypes to enable per-operation URL/feed version specification - Added
--jobs-fileflag 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
--dateand--fetched-sinceflags from import command andMainImportFeedVersion()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.
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.
Introduces a job-based architecture for
fetchandimportcommands, 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 URLImportJob{FeedVersionID}- Explicit import job specificationFeedIDs []stringwithFetchJobs []FetchJobandImportJobs []ImportJobNew CLI Flag
--jobs-filefor fetch command: reads tab-separatedfeed_id<tab>urllinesStructured Logging
feed_onestop_id,feed_id,url,duration, etc.)log.WithLogger(ctx, jobLog)Removed
--dateand--fetched-sinceflags from import commandMainImportFeedVersion()wrapper function (callers useImportFeedVersiondirectly)Refactored
--feed-urlmoved toParse()for earlier error detectionTests
TestFetchCommand_FetchJobscovering multiple jobs andCreateFeedscenariosFetchJobsAPIBreaking Changes
FetchCommand.FeedIDs→FetchCommand.FetchJobs--date,--fetched-sinceimport flagsimporter.MainImportFeedVersion()