Skip to content

Import the Volvo Data Portal's files as it delivers them - #396

Merged
vcanuel merged 2 commits into
mainfrom
feat/volvo-portal-zips
Nov 14, 2026
Merged

vcanuel merged 2 commits into
mainfrom
feat/volvo-portal-zips

Conversation

@vcanuel

@vcanuel vcanuel commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

The Volvo Data Portal does not give two CSV files, as the import assumed: it gives dozens of ZIPs to download one by one, each holding a data.csv, plus metadata.json and final.zip. An owner had to unzip and merge them by hand. Now every file is chosen at once, as downloaded, and imported straight away.

Changes

  • Reading (internal/volvoportal): ReadFiles takes the portal's ZIPs, a ZIP of them all, or the CSVs; trips and waypoints are told apart by their header, never by the file's name (a trip's waypoints are not always in the ZIP whose name matches it), and merged. metadata.json, final.zip and macOS's archive leftovers are ignored. Bounded: 10,000 CSVs, 256 MiB inflated, a ZIP inside a ZIP one level deep only.
  • Import: a trip given twice, in two of the portal's chunks, is written once.
  • API: POST /vehicles/{vehicle}/imports/volvo_data_portal takes one repeated field, files, in place of trips and waypoints (at most 1,000 files, 32 MiB together). A breaking change of the form, on an import still in beta.
  • Front end: Choose the files opens the browser's picker, for many files; the files chosen are imported at once, the report or the error shown under the button. No form, no Import or Cancel left.
  • The vehicle's tab is named Import rather than Imported history, which read as something past: it is where an import starts as much as where it is listed (its own commit).
  • Docs: guide/importing.md describes what the portal really delivers.
  • Fixture: a made-up answer of the portal in internal/volvoportal/testdata/portal, zipped exactly as the portal zips (deflate, a data descriptor, no attributes), rows out of order and a trip's waypoints in a ZIP of another name.

Screenshots

The API answered by Playwright from the API's test fixtures.

Before After
before after
before after
before after
  1. The tab's name.
  2. The section, closed: the intro no longer speaks of two CSV files; a hint under the button.
  3. Before, the button opened a form of two CSV fields; after, it opens the picker, and the files chosen are imported (the report).

Tests

  • task unit passed (fmt, lint, Go tests without PostgreSQL, govulncheck, build; Vitest, ESLint, vue-tsc, the web build).
  • A real export an owner shared (6 ZIPs, kept out of the repository) imported through the new path: 14 trips, each with its track, none refused; then from the page, under tilt up.
  • Not run: task integration and task system (no store, migration or Compose change). The browser tests' locators follow the tab's new name (exact, since Import is also a button); they run in CI.

Closes #395

🤖 Generated with Claude Code

vcanuel and others added 2 commits November 14, 2026 11:40
The portal does not give two CSV files: it gives dozens of ZIPs to
download one by one, each holding a data.csv, with metadata.json and
final.zip beside them. A trip's waypoints are not always in the ZIP whose
name matches it, and rows come in no order.

The import now takes every file at once: the ZIPs, a ZIP of them all, or
the CSVs, told apart by their header and merged; what holds no data is
ignored. Bounded to 1,000 files, 32 MiB uploaded and 256 MiB inflated.
A trip given twice, in two chunks, is written once. The API's form has a
single field, files, in place of trips and waypoints.

The page's button opens the browser's picker, and the files chosen are
imported at once, the report or the error shown under it. The fixture is
a made-up answer of the portal, zipped as it zips.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Imported history" read as something past, done once: the tab is where
an import is started, as much as where its history is listed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 310f84a and c0f765b.

Files ignored due to path filters: 7

  • api/openapi.yaml is excluded by !api/openapi.yaml
  • internal/volvoportal/testdata/portal/00-0123456789abcdef0123456789abcdef-null-01_trip_2025-11-20T02_00_00Z.zip is excluded by !**/*.zip, !**/testdata/**
  • internal/volvoportal/testdata/portal/00-0123456789abcdef0123456789abcdef-null-01_waypoint_2025-11-20T02_00_00Z.zip is excluded by !**/*.zip, !**/testdata/**
  • internal/volvoportal/testdata/portal/00-fedcba9876543210fedcba9876543210-null-01_trip_2025-12-01T02_00_00Z.zip is excluded by !**/*.zip, !**/testdata/**
  • internal/volvoportal/testdata/portal/00-fedcba9876543210fedcba9876543210-null-01_waypoint_2025-12-01T02_00_00Z.zip is excluded by !**/*.zip, !**/testdata/**
  • internal/volvoportal/testdata/portal/final.zip is excluded by !**/*.zip, !**/testdata/**
  • internal/volvoportal/testdata/portal/metadata.json is excluded by !**/testdata/**
Files selected for processing: 29

  • cmd/runsten-api/main.go
  • documentation/guide/bmw.md
  • documentation/guide/importing.md
  • documentation/guide/index.md
  • documentation/guide/trips-and-charges.md
  • internal/api/fileimport.go
  • internal/api/fileimport_test.go
  • internal/importer/volvoportal.go
  • internal/importer/volvoportal_test.go
  • internal/volvoportal/files.go
  • internal/volvoportal/volvoportal.go
  • internal/volvoportal/volvoportal_test.go
  • web/e2e/imports-run.spec.ts
  • web/e2e/imports.spec.ts
  • web/e2e/settings.spec.ts
  • web/src/entities/vehicle-import/api/importApi.ts
  • web/src/features/manage-imports/composables/useImportJob.ts
  • web/src/features/manage-imports/ui/VolvoDataPortalImport.vue
  • web/src/shared/i18n/locales/de.json
  • web/src/shared/i18n/locales/en.json
  • web/src/shared/i18n/locales/es.json
  • web/src/shared/i18n/locales/fr.json
  • web/src/shared/i18n/locales/it.json
  • web/src/shared/i18n/locales/nb.json
  • web/src/shared/i18n/locales/nl.json
  • web/src/shared/i18n/locales/sv.json
  • web/test/entities/vehicle-import/importApi.test.ts
  • web/test/features/manage-imports/VolvoDataPortalImport.test.ts
  • web/test/pages/vehicle-settings/VehicleSettingsPage.test.ts

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.

Share

@vcanuel
vcanuel enabled auto-merge November 14, 2026 10:50
@vcanuel
vcanuel merged commit a949680 into main Nov 14, 2026
8 checks passed
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.

Volvo Data Portal import: accept the portal's ZIP files as delivered

1 participant