You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(cli): migrate car assets onto shared request execution - #517
Migrate iracing-data assets car to the schema → Commander adapter → opinionated command service → shared authenticated request/output executor established by #516. First layer of the three-PR assets stack.
Parent: #516 (codex/issue-515-docs-executor).
Next layers: #518 (series) and #519 (track). Actual branch bases are #516 → #517 → #518 → #519.
Scope
Examples or documentation
Dependencies or maintenance
Execution boundaries
Previously: Commander → per-invocation car scope → credential resolver + generated client → locally duplicated request error handling → returned HTTPS data link → locally duplicated JSON stdout → diagnostics.
Now: Commander validates local RawOptionsSchema / OptionsSchema, then invokes makeCarAssetsService. The service selects IRacingAPI.withAccessToken(token).car.getCarAssets(). The shared executor resolves credentials, maps only the generated API request through DataApiRequestError, optionally materializes the returned link outside that catch boundary, invokes the shared document writer, and reports success.
Car's scope.ts and its nested per-invocation capabilities are removed.
The shared executor gains an optional second-stage materialize callback and the existing writer accepts an Assets label. No new CLI flags; assets are always pretty JSON to stdout with a trailing newline.
The materializer is injected once through the registrar, stays HTTPS-only, does not forward Authorization, and retains existing redacted response handling and exactly-once link fetching. Series and track remain on their existing scopes in this layer.
Generated Files
None.
Package and Release Notes
None. Private CLI; no generated SDK/OAuth changes or public option changes.
Validation
The local repository was unavailable in this execution environment; verification below is from GitHub Actions, not local command execution.
pnpm --filter @iracing-data/cli test — not runnable in this execution environment (repository/dependencies unavailable locally).
pnpm verify:js — same limitation.
pnpm verify:repo — same limitation.
GitHub Actions CI run #39167954569 — passed repository verification, lint, style, CLI/unit tests, generated-client checks and Rust checks; Docker offline recovery also passed.
Changed tests: car Commander/schema/service/executor behavior, credential and generated-request failure boundaries, materializer security cases and OpenAPI parity. Existing docs, series and track tests remain in the stack.
Notes for Reviewers
Inspect src/services/request.ts first: generated Data API errors are translated, returned-link failures are not. Examine the security assertions in test/assets.test.cjs. This PR is intentionally independently reviewable against #516, before subsequent assets migrations.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The car-assets command now uses a service backed by shared request execution. It validates credentials, calls the generated car API, materializes the returned link, and publishes the asset document as JSON.
The API facade adds a lazily cached CarApi client. The request service can materialize a response before output, and output labels now include Assets.
Car service and command apps/iracing-data-cli/src/commands/assets/car/*, apps/iracing-data-cli/src/commands/assets/returned-data-api-link.ts
The car command validates credential-only options with fixed JSON output and delegates execution to CarAssetsService. The service calls getCarAssets(), materializes its returned link, and uses the shared request lifecycle. The previous car-assets scope implementation is removed.
CLI composition and validation apps/iracing-data-cli/src/commands/assets/README.md, apps/iracing-data-cli/src/commands/assets/index.ts, apps/iracing-data-cli/src/program.ts, apps/iracing-data-cli/test/assets*.test.cjs, apps/iracing-data-cli/test/series-assets.test.cjs, apps/iracing-data-cli/test/track-assets.test.cjs
createProgram composes the car service with the shared request service and link materializer. Tests cover service execution, error handling, registration, and help output.
The car-assets migration has no identified merge-blocking issue after normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly identifies the main change: migrating car assets to the shared request execution flow.
Description check
The description includes the required summary, scope, generated files, release notes, validation, and reviewer notes. It also explains unavailable local checks and provides successful CI validation.
Docstring Coverage
Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 14 files. (1 skipped: 1 …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 14 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit packed a carrot snack Then watched the car API call back A link became JSON, neat and bright The shared request service got it right The bunny hopped into the night
Comment @coderabbitai help to get the list of available commands.
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
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.
Summary
Migrate
iracing-data assets carto the schema → Commander adapter → opinionated command service → shared authenticated request/output executor established by #516. First layer of the three-PR assets stack.Parent: #516 (
codex/issue-515-docs-executor).Next layers: #518 (series) and #519 (track). Actual branch bases are #516 → #517 → #518 → #519.
Scope
Execution boundaries
RawOptionsSchema/OptionsSchema, then invokesmakeCarAssetsService. The service selectsIRacingAPI.withAccessToken(token).car.getCarAssets(). The shared executor resolves credentials, maps only the generated API request throughDataApiRequestError, optionally materializes the returned link outside that catch boundary, invokes the shared document writer, and reports success.scope.tsand its nested per-invocation capabilities are removed.materializecallback and the existing writer accepts anAssetslabel. No new CLI flags; assets are always pretty JSON to stdout with a trailing newline.Generated Files
None.
Package and Release Notes
None. Private CLI; no generated SDK/OAuth changes or public option changes.
Validation
The local repository was unavailable in this execution environment; verification below is from GitHub Actions, not local command execution.
pnpm --filter @iracing-data/cli test— not runnable in this execution environment (repository/dependencies unavailable locally).pnpm verify:js— same limitation.pnpm verify:repo— same limitation.Changed tests: car Commander/schema/service/executor behavior, credential and generated-request failure boundaries, materializer security cases and OpenAPI parity. Existing docs, series and track tests remain in the stack.
Notes for Reviewers
Inspect
src/services/request.tsfirst: generated Data API errors are translated, returned-link failures are not. Examine the security assertions intest/assets.test.cjs. This PR is intentionally independently reviewable against #516, before subsequent assets migrations.Related: #515, #516.
Summary by CodeRabbit
assets carcommand to retrieve car assets and output them as JSON.