Introduce LicenseV3SyncService for package licenses

What does this MR do and why?

Note

Review this after Extract V3SyncService from the malware sync ser... (!251813 - merged) • Orin Naaman • 19.4, which extracted PackageMetadata::V3SyncService as a base class.

  • Adds PackageMetadata::LicenseV3SyncService, a subclass of V3SyncService.

  • Pacing carries over from v2 SyncService: MAX_LEASE_LENGTH 5 minutes, MAX_SYNC_DURATION 4 minutes, INGEST_SLICE_SIZE 200, THROTTLE_RATE 0.75 seconds. v3 covers the same packages as v2, only with expressions added, so the v2 values already hold at this volume.

  • MAX_LEASE_LENGTH is 5 minutes, not 6 like SyncService, because V3SyncService requires it to match LicensesSyncWorker::LEASE_TIMEOUT.

  • Ingestion::CompressedPackage::IngestionService#execute now returns true, the same as MalwareAdvisoryIngestionService.

    • V3SyncService reads that value as "was this slice saved?" and only moves the checkpoint forward when every slice says yes.
    • It was returning the transaction's value, a list of saved rows. Ruby reads any list as true, so the check passed by luck rather than by contract.

Note

This code is dormant and cannot silently do the wrong thing. LicensesSyncWorker still runs SyncService, so nothing calls it. If a worker pointed here today, validate_v3_configs! would raise, since license_configs still emits v2. The two hooks whose collaborators are not v3-ready raise as well, rather than falling back to a v2 reader. Specs pin all three.

Not in this MR

References

Edited by Orin Naaman

Merge request reports

Loading
Loading