Skip to content

LWLP-5: Lightwell Network API - #1666

Merged
etsien merged 59 commits into
content-services:mainfrom
etsien:LWLP-5-Lightwell-Network-API
Sep 9, 2026
Merged

etsien merged 59 commits into
content-services:mainfrom
etsien:LWLP-5-Lightwell-Network-API

Conversation

@etsien

@etsien etsien commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the Phase 1 v2 API spec for Lightwell endpoints: flat cross-repo and nested repo-scoped aliases for packages, package_versions, and advisories. Adds CVE-based version filtering (resolves/vulnerable), sqlc-generated advisory store, severity-ordered advisory listing, and a CI job to detect sqlc drift.

Testing Steps

  1. make compose-up to start postgres, pulp, and kafka containers.
  2. make db-migrate-up to apply all migrations (including the new advisory severity_order migration).
  3. Run handler unit tests:
    go test ./pkg/handler/ -run "LightwellAdvisory|LightwellPackages" -v
    Expect 20 PASS (6 advisory, 14 packages).
  4. Run store integration tests (requires live DB from step 1):
    go test ./pkg/lightwell/db/store/ -v -count=1
    Expect PASS for advisory queries (ListAdvisories, filter by package/severity/repo, CountByRepo, ByCveID, ByPackage) and vulnerability queries.
  5. Optionally seed advisory data and curl the endpoints:
curl localhost:8000/api/content-sources/v1.0/lightwell/advisories
curl localhost:8000/api/content-sources/v1.0/lightwell/repositories/java-remediated/advisories
curl localhost:8000/api/content-sources/v1.0/lightwell/package_versions?resolves_cve_id=CVE-2024-1234

Verify response envelopes contain data, meta, and links fields.

@etsien
etsien requested a review from a team as a code owner August 24, 2026 18:20
@etsien etsien changed the title Lwlp 5 lightwell network api LWLP-5: Lightwell Network API Aug 24, 2026

@dominikvagner dominikvagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could you rebase this please? (it has a duplicate commit for 2187002 which is in main)

also if possible, could the commits be cleaned up a bit for easier reviewing 🧹
not sure if the work should be split into more commits, or squashed together, don't know your workflow 😅

etsien added 4 commits August 25, 2026 11:28
Add severity_order column to advisories table and duplicate_of to
vulnerabilities. Rename the duplicate migration to avoid timestamp
collision. Add sqlc queries for listing/counting advisories with
filtering and pagination. Extend store_test.go with advisory query
coverage.
Add REST handlers for /lightwell/advisories, /lightwell/packages, and
/lightwell/package_versions with filtering, pagination, and aggregate
counts. Include cross-repo package listing with CVE-based filtering.
Add packages_count, versions_count, and remediations_count to the
repository response. Full handler test coverage for both endpoints.
@etsien

etsien commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

could you rebase this please? (it has a duplicate commit for 2187002 which is in main)

also if possible, could the commits be cleaned up a bit for easier reviewing 🧹 not sure if the work should be split into more commits, or squashed together, don't know your workflow 😅

yeah just did, sorry, the rebasing was a bit of a mess at first

@etsien

etsien commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok-to-test

1 similar comment
@xbhouse

xbhouse commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

etsien added 3 commits August 25, 2026 14:56
Add severity_order column to advisories table and duplicate_of to
vulnerabilities. Rename the duplicate migration to avoid timestamp
collision. Add sqlc queries for listing/counting advisories with
filtering and pagination. Extend store_test.go with advisory query
coverage.
Add REST handlers for /lightwell/advisories, /lightwell/packages, and
/lightwell/package_versions with filtering, pagination, and aggregate
counts. Include cross-repo package listing with CVE-based filtering.
Add packages_count, versions_count, and remediations_count to the
repository response. Full handler test coverage for both endpoints.

@rverdile rverdile 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.

A couple small comments. Also this unfortunately needs another rebase. I'm not sure how much of this I can test locally, but I'll test next as well

Comment thread pkg/dao/repository_configs.go
Comment thread pkg/dao/repository_configs_test.go
Comment thread pkg/handler/repositories.go Outdated
Comment thread .mockery_v3.yml
The 20260827110000 timestamp collided with the upstream
20260827120000_add_lightwell_vulnerability_key migration.
CI checks that migrations.latest matches new migration files
added by the PR; move to 20260828110000 so it sorts last.
@etsien

etsien commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

fixes implemented

Comment thread db/migrations/20260828110000_add_lightwell_advisory_severity_order.up.sql Outdated
Comment thread pkg/handler/lightwell_advisories.go Outdated
Comment thread pkg/handler/lightwell_advisories.go Outdated
Comment thread pkg/api/lightwell_packages.go
Comment thread pkg/api/lightwell_packages.go Outdated
Comment thread pkg/handler/lightwell_advisories.go
@etsien

etsien commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

merged in main and Beacon SPUR changes

The severity_order migration had timestamp 20260828, which predates
upstream's 20260902 migration. CI requires migrations.latest to match
the PR-added migration timestamp.

@rverdile rverdile 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.

Overall there is a lot working, two more functional comments!

I can help you set up to test locally if you want help verifying, or I can test it again on my end

Comment thread pkg/handler/lightwell_advisories.go Outdated
Comment thread db/migrations/20260904120000_add_lightwell_advisory_severity_order.up.sql Outdated

@rverdile rverdile 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.

Thanks for the changes, looks good!

@etsien
etsien merged commit fcd3106 into content-services:main Sep 9, 2026
20 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.

5 participants