Concrete
Rulescontract

concrete/contract/url

A url slot's accepts names a link kind or provider that a registered provider implements.

A url slot's accepts names a link kind or provider that a registered provider implements.

Graded by the contracts stage of concrete check, in the contract venue. A violation reports this id and the file it failed at — see every rule and concrete check.

Reason

A url slot's accepts narrows what the slot will take: a link kind, or one provider id. The check runs by classifying a pasted url against the provider catalog, and it fails closed — an accepts nothing can satisfy rejects every value the author meant to allow, silently, in an editor that shows no error.

Two ways to write one. A token the catalog does not know at all is the first. The second is subtler: a link kind may be declared vocabulary with no provider registered behind it yet, so it classifies nothing. Declaring that kind blanks every url a user types, with no error anywhere — the exact invisible failure this venue exists to catch. It stops being rejected the moment a provider for that kind is registered, because the legal set is derived from the catalog rather than listed a second time.

Type-caught for the unknown token: accepts is typed to the link kinds and the provider ids, so a typo does not compile. Check-caught for the provider-less kind, which is a real member of that union.

Fix

Name a kind that has providers, or the provider id itself — see url. The error names the token it refused.

Before and after

import { url } from "@homepages/concrete";

url({ label: "Profile", accepts: "social" });
import { url } from "@homepages/concrete";

url({ label: "Virtual tour", accepts: "tour" });

On this page