Skip to content

feat: show rockspec metadata on package pages - #178

Open
NTBBloodbath wants to merge 9 commits into
push-puuunknxklwvfrom
push-yprlsxusxukz
Open

NTBBloodbath wants to merge 9 commits into
push-puuunknxklwvfrom
push-yprlsxusxukz

Conversation

@NTBBloodbath

@NTBBloodbath NTBBloodbath commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

The package page now uses metadata already present in rockspecs and lux.toml instead of showing only the package name, download counts, version count, and install commands.

This adds verifier extraction, per-release metadata storage, and UI for license, homepage, issue tracker, labels, Lua version, supported platforms, runtime and system dependencies, build type, last updated date, and copyable install commands.

Why

Real rockspecs contain useful compatibility and install data that the page currently discards. The verifier only read top-level package, version, summary, and description, so standard rockspecs produced nil summaries and descriptions. It also rejected any rockspec larger than 2,560 bytes. Kong 3.9.4-0 is 48,587 bytes, so the old limit rejected real registry content. Some other libraries that are smaller like busted or luacheck would be rejected with the old limit as well.

What changed

Verifier

  • Raise the rockspec limit to 48 KB and the sandbox budget to 750,000 reductions and 1,000 ms.
  • Extract nested description fields, labels, Lua requirement, supported platforms, runtime dependencies, external dependencies, and build type.
  • Keep verify/2 returning a boolean.
  • Add verify_with_metadata/2.
  • Make parse/1 return nested summary and description plus the metadata map.

Data

  • Add JSONB metadata to releases.
  • Store verifier metadata in Release.changeset/2 after successful verification.

Package page

  • Show license, Lua version, supported platforms, build type, and last updated date.
  • Add homepage and issues links plus label chips.
  • Add runtime and system dependency lists.
  • Add lx add, lx install, and luarocks install with copy buttons.
  • Fall back to the rockspec detailed description when the database description is blank.
  • Add an empty state for packages with no releases.
  • Tighten version rows on mobile.

Security

  • Treat every rockspec value as untrusted.
  • Only render http and https URLs with a host.
  • Keep Markdown sanitized and never render raw HTML.
  • Cap labels, runtime dependencies, and system dependencies.

Deployment

  1. Deploy the verifier changes.
  2. Run the main app migration.
  3. Run the metadata backfill.
  4. Deploy the package view changes.

The UI hides missing metadata, so it is safe to deploy as-is with the existing packages list in our beta server. New packages receive metadata immediately through the changeset.

Screenshots

New package view with proper rockspec metadata image image

Out of scope

  • Per-release metadata. The page shows the latest release only.
  • Per-release rockspec download links. The existing download route increments the download counter.
  • Dependency filtering or links to dependency package pages.
  • Build modules and maintainer details.

The old 2.5 KB body limit rejected real rockspecs. Kong 3.9.4-0 is
48,587 bytes with 588 build modules; busted and lapis are about 5 KB.
Raise the limit to 48 KB.

The old 500-reduction sandbox budget also killed valid large rockspecs.
Kong measures ~525k reductions, so use 750k with a 1s cap. Malformed
source and build values and unexpected sandbox results now return false
instead of raising.
Read the nested description table instead of only top-level fields, so
standard rockspecs no longer produce nil summaries and descriptions.

Return metadata from verify_with_metadata/2 and include it in the verify
response. Extract license, homepage, issues_url, labels, lua,
supported_platforms, dependencies, external_dependencies, and
build.type, normalizing untrusted values and dropping unexpected shapes.

Keep verify/2 boolean for existing callers and make parse/1 return
nested summary/description plus the metadata map for LuaRocks uploads.

Add tests for full metadata, parse compatibility, legacy top-level
fields, bad shapes, and the Kong fixture response.
@NTBBloodbath
NTBBloodbath added this pull request to stack #175 November 11, 2026 12:55
@NTBBloodbath NTBBloodbath added Scope / Backend Back-end related issue or pull request Scope / Frontend Front-end related issue or pull request Kind / Feature New functionality elixir Pull requests that update elixir code labels Nov 11, 2026
Add a JSONB metadata column to releases and store the verifier's
metadata map when a rockspec passes verification. Missing or malformed
metadata falls back to an empty map, so the app remains compatible with
an older verifier.

Extend the release fixture to accept metadata and add storage tests for
the default and populated cases.
Surface the latest release metadata in the package overview: license, Lua
requirement, supported platforms, and a non-builtin build type. Replace the
redundant package name and created rows with the latest release date, and hide
each row when its metadata is missing.

Read metadata once in mount and refresh it after a yank or unyank. Normalize
platform labels, omit negative entries such as "!windows", and ignore malformed
values so old or partial metadata cannot break the page.

Add LiveView coverage for populated metadata, missing or builtin values, and
negative-only platform lists.
Show homepage and issue tracker links from the latest release metadata,
plus up to six label chips in the package hero. Only http and https URLs
with a host are rendered, with noopener noreferrer on external links.

Links use ghost buttons with icons to match the existing report action,
and the chips use the soft badge style so they follow the active theme's
content color. Labels are trimmed, de-duplicated, capped at six, and long
labels are truncated. Missing or unsafe metadata hides the row.

Add LiveView tests for valid links, unsafe URLs, label normalization, and
the empty state.
Read runtime dependencies and external system dependencies from the latest
release metadata and show them in a Dependencies card after the package
description. The card is hidden when both lists are empty.

Runtime dependencies render as compact chips, excluding the Lua requirement
already shown in the overview, capped at 20 with a remainder count. System
dependencies list the header and library names and warn that they must be
installed before building. Non-string and malformed entries are ignored.

Add LiveView tests for dependency rendering, the cap, and the empty case.


NOTE: I did not add per-dependency links, since there is no lookup for
related packages yet. We can add that feature later.
Add `lx add` as the project workflow alongside `lx install`, and keep the
LuaRocks fallback command. Each command sits in a single raised bar with a
copy button on the right, using the existing phx:clipcopy handler so no
new JavaScript is needed.

Copying also pushes an event that flashes a confirmation, matching the
backup-code copy in settings, and buttons carry distinct aria-labels so the
three actions are not indistinguishable to screen readers.

Add LiveView tests covering the three commands, their copy buttons, and the
confirmation flash.
Fall back to the rockspec "detailed" description when the package has no
database description, so packages created only from a rockspec still show
their full text. The card stays hidden when the text repeats the summary,
and the Markdown output keeps the existing sanitizer.

Show a message in the Versions card when a package has no releases instead
of an empty list.

Add LiveView tests for the fallback, sanitization, the summary check, and the
empty state.
@NTBBloodbath
NTBBloodbath marked this pull request as ready for review November 11, 2026 18:18
@NTBBloodbath
NTBBloodbath requested a review from vhyrro as a code owner November 11, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

elixir Pull requests that update elixir code Kind / Feature New functionality Scope / Backend Back-end related issue or pull request Scope / Frontend Front-end related issue or pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant