Skip to content

feat: backfill download events from access logs - #2228

Merged
netomi merged 8 commits into
mainfrom
gnugomez/main/backfill-analytics-data
Sep 22, 2026
Merged

netomi merged 8 commits into
mainfrom
gnugomez/main/backfill-analytics-data

Conversation

@gnugomez

Copy link
Copy Markdown
Member

No description provided.

@gnugomez
gnugomez force-pushed the gnugomez/main/backfill-analytics-data branch from 3b456f8 to d536998 Compare September 21, 2026 07:09
@gnugomez
gnugomez force-pushed the gnugomez/main/backfill-analytics-data branch from ba62b7e to 8ecdf6b Compare September 21, 2026 10:44
@gnugomez
gnugomez force-pushed the gnugomez/main/backfill-analytics-data branch from 8ecdf6b to 1f6f80f Compare September 21, 2026 13:39
@gnugomez
gnugomez requested a review from netomi September 21, 2026 13:43
@gnugomez
gnugomez marked this pull request as ready for review September 21, 2026 13:43
@netomi
netomi requested a lite review from Copilot September 22, 2026 07:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Critical idempotency, resource-lifetime, and unbounded-input issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 4 High severity

Open (4)
What changed in this PR

Adds an admin API and processing pipeline to backfill download analytics from access logs.

Changes:

  • Adds log parsing, gzip support, and analytics backfill processing.
  • Adds continuous aggregate refresh and repository wiring.
  • Adds comprehensive endpoint, parser, processor, and integration tests.
File Description
server/​src/​test/​java/​org/​eclipse/​openvsx/​repositories/​RepositoryServiceSmokeTest.java Repository smoke-test coverage
server/​src/​test/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​jobs/​IngestionJobsTest.java Ingestion job wiring tests
server/​src/​test/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​DownloadIngestionProcessorTest.java Backfill processor tests
server/​src/​test/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​DownloadBackfillAPITest.java Backfill API tests
server/​src/​test/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​aws/​DownloadLogParserTest.java Access-log parser tests
server/​src/​test/​java/​org/​eclipse/​openvsx/​analytics/​ContinuousAggregateRefresherTest.java Aggregate refresh tests
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​RepositoryService.java Repository query delegation
server/​src/​main/​java/​org/​eclipse/​openvsx/​repositories/​DownloadIngestionRepository.java Processed-ingestion query
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​DownloadIngestionProcessor.java Analytics backfill persistence
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​DownloadBackfillAPI.java Admin backfill endpoint
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​BackfillResultJson.java Backfill response DTO
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​aws/​DownloadLogParser.java Access-log parsing and gzip handling
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ingestion/​aws/​AwsDownloadRecordSource.java AWS log record source
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​DownloadAnalyticsConfiguration.java Analytics bean configuration
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ContinuousAggregateSet.java Aggregate registration contract
server/​src/​main/​java/​org/​eclipse/​openvsx/​analytics/​ContinuousAggregateRefresher.java Continuous aggregate refresh logic

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

netomi and others added 6 commits September 22, 2026 08:32
Copilot flagged four issues on the backfill feature:

- Re-uploading or retrying a backfill wrote a second set of download_event
  rows, since nothing tracked which files had already been backfilled. Adds
  a dedicated download_backfill ledger (deliberately separate from
  download_ingestion, which backfill still does not touch) and rejects a
  repeat of the same file with 409, both from the API and at the DB level
  via a unique index.
- The S3 response stream stayed open while the temp file was parsed,
  defeating the connection-release comment right above it and risking pool
  exhaustion. Closes it before the parse starts.
- An admin upload had no cap on decompressed size, so a small but
  highly-compressible gzip could grow the in-memory record list without
  bound. Wraps the decompressed stream in the existing SizeLimitInputStream,
  configurable via ovsx.analytics.ingestion.max-decompressed-bytes.

Also removes findAllDownloadIngestionsProcessedSince, which was added for
the same double-counting problem but never wired into the backfill path -
dead code superseded by the ledger above.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Complements generate-download-logs.sh --upload, which only exercises the
scheduled AWS ingestion path. This one reuses the same generator to build
the log, then POSTs it straight to the new backfill endpoint, so the API
can be exercised without a Silo/S3 bucket or waiting on the cron schedule.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The prior script (77c96c5) came out of a research task that overstepped
its scope and pushed on its own; replaces it with a version that also
supports a dry-run preview (--out without --backfill, matching
generate-download-logs.sh's own --out/--upload split) and skips the
unnecessary gzip step, since the parser already auto-detects it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The download_backfill table/entity added to fix Copilot's double-counting
findings was reviewed and judged not worth its footprint - a new table,
entity, repository and migration for what boils down to a boolean check.
Reusing download_ingestion instead would have needed either a storageType
hack or a new column plus filtering the scheduled job's own queries, to
avoid it wrongly skipping a file an admin had backfilled under the same
name; both were judged more complexity than the problem warrants.

Reverts to the original behavior: backfill trusts the caller not to
re-upload the same file, with no persisted guard against it. The S3
stream-lifetime and decompressed-size-cap fixes from 65f2d0d are
unaffected. Updates generate-download-logs-backfill.sh to match (drops
--file-name, no longer needed).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Completes ae4b2c0 - that commit only removed the new entity/repository/
migration files; this one reverts the code that referenced them
(DownloadBackfillAPI, DownloadIngestionProcessor, RepositoryService and
their tests) back to the pre-ledger behavior, and drops --file-name from
generate-download-logs-backfill.sh since the endpoint no longer takes it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
generate-download-logs-backfill.sh only ever wrapped this script and
added a curl call, so the two had near-identical flags and structure.
Folds that into a --backfill mode alongside the existing --upload,
sharing all the generation logic, argument parsing and usage text
directly instead of through a delegating sibling script.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@netomi
netomi merged commit 70811f5 into main Sep 22, 2026
5 checks passed
@netomi
netomi deleted the gnugomez/main/backfill-analytics-data branch September 22, 2026 10:58
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.

3 participants