ToolsFinding code a standard type could replace
Functions that already exist
Two signals read whole functions: a copy of one a package publishes, and
one the standard library already has. Each finding's snippet is the
declaration, shown as its first line; installed packages under packages/,
tests, fixtures and seeds are left out.
published. Each of the app's own functions and actions has a source
fingerprint, worked out exactly as a release's is (How a release's facts,
change record and fingerprints are worked out):
its tokens as the formatter writes them, without its description,
comments, visibility, decline lines or its own name, its parameters and
variables named by position as the similar-helper check names them. So a
copy of uk.parse renamed read_postcode, its variables renamed too and
reformatted, has uk.parse's fingerprint. The finding suggests the package
and the declaration, @acme/postcodes uk.parse, and says the release; a
fix or an advisory for the package never reaches a copy.
jadpo suggest asks the registry with the first five hex digits of each
fingerprint, each once, and never the fingerprints, names or source
(POST fingerprints/query, The registry protocol).
The registry answers every published fingerprint starting with one of
them, so it can't tell which it was asked about, and the scan compares them
itself. A package of the app's own is never told about its own publisher's
releases. It asks JADPO_REGISTRY when that names a stand-in, as the
package commands do, and JADPO_SUGGEST_REGISTRY set to anything but on
stops it asking, on a machine or in CI. A registry that can't be reached,
or answers what can't be read, never stops the scan: its other findings
are listed, and its summary says registry not reached.
function. A standard operation has no source of its own to
fingerprint, so its fingerprint is its name, parameters and result as the
operation table gives them. A function fires when its own name is the
operation's, with or without the operation's namespace (slug or
text_slug for text.slug), every parameter the operation needs is
there, each fits the operation's in order (built on the type it takes, or
the list, set or map it takes), and its result fits the operation's. A
function named for an operation that takes something else, or with more in
its name (slug_of), is left alone.
The canonical form of a published finding is the function's normalised
tokens, so an ignore lasts until its code changes; a function finding's is
its name, its parameters' types and its result, so an ignore lasts until its
signature changes.
Markdown for agents: /docs/functions-that-already-exist.md.Built from Jadpo's main branch at commit 9080dc3.