Skip to content

feat: migrate source human_link templates from jinja to Go templates - #6342

Draft
michaelkedar wants to merge 1 commit into
masterfrom
human-link-yaml
Draft

michaelkedar wants to merge 1 commit into
masterfrom
human-link-yaml

Conversation

@michaelkedar

@michaelkedar michaelkedar commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Warning

Do not merge until #6341 is deployed to both staging and prod. Merging syncs source.yaml/source_test.yaml to Datastore immediately, and the old website code cannot render the new syntax.

Part 2/3: rewrite every human_link in source.yaml and source_test.yaml from jinja to the Go template syntax added in #6341, and document it in docs/new_source.md.

This also fixes AlmaLinux human links:

  • prod used ECOSYSTEMS[1], which only made sense for the old Python ecosystem list, so single-package advisories got no link
  • staging used ECOSYSTEM_VER, which the Go website never set, so there was never a link

After merging, spot-check human links for alma, suse, julia, alpine and a simple source on test.osv.dev and osv.dev.
agy

@michaelkedar
michaelkedar added this pull request to stack #6344 November 11, 2026 03:09
Base automatically changed from human-link-template to master November 11, 2026 23:10
michaelkedar added a commit that referenced this pull request Nov 11, 2026
Part 1/3 of moving `SourceRepository.human_link` off jinja (a leftover
from the Python website) onto Go `text/template`.

Templates get `.ID` and `.Ecosystems` (the affected ecosystems, in
order), plus a small set of generic functions:
- `field SEP N`: split on `SEP` and take part `N` (0-indexed; out of
range is an error)
- `replace OLD NEW`
- `lower`

Any render error means no human link is shown, so templates don't need
conditionals.

To keep things working while `source.yaml` is migrated (#6342),
templates that fail to parse as Go templates fall back to gonja, with a
`human_link is not a valid Go template, falling back to jinja` warning.
The fallback is removed in #6343.

Also updates the website devserver test data to the new syntax.

Also removes the Flask-era `FLASK_SECRET_KEY`/`SECRET_KEY`/`API_URL` env
var fallbacks from the website; neither staging nor prod sets them (both
use `SESSION_SECRET_KEY`/`OSV_API_URL`).
agy
Rewrite human_link in source.yaml and source_test.yaml to the Go template
syntax, and document it in docs/new_source.md.

This also fixes AlmaLinux human links, which used ECOSYSTEMS[1] (only valid
for the old Python ecosystem list) in prod and the never-populated
ECOSYSTEM_VER in staging.
@michaelkedar
michaelkedar requested review from a team and cuixq November 11, 2026 23:10

This branch has not been deployed

No deployments
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.

2 participants