Feature/updateinfo v2#20
Merged
rockythorn merged 4 commits intofeature/config-and-processing-refactorfrom Nov 15, 2025
Merged
Conversation
Implements new v2 endpoint that uses normalized database relationships
(supported_product_id, major_version) instead of denormalized product_name
strings to enable aggregation across minor versions within a major release.
Key improvements:
- FK-based package filtering prevents cross-product contamination
- Fixes module prefix bug by stripping "module." consistently
- Enables major version aggregation (e.g., all Rocky 8.x advisories)
- Maintains v1 backward compatibility with no functional changes
- Fixes source RPM mapping bug where binaries were incorrectly mapped to
source RPMs from different minor versions (e.g., el8_7 binary mapped to
el8_6 source). The refactored build_source_rpm_mapping() now correctly
matches each binary package to its exact source RPM version.
New endpoint: /{product}/{major_version}/{repo}/updateinfo.xml?arch={arch}
Example: /rocky-linux/8/BaseOS/updateinfo.xml?arch=x86_64
Implements transparent stripping of 'module.' prefix from package_name field at the ORM layer using Python property pattern. The package_name field contains 'module.' prefix for module packages (e.g., 'module.postgresql' instead of 'postgresql'), causing source RPM mapping failures. No database migration required. The ORM property pattern handles the data quality issue transparently. Co-authored-by: Trinity Quirk <[email protected]>
Removes manual module. prefix stripping from business logic now that the AdvisoryPackage ORM model handles it transparently via property getter. Changes: - get_source_package_name(): Removed .removeprefix(module.) call - build_source_rpm_mapping(): Removed manual prefix stripping before comparison - Updated function docstrings to remove references to prefix handling - Updated tests to use clean package names (ORM already stripped prefix) The ORM property pattern ensures pkg.package_name always returns a clean value without the module. prefix, eliminating the need for defensive prefix stripping throughout the codebase. Benefits: - Simpler, more maintainable code - Single source of truth for prefix handling (ORM layer) - No risk of forgetting to strip prefix in future code - Business logic focuses on domain concerns, not data quality issues
Replaces hardcoded architecture list with the Architecture enum from apollo.server.validation module to eliminate duplication and ensure consistency across the codebase. The centralized enum supports all architectures Rocky Linux uses, including riscv64 which was missing from the hardcoded list but exists in the database. Changes: - Import Architecture enum from validation module - Replace hardcoded list check with enum validation - Remove duplicate architecture test (already tested in test_validation.py) Benefits: - Single source of truth for valid architectures - Supports full set of architectures (x86_64, aarch64, i386, i686, ppc64, ppc64le, s390x, riscv64, noarch) - Consistent validation behavior across all Apollo endpoints - No risk of architecture lists diverging between modules
trinity-q
approved these changes
Nov 15, 2025
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.
Summary
Implements v2 updateinfo.xml API endpoint with FK-based filtering and major version aggregation. Fixes critical module package bug causing 230+ missing advisories through ORM-level property pattern.
Problems Solved
Module Package Source RPM Mapping Bug
V1 Endpoint Limitations
product_namestrings instead of FK relationshipsChanges
1. ORM-Level Module Prefix Fix (Trinity Quirk)
Adds Python property pattern to
AdvisoryPackagemodel to transparently strip "module." prefix:2. Simplify Business Logic
Removed manual
.removeprefix("module.")calls since ORM handles it automatically.3. V2 Updateinfo API Endpoint
URL:
/api/v3/updateinfo/{product_slug}/{major_version}/{repo}/updateinfo.xml?arch={arch}Example:
/api/v3/updateinfo/rocky-linux/8/BaseOS/updateinfo.xml?arch=x86_64Key improvements:
supported_product_idinstead of string matching4. Architecture Validation
Uses centralized
Architectureenum from validation module instead of hardcoded lists.5. Helper Functions
Extracted reusable functions:
resolve_product_slug()- Convert URL slug to product nameget_source_package_name()- Extract source package identifierbuild_source_rpm_mapping()- Map binary packages to source RPMsAlso fixed bug where binaries were mapped to source RPMs from different minor versions.
API Comparison
/Rocky%20Linux%208%20x86_64/BaseOS/updateinfo.xml/rocky-linux/8/BaseOS/updateinfo.xml?arch=x86_64product_namesupported_product_idTesting
Deployment
Files Changed