The project lint never checks routes an integration registers #63

Open
opened 2026-09-21 07:18:19 +00:00 by cgalo5758 · 3 comments
Owner

What a contributor runs into

The lint's route scanner reads route registrations in the core server package only. A route an integration registers through the contract's registration hook is invisible to it, so the rule that every mutation route has a walkthrough and the rule that no handler renders a raw error both pass over every route an integration owns. The route count the lint reports is the same with or without an integration's tree compiled in.

Why it costs

An integration can ship a mutation route with no walkthrough and a raw error render, and the lint calls the repository clean. The first integration to register routes declared its coverage in comments by hand, which is exactly the claim the lint exists to check.

Where

The route scanner in internal/lint; the integrations' web packages, or the registry that already collects them.

Done when

The lint collects routes through the registry or by walking each integration's web package, its route count grows when an integration is compiled in, and deleting the walkthrough for an integration route fails the lint.

Migrated from status/issues.md at b7a0e15

## What a contributor runs into The lint's route scanner reads route registrations in the core server package only. A route an integration registers through the contract's registration hook is invisible to it, so the rule that every mutation route has a walkthrough and the rule that no handler renders a raw error both pass over every route an integration owns. The route count the lint reports is the same with or without an integration's tree compiled in. ## Why it costs An integration can ship a mutation route with no walkthrough and a raw error render, and the lint calls the repository clean. The first integration to register routes declared its coverage in comments by hand, which is exactly the claim the lint exists to check. ## Where The route scanner in [`internal/lint`](https://git.coopcloud.tech/wiki-cafe/member-console/src/commit/b7a0e15/internal/lint); the integrations' web packages, or the registry that already collects them. ## Done when The lint collects routes through the registry or by walking each integration's web package, its route count grows when an integration is compiled in, and deleting the walkthrough for an integration route fails the lint. Migrated from status/issues.md at b7a0e15
cgalo5758 added the
kind
debt
area/integrationsarea/testing
labels 2026-09-21 07:18:19 +00:00
Author
Owner

The route scanner is one case of a wider pattern in internal/lint: each rule picks its own directories. Routes, template references and the raw-error rule read only internal/server and internal/embeds/templates, so the dead-route, dead-target, walkthrough and screen coverage rules miss integrations too; the anatomy and copy rules add each integration's templates and web directories by glob. One list of source directories, integrations included, read by every rule would fix this issue and keep the next rule from repeating it.

The route scanner is one case of a wider pattern in `internal/lint`: each rule picks its own directories. Routes, template references and the raw-error rule read only `internal/server` and `internal/embeds/templates`, so the dead-route, dead-target, walkthrough and screen coverage rules miss integrations too; the anatomy and copy rules add each integration's `templates` and `web` directories by glob. One list of source directories, integrations included, read by every rule would fix this issue and keep the next rule from repeating it.
Author
Owner

The project lint now parses integration templates through the same surface constructors the console uses (web.MemberTemplates and web.OperatorTemplates), so a template that calls a function its surface lacks fails the lint. Route checking has not moved: route references are still read only from the core templates, and routes only from internal/server, so an integration template's links and targets go unchecked.

The project lint now parses integration templates through the same surface constructors the console uses (`web.MemberTemplates` and `web.OperatorTemplates`), so a template that calls a function its surface lacks fails the lint. Route checking has not moved: route references are still read only from the core templates, and routes only from `internal/server`, so an integration template's links and targets go unchecked.
Author
Owner

Two more things for the change that rewrites how the lint reads templates.

scanTemplateHTML (internal/lint/lint.go) advances its line counter by a token's newlines before it reports, so an id, an hx-target or an interpolated hx-* URL on a tag that spans several lines is reported at the tag's last line, while the anatomy rules report a tag's first line. Its consumed variable is never read.

The lint command's help (cmd/lint.go) lists the page anatomy rules as raw titles, badges and empty states, hx-confirm, load-triggered fetches and heading skips. It leaves out the form, table, disabled-control, Actions-column, page-header and htmx 2 rules the lint also checks.

Two more things for the change that rewrites how the lint reads templates. `scanTemplateHTML` (`internal/lint/lint.go`) advances its line counter by a token's newlines before it reports, so an `id`, an `hx-target` or an interpolated `hx-*` URL on a tag that spans several lines is reported at the tag's last line, while the anatomy rules report a tag's first line. Its `consumed` variable is never read. The `lint` command's help (`cmd/lint.go`) lists the page anatomy rules as raw titles, badges and empty states, `hx-confirm`, load-triggered fetches and heading skips. It leaves out the form, table, disabled-control, Actions-column, page-header and htmx 2 rules the lint also checks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#63