All notable changes to Surfex are recorded here, following Keep a Changelog and Semantic Versioning.
[0.13.0] — 2026-11-18
A test's failures get a history, and reading the evidence no longer costs what the file
weighs. Each run's flips, a test that passed and now fails or the other way round, are kept
in a committed .surfex/transitions.log. Each flip carries the commit, the failure (its
kind, place and seed, and a digest that ignores the message) and what changed since the
opposite result. mix surfex.failures classes every flip (nondeterministic, code changed,
test changed, recurred, new) and records judgements on them. So a flake is shown from history,
not proven by rerunning the suite, and surfex reads and writes no issue tracker for it. On
apu's 1.15 GB evidence file a read went from 33 s and 14.8 GB to under 3 s and 1.3 GB warm.
The log, the cache and the evidence are now read without OTP's file server keeping the last
of them alive.
Upgrade from 0.12.0. Measured before release on the 30 checkouts that use surfex: no code
or spec unit changes version, none disappears and none is new, so no relation dangles on the
upgrade. Once upgraded, a project with a .surfex/ gains .surfex/transitions.log the first
time one of its tests flips. It is meant to be committed, and the existing .surfex/*.log
rule union-merges it with no .gitattributes edit. A CI job that should keep its flips sets
SURFEX_TRANSITIONS_OUT=PATH and keeps PATH as an artifact (mix surfex.info failures).
Evidence lines gain optional duration and failure fields, and older lines load as before.
An evidence line missing a field now raises an ArgumentError naming the first such line,
where it raised KeyError.
Changed
Surfex.Evidence.load/1decodes the evidence file on every core, and records holding equal values (a test and its version, a run, a set of code versions) share one copy. On apu's 1.15 GB file (911k records, 18k distinct code maps) the read went from 33 s and a 14 GB peak to 5 s and 2.5 GB, keeping about 0.4 GB. The records and their order are unchanged. It reads the file without OTP's file server, which kept the whole file alive after the read. A line that isn't a record is now reported as anArgumentErrornaming the first such line in the file: a missing field no longer raisesKeyError(#398, #399).- The relation log's segments and the cache's files are read without OTP's file server, as the evidence is, so it no longer keeps the last of them alive after the read: on surfex, the 51 MB log checkpoint after a load and 92 MB of segments after a check; on apu, the 71 MB log. What is read is unchanged (#401, #403).
Added
mix surfex.failures [TEST…] [--json]shows each test's failure history from.surfex/transitions.log. Each flip is classed by what differed from the run before it:nondeterministic(identical versions: a flake, or a change no version holds, shown without reruns),code_changednaming the code,test_changed,recurred(the same failure back after a fix), ornew/unknown. A renamed test keeps its history.--judge TEST --note N [--at TIME]records a judgement as its own committed line. It is advisory, and reads no issue tracker (mix surfex.info failures; #405, #408).- A CI job writes its run's transitions to an artifact with
SURFEX_TRANSITIONS_OUT=PATH, never to the checkout.mix surfex.failures --merge PATHreads it into the report, and--ingest PATHappends its new lines once. Without the opposite run's evidence (a fresh CI build, a clean build), a flip compares with the test's last transition, so identical versions are still shown (#405, #409). - Each test's pass/fail transitions are kept in
.surfex/transitions.log, committed and union-merged with the log's existing.surfex/*.logrule: the end of a run appends a line only for a test whose result flipped. A line gives the test's id and version, both ends, the commit, and what changed since the opposite result: the test's version, or which code. A pass→fail carries its failure, and a fail→pass the number of failed runs. A stable suite writes nothing (#405, #407). - An evidence record carries its test's
duration(microseconds), and a failed one afailure: its kind (assertion, timeout, error, exit, throw), first line, location in the test file, the run's seed, and a digest that leaves the message out, so the same failure keeps one digest across runs. Both are optional: older lines load as before (#405, #406). Surfex.Evidence.project/1reads a project's own evidence file through a checkpoint in.surfex/cache/, as the log is read, and decodes only the lines appended since. It gives exactlyload/1's records.mix surfex.status --evidence, the recording commands andmix surfex.baselineread through it, and--mergefiles are still read withload/1. On apu's file a warm read takes under 3 s and 1.3 GB, against 8 s and 2.9 GB cold (#398, #400).
[0.12.0] — 2026-11-10
Commands are three to four times faster, and the claim-grain migration does what it says.
mix surfex.status takes about 3s on surfex's own tree where it took about 10s: the log and
the source are read on every core, a command reads each thing once, and two local caches in
.surfex/cache/ (which ignores itself in git) keep the decoded log and definition versions
between runs. --verify decodes each log line once, and suggest derives its status once. A
behaviour's callbacks become items of their own, dispatch: follows a registry or a module
passed as a value, a marked table can carry a class, and mix surfex.relate --file records
many relations from one scan. mix surfex.migrate reads a claim as the verdicts do, retires
only what it names, and keeps a section green while it migrates. JSON output now has its keys
in a fixed order.
Upgrade from 0.11.0. Measured before release on the 18 projects with a .surfex.exs: no
code or spec unit changes version and none disappears, and every project's status, with its
counts, is the same as under 0.11.0. The only new ids are behaviour callbacks
(Module.callback:name/arity, #337): each is judged with its module until a relation names it,
so none fails on upgrade, and mix surfex.suggest proposes the callback contracts a spec
states. A tool reading --format json byte for byte sees the keys reordered once, sorted from
now on, and an absent value as null (#394). Library-only users (Surfex.Golden,
Surfex.SourceScan) need no change; the files each needs are now listed in the guide (#357).
Added
dispatch:declares a registry and a module passed as a value (#290, #377).{Billing, :run, 1, registry: {Billing, :reports, 0}}reaches the callbacks of each module the catalogue's literal list holds, and{Http, :read, 2, module_arg: 2}those of the module a call passes there by its literal alias.callback: :namenarrows either. Read from source, never traced.Surfex.Status.Config.dispatch!/1returns a map for these forms.- A
@tag verifies:a later@tagon the same test replaces is reported as inert (#369, #371). ExUnit keeps the last, so the first verified nothing, silently. It is information and fails nothing. An override of a@describetagor@moduletag, and a list in one tag, aren't listed. mix surfex.migrate --accept --skip ID(#365, #368), once per item, records the other single proposals and leaves that one on its section. Without it a wrong single could only be avoided by retiring its relation first.--codeon a relation already retired now says to record the claim's withmix surfex.relate.- A marked table can carry a class (#291, #362):
<!-- surfex: table NAME class: CLASS -->, CLASS declared inspec_classes:. Its rows stay citable, deferrable and pinnable, but each is excused rather than a claim, so a table of what's deferred no longer adds rows that can never be verified. Averifiesorimplementsto one is contradicted. Classing a table changes no version. - The library guide lists the source files each library module needs (#293, #357), for
a project that loads
Surfex.GoldenorSurfex.SourceScanfrom source with no Mix project:golden.exandgolden/span.ex;source_scan.exandsource_scan/closure.ex. A change to a list now comes in a minor release, listed here and marked for library users (spec §23.4), and a test computes the lists from the code. Neither list changes in this release. mix surfex.relate --file PATH: many relations from one scan and one log load (#350, #351). Each line is tab-separatedFROM,TO,TYPEand an optionalNOTE, and records what the single form records, so it validates nothing (spec §18). Notes may be missing or repeated, since a claim has no judgement to write;Surfex.Record.relate_batch/5is claims only, andbatch/3keeps its distinct-notes rule. Each line stands alone (#352, #353): one run names every line it refuses, records the others, and then fails. A rerun records only what's new: a line whose relation already stands at those versions is skipped and reported, and a rerun never puts a validated relation back to proposed.Surfex.Record.parse_claims/1reads such a file;confirm --fileandvalidate --filestay all or nothing.- A behaviour's callbacks are items of their own (#337, #345). The Elixir scanner lists
each public
@callbackand@macrocallbackas an item of its module, keyedModule.callback:name/arity(macrocallback:for a macro callback, spec §5.2.1): its version over its declaration alone, its doc version over its@doc, a shape with no aliases or calls. A callback contract (§11.1) now resolves to that item (§6.9) andmix surfex.suggestproposes it (§15.3), so changing one callback's signature or rewording its@docdangles exactly that contract's relation, where a relation to the behaviour module missed the doc and dangled on any change to the module. One under@doc falseis no item. A callback contract naming a callback its module doesn't declare is now a broken citation,no callback f/1 in M; it resolves to the module only where no scanner lists any of the module's callbacks. surfex's own two callback contracts (§23.1.1) now relate to their callback items (#346): a rewordedSurfex.Scannercallback@docdangles that contract's relation alone. Surfex.ItemandSurfex.Scanfieldin_parent(defaultfalse, true on callback items): a member whose declaration is already in its parent's version is judged with its parent until a relation of its own names it, so it isn't listed as new, judged byrequire:or counted by completeness (spec §13.19).SourceScan.module_hash/1is unchanged and still covers callback declarations, which is what makes this sound.
Changed
suggestderives the status once, and reads judgements from it (#390, #392, #391, #393).Surfex.Suggest.all/5derived it for the moves and again for the rest, the same status when nothing moved: it now derives again only after recording a move. Each relation's judgement in force now comes from that status, where the log was regrouped for it three more times (specsuggest-derives-once).Suggest.allon surfex's tree takes about 0.95s where it took 1.8s. The suggestions are unchanged.--verifydecodes each log line once (#386, #388).Surfex.Log.check/1builds each segment's chain hash from its own parallel decode, where it decoded every line again, one at a time, to read its id: checking surfex's own log takes about 1.4s where it took 2.3s. The hash, the headers and every problem reported are unchanged, and a line that doesn't decode still chains by the id it carries.Scans remember definition versions (#383, #385). Inside a scan,
Surfex.SourceScan.definition_hash/1looks each definition up by a digest of its AST in a memo kept in.surfex/cache/, and pretty-prints only what changed: reading surfex's own source takes about 1.65s where it took 2.3s. Every version is the same as without it, and outside a scan the function is unchanged and reads no file.The log is checkpointed locally (#382, #384).
Surfex.Log.load/1keeps the entries it decoded in.surfex/cache/, which ignores itself in git, keyed on the segments' exact bytes, so a run decodes only the lines appended since. Loading surfex's own log takes about 0.5s where it took 1.3s. Any other change to a segment is decoded in full, andverify/1,check/1andmix surfex.log --verifynever use it.The log and the source are read on every core (#379, #381). Decoding the log's lines and scanning spec, code and test files run in parallel. What they give is unchanged, in content and order, and a syntax error or an edited log line is reported as before, with no extra crash report.
Commands repeat less work (#379, #380).
mix surfex.status --verifyreads the log once, where it decoded every line twice.mix surfex.suggestscans the code once, and--acceptrecords from what it already read.suggestbuilds its set of related pairs once, andmix surfex.completenessno longer filters every relation for each item. Output is unchanged.Surfex.Log.check/1andSurfex.Status.Config.scans_of/3are new.mix surfex.validatepoints at a deeper test (#290, #378). The test that only calls code directly was the cheapest to review, which pulls toward shallow tests. Where another test verifying the unit reaches more of its code, it now says so, naming that test and the call it goes through. The review is recorded either way.Reach follows test-support helpers (#290, #376). A test reading through a fixture helper in
test/supportverified a claim and "called none of its code", so projects rewrote good tests to suit the tool. Reach now passes through support code as it does hidden code, with no key to set. Support code is never an item. A citation of a support module, function or type has the new statustest_supportand isn't broken. On upgrade the firstmix surfex.suggestmay offer moretestsrelations, and fewer triangle gaps are reported.mix surfex.migrate --reportreads at its actionable size (#289, #375). With no section named it opens with one line per section, worst first. Items reading the same collapse to one line, and--itemsshows them all. A contained list, here and inmix surfex.status, names the claims directly inside and counts the rest. A move that widens the dangle is flagged. The JSON keeps every item.mix surfex.migrate'snonesays what to do (#289, #374). It read as a dead end, though usually a test already calls the code and only the claim it checks has no name yet. The listing and the report name the tests that call or reach the code and whether each verifies a claim in the section, or sayno test calls it.--format jsongivescallers.mix surfex.suggest --acceptno longer retires a validated relation when a test stops declaring it (#369, #370). A misplaced tag could quietly discard a reviewed judgement, and a retired relation doesn't come back on its own. Such a relation is now listed and left in place, and the status keeps failing until the tag is restored or the relation retired. A proposed one still retires. A retired relation a test still declares names the command that revives it. Upgrade step: if you remove tags on purpose, runmix surfex.suggest --accept --retire-undeclaredafter reading the list.Surfex.Suggest'sundeclaredentries gainvalidated.The gate lists a row that only re-rendered as re-rendered (#291, #361). A release that changes how a cell renders used to show the row under both Gone and Added, which read as a loss.
mix surfex.goldensnow lists it once, underRe-rendered (same row, new rendering), and a row written by an older release's`a`b`is named by its text.Reports say what they mean (#291, #360).
completeness --summarynames each deferred unit and what defers it, where it printed only the cited reference. An on-container line says redundant when the same test declares every claim inside, and otherwise names the claims it doesn't declare; the JSON gainsredundantandundeclared. An excused or deferred unit under New says so, and the header counts them. The status's excused line says what its numbers are, so it agrees with completeness's on its face. No verdict changes.The claim-grain guide says what upgrading costs (#293, #359): the dangle wave as the real work, with a worked example; lowering a completeness floor to the measured score and raising it as sections settle; the wave of reach suggestions; wiring excuses dangling; a deviation failing
require: code:; poncho siblings pinning surfex; a retired release failingmix hex.audit.guides/writing-specs.mdadds when to name code in a spec.The docs say what
validatecredits, what a class name is and how to bring evidence from CI (#293, #358).mix help surfex.validatesaid a review credits code the test "exercised", which reads like earning's reach; it credits code the test calls directly, and reached code when named with--code.mix surfex.info validationgains a recipe for saving CI's evidence as an artifact and merging it.mix surfex.info claimsstates the class-name characters and §13.6's rule that a classed section with claims inside reads as a container. No behaviour changes.mix surfex.confirm --filenames the line of an unknown type (#351).A shape is not on the triangle's code side (#345, spec §13.20). No run exercises a type or a callback, so an
implementsto one is nevercode_untested, and a unit implemented by shapes alone has no triangle gap once a test verifies it. Code with behaviour beside a shape is judged as before.
Upgrade step: none required. Measured read-only against 0.11.0 on every project with a
.surfex.exs (surfex_unit_versions.exs): no existing code or spec unit changes version
and none disappears; the only new ids are the callback items, in the projects that declare
callbacks. A new callback item is judged with its module, and comparing each project's
status under both versions, none changes whether it fails, what it lists as new or unmet,
or its broken citations. Five projects lose 39 reported triangle gaps between them
(implements to a type or a DSL declaration), each such relation now complete in
completeness. Only surfex had callback contracts (2); a
project that relates a callback contract to its module can move it: relate the contract to
its callback item (mix surfex.suggest proposes it) and retire the module relation.
- surfex's own test suite now fails the run, naming each file, if it changed, added or
removed anything under the project's
.surfex/(spec §1.2, #341). A one-off CI failure ofmix surfex.status --verify("entry … does not match its content (edited?)") on a log byte-identical to a passing one was not reproduced: the suite under 23 seeds and loads never wrote the log, and decode is deterministic over every line. No cause was found in shipped code; the guard turns a recurrence from a retry into a diagnosis. No change for projects that use surfex.
Fixed
- JSON output has its keys in a fixed order (#394, #395). A map's atom keys were written in the
order the VM created the atoms, so
mix surfex.suggest --format jsonandmix surfex.status --format jsoncould change their bytes after a compile, with the same content. Every writer (status, completeness, migrate, suggest, draft hand-off, evidence) now goes through one encoder that sorts each object's keys at every depth and writes an absent value asnull(specjson-key-order). Evidence, migrate and completeness wrotenilas the string"nil"; none of today's output had one. The relation log's lines are unchanged. - A JSON log line that is no entry is reported, not raised (#387, #389). A line with no string
"id", or that isn't an object, madeSurfex.Log.verify/1,break/1andrechain/1raise aKeyErrororBadMapErrorwhile hashing its segment.verify/1now lists it asnot a log entrywith its line, and it adds nothing to its segment's hash (speclog-non-entry). Text that isn't JSON still raises. mix surfex.migrate --code --toretires only what it names (#289, #373). It retired every settled pair in the section under its one--note, and a retired relation can't be annotated, so the wrong note stayed for good.--acceptandmix surfex.suggest --acceptnow retire with surfex's own note and leave out--note.mix surfex.migratereads a claim as the verdicts do (#289, #372). It only knew blocks, hints, rows, rules and contracts, so a project whose claims are id'd subsections gotnonefor everything, was told its sections were prose, and had--code --torefused. A claim is now one thing everywhere: text of its own, no class or deferral. A refused target says why.mix surfex.suggestproposes code to a section only when no claim sits inside it, so a section with hints isn't offered back the code a migration moved off it. On upgrade a project with leaf sections sees more claim-derived candidates, none recorded by--accept.- A section stays green while it migrates (#365, #367). As a section's code moved to its
claims, a test tagged to the section could stop reaching the code still on it and fail the
triangle, in one section 82 tests at once, breaking §14.1's promise that a migration can span
commits. A test now meets a unit when it reaches code implementing the unit or a claim inside
it. Code left on the unit that no verifying test reaches is still reported. On upgrade a
project can only see fewer
test_misses_codegaps. Newjudges code by definition (#354, #355), as therequire:policy and the triangle already do (spec §13.1). A default-argument arity (f/1fromdef f(x, y \\ 1)) no longer shows asNew (in no relation)while another arity of its definition is in a relation.mix surfex.suggeststill finds an unrecorded arity as a rename target.
[0.11.0] — 2026-10-31
Spec marking reads as its writer means it, and the log asks less of its keeper. Contract
fences, marked tables and headings are read by the rules their readers use, and what fails
to read is reported once, with its cause. Citations propose fewer, better-grounded
implements once a log is established, and a claim's tests propose for review, not for
--accept. A contract relation dangles when its function's @doc changes. triangle:
takes a mode per spec file. surfex now states its own pinned library API as contract
fences, and promises that a spec unit's version holds across releases (spec §23.3).
Upgrade from 0.10.0. Measured before release on the 17 projects with a .surfex.exs:
no code or spec unit changes version, no unit id appears or disappears, and every
project's status is the same as under 0.10.0 except one, which goes from failing to
passing. Two entries can still ask something of a project: a .surfex.exs that sets
claim_implements:, or a key with a wrong-typed value, is now refused (#321, #288), and
mix surfex.suggest --accept no longer records implements from a claim's tests (#329):
review those with mix surfex.suggest. Library-only users (Surfex.Golden,
Surfex.SourceScan) need no change.
Added
surfex states its own library API as contract fences (#334, #336). Spec §23.2 holds the pinned functions of
Surfex.GoldenandSurfex.SourceScan, and §23.1.1Surfex.Scanner's two callbacks, each with the@specor@callbackthe code declares. Each contract is related to its function (a callback toSurfex.Scanner, as the built-in scanner lists no callback item) and validated by a test that calls it, so a changed signature or a reworded@docof the supported API now dangles exactly one relation in surfex's own log. A test reads the contracts as the scanner does and checks them against the pinned API both ways, and each signature against the code's. The pinned types stay pinned by the test alone. This is the first real log the contract machinery runs on: the doc dangle of #325 was exercised on it before merge (a reworded@docdangled withdoc changed,confirm --evidenceleft it,validatesettled it). The library guide and the claim-grain guide now recommend contract fences for a library's public API, with this as the worked example. Upgrade step: none. Nothing changes for a project; surfex's spec gained units of its own.A contract relation dangles when its function's
@docchanges (#325, #332, plan v2 B.6). A contract unit and its function's docstring state the same thing twice, and until now nothing noticed when one moved. Animplementsrelation whose spec end is a contract unit now records the code's doc version (#331) on its code end, asdocin the log (written only when set, so every existing entry keeps its line and id). Rewording, adding or removing the@docdangles that relation, and the status names it apart:(doc changed: …)beside(changed: …),doc_changedin the JSON's end and onSurfex.Statusrelation statuses. Re-wrapping a docstring doesn't, and@doc falsekeeps its meaning (the function is hidden). A passing run reads no docstring, somix surfex.confirm --evidenceleaves a doc change dangling:mix surfex.validatesettles it. Relations to sections, rules and rows record no doc version; there is no opt-out key. Spec §13.18, §12.1, §3.3, §3.4. Upgrade step: none, and no wave of dangling relations: a contract relation recorded before this has no doc version, so it doesn't dangle on a doc edit; the status counts them,N contract relations have no doc version recorded yet(doc_unrecordedinSurfex.Statusand the JSON), and each gets one on its next relate, confirm or review. Measured read-only on the two adopters that asked for this: neither has a contract fence or a relation log yet, so a doc edit dangles nothing there today; over their 1,003 and 4,289 code items no code version changes, and 852 and 3,414 functions, macros and types carry a doc version (174 and 671 of them undocumented).known_external:can take its vocabulary from a committed golden (#322, #330). A spec that names a peer system's or a C header's symbols no longer copies a golden that already lists them into.surfex.exs:known_external:takes a list of maps and{:golden, "REFERENCE.md", column: "Item"}entries, andSurfex.Status.Config.read!/1reads each golden's column, relative to the config's directory, into the one map the profile holds. The names are versioned with the golden: one it stops listing makes its citations broken again. A missing file, an unknown column or an empty column is a refusal, reported with the config's others. For library users,Surfex.Profile.external_from_golden/3gives a golden's names as aknown_externalmap ({:ok, map}or{:error, message}, never raising), so a project callingSurfex.Profile.new!/1directly gets the same vocabulary;Surfex.Profile'sknown_externalstays a plain map. An:externalcitation now carries its reason aswhy(a golden's names:"listed in PATH"), so a later reader can tell a golden's vocabulary apart. Spec §6.11. Measured read-only on an adopter whose golden lists 464 names: with that vocabulary and no map entries, its spec's 142 distinct broken names fall to 16, the rest becoming external (588 citations); the 16 left are its vendored file names, a documented absence and the two names it lists in its own map.A citation says how it was made:
kind(#321, #328). For library users,Surfex.Cite.t()gainskind: :span | :subject | :cell: a code span in prose or a fenced token, a subject heading or a contract's own function, or a cell under a citing column. It is additive; resolution and statuses are unchanged. Spec §6.10.triangle:takes a mode per spec file, so a project can close its triangle chapter by chapter (#326, #327). Besides:reportand:fail, it takes[default: :report, fail: ["spec/03-*.md"]], where a gap fails when its unit's file matches a glob and is reported otherwise, or the mirror[default: :fail, report: globs]for a project that is mostly closed. Any other key, both lists, or a glob matching no spec file is refused, so a renamed chapter can't drop out of the list in silence.Surfex.Status.derive/4'striangle:option takes the same forms,policy.trianglekeeps the resolved one, and each gap carries its unit'sfileand itsmode; the check fails on any gap whose mode is:fail. Spec §13.17. Measured: on an adopter with 30 gaps in 5 of its 11 spec files, a scratchfail:list of its 6 closed files fails on none, and adding one open file fails on exactly that file's 3 gaps; on an adopter with 529 gaps in 17 of 18 files, adding one open file fails on exactly its 33.TABLE/*declares every row in a test'sverifies, as in a check's (#286, #319). The expansion ran only over checks, so@tag verifies: ["spec/x.md#modes/*"]on a table-driven test was broken ("no spec unit has that id") and each tag had to list every row by hand. It now runs once over every test and check declaration, before they are resolved, whatever form declares it (verifies:, adeclares:form) and with or withoutunit_refs:. The test declares oneverifiesper row at its own version, so a row added to the table is declared with no edit to the test; its relation is still recorded by the usual process, and until then the row is listed as unrecorded, not credited. A/*on anything but a marked table stays broken. Spec §11.16. Measured: no adopter's test or check declaration changes (none declares a/*today); an adopter's table-driven test whose tag lists all 15 rows of its table by hand declares exactly those 15 rows when the tag is written asTABLE/*(in a scratch copy).Two key-shape warnings for marked tables (#286, #318). A row key holding a
/outside its code spans that isn't the spaced/(HTML/D3 visualizer) gives an id that reads as a path one level deeper: it is now warnedslash_key, andTABLE/KEYstill resolves it. A/inside a code span (`f/2`,`lib/`) is a name written as code and isn't warned. A key cell that is a code span followed by prose (`ack` (high 3 bytes of TCP ack)) is warnedspan_key, naming the span as the probable key. Neither re-keys the row nor fails the status; both are listed underSpec shapeand in the JSON'sspec_warnings, besidelist_key(migrate --reportis unchanged). Spec §11.12, §11.2. Measured: no row of the three adopters' marked tables is warned (103 of their 279 keys hold a/, every one inside a code span, a function's arity); with every table of the volunteers' and adopters' specs marked (a scratch copy), 18 rows would be warnedslash_keyand 36span_keyof 2,410, the reported/row among them; the reported code-span row is warned once its table is keyed on its field column.mix surfex.status --specreads the spec side alone (#297, #316). For a repository that holds only a spec, one another repository implements and pins, where a full status saysFAILING,(no relations)and lists every citation as naming nothing.--specreads.surfex.exs(still required, every key validated) and scans only the spec: no code, tests, checks, classes, log, evidence,require:or completeness floor. It fails on scan errors (an unresolved deferral citation among them), on each citation of an arity the spec's own contracts don't state (§13.15's warning, failing here because no code can vouch for it), and on a stale deferral citing a spec unit; restated contracts, list-shaped keys and the other spec-shape warnings are listed. The text report opensspec only (--spec): code, relations, the log and evidence are not readand the JSON carriesmode: "spec". Flags that read what it skips (--evidence,--verify,--issues, …) are refused with it.Surfex.Status.Config.read_spec/3gives its status. Spec §13.16. Measured: on a volunteer spec repository (contract fences marked in a scratch copy),--specfails on exactly the one cited arity its team found by hand, lists one restated contract and one path-heading warning, and says nothing about code; on the nine adopters with a relation log and two volunteers with code,--specgives the same spec-side lists as the full run.A citation of an arity no contract states is warned (#287, #315). A citation
MyApp.Env.check/1in the spec's text, where the spec's contracts stateMyApp.Env.checkonly at other arities and the code has no such function, is now a spec-shape warning of a new kind,contract_arity, naming the contracts and where they are. It reads the spec alone, so it works with no code scanned, and it never fails (a citation naming nothing is broken as before where code is scanned).Surfex.Scan.at/3gives the innermost spec unit holding a line. Spec §13.15. Measured: none of the nine adopters with a relation log has a contract fence; on three volunteer specs with their fences marked (in a scratch copy), the one citation a team found by hand is warned, with no code in its repository, and nothing else is. Across all of #287's changes, the nine adopters' status goldens are byte-for-byte unchanged.suggestpairs a contract with its own function (#287, #314). A contract unit keyedModule.name/aritywas offered onlyrefines, while prose mentions gotimplementssuggestions; nowmix surfex.suggestproposesimplementsbetween each contract and the code item of its key (a callback's where a scanner lists callbacks), cited at the contract's line and listed first, with or withoutclaims: true. A pair related in any state, retired included, is not proposed. Spec §15.3. Measured on one volunteer spec with its fences marked (in a scratch copy, against its own code): 63 of its 77 contracts are now paired with their functions, the one its team named among them; the other 14 are callbacks, which the built-in scanner doesn't list, and the functions it lacks.A contract's function is a citation (#287, #311). A contract unit's key,
Module.name/arity, is now resolved against the code as a cited name is, and one naming nothing is a broken citation at the signature's line, under the section(contract), saying what is missing:no module M,no f in M, orM.f exists at /3, not /2. A callback resolves to its behaviour module (the built-in scanner lists no callbacks).known_external:anddocumented_absences:carry one as they carry any citation, and a contract deferred by its own marker or its section is not broken. The JSON's citation gainswhywhere there is one.Surfex.Status.Config.broken_citations/5takes the scans;/4is unchanged. Spec §6.9, §6.2. Upgrade step: a spec with contract fences may now fail on broken citations its contracts make. Each names a function the code lacks: fix the contract, defer its section, or name it indocumented_absences:. Measured: none of the nine adopters with a relation log has a contract fence, so none changes; on three volunteer specs with their fences marked (in a scratch copy), the two functions and the three moved ones their teams reported are among the new broken citations, and a spec with no code in its repository reads every contract as broken until a spec-only reading exists.namespace:takes a module (namespace: MyAppreads as"MyApp") or a list of roots, where it took only a string and a module crashed the scan with aFunctionClauseErrorfrom inside the Elixir scanner (Surfex.Status.Config.namespace!/1). Aspec_classes:name may be an atom ({:informative, "…"}names the class"informative"). A check'srun:takes an argv, a non-empty list of strings run with no shell, asissues: command:does; a string still runs throughsh -c. Spec §13.14, §11.4.A citation of a registered process name resolves (#299, #303). A span naming exactly a module alias that the Elixir scanner's source uses as a process name,
name: MyApp.Sessions(a literal alias, in a call or a child-spec tuple alike; not{:global, …},{:via, …}or a variable), is no longer a broken citation when no module of that name is scanned. It has a status of its own,:registered_name, so it never hides a misspelt module, and a function on it (.count/0) still names nothing. It is no item: no relations, no completeness.Surfex.Cite.citations/4takes the names asregistered:;citations/3is unchanged. Spec §6.7. Measured on an adopter's spec: 1 of its 21 broken citations (a supervisor registered by name) goes, and none other changes.A path heading among numbered siblings is warned (#292, #306). A heading with no id whose siblings (the headings at its level under the same parent) carry ids the
heading_ids:grammar read, such as## 3-raw.between## 5.and## 6., is almost always a missed id. The status now lists it, never failing, naming its nearest numbered siblings and the unit it reads as: the sectionfold_paths:folds it into, or its own path unit. The scan record carries it in a newwarningsfield. Spec §11.12. Measured: none of the nine adopters with a relation log has one; one volunteer spec read under:section_numberwithfold_paths: truehas exactly the one that motivated this.
Changed
For scanner authors and library users: a function's, macro's or type's documentation has a doc version of its own (#325, #331, plan v2 B.6).
Surfex.Itemgainsdoc(defaultnil, so an existing scanner's items are unchanged): a hash of the item's documentation, kept apart fromhash.Surfex.Scanner.Elixirfills it for functions, macros and types from their@docor@typedoctext, whitespace normalised; a definition with no doc text has a doc version of its own, and a module has none, since its version already covers its@moduledoc.@doc falsekeeps its meaning: the definition is hidden and has no item.Surfex.SourceScan.defs/1's andtypes/1's maps gain the samedockey, andSurfex.Scancode records carry it (Surfex.Scan.code/1). No code version changes: a docstring edit still re-versions nothing. Spec §3.4, §4.Breaking: once the log is established, prose citations stop proposing
implements, and a claim's tests always do, for review rather than--accept;claim_implements:is refused (#321, #328, #329, #335, plan v2 D.3). A log is established when it holds a liveimplementswhose judgement in force records a validation (Surfex.Suggest.established?/1), read from the log with no key. There, a code span in prose proposes only inside a contract unit; a subject heading, a citing cell, a contract's own function and a claim's tests still propose. A prose citation still resolves or is broken.Surfex.Suggest.all/5lists what it didn't propose underwithheld, andmix surfex.suggestprintsN prose citations not proposed (log established: relate the claim, not the sentence)when there are any. Claim-derived candidates (§15.1) are always on:Surfex.Suggest.all/6and itsclaims:option are gone, as isSurfex.Status.Config.claim_implements?/1. They are proposed only for a claim nothing implements: neither it nor a unit it sits in has a liveimplementsor one a citation or a contract proposes in the same run. Per claim, only its most specific calls are proposed: each candidate carriesshared, how many other claims' tests call the same code, only the lowest is listed (also called by the tests of N other claimswhen N > 0), andalso_calledcounts the rest in one line per claim.--acceptnever records a claim-derivedimplements: it records structural suggestions, excuses and the citation and contract candidates as before, and prints each claim-derived pair with themix surfex.relatecommand that records it, its decline command and a count line,N claim-derived implements to review one at a time: not recorded by --accept(Surfex.Suggest.claim_derived?/1,Surfex.Suggest.relate_command/2).mix surfex.suggest --format jsongives every list as JSON, eachimplementscandidate withsharedandaccept(Surfex.Suggest.json/1). Spec §15.4, §15.1, §15.5. Measured read-only on the nine adopters with a relation log and the elixir scanner, all established: prose citation candidates fall from 5 to 0 across them (4 now withheld, 1 still proposed through a claim's tests); no contract-unit candidates before or after. Claim-derived candidates, previously proposed to no one (no adopter set the key), measured again on five adopters with a relation log: proposed for every claim, they would number 83, 250, 2,788, 4,090 and 68; with the two rules they are 7, 15, 70 and 746, over 2, 7, 48 and 570 claims, and none in the fifth, whose claims are all implemented. No accepted relation changes: only suggestions do. Upgrade step: deleteclaim_implements:from.surfex.exsif it is there (no adopter's sets it); a config that still does is refused, naming the key. Routinemix surfex.suggest --acceptstays safe to run after every change. Review the listed claim-derived candidates one at a time: relate the ones that realise their claim with the printedrelatecommand, and decline the rest.The status lists triangle gaps by spec file (#326, #327). The text report's
Trianglelist now opens withN failing (in fail files), M reportedand groups the gaps under each file with its mode (spec/03-keys.md (fail):); the JSON's gaps carryfileandmode. The golden is unchanged. A refusal oftriangle:names the new forms.Restated contracts compare parsed signatures (#287, #313). A contract stated in several files was listed as restated when the texts differed, so
feed(t, binary)againstfeed(t(), binary()), one contract in two notations, read as a drift. Each clause is now parsed and compared with its metadata, line breaks and head module dropped and a bare type read as its zero-arity type; a type variable the clause'swhenbinds stays a variable. Any differing type is still listed. The record carries the comparison's digest in a newSurfex.Scanfield,signature; a unit's version is still its text. Spec §13.10. Measured on three volunteer specs with their fences marked (in a scratch copy): the four restated listings of one, all notation, are gone; the real drift another reported stays listed, and the two statement pairs a third reported still compare different.A heading naming a qualified function names its module (#287, #312). Under
### `MyApp.Feed.Telemetry.emit/3`, an unqualified@spec emit(…)in a contract fence was keyed by an outer heading's module, or found none; it is now keyedMyApp.Feed.Telemetry.emit/3.`M.f`namesMfor every arity off; another function in the fence still climbs to the headings above. With the code scanned, the name resolves as a citation does (the profile'snormalise:rewrites, then an item key or an alias). And where a nearer heading names a module only through other functions, the signature's outer module lacks it and the nearer one has it, the scan stops with an error naming both headings' lines rather than keying it silently to a function that doesn't exist.Surfex.Scan.Markdown.sections/3takes the code's names ascode:. Spec §11.14. Upgrade step: a contract under such a heading changes id, so its relations show as orphaned:mix surfex.suggestproposes the move. Measured: none of the nine adopters with a relation log has a contract fence; on three volunteer specs with their fences marked (in a scratch copy), two fences that no module placed now read, one keyed by the qualified function its team expected, the other by its short module as written (a broken citation until a rewrite names the module), and none raises the new error.Every
.surfex.exskey is validated before scanning, and refused all at once (#288, #308). A known key with a value of the wrong type was refused only when its reader ran, after part of the scan, or crashed inside it; now every key has a validator (Surfex.Status.Config.validate!/1, asked byread!/1and byitems/2, where every scan starts), and oneArgumentErrorlists every refusal, an unknown key among them, one per line:KEY: must be FORM, got VALUE, the value as written. Where one element is wrong (a class's name, its reason, an unknown option), the refusal names that element and quotes the whole entry as written, never a normalised one. The profile keys, theheading_ids:/rule_ids:grammars,unit_refs:andnot_claims:are refused up front with the rest, and so is arules:entry naming a classclasses:lacks. Some messages are reworded to that one shape (require:,spec_classes:,checks:,goldens:).checks:is validated bySurfex.Status.Config.checks!/1: thedeclared!function ofSurfex.Scan.Checksis gone, andSurfex.Scan.Checks.records/2takes the validated checks in place of the config. Spec §13.14. Measured on the nine adopters with a.surfex.exs: every config reads with no refusal, so none needs a change.A folded unit keeps its own line ranges (#292, #307). A unit
fold_paths:folds a heading into was located from its first line to its last folded one, so a chapter whose path heading sat after §5 claimed the lines of §1–§5, units of their own. It is now located at its own lines and each folded part's, one range where nothing sits between: its record'slinesare the first range andlocation.rangeslists them all (Surfex.Scan.ranges/1). Reports printspec/07.md:1-7, 157-167, the JSON addsrangesbesidelinesfor such a unit only,suggestfinds the unit a citation sits in by its ranges, and a change draft quotes each range. Versions are unchanged, so nothing dangles. Measured: no unit of the nine adopters with a relation log has more than one range (theirlinesare unchanged); one volunteer spec has one, the motivating chapter.Spec-shape warnings share one listing (#292, #306). The text report's
List-shaped keyslist is now a group of oneSpec shape (warnings; none fails)listing, beside the path-heading warnings and any later kind; the JSON gives every such warning asspec_warnings(kind,file,line,unit,message), and keepslist_keysas it was. Nothing fails that didn't. Spec §11.2, §11.12.Scan errors are collected and reported once (#292, #305). A spec or test that can't be read as written (an unplaced contract fence, a malformed marker, a repeated id, a block or hint left open, a deferral citing no unit, an unreadable
verifiesordeviationtag) no longer stops the scan at the first one with a stack trace. The scan reads past each error to the end of every file, and every mix task reports them all at once, sorted,file:line: messageeach, with no stack trace, failing once.mix surfex.status --format jsonprints{"failing": true, "scan_errors": [...]}in place of a status, and a status that scanned hasscan_errors: []. Messages are unchanged. A team marking a spec for the first time used to need one run per error (8 unplaced fences took 9 runs).Surfex.Scan.Markdown.sections/3,records/4andSurfex.Scan.ExUnit.tests/6,records/6still raiseArgumentError, once, naming every error one per line. A repeated id is now reported at each later use, not only the first. Spec §11.11. Measured on the nine adopters with a relation log: none has a scan error at its HEAD, so none sees a change.
Fixed
A marked table and the rows of an
ignore:table keep 0.10.0's versions (#338, #339). Two changes unreleased since 0.10.0 re-versioned units whose text hadn't changed, and every relation to them would have dangled on the upgrade. #305 made a marked table's version cover its header line with its pipes, where 0.10.0's covers the header's cells joined without them; #317 trimmed the cells a row of anignore:table is versioned from, so| a | b |versioned asa|b, nota | b. Both now version exactly as 0.10.0 did, and the rule is unchanged. Measured before the fix, comparing every unit's version under 0.10.0 and main across the 17 projects with a.surfex.exs: 39 table units in three projects re-versioned (1, 1 and 37), dangling 7, 39 and 272 relations, each project green on 0.10.0 and failing on main; none marks anignore:table. After it, no unit of any of them re-versions, and no id appears or disappears. A new §23.3 extends §23's stability promise from code versions to spec unit versions, a test pins every kind of spec unit's version to the literal 0.10.0 gives it, and the release check compares every unit's version across the projects that use surfex before each release (RELEASING.md). Upgrade step: none from 0.10.0. A log recorded on an unreleased main since #305 re-records its table relations once.A marked table's row is read as GFM reads it, and its KEY as a reader sees it (#286, #317). The row splitter toggled "in code" on every backtick and read
\as an escape everywhere, so a row holding`ESC \`or a double-backtick span holding a backtick (`` CSI Ps ` ``, what surfex's own golden writer writes) read as one key swallowing the rest of the row. Rows now split on every|not preceded by a backslash, in a code span too (GFM: write\|), and code spans are CommonMark's: an N-backtick span closes at a run of exactly N, with no escapes inside. KEY keeps a code span's text as written (its backticks included), undoes backslash escapes outside spans, and drops emphasis wherever CommonMark reads it as emphasis, not only around the whole cell:Generated test *files*keysGenerated test files, whilesnake_case_nameand`*ptr`are unchanged. One reader does all of this, beside the golden writer, and the gate, the citation pass's table rows and the golden tests read cells with it too: a cell with\|in it no longer shifts the citation columns. Spec §11.15, §2.2.Upgrade step (re-keyed rows). A row whose key reads differently has a new id, and its recorded relations dangle under the old one. Move each with
mix surfex.move OLD NEW. The rows that change are those whose key holds emphasis inside the cell (a *b* c), a backslash escape (\*), a backtick inside a double-backtick span, an unpaired backtick, or an unescaped|inside a code span (which now splits the row: write it\|). Measured: the three adopters with marked tables (279 rows, with recorded relations) have no row re-keyed, and the citations of the nine adopters with a relation log and of two volunteer specs are unchanged. With every table of their specs marked (a scratch copy), 13 of 2,410 rows across ten projects would re-key: 11 for emphasis inside the cell (in five projects) and 2 that now split as GFM does (in one).A fence is read by CommonMark's rule in the citation pass (#287, #311). The citation pass found fenced code blocks with a pattern that only opened on a lowercase info string, so an
elixir contractortest:idfence was skipped and its closing line was taken as the next fence's opening: the prose after it was read as a code block and the next real fence's code was not. It now reads fences as the spec scan does (any info string, tildes, a closer only of the same character and length), and credits a fence's tokens to(code block)at their own line rather than line 1. Spec §6.8.A class marker with a malformed name says the name is the problem (#288, #309).
<!-- surfex: class defect log: … -->got only the marker's form,a class marker is <!-- surfex: class NAME[: REASON] -->, which didn't say the space broke it. The scan error now names the name as written and, where joining its words with-makes one, the name to write:`defect log` is not a class name: letters, digits, - and _ (no spaces); write `defect-log`. It is one of the collected scan errors (§11.11). Spec §11.7.
- validate's refusal names its real cause (#298, #301). With nothing to record,
mix surfex.validate said already validated: nothing to record even when the unit
still had unvalidated implements: when the test's green run in the evidence reached
their code only at an older version (the code had changed since, so the relations
dangled), or didn't reach it at all. It now names that code and says what to do: run the
test's suite again, or name the code with --code and say how with --through.
already validated is said only when nothing is left. The refusal for want of a green
run says what the last run was, never, failed or at an older version of the test,
for a test and for a check, and for never it says that in a poncho a sibling app's suite
writes the root's evidence only when its formatter sets surfex_root:. The same messages
come through --file. Spec §18.5.
## [0.10.0] — 2026-10-15
Claims own their code (#145, plan v2). A spec states its claims at the grain it means
them, as rules, id'd paragraphs, contract fences and table rows, and each claim answers
for itself: it is complete only with its own evidence, and an implements earns only
through a test that exercises the code. Sections that only orient the reader can be
classed, open work can be deferred to an issue or a spec unit, and mix surfex.migrate
moves an existing log from section grain to claim grain (guide "Migrating to claim
grain").
This release is breaking. Claim grain is now the only reading, and a .surfex.exs
that sets claim_grain: is refused. Projects with unearned implements start failing.
Read the upgrade step under Changed (#285) before taking it. The entries below were written
while claim grain sat behind the key: wherever one says "under claim_grain: true", it now
applies to every project.
Correction, for library users (#357): Surfex.Golden began needing a second source file
in this release, lib/surfex/golden/span.ex, which this entry didn't say. A project loading
golden.ex from source with no Mix project fails with UndefinedFunctionError until it
loads golden/span.ex too.
### Added
- Rules and paragraphs as claim units (#205, #234). A claim smaller than a section is a
unit of its own, role :rule, once its author names it (spec §11.1):
- an id comment of its own line directly before a paragraph or list item,
`<!-- surfex: no-override -->`, names it `file#no-override`, as does one that starts
the item or paragraph;<!-- surfex: rules NAME -->before a list makes each top-level item a rule, its id the item's id comment or what the newrule_ids:grammar reads from its text, in the formsheading_ids:takes (:section_signreads1. §Tenancy.1.4 …);- a rule's version is its text and nested lines without the list marker or id comment, so renumbering a list changes nothing, and it is left out of its section's version;
- an item of a marked list with no id is an error naming its line, never an ordinal. Bold is never read as a claim.
require: takes the :rule role, and the status counts rules once a spec names one.
ex_doc renders the comment of its own line and the rules marker as comments, but shows
a comment inside a list item as text and lets one starting a paragraph swallow the
heading after it; §11.1 says which form to use.
A spec that names no claim scans as before. The one change for an existing spec: an id
comment of its own line that was an unclosed block's error now names the paragraph or
item after it, and a list item or paragraph already starting with <!-- surfex: ID -->
becomes a rule, leaving its section's version.
Contract fences (#205, #235, #270, #277). A fenced block after
<!-- surfex: contract -->, or opened as```elixir contract, is one unit of role:contractper function its@spec,@callbackand@macrocallbacklines name, keyed by the function it states,file#MyApp.Feed.feed/2, so changing one signature dangles only that function's relations (spec §11.1). An unqualified signature's module is, nearest first, thedefmodule M doaround it inside the fence (nested ones join), the marker'smodule:option, then the nearest enclosing heading that names one (asubjects:item, else a module alias alone in backticks), climbing past headings that name none (spec §11.9). So two functions of one name in two modules of one file are two units. A@callbackkeys apart from a@specof the same name and arity,file#MyApp.Feed.callback:init/1(macrocallback:likewise). The same id in two fences of one file, and a signature no module places, stay errors naming the lines. The new scan-record fieldcontractholds the function,MyApp.Feed.feed/2. ex_doc renders the marker as a comment, but anelixir contractinfo string swallows the heading after it, astest IDdoes.A contract stated differently in several files is listed (#270, #278). Two contract units with the same id after the file (the same
Module.name/arity, of the same kind) in several spec files, at more than one version, arerestated: the status derives%{contract, units}for each, the text report lists them, the JSON givesrestated, and the status golden holds arestatedtable and header count, each only where there is one. It never fails, with or withoutclaim_grain:(spec §13.10). Measured read-only over three adopters' specs: 4 restated contracts in one, 1 in another, and none in the third until its unplaced fences name their module.Path headings fold into an id'd section, opt-in (#205, #237). With
fold_paths: true, a heading with no id inside a section that has one is part of that section's unit: its text counts in the section's version and its hints, blocks, rules, rows and contracts sit in that section (spec §11.1). Upgrade step, when it becomes the default (underclaim_grain: truenow, for everyone in the release that completes claim grain, #260) whereverheading_ids:is set: a spec that writes ids keeps fewer units, and each folded heading's relations move to the id'd section (mix surfex.suggest --acceptcarries them as moves), or setfold_paths: falseto keep path headings as units.List-shaped table keys warn (#205, #238). A marked table's row whose key reads as a list (
1001, 1005 legacy hilite: it holds,,/orand) is probably two things in one row.Surfex.Status.list_keys/1lists them, and the status reports them in a list of their own (list_keysin the JSON), as a warning that never fails (spec §11.2).A project's citation forms (#205, #236).
unit_refs:in.surfex.exslists the forms a project cites spec units in across files, each a regex with named capturesidandfileorchapter(a spec file's leading number):~r/^§(?<chapter>\d\d)\.(?<id>[\w.]+)$/makes§03.4namespec/03-wire-format.md#4(spec §11.1).Surfex.Scan.resolver/2takes them andSurfex.Scan.resolve/2tries them first; a test'sverifies:,mix surfex.testand the recording tasks that take a unit accept the forms.Several code scanners, combined (#208, #239).
scanners:in.surfex.exslists the code scanners whose items are combined:scanners: [:elixir, {MyApp.DslScanner, opts}]keeps every Elixir item and adds a project scanner's (spec §5.3). Each item keeps its own scanner's file, lines, hash and kind. One key from two scanners is an error naming both.scanner:withscanner_opts:keeps working as the one-element list, so nothing changes for an existing config; giving bothscanner:andscanners:is refused.Surfex.Status.Config.scanners!/1reads the list.DSL items, as a contract (#208, #240). A block a DSL declares inside a module (an action, a policy) can be an item: a project scanner for the DSL gives it as a
Surfex.Itemwith the DSL's kind, the declaring module as parent, the DSL's name (keyModule.name),Surfex.SourceScan.definition_hash/1over the block, the block's lines, the keys it references as calls, andshapefor a pure declaration (spec §4.1). A DSL item carries no hidden definitions and runs no hidden code: its hash covers its block. Surfex depends on no DSL; its own tests prove the contract with a fixture DSL and scanner.Calls resolved to DSL items by a scanner (#208, #241).
Surfex.Scannergains an optional callback,calls(call, aliases, opts): the test scanner and the Elixir scanner ask each of the project's scanners implementing it about every remote call they read (a piped call with its piped value as first argument), and add the item keys it answers to the caller's calls (spec §5.4). A test drivingMyDsl.run(MyApp.Order, :checkout, …)then reaches thecheckoutitem and, through its calls, the code its block references, so evidence, the triangle and suggestions work for DSL items. A scanner without the callback is never asked, so nothing changes for one; an answer that isn't a list of keys raises naming the scanner.Surfex.Status.Config.call_scanners/1gives the scanners asked, andSurfex.Scan.ExUnit.records/4takes them.Surfex.ScannerandSurfex.Itemare supported API (#150, #208, #240). The stability promise ofSurfex.GoldenandSurfex.SourceScannow covers them (spec §23.1): callbacks and fields keep their names and shapes, additions are optional or have a default, and a change comes only in a minor release under "Changed". A test pins both.Reviews through a path no call shows (#206, #242).
mix surfex.validate TEST UNIT --code ID --through HOW --note Ncredits named code the test's green run didn't reach, withHOWsaying how the test exercises it (route GET /settings,message {:feed, _},js hook Canvas). The log entry gains an optionalthroughfield, written only when set and only on a reviewedimplements(spec §12.1, §18.2); a move, a resolve andannotatekeep it,mix surfex.historyshows it, andSurfex.Status.through_count/1counts such reviews in the status text, JSON and, when there are any,RELATIONS.md. The triangle counts the named code as exercised. Without--through, an unreached--codeis still an error. The guide andmix surfex.info validationsay that code relates to the claim it realises, and how to record that by hand. Every existing entry keeps its line and id; a log holding athroughentry needs this version to read it.Routes, LiveView events and messages are a test's calls (#206, #243). A test's
live(conn, "/carts/1"),get/post/put/patch/delete(conn, PATH)andlive_isolated(conn, Module)resolve through the project's router, read from source, to the LiveView (mount/3,handle_params/3) or the controller action; an event (render_click,render_submit, … given the view or an element or form of it) to the mounted view'shandle_event/3; andGenServer.call/cast(Module, msg)toModule.handle_call/3orhandle_cast/2(spec §11.3). The router is found from the endpoint, or named with the newrouter:key (falseturns it off). Literal paths and~ppaths with interpolated segments, matched against the route patterns in order.Surfex.Scan.ExUnit.records/5andtests/5take the routes,Surfex.Status.Config.routes/2gives them, andSurfex.SourceScan.Calls.of/4asks a reader about each whole body. Only test records change: no code version moves. On upgrade a Phoenix project's tests reach more code, somix surfex.suggestproposes moretestsrelations and the triangle reports fewer gaps; nothing that held stops holding.A claim's implements suggested from its tests, opt-in (#206, #244). With
claim_implements: truein.surfex.exs,mix surfex.suggestproposesimplementsbetween each claim (block, test hint, row, rule, contract) and the scanned code its verifying tests call directly; a hidden callback a route or message names proposes its module. Code reached only through a called function is onereached … through X: N more itemsline per claim and entry, never a list (reachedinSurfex.Suggest.all/6's result; newSurfex.Scan.reacher/1). A claim with no verifying test, and a section, get nothing: the filter is the direct-call rule, decided at evaluation, with no section pool (spec §15.1). Upgrade step, when it becomes the default (with the release that completes claim grain):suggest --acceptwill then record these as proposedimplements, which fail the check until validated; until then nothing changes unless a project sets it.Checks: gates that verify claims (#207, #245). Some claims are verified by a tool, not a test: a lint rule, a security scanner, a project's own verification task.
checks:in.surfex.exsdeclares each as[id:, run:, verifies:, inputs:]: a command that can fail, the spec units it verifies (TABLE/*for a table's every row, andunit_refs:forms), and the files it inspects (spec §11.4). A check is a scan record of the new kind:check(Surfex.Scan.Checks), versioned over its declaration and its inputs' content; the log'sverifiesnow runs from a test or a check, and ared_greenobservation may be a check's (spec §12.1).mix surfex.check [ID…]runs them and records each result as evidence in the test formatter's file (Surfex.Check). A check discriminates as a test does, failing against one set of inputs and passing against another, and thenmix surfex.confirm --evidenceconfirms itsverifies; one that never failed is validated only bymix surfex.validate CHECK UNIT --note, the note saying what it would catch (spec §17.1, §18.3). CI's--evidencecheck covers check-confirmed claims, so a check CI doesn't run reads as not run. Checks are suggested, listed as unrecorded and undeclared as tests are, close the triangle for the code in their inputs, count in completeness, and are listed in the status text, its JSON (checks) andRELATIONS.md.mix surfex.test UNITnames the checks verifying a unit, and runs them with--checks. A project with nochecks:scans and reports as before.Inert verifies tags are reported (#207, #246). A
verifiesdeclaration counts only from the test or property block it applies to, or from a check (spec §11.5, §17.2). A tag that applies to none (a@tagno test follows, a@moduletagor@describetagover a module or describe with no test, anyverifiestag undertest/support/) is listed as inert (Surfex.Scan.ExUnit.inert/2;inertin the JSON and, where there are any, inRELATIONS.md), so a misplaced tag is visible rather than silently ignored. It never fails the check, and nothing it names was ever credited by it.validatenames the arities one review credits (#209, #249). A function with default arguments is one definition under several arities (put/3andput/4), so a review of either credits both under one note.mix surfex.validatenow says so after recording, naming them (Surfex.Record.shared_definitions/2, spec §18.4), so the note is written for the definition rather than for the arity the test calls.A project's own declaration forms (#209, #250).
declares:in.surfex.exsnames other forms the test scanner reads asverifiesdeclarations, for a project that already records them:[verifies: [{:tag, :validates, strip: ~r/@[0-9a-f]+$/}]]reads@tag validates: ["Engine.15.2@abc123"](at any tag level) as declaringEngine.15.2, and{:attribute, :validates}reads@validates [...]before a test (spec §11.6). The ids resolve throughunit_refs:and are suggested and confirmed as any declaration; they are counted unselectable bymix test --only, andmix surfex.testselects them. Opt-in: without the key nothing changes.mix surfex.migrate: section grain to claim grain, one section at a time (#209, #251). For a section, each liveimplementsbetween code and it (or a table in it) is listed with the claims inside that could own the code (Surfex.Migrate.proposals/3, spec §14.1): a row whose key names it (an arity-less keyMod.funnames every arity), a contract unit for it, a claim whose verifying test calls it, or, failing those, one whose test reaches it, naming through what. Arities of one definition are one proposal. Code no claim owns is listed first, several candidates are listed and never decided.--within PREFIXtakes every section under a prefix.--reportsays what migrating buys: per section, the relations an edit dangles now and after, the marking a prose section needs first (one marker line re-versions the section), and each code item's dangle width; with no section, every section worst first and the population split into sections whose claims are already units and prose ones (Surfex.Migrate.report/3). Read-only.Migrating: a section moves over several commits, green (#209, #252).
mix surfex.migrate SECTION --acceptrecords each single proposal as animplementsto its claim, proposed, with the new entry fieldmigratesnaming the section (spec §12.1, §14.1). Such a relation doesn't fail the status while the section still holds its own, and the status lists it as migrating (text, JSONmigratingand each relation'smigrates,RELATIONS.md). Once the claim's relation is validated the pair is settled, and--acceptormix surfex.suggest --accept(a newmigratedsuggestion) retires the section's relation, noting the claim: a section never loses a relation before its claim holds one.--code ID --to CLAIMrecords a reviewer's choice. Additive: an entry withoutmigrateskeeps its line and id, and nothing changes for a project that doesn't migrate.A baseline carried to the claim (#209, #253). A section relation resting on the baseline (§18.1) migrates to a claim whose verifying test is the same baselined test, at the trusted version, exercising the code: the claim relation keeps basis
baseline, holds at once, and the section's retires in the same--accept(spec §14.1). A project that baselined at section grain starts its migration from that baseline instead of redoing it. Any other claim relation is proposed, as before.Measured read-only over the volunteer projects before release (#145, #254): of 526 sections holding section-grain
implementsin five relation logs, 121 (750implements) already have their claims as units and migrate today; in the two projects that have them, what an edit of a section can dangle falls from 1,128 relations to 413, and in the widest section the widest code item from 81 to 6. The other 405 sections (2,698implements) are prose: their first marker would dangle up to 153 relations at once, which the report counts. An import throughdeclares:read 2,370 declarations on 1,237 tests in one project's own tag form, every one of its 257 ids resolving.Verdicts: what verified means for each spec unit (#256, #258). Plan item C.1 starts here. A unit's own text is its body without the finer units inside it: a claim has some (a section or block with prose of its own, and every hint, rule, row and contract), a container has none (a heading over subsections, a section whose body is only named claims, a marked table).
Surfex.Status.derive/4gives every unit one verdict (verdicts,Surfex.Status.verdict/2)::verified(a currentverifiesof its own),:contained(none of its own, but a claim inside it is verified: its own text isn't),:unverified, or:through_claimsfor a container, with how many of its claims are verified (spec §13.4). No credit moves up to the claims inside a verified unit, and none into a unit's own text. The status lists the contained claims and eachverifiesaimed at a container (on a container: it verifies nothing), counts claims by verdict (claims: N · verified · contained · unverified · containers), and givesverdicts,contained,on_containerandcontainersin the JSON. A section now records the section whose heading it sits under (scan-record fieldunder). Additive: nothing new fails. Upgrade step:RELATIONS.mdgains a claims line among its stats, andcontainedandon containertables where there are any, so runmix surfex.goldens --writeonce.Earning: the one definition of an earned
implements(#256, #259).Surfex.Status.earning/2says whether animplementsearns, and why not:Surfex.Status.earned?/2is its yes or no (spec §13.5). Code earns its relation to a:verifiedunit, or to a container or:containedunit through a verified claim inside it whose verifying test reaches the code (directly, through what it calls, or by another arity of the same definition), holds atestsrelation to it, or whose verifying check inspects its file; a current--throughreview counts too. Otherwise it is unearned:unverified,not_exercisedornothing_inside. A section's own tag gives the claims inside it nothing. Additive: nothing reads it yet. B.3's unearned rule (#247) will failrequire: [code: [:implements]]through it, in the same release.Spec rules judge claims, and name a contained one (#256, #260). A
require:rule on a spec role (section:, …) or on the kindspec:no longer judges a container (a heading over subsections, a section whose body is only named claims, a marked table): its claims answer under their own roles (spec §13.2, §13.4). A:containedclaim averifiesrule fails is unmet and says why (why: :contained; the report line endscontained: a unit inside it is verified, its own text isn't; the JSON'swhy; the golden's(contained)).require: [spec: [:verifies]]is the one-line policy that every claim is verified. Relief only: a container that was unmet no longer is, and nothing that was met becomes unmet.claim_grain: true, the one switch for claim grain's breaking parts (#256, #260). Until the release that completes claim grain, every part of it that changes what an existing project's check reports is read only underclaim_grain: truein.surfex.exs(Surfex.Status.Config.claim_grain?/1, spec §13.2); that release makes it the only reading and refuses the key. What it changes so far: path headings fold by default wherever the spec writes ids (heading_ids:set and nofold_paths:, spec §11.1);fold_paths: falsekeeps them units; and completeness counts own text (#261, below). Coming under the same key: spec-unit classes (C.2, #257) and unearnedimplements(#247).Completeness counts own text, under
claim_grain: true(#256, #261). A claim is complete only with a validatedverifiesof its own; one inside it no longer completes it (spec §20.1). A contained claim missescontained (<unit>, …), naming the verified claims inside it, in the text, JSON andCOMPLETENESS.md; containers, marked tables among them, aren't counted. Without the key completeness reads as before. Upgrade step, when the key is set (and for everyone in the release that completes claim grain): scores drop by the contained claims, socompleteness: [min: N]can fail.mix surfex.completeness --format jsonlists each one with the verified claims inside it: add the claim to the tag of a test that really checks its prose, name the prose's claims (spec §11.1) and migrate them (mix surfex.migrate), or class the prose as asserting nothing (C.2, #257). Surfex's own spec has 49 contained sections: 79.7% of its spec units are complete under the key, against 100% without it, and settling them is its own upgrade (#263).Guides for containment (#256, #262). "Writing specs" says a section's prose is a claim: name its claims, verify it, or (with spec-unit classes) class it, and that
require: [spec: [:verifies]]never asks a container for a tag (spec §16).mix surfex.info claimsexplains the verdicts and earning, and the status, completeness and config pages the new lists, thecontainedreason andclaim_grain: true.Measured read-only over the volunteer projects before release (#145, #262), six relation logs including surfex's own: of 3,788 live
implements, 969 end at a contained claim and 28 at a container. Under the earn rule 18 of them, in one project, arenot_exercisedand 2 more, in another, end at a container no claim inside exercises; every other one earns. Completeness underclaim_grain: truemoves only in the three projects that tag hints rather than sections (spec units 100% to 79.7%, 56.5% to 46.4%, 79.0% to 60.9%); the three that tag sections are unchanged.require: [section: [:verifies]]stops failing on containers: unmet sections fall from 20 to 15, 68 to 48, 5 to 4 and 159 to 153, and stay at 75 in the project whose sections need classes (C.2). Folding by default under the key changes one measured spec, 1,389 sections to 1,178 (211 path headings folded into their id'd sections), and three others by 0 to 3.Spec-unit classes and deferrals: the markers and patterns (#257, #264). Plan item C.2 gives spec text the excusal code has.
spec_classes:in.surfex.exsdeclares the project's classes, each a name and a reason, selected by surfex's own marker<!-- surfex: class NAME[: REASON] -->in a section, by afiles:orheadings:pattern, or by a project's existing comment throughmarker:(an alias). A unit waiting on an issue is deferred,<!-- surfex: deferred #123[: REASON] -->, in a section or a marked block. Both markers are own-line comments that ex_doc renders as nothing, and they sit outside every unit's version, so adding one dangles nothing. The scan records carryclassanddeferred(spec §11.7). A class marker in a block or rule, an undeclared class, two markers in one unit, a deferral without an issue and a marker under a folded heading are errors naming the line;spec_classes:refuses a glob that matches no spec file. Nothing in the status reads them yet: what a class excuses arrives with #265, underclaim_grain: true.The one change for an existing spec: an own-line comment a declared
marker:alias reads leaves its section's text, so that section's version changes once.Excused and deferred units in the status, under
claim_grain: true(#257, #265). The status always listsexcused(each classed unit, its class, reasons, how it was selected and the claims inside it) anddeferred(each deferred unit, its reference and reason), in text as one header line and in JSON. Underclaim_grain: trueit reads them (spec §13.6): a classed section with no claim inside is:excused, a deferred unit:deferred, and with claims inside either is a container. A class excuses a section's own text, never a named claim inside it: every rule, row, hint, contract, block and subsection inside stays a claim.require:spec rules and the triangle skip excused and deferred units, and animplementsto one earns nothing (unverified). A liveverifiesto a classed section, animplementsto an excused one, or a declaration naming a classed section is contradicted, and fails.mix surfex.suggestproposes noimplementsfrom a classed section's citations and noverifiesto a classed unit (§15.2), and completeness leaves excused and deferred units out of the spec score, counting them on lines of their own (§20.2). Upgrade step, underclaim_grain: truenow and for everyone in the release that completes claim grain: classing a section your log relates to contradicts those relations; retire the ones that were narration, or don't class the section.Deferrals go stale:
issues:andmix surfex.status --issues(#257, #266). A deferral holds while its issue is open and its unit isn't built (spec §13.7). Underclaim_grain: truethe status lists and fails on each stale deferral:built(the unit has its ownverifiesnow),closed(its issue is closed) orunresolved(the tracker couldn't say). Issue state is an input, never stored:issues:in.surfex.exsdeclares the project's own command ([command: argv, state: key, project: name], with{ref},{n}and{project}substituted, run with no shell),Surfex.Issues.states/3runs it once per reference, andmix surfex.status --issuespasses the answer toSurfex.Status.derive/4asissues:. A command that exits non-zero stops the task with its output. Without--issuesnothing runs and onlybuiltis judged..surfex.exstakes the new keysspec_classesandissues(§13.2).Excusals in the record, the guide and the measurement (#257, #267).
RELATIONS.mdgainsexcusedanddeferredtables keyed by unit (andcontradictedandstale deferralswhen any), with their counts in the header, andCOMPLETENESS.md's header counts the units excused by class and deferred (spec §13.8). Both appear only where a spec has a class or deferral, so other goldens render as before. "Writing specs" gains "Text the spec doesn't verify" (§16.1): class prose that asserts nothing, name the real claims inside it first, verify tool-checked rules with a check, defer what waits on an issue.mix surfex.info claims,status,configandcompletenesssay the same.Measured read-only over the volunteer projects before release (#145, #267), classes added in memory only. In the two relation logs measured with patterns or their own unrelated-section lists,
require: [section: [:verifies]]unmet sections fall from 75 to 35 and from 48 to 9, and spec completeness underclaim_grain: truerises from 46.4% to 62.5% and from 84.5% to 96.4%. Classing by pattern contradicts existing relations where a classed section holds real claims: 5 relations to one decision record in one project, 4 to one principles section in another; those are the relations to re-home or the sections not to class. Across the specs without a log, an existing informative comment read throughmarker:classes 200 sections (31 of them over subsections, 185, that stay claims) and changes those 200 sections' versions once, and file patterns class 49 to 210 sections per project, none of them over a named rule yet: a chapter whose MUSTs aren't named as rules is excused whole, so name them first.Upgrade step, under
claim_grain: truenow and for everyone in the release that completes claim grain: declarespec_classes:; class descriptive sections by pattern or marker (or pointmarker:at a comment you already write); name the real claims in any section you class by pattern; defer what waits on an issue with<!-- surfex: deferred #N -->; settle each contradicted relation, usually by retiring narration; and addissues:andmix surfex.status --issueswhere your tracker can be asked.Unearned: an
implementscounts forrequire: code:only when it earns, underclaim_grain: true(#207, #247). B.3's guard against claims written only to own code (spec §13.9). The status lists every liveimplementsthat doesn't earn (§13.5,Surfex.Status.earning/2) asunearned, with its code, spec unit and why (unverified,not_exercised,nothing_inside), in text with a count in the header, in JSON (unearned) and as aRELATIONS.mdtable with a header count. An unearned relation meets norequire:rule: code whose onlyimplementsare unearned is unmet,why: :unearned, and where the policy isrequire: [code: [:implements]]every unearned relation fails the status, a spare one beside an earning one included. Credit never flows up from an enclosing unit: code earns through a verified unit, or a verified claim inside it whose test or check exercises the code. Completeness reads code the same way (§20.3): code whoseimplementsall earn nothing missesunearned. Withoutclaim_grain:nothing changes and no list, count or table appears.Measured read-only over the adopters with a relation log before release (#145, #247), under
claim_grain: truewith each project's ownrequire:: 18 relations unearned in one project, allnot_exercised, against 4 sections (18 code items newly unmet, 17 incomplete), 2 in another (1 code item unmet), and 0 in the six others.Upgrade step, under
claim_grain: truenow and for everyone in the release that completes claim grain: runmix surfex.statusand settle each unearned relation by its why.not_exercised: the code belongs to another claim, or the claim inside that covers it has no test reaching it;mix surfex.migrate --reportshows where it goes.unverified: add a test or check that verifies the unit, or retire the relation.nothing_inside: relate the code to a claim, not the empty container. RegenerateRELATIONS.md(mix surfex.goldens --write), which gains anunearnedcount.Surfex checks itself under claim grain (#256, #263). Its own
.surfex.exssetsclaim_grain: true, withcompleteness: [min: 100]andrequire: code:unchanged. The switch left 58 of its sectionscontained(completeness 95.2%), each settled on its own: 57 are now verified by tests that check their own prose, tagged with the section beside the hint they already verified (270verifies, each recorded on its test's red run or reviewed one by one), and one, a single sentence naming a module over the claims below it, is classedinformativethroughspec_classes:, its oneimplementsmoved to the hint inside withmix surfex.migrate. Nothing was renamed or removed from the spec. This is the upgrade step of §20.1 done on a spec of 267 claims, as a reference for the work it asks.mix surfex.migrate --reportis the migration's one work list (#269, #280), as #256 promised. Each contained section (noverifiesof its own while a claim inside it is verified, spec §13.4) gets acontained:line naming the verified claims inside it, and with no section named the report covers every contained section, including those holding noimplements, which it used to leave out; the population counts them (spec §14.2).--format jsongives the same report for tools (Surfex.Migrate.json/1; refused without--report).Surfex.Migrate.report/4takesSurfex.Status.derive/4's options, and the task passes the project'sclaim_grain:and classes, so what reads as contained is what the status says.Measured read-only over eight adopters with a relation log, under
claim_grain: true: the report now lists 2 to 120 contained sections per project (220 in all), of which 85 hold noimplementsand were missing from it before; one project's report went from no sections to 11. Surfex's own lists none, its contained sections settled under #263.Upgrade step: none; the text report gains lines, never loses any. A tool reading the report's population as two kinds should expect a third key,
contained.A declared dispatch function reaches the handlers its table lists (#272, #281). Code that runs its handlers through a table (
apply(module, fun, args)from a map of operations) reached no handler from a test driving it, so each handler earned only through a unit test calling it or a--throughreview per relation.dispatch: [{MyApp.Ops, :run, 3}]in.surfex.exsdeclares the dispatcher once (spec §11.10):- its module's literal entries,
{Module, :fun}(every arity defined),{Module, :fun, arity}and&Module.fun/arity, inside module attributes, map literals and keyword literals, are its targets, read from source, never traced; - a call naming the dispatcher, in a definition or a test, also calls each target and names its module, so reach, the triangle, evidence and earning follow;
- a scanner's
calls/3answer for a call takes precedence over the table; - the status lists each dispatcher with its targets and the entries naming unscanned
code (text, JSON
dispatch, and adispatchtable anddispatcherscount inRELATIONS.md), only wheredispatch:declares one. A dispatcher whose module lists no literal entry is unresolved: reported, never failing. A malformeddispatch:, an undefined dispatcher, one in a@moduledoc falsemodule, or the key without the Elixir scanner is refused.
Measured read-only on one adopter whose S3-style API dispatches 56 handlers through one table: the table reads whole (56 targets, none unscanned), and test→handler reach grows from 59 to 166 pairs. Its 2
not_exercisedimplements stay: their verifying HTTP tests reach the endpoint module, but the endpoint plugs its pipeline (plug Pipeline), which is no call, so they never reach the dispatcher (proposal #282).- its module's literal entries,
Lines a project declares are not claims (#273, #283). Under claim grain everything in a section that isn't a finer unit is its own text, so a provenance line kept a section contained for good, and classing the section would excuse any sentence added to it later.
not_claims: [~r/^Legacy reference: \S+$/]in.surfex.exs(spec §13.12):- each non-blank line of a section's or marked block's own text is matched as written
against the patterns, and a matched line is left out of what the verdicts (§13.4) and
completeness (§20) read (
Surfex.Scan.Markdown.claimless?/1). Versions still cover every line, so editing one still dangles; - a section left with only matched lines is a container; a sentence no pattern matches makes it a claim again. A paragraph naming code is not left out by rule: a project that wants that writes a pattern;
- the scan records what each unit's lines matched (
Surfex.Scanfieldnot_claims), and the status lists each pattern with its lines and units,0for one matching nothing (derivenot_claims, text, JSON, and anot claimstable inRELATIONS.md), only where the key is set. Anot_claims:that isn't a list of regexes is refused.
Upgrade step: none; without the key nothing changes. Measured read-only on the adopter that asked for it: a pattern on its provenance prefix matches 26 lines in 26 sections, and none becomes a container yet, because each still has other own text (120 contained before and after). 12 of those lines carry behaviour on the same line as the reference, so a pattern on the prefix alone would leave behaviour out: anchor it to the whole line (14 lines are the reference alone) and keep the reference on a line of its own.
- each non-blank line of a section's or marked block's own text is matched as written
against the patterns, and a matched line is left out of what the verdicts (§13.4) and
completeness (§20) read (
A deferral may cite the spec unit that records the decision (#274, #284). Some deferrals are spec decisions ("deferred past v1", with the reason in a decision table), not tracked work, and forcing an issue for them only satisfied the marker.
<!-- surfex: deferred UNIT[@VERSION][: REASON] -->(spec §13.13) cites a spec unit in any form a declaration may name one,unit_refs:forms included:- it is resolved when the spec is scanned (
Surfex.Scan.Markdown.records/4, givenunit_refs:), and one citing no unit or several raises naming the file and line; @VERSIONpins the cited unit's 8-hex version. Underclaim_grain: truethe deferral is stale aschangedwhen the unit's version differs (its decision text was edited),unpinnedwith no pin,gonewithout the unit, andbuiltas before. The report names the version to write and the marker's line; JSONstale_deferralscarrypin,versionandline, anddeferredcarrycitesandpin, for citations only;- the scan records
%{ref, reason, cites, pin, line}(Surfex.Scanfielddeferred). Issue deferrals are unchanged, and--issuesasks only issue references.
A pin rather than staleness on disappearance alone: nothing is stored for a deferral, so what its author judged lives in the marker, and only a pin makes an edit to the decision text re-open the deferral. No tracker is needed, so it is judged offline and in every CI job. A reference that isn't an issue was refused before, so no existing spec reads differently.
Upgrade step: none; no adopter writes a deferral marker yet. Measured read-only on the adopter that asked, with the marker added to a scratch copy: citing its deferred table resolves only once the cited file is in
sources:(its.surfex.exsscans one chapter); unpinned it is one stale deferral, pinned none, and an edit to any row of the unmarked table makes itchanged, since the table is its section's own text.- it is resolved when the spec is scanned (
Surfex.Itemgains adispatchfield (#272, #281), for scanner authors: on a module item, the dispatch functions declared in it with what each one's table lists (spec §4, §11.10). It defaults to%{}, so a project scanner's items are unchanged.A deviation holds back the
implementsit says the code doesn't meet (#255, #279).mix surfex.confirm --evidenceno longer validates animplements, dangling or proposed, whose spec unit is deviating or holds a deviating unit at any depth (spec §13.11): a module that fails one of its section's requirements doesn't implement the section, however green its other tests are. Each the evidence would have validated is listed asheld back by a deviation: implements code … ↔ spec … (deviates: #119); once the tag goes and the test passes, the next evidence run validates it. A deviation test's failing run still records itsverifies.Surfex.Status.derive/4givesheld(each held unit with its references), which also marks a proposed relationdeviates, andSurfex.Record.evidence_outcome/4returns the held list beside the entries. Underclaim_grain: truea section a deviating one sits under is held too, andSurfex.Status.earning/2answers{:unearned, :deviates}for animplementsto a held unit, asked first, sounearned,require: code:and completeness agree with confirm. No new option;deviations: :failis unchanged.Measured read-only over the adopters before release: only one tags deviations, and none are left at its head. At the commit that tagged them (23 deviating units, 4 references) 17 proposed
implementswould have been held back (19 under claim grain, plus one validated relation now unearned asdeviates, 11 code items unmet); a later commit with 5 deviating units held 3 (4). Those are the relations that project withdrew by hand after each evidence run.Upgrade step: none for a project without deviation tags. With them, expect
mix surfex.confirm --evidenceto list held relations instead of recording them; stop withdrawing them by hand. Underclaim_grain: true, animplementsto a held unit is unearned asdeviatesuntil the fix lands.
Changed
Breaking: claim grain is the only reading, and
claim_grain:is refused (#285, for #145). Every part of claim grain that shipped behind the transitional key now applies to every project, and a.surfex.exsthat setsclaim_grain:,trueorfalse, raises: the message names the key, says claim grain is now the only reading, and points to this step andmix surfex.migrate --report(spec §13.2). A config that only drops the key reads as before. For a project that never set it, what changes:- contained sections: a claim is complete only with its own evidence, so a section
verified only through a claim inside it misses
containedin completeness, and containers (marked tables among them) are no longer counted (spec §20.1); - earning: an
implementsthat earns nothing is listed as unearned and meets norequire: code:rule; whererequire: [code: [:implements]]is set it fails, and code with no earningimplementsis unmet (why: :unearned) and missesunearnedin completeness (spec §13.9, §20.3). The text header always counts them; - classes and deferrals are read: an excused or deferred unit isn't judged by
require:spec rules or counted in completeness, a relation to an excused section is contradicted, and a deferral that no longer holds is stale; both fail (spec §13.6, §13.7, §13.13, §20.2), andmix surfex.suggestproposes nothing from a classed section's own text (spec §15.2); - deviations hold back the sections a deviating unit sits under, for
confirm --evidenceand for earning (spec §13.11); - path headings fold under an id'd heading wherever
heading_ids:is set andfold_paths:isn't (spec §11.1).
Library API:
Surfex.Status.Config.claim_grain?/1is removed;Surfex.Status.derive/4no longer reads aclaim_grain:option and itspolicyno longer holds one;Surfex.Record.evidence_outcome/4no longer readsclaim_grain:from its meta;Surfex.Suggest.all/6no longer takesclasses:. Each such option is ignored.Measured read-only over the 9 projects with a
.surfex.exsand a relation log, each at its committed head, with this checkout's code against their files (nothing written in any of them). Before is each project's own config as it stands, after is the same config read now:- failing projects: 2 before, 4 after. Status failures per project, before → after: 0 → 0 in five, 0 → 36 and 0 → 3 in two (unearned relations and the code they leave unmet), and unchanged in the two that already failed (their failures are proposed and dangling relations, read the same either way);
- unearned
implements: 18 and 2 in two projects, 0 in seven; - contained sections: 2 to 120 per project, 223 in all (listed before too); spec completeness falls in four projects, by 3.7 to 18.1 points, and holds in five;
- none declares spec classes or deferrals yet, so nothing is excused, deferred, contradicted or stale.
Upgrade step (breaking): delete
claim_grain:from.surfex.exsif it is there, then runmix surfex.statusandmix surfex.migrate --report. Settle each unearned relation by its why (the #247 entry above); settle each contained section by tagging it on a test that checks its own prose, by naming its claims and migrating (mix surfex.migrate), or by classing prose that asserts nothing (spec_classes:). Acompleteness: [min: N]floor can fail until then. Regenerate the goldens (mix surfex.goldens --write):RELATIONS.mdgains itsunearnedcount andCOMPLETENESS.mdits new scores. A library caller dropsclaim_grain:andclasses:.- contained sections: a claim is complete only with its own evidence, so a section
verified only through a claim inside it misses
Fixed
mix surfex.suggestagrees in number (#269, #280): a settled migration moved to one claim reads(moved to X, which holds it now); to several,which hold it now.A contract signature ends where its text parses, not at its indentation (#271, #276). B.1's contract fences ended a signature at the first line not indented deeper than its head, so a multi-line type whose closing
},),]or>>came back to the head's column was cut one line early and reported as a signature that doesn't parse. A signature now takes the next lines while its text doesn't parse, whatever their indentation, then the lines indented under it, and stops at the next@spec,@callback,@macrocallback,@type,@typepor@opaqueline or the fence's end (spec §11.8). A sketch that never parses, such as%{id:, …}, is still an error naming its line. Nothing changes for a fence that read before.
[0.9.1] — 2026-10-14
What surfex writes now reads right. Spec pages published with ex_doc keep their headings
and hide their markers, given the test:ID hint form and a heading id on the next line
(#195). Golden cells holding | or a backtick render as one cell (#199), and a hand-edited
golden row is reported by the column that changed (#215). mix surfex.completeness --summary prints just the scores for a gate step (#216). One upgrade step, for goldens
with such cells: regenerate them.
Added
Spec forms ex_doc renders (#195, #228). ex_doc's markdown (EarmarkParser) shows a heading's id comment and anchor as heading text, and renders a
```test IDhint, whose info string holds a space, as a line of text that swallows the heading after it. Two spellings it renders cleanly are now read as well:- a test hint whose info string is
test:ID,```test:totals-counts, read exactly astest IDis, with the same id and version; - a heading's id comment on the line after it,
## Totalsthen<!-- surfex: totals -->. That line is also a block's opening marker, and it still opens a block wherever a<!-- /surfex -->closes it before the next marker or heading. It is the heading's id only where it used to be an error (a block never closed, spanning a heading or opening inside itself), so no spec that scanned before changes meaning. A heading with an id on both lines is an error.
Switching a spec to them changes no id and no version: surfex's own spec moved every anchor and hint across with its relation log untouched. Spec §11 now says which forms each renderer shows, and a test renders each one through ex_doc so it stays true.
- a test hint whose info string is
mix surfex.completeness --summary(#216, #233). It prints the score lines only, overall and per kind, and still fails belowcompleteness: [min: N]with the same message. A gate step that enforces the floor no longer prints every incomplete item, whichgoldens: [:completeness]already commits asCOMPLETENESS.md. Without the flag the output is unchanged.Surfex.Completeness.summary/1renders the lines.
Fixed
The claim that heading id comments suit ex_doc (#195). 0.7.0 said an id comment at the end of a heading "doesn't render, so it suits ex_doc extras". It renders as heading text there and leaks into the anchor link. Put it on the line after the heading.
surfex's own published spec and guides (#195, #228) lost a heading after every test hint and showed every anchor as text on hexdocs. They use the forms ex_doc renders.
Golden cells holding
|or a backtick (#199, #229).Surfex.Goldenwrapped every:code,:atom,:locusand:versioncell in single backticks with nothing escaped. Under GFM, which is how GitLab and GitHub render a golden, a|split the cell even inside the span (an extra column, the rest of the row shifted), and a backtick closed the span early or left it open. The golden stayed byte-stable, so its gate passed; it was only wrong when read. Every backticked cell is now a code span that reads back as its text:|is escaped as\|, the delimiter is one backtick longer than the longest backtick run in the text, and the text is padded with a space when it starts or ends with a backtick, or starts and ends with a space. No API changes. The status golden (RELATIONS.md) builds its composite cells by the same rule and escapes|in their free text, so an id that holds a pipe (an operator such as|>, a test name) or a backtick keeps its row whole, and the gate's drift report names such an item by its text. A{:raw, …}or plain-string cell is still written verbatim: a caller composing one escapes it.Upgrade step: a golden changes only where a backticked cell holds
|or a backtick (or, in the status golden, a note or reference holds|); run its--writetask (mix surfex.goldens --writefor the status and completeness goldens) once after upgrading, and commit what changes. Those rows were rendering wrong.A hand-edited row read as a prose change (#215, #231). The gate's drift report keyed each row by its first cell (
Item, else the first column) and kept one row per key, so in the status golden, where many rows share anEnd, a row was hidden behind its neighbour, and editing its state by hand was reported as "No row changed: the prose or a stats line did".Surfex.Gate.drift/2now tells tables apart by their##heading and header, keys a row by the cells that identify it (Item, else the fewest leading columns that name every row once on both sides), compares rows whole, and names each changed cell with its old and new text:excuses: class type · code t:X.t/0 — State :current → :retired. A row with aVersioncolumn is now compared whole too, so a cell beside the version that changed is reported rather than missed. Cells are split as GFM splits them, on each|not escaped as\|. "No row changed" is kept for a change outside every row. No golden's bytes change; only the failure message reads differently. In the local checkouts of the projects using surfex, 3 of 31 committed goldens have rows broken this way (25 rows in all).
[0.9.0] — 2026-10-14
Status reports what it used to miss. A verifies tag the log doesn't record now fails
(Unrecorded, #203), and so does a refines whose unit moved out of its section
(Moved, #218). A known deviation, a test kept red against a tracked issue, has a state
of its own that doesn't fail the gate until you ask (Deviating, #214). Tests calling
through brace imports reach their code (#194), and the code of a @moduledoc false
module is versioned in what runs it (#219). The status check also grows with the project
in proportion again (#204). A minor release, because what fails and some versions change:
upgrade steps under Changed, each with its measured cost.
Added
Surfex.Scan.resolver/1(#204, #220): the spec units indexed once, by full id and by bare id.Surfex.Scan.resolve/2takes it in place of the scans and resolves exactly as they do (unknown, ambiguous,§-ids), so code resolving many references builds it once.Known deviations:
@tag deviation: "<ref>"(#214, #223). A suite that passed while the code deviated from its spec gets each deviation's test written from the spec; it fails, so it is skipped with a reference to what will fix the code. surfex had no state for that: the requirement'sproposedrelations failed the check until every deviation was fixed, and averifiesrecorded on the red run counted the requirement complete. Now the tag (free text, beside theskip:; at test,describeor module level) makes each unit the test declares deviating:mix surfex.statuslists it under Deviating with its reference and test. Aproposedrelation to it, or to a unit it sits in, is markeddeviatesand doesn't fail.--no-deviations(deviations: :fail) fails on any deviation, for a release.- A deviation test that passed at its version in the evidence is a stale deviation and fails: drop the tag and validate. A skipped test never passed, so only a run that includes it judges this.
- A deviation test that runs and fails is listed under Deviating, not under Failed. Any other failed test still fails.
- A deviation tag on a test that declares no spec unit is broken.
- Completeness: a deviating unit is incomplete, missing
deviates (<ref>), whatever its basis. RELATIONS.mdgains adeviatinggroup (unit, reference, test): the ledger of known deviations.COMPLETENESS.mdshowsdeviates (<ref>). The JSON hasdeviating, and each relation adeviateslist.
mix surfex.test --deviations(#224) runs exactly the deviation tests, skips included, so their evidence says whether any is stale: run it on demand or in a scheduled job, thenmix surfex.status --evidence. ExUnit includes a skipped test only by its reason, so it runsmix test FILES --only location:FILE:LINE … --include skip:REASON …(Surfex.Select.deviations/1,Surfex.Select.deviation_args/1), and refuses, before running, another test in those files skipped for a deviation test's reason, or a reason that isn't a literal. Test records gainskip, the reason as that filter matches it.Surfex.Scangainsdeviation, a relation statusdeviates, andSurfex.Status.derive/4deviatingand thedeviations:option. Nothing changes for a project without the tag.Uncredited red→green is reported (#194, #225). A test version that failed and then passed against the same code versions never discriminates, so
mix surfex.confirm --evidencecredited nothing, and nothing said so: the change that made it pass was outside what the test reaches (a call the scanner didn't see, a change outside the scanned code, or a flaky test).mix surfex.status --evidencenow lists each such test under Uncredited, with the code its runs recorded, unless the log records the version as discriminated. Information, never a failure.Surfex.Evidence.uncredited/1finds them,Surfex.Status.derive/4returnsuncredited, and the JSON hasuncredited.
Changed
A
@moduledoc falsemodule's code is versioned in what runs it, and reach goes through it (#219, #226). 0.8.0 covered a module's hidden definitions; a hidden module was still skipped outright, so a test driving a Mix task stopped at the helper module the task hands its work to, and changing that helper dangled nothing. The Elixir scanner now reads every file before it versions anything, and treats each definition of a@moduledoc falsemodule as hidden code. An item's version covers the hidden modules' code it runs, in any module and any file, transitively, stopping at code an item versions (a public function, or a shown module's hidden definition): changing the public function the helper calls dangles that function alone. The hidden module still has no items,Surfex.SourceScan.module_hash/1anddefs/1are unchanged, and a module nested in it is still scanned.Surfex.Itemand code records gainruns, the hidden modules' code the item runs with its calls: a call naming it reaches what it calls and no record for it, and a test importing a hidden module resolves against it.Upgrade step. Every item running a hidden module's code gets a new version once. Measured on eight adopting projects: four have no item running any, and keep every version; in the other four, 1 to 11 item versions change, and 11 to 62 tests reach more code (none reaches less). Most of the relations that dangle are
testsrelations, whichmix surfex.suggest --acceptre-records; aftermix test,mix surfex.confirm --evidencere-confirms theimplementsconfirmed by evidence (2 or 3 per project). What remains, 1 to 5implementsvalidated by review per project, plus a few excuses and baselined relations, is a review of the helper code now in the version.A test's declaration with no
verifiesrelation fails the check: Unrecorded (#203, #221). A test tagged@tag verifies: "id"that resolves to a real spec unit, with noverifiesrelation between them in the log, was reported nowhere: the tag read as done while the test contributed nothing. It is now unrecorded, the other direction of undeclared, and fails like it. A tag left on a relation that was retired is listed under the same heading, "declared, but the relation was retired (note): remove the tag, or reinstate it", and fails too.Surfex.Status.derive/4returns them asunrecorded(each with its test, its spec unit and, when retired, the retire's note), the JSON asunrecorded, andRELATIONS.mdas anunrecordedgroup and count. No setting: arequire:policy can't express it, and nothing needs one.Upgrade step.
mix surfex.statusmay newly fail. For each test and unit it lists: a tag with no relation is the onemix surfex.suggestalready offers underverifies; record it and validate it (a failing run, ormix surfex.validateafter reading both ends), or remove the tag if the test doesn't verify that unit. Judge each one; don't accept them in bulk. A tag on a retired relation: remove the tag, or reinstate the relation if the retirement was wrong. Measured on eight adopting projects: none has a tag without a relation, and two have one tag each on a retired relation, so the upgrade newly fails 0 to 1 declarations there. One of the two is a module's@moduletaginherited by a test it doesn't fit. Because it changes what fails, this ships in a minor release.A
refinesrelation whose unit moved out of its section fails the check: Moved (#218, #222). Moving a marked block unchanged into another section changes neither end's version (a section's version leaves its blocks out), so the oldrefinesrelation stayed current, stating a structure the spec no longer has, whilesuggestproposed only the new one. Status now re-readswithinfor every liverefinesrelation: one whose unit no longer sits in what it refines is moved, names where the unit sits now, and fails.Surfex.Status.derive/4returns them asmoved(from,to,now), the JSON asmoved, andRELATIONS.mdas amovedgroup and count.Surfex.Suggest.all/5gainsmoved, whichaccept_all/5retires beside the newrefinesrelation, so onemix surfex.suggest --acceptsettles the move; a danglingrefinesrelation whose unit moved, which refresh can't re-establish, is retired the same way.Upgrade step.
mix surfex.statusmay newly fail on a block or test hint moved between sections since itsrefinesrelation was recorded. Runmix surfex.suggest: it lists the relation to where the unit sits now and the old one's retirement;--acceptrecords both. Both are structural facts read from source, so nothing needs judging. Measured on eight adopting projects (784 liverefinesrelations, four of them using blocks or hints): none has a moved relation, so the upgrade newly fails nothing there. Because it changes what fails, this ships in a minor release.
Fixed
Surfex.Status.derive/4grows with the project in proportion (#204, #220). It was quadratic in the spec units: each test declaration resolved by filtering every scan, and the triangle walked every verified unit'swithinchain for each spec unit (the baseline check, every verifies relation for each baselinedimplements). Both are now indexed once per derive, and aderive-lineartest guards the growth. On a project of about 2,900 records and 27,500 log entries derive fell from about 3 s to 0.65 s, with an identical status.mix surfex.suggest,mix surfex.testand the baseline resolve declarations through one resolver too.A test's calls resolve through brace imports, and credit the imported module (#194, #225).
import Base.{A, B}imported nothing for surfex, so a test callingf()through it reached none ofA's orB's code: the run recorded no versions for it, and its red→green against a change there was lost. Now each member is imported, andonly:andexcept:are honoured in either form. Given the project's code, a local call resolves only to a function the imported module defines, and names the module too, asA.f()would: a test calling a module's functions through an import exercises the module, so a section the module implements no longer reports it as a triangle gap. A call no scanned imported module defines (ExUnit'sassertbesideimport A) is no longer listed under it; through a module that isn't scanned, nothing changes.Surfex.Scan.ExUnit.records/3andtests/3take the code records for this, andmix surfex.statusandSurfex.ExUnitFormatterpass them. Code calls read brace imports andonly:/except:too.Upgrade step: none required, but run
mix surfex.suggestafter upgrading: tests calling through imports gaintestsproposals to the functions and modules they now reach, each to be confirmed by evidence or review. Measured read-only on eight adopting projects: in two, 307 tests reach more code and 12 triangle gaps close; no test reaches less anywhere and no gap opens. In six, the calls of 502 tests drop candidates no scanned module defines, which reach nothing either way.
[0.8.0] — 2026-10-13
A planted bug now fails the gate. A failed test fails its relations whatever validated
them, so a project validated by review no longer passes while the tests behind its
requirements fail (#211). And a version now covers the hidden code its item runs, so
changing a GenServer's handle_call/3 dangles the relations on its module and on the
functions that call it (#210). A minor release because the second changes versions:
upgrade step below, a one-time review of the hidden code no earlier review saw.
Changed
A version covers the hidden code its item runs (#210, #193, #213). A
@doc falsedefinition, or an@implcallback with no@doc, is no item, and until now no version covered it, so changing a GenServer'shandle_call/3dangled nothing. The Elixir scanner now folds hidden definitions into versions. A module's version covers its hidden definitions; a module with none keeps its version. A public function's version covers the hidden definitions it runs: those it calls locally, and the module's hidden callbacks when it dispatches through its own behaviour (GenServer.call,GenServer.start_link,:gen_statem.callfrom a module thatuses or declares that behaviour). A call naming a hidden definition, such as a Mix task'srun/1, now reaches the module and goes on through what the definition calls, so evidence credits the code a task hands its work to.Surfex.Itemand code records gainhidden, andSurfex.SourceScan.module_hash/1anddefs/1are unchanged, so surface goldens built on them don't move.Upgrade step. Every module with a hidden definition, and every function running one, gets a new version once, and its relations dangle. Measured on seven adopting projects, 4 to 185 item versions change. Most of the relations that dangle are
testsrelations, whichmix surfex.suggest --acceptre-records. Aftermix test,mix surfex.confirm --evidencere-confirms theimplementsrelations confirmed by evidence. What remains, between 1 and 108implementsvalidated by review, is a review, and reading the hidden code is the point of it: no earlier review saw it versioned.
Fixed
- A failed test fails its relations, whatever validated them (#211, #212). With
--evidenceor--merge, a currentverifiesortestsrelation whose test failed at the version the relation holds is now reported as failed, and fails the check. That holds whether the relation was validated by evidence, a review, a judgement or a baseline. Before, only claims by evidence or baseline were checked against a run, so a project validated by review (adoption: :reevaluate) passed its surfex gate while the tests behind its requirements failed. The relation isn't invalidated: once its test passes again, it holds with no new review. A claim by evidence whose test failed now appears under the newFailedheading (JSONfailed), not underUnproven. Animplementsclaim judged over its candidate tests stays underUnproven. A gate whose tests pass sees no change.
[0.7.2] — 2026-10-13
A fix for 0.7.0's slow evidence check. mix surfex.status --verify --evidence took 36
minutes on a project with about 4,000 tests and 500,000 evidence records, where 0.6.2
took 5. It now takes seconds, with an identical result (#201). No upgrade step.
Fixed
mix surfex.status --evidencegrows with the project in proportion again (#201, #202). Since 0.7.0 every test's reached code joins the pairs animplementsclaim's candidate tests are found among. The check scanned everyverifiespair against all of them for each claim, and then the whole run's evidence for each candidate test. On a project with about 4,000 tests and 500,000 evidence records, that took 36 minutes, where 0.6.2 took 5. The candidates and each test's latest record are now indexed once per check. On that project, the check's derivation takes 10 seconds, with an identical result. A test now holds the check's work over a project twice as large to about twice.
[0.7.1] — 2026-10-13
What 0.7.0's users asked for, and two corrections. Unit ids take several heading grammars
and lettered section numbers, and a marked table keys on several columns and can leave
measured ones out of a row's version (#187). A review credits only the code its test
calls, and reached code once you name it (#191). A test tagged with a list of ids, which
mix test --only can't select, is counted by status (#190), and mix surfex.test UNIT
runs it with the rest of a requirement's tests (#198). No upgrade step. A misspelt table
marker option, which used to leave the table unmarked, is now an error.
Added
Several heading grammars, and lettered section numbers (#187, #188).
heading_ids:takes a list of grammars, tried in order, for a spec that writes ids in more than one form:[~r/^(?<id>ADR-\d+[a-z]?)\b/, :section_number]. A single grammar stays valid, and two grammars reading one id is the repeat error it would be from one.:section_numberreads a lowercase letter on a number's last part when its dot follows:## 2a. Model checkingis#2a, while## 3d renderingis still a path. A spec using:section_numberwith such headings sees them re-id'd with their versions unchanged, somix surfex.suggest --acceptcarries their relations across as moves.Composite table keys, and columns left out of a row's version (#187, #189). A table whose row is identified by a pair keys on both:
<!-- surfex: table options key: [Function, Key] -->givesfile#options/render/2/:width. A column that records a measurement rather than stating a claim can be left out of each row's version, so refreshing it dangles nothing:ignore: [Measured]. It can't name a key column. The options read in either order, and a singlekey: Headeris unchanged.Status says which tests
mix test --onlycan't select (#190, #196). ExUnit compares a list tag as one string, its ids run together, so a test taggedverifies: ["a", "b"]is selected by neither--only verifies:anorverifies:b, while surfex records it against both. A one-id list stays selectable. The test record'sunselectablelists those ids,mix surfex.statuscounts the tests in one line (unselectable by --only: N tests), and--format jsonlists each with its ids. It never fails: a list is the honest tag for a test that verifies several requirements, and the count shows what it costs. §11 no longer says--onlyalways runs exactly a requirement's tests.mix surfex.test UNITruns a requirement's tests, list tags included (#198, #200). It selects every test whoseverifies:declarations resolve to the unit, as surfex reads them, and runsmix test FILE:LINE …, which ExUnit's location filter selects exactly. It exits with that run's status.--withinadds the tests of the blocks, hints and rows inside a unit,--listnames the tests without running them, and arguments after--go tomix test. A unit that is unknown, ambiguous or that no test declares is an error rather than an empty, passing run.Surfex.Selectmakes the selection.
Changed
- A table marker's text after its id must be its options (#189). A misspelt option
(
keys: A) or a repeated one used to leave the line as body, so the table quietly wasn't marked. It's now an error naming the line.
Fixed
- A review credits the code its test calls, and reached code only when named (#191,
#192). Since 0.7.0,
mix surfex.validatecredited everyimplementsits test reached under the one note, including code behind an entry point that the reviewer never read. Now code the test reaches only through other code is credited when you name it:--code ID, once per item. A named id the green run didn't reach is an error, and a review with only reached code to record says which to name. Evidence still credits reach without naming.
[0.7.0] — 2026-10-12
Finer units and honest credit, the first part of claim grain (#145). Headings keep the ids
their authors write, a marked table's rows are units, and a test is credited for the code
it reaches through an entry point. Completeness counts a function once whatever its
default arguments, and the triangle reads what a test calls from the source. One upgrade
step: verifies tags now combine as ExUnit merges them, so a test inherits a requirement
only where it doesn't set its own (see Upgrading). Claim forms, the rest of #145's plan,
come in a later release.
Added
Headings keep the ids their authors write (#179, #180). A section's id is, in order:
- an id comment at the end of the heading,
## Totals <!-- surfex: totals -->, which doesn't render on a forge (ex_doc does show it as text: put it on the line after the heading instead, #195); - an anchor,
{#totals}; - what the project's heading grammar reads, set by
heading_ids:in.surfex.exs::section_signfor## §Api.3.2 — Limits,:section_numberfor## 1.2 Totals, or a regex with a named captureid; - otherwise its heading path, as before.
A written id survives renaming the heading, is never numbered
~2(a repeat is an error), and may be cited bare. A§id may keep its sign:§Api.3.2. Ids may now hold letters of either case, digits and. _ - :; every existing id stays valid. Turning onheading_ids:re-ids the matching sections with their versions unchanged, somix surfex.suggest --acceptcarries each relation across as a move.- an id comment at the end of the heading,
A marked table's rows are units (#179, #181).
<!-- surfex: table ID -->on the line before a table makes the table a unit (role:table, its header) and each row one (role:row), with idfile#ID/KEY. KEY is the row's first cell, or the column named bykey: Headerin the marker, without code or emphasis marks:`:word`is:word. Editing a row changes only that row's version. A table without the marker is body, as before. The reports count tables and rows only where a spec marks one.A test reaches what the code it calls calls (#183, #185, #186). Each function and macro the Elixir scanner reports now lists the code it calls (
Surfex.Itemand code records'calls): through its private helpers, a local call to its module's public functions, and adefdelegate's target.Surfex.Scan.reach/1follows a test through them. A section may now cite the function that does the work while its test drives the public entry point (a mix task'srun/1that formats through another module, say):Surfex.ExUnitFormatterrecords the versions of everything a test reaches;mix surfex.confirm --evidencecarriesimplementsto reached code, and a change to it dangles the relation until a green run re-confirms it;mix surfex.validatecredits it by review;mix surfex.status --verify --evidencechecks the claim against the run;- the triangle counts it exercised.
Reach credits relations someone recorded and never suggests one:
testsrelations still name what a test calls itself. Calls aren't part of any version, so nothing dangles on upgrade. A scanner of your own may fillcalls; one that doesn't is unchanged.
Changed
verifiestags combine as ExUnit merges them (#149, #171). The most specific level that setsverifiesreplaces the others: a test's own@tagover its describe's@describetagover its module's@moduletag. Until now surfex took their union, so surfex disagreed withmix test --only verifies:id, and a test could be recorded as verifying its module's requirement without anyone having judged it. §11 states the rule.
Fixed
The triangle reads what a test calls from the source (#173). A test counts as exercising code when its scan record calls it, as well as when a
testsrelation records it, compared by definition. A project that doesn't recordtestsrelations (by runningsuggest) no longer sees the code its tests call reported as untested. A call to code not written yet still shows the code missing. Gaps can only shrink.Completeness counts a function once, whatever its default arguments (#182). A function's default-argument arities (
f/2,f/3) are one code item, as they already were torequire:, the triangle andvalidate. They're judged together, counted once, and listed under the first id. A relation per arity is no longer needed to score 100%, and the code total now counts definitions, so it may drop.
Upgrading
mix surfex.statuslists the relations a test no longer declares under "Undeclared". For each, judge whether the test really verifies the inherited requirement:- if it does, name it in the test's own list:
@tag verifies: ["own-id", "module-id"].mix test --onlythen selects that test by neither id, since ExUnit compares a list as one string (#190; 0.7.1's status counts such tests); - if it doesn't, retire the relation with a note:
mix surfex.retire "test:<test id>" "spec:<unit>" --type verifies --note "why".
- if it does, name it in the test's own list:
- Measured on six adopters before the change, the cost ranged from none (where tests
already name every id they verify) to about two hundred relations. Surfex settled its
own 133 this way, keeping 42 and retiring 91, and added two tests for
recording-by-namethat the union had been standing in for.
[0.6.3] — 2026-10-11
The first release published to GitHub with its full history, from the v0.2.8 cut. No change to surfex itself and no upgrade step; a clone made from GitHub before the recut needs the README's "History" steps.
Changed
- GitHub carries the full history, from v0.2.8 (#174). Until 0.6.2 it carried release snapshots, since the earliest commits held material from the project surfex grew out of. The history is recut at v0.2.8, the first release after the separation, and published from there. A clone made before the recut needs a forced fetch; the README's "History" section says how.
[0.6.2] — 2026-10-09
Making the honest path cheap, from the users' RFC on #145: batched confirm and
validate with a distinct note per relation, annotate for a current relation, declining
shown beside each suggestion, code moves suggested when a function's arity changes, CI's
evidence readable by the recording commands, and suggest about fifteen times faster on a
large log. Surfex.Golden and Surfex.SourceScan are now documented, supported library
API. No upgrade step.
Added
- Recording reads CI's evidence (#154).
--merge PATHonconfirm --evidence,validate,relateandsuggest --acceptreads other runs' evidence files (CI artifacts) with the local run as one history, so a test excluded locally because it needs a service you don't run counts from CI's run. A missing file fails. suggestproposes code moves (#153). When a function's arity changes (render/2→render/3), its relations used to orphan, and each was retired and re-validated. Now suggest proposes the move, which carries them across to be judged once more.mix surfex.movealready worked for code ids; its docs now say so.mix surfex.annotate(#152): a current relation takes a new note, re-recorded at its own versions and basis. A re-review that changes nothing, such as fixing a batch of templated notes, now lands in the log rather than a commit message.- The docs say plainly that
@docisn't covered (#155). A function's or type's version leaves out its docstring, so a@docstating a contract can drift from the spec unnoticed. A test pins this, so covering docstrings (planned with claim-level relations) will change it deliberately. suggestshows how to decline each judgement (#148). Under eachimplementsandexcusescandidate it prints the exactretirecommand that declines it, so the decision lands in the log and the pair is never proposed again. Declined in a commit message, it came back on every run.- Batched
confirmandvalidate(#147).--file PATHrecords many relations in one run, one per line (tab-separated, each line ending with its own note), saving the project load per relation that made agents script loops with templated notes. The notes must be distinct, or the batch is refused; each line is judged as the single form judges it, and a refused line fails the whole batch. Surfex.GoldenandSurfex.SourceScanare supported library API (#150). Projects that render surface goldens without a relation log call them, and their CI gates rest on them, yet since 0.5.16 they weren't on hexdocs.- They are documented now, with a guide, "Using surfex as a library", and a promise:
their documented functions and types keep their shapes (as they have since v0.1.0), and
definition_hash/1gives the same version for the same code. - A change to either comes only in a minor release, marked here for library users. A test pins their documented surface.
- They are documented now, with a guide, "Using surfex as a library", and a promise:
their documented functions and types keep their shapes (as they have since v0.1.0), and
mix surfex.infonotes a project with no relation log: rendering goldens is a use of surfex, not adoption.
Fixed
suggestis linear in the log (#168). It re-filtered the whole log once per relation, so on surfex's own log (~10k entries) it took ~32 s, ~30 of them in that one helper; it now takes ~2 s. A test counts its work (reductions, not seconds) over N and 2N relations.- Suggestions no longer follow the order of the scans or the log's lines (#151). A
shuffled input reordered
suggest's lists (thetestssuggestions showed it). Every list is now sorted by the ids it names, and a test renders every report, golden and suggestion list from surfex's own log in two orders and requires them identical. confirm --fileno longer crashes (#162). Its option guard usedoron an absent switch (nil). Both tasks'--filepaths are now tested end to end.- A function's default-argument arities are one item to
require:(#146).f/1andf/2from onedef f(x, y \\ 1)each needed their own relation, so projects wrote a call or a citation per arity to clear "unmet". The triangle andvalidatealready compared code by definition; now the policy does too. - The library-API pin test no longer depends on test order (#158).
function_exported?/3is false for a module not yet loaded, and tests load modules lazily, so the test failed about one run in four. It loads the module first now.
[0.6.1] — 2026-10-07
An ExUnitProperties property is now a test, so a suite's generative tests can verify
spec units. No upgrade step.
Added
- Properties are tests (#141). The ExUnit scanner records an ExUnitProperties
propertyas it does atest: its id, itsverifiestags, what it calls, and a version that changes with itscheck allgenerators. Its runs are evidence, so a property can verify a spec unit.
[0.6.0] — 2026-10-07
Public types are items: a spec may cite Mod.t(), and a relation to a type is judged,
since no test run exercises one. The relation log is model-checked with extla, the real
code as oracle, which found two defects, both fixed here: tips that agree are not a
conflict, and a review records only what isn't validated already. Projects that require
code relations have one upgrade step (below).
Upgrading (0.6)
Public types are now code items (#137). A project whose require: asks code for a
relation (require: [code: [...]]) finds each public type unmet until it is related or
excused. To excuse them as a class, add to .surfex.exs:
require: [code: [:implements, :excuses], ...],
classes: [{"type", "a type is the shape of the data its functions take and return"}],
rules: [%{class: "type", kinds: [:type]}],then mix surfex.suggest --accept proposes one excuses per type, and each is confirmed
by judgement (mix surfex.confirm class:type code:t:Mod.t/0 --type excuses --note …). A
type the spec cites is related instead, by judgement (below).
Added
- Types are items (#137). Each public
@typeand@opaqueis an item keyed as ExDoc writes it,t:Mod.t/0, versioned by its own declaration. A spec cites it asMod.t()ort:Mod.t/0; an undeclared or private type is still an unresolved citation. A function of the same name keeps its own key. - A shape is judged (#137). A type has no behaviour for a test run to exercise, so an
implementsrelation to one is confirmed by judgement, with a note saying what was compared, and dangles when the type changes. The scanner marks such items (shape); code with behaviour is still never confirmed by hand, and a judgement on it doesn't validate. - Models of the relation log (§22). Exhaustive extla models drive the real recording
code and check the real status in every state they reach. Across two branches and main,
merged by git's union merge: order doesn't matter, a conflict is a disagreement between
tips, resolving ends it, and every entry reads back. Through versions and validation,
on the evidence path and the review path: a current relation's ends are at their
versions, a current
implementsrests on evidence or a review, every entry on evidence is borne out by runs, and every review rests on a green run. Through moves: every claim, retirement and red→green survives a rename. And liveness: whatever changes, a dangling relation whose test passes comes back to current. They run in a Mix environment of their own (MIX_ENV=model) and their own CI job.
Changed
- A review records only what isn't validated already (#138).
validatere-recorded the test'sverifieson every call, and replaced one on its failing run (a claim CI checks) with a review (which it doesn't). Now thatverifieskeeps its basis, and a review with nothing left to record is refused. Found by the model of the log. - The README installs surfex from Hex (
~> 0.6.0) rather than from GitHub, and points to the docs on hexdocs. - The README drops "Upgrading from the v0.2 trace": the trace went in 0.4.0, and spec §9 and the 0.4.0 entry below keep the record.
- Tips that agree are not a conflict (§13.1). Two branches that record the same
judgement without seeing each other (the same operation, ends at the same versions, and
basis) no longer leave a conflict to resolve, as when both re-run
confirm --evidenceafter merging main. Who recorded it, when and the note are context, so both entries stay in the log and both tips are reported. A different operation, version or basis still conflicts, andresolverefuses tips that agree. Found by the model of the log.
[0.5.24] — 2026-10-02
The first release on Hex. Its usage rules are one short page for an agent that points to
mix surfex.info, so a project's AGENTS.md stays small and the detail always matches the
installed version.
Changed
- The usage rules are one short page that points to
mix surfex.info(§21).usage-rules.mdis now the agent page: what surfex is, the rules for an agent, and where to find the rest. The directory and the other topics are back inpriv/info/, somix usage_rules.synccopies one short page into a project'sAGENTS.mdinstead of every topic, and the detail always matches the installed version.
[0.5.16] — 2026-10-02
The first release on Hex. Its docs are a guide to using surfex as a mix tool, and its
usage pages ship as usage-rules.md for usage_rules, so the same text reaches the
terminal (mix surfex.info), hexdocs and a project's AGENTS.md. It also keeps a moved
baseline relation in CI's check, and makes the baseline adopt tags deliberately.
Added
- Docs on hexdocs, as a usage guide (§21). They lead with the README and the usage
pages, then the
mix surfex.*tasks and the three modules a project writes code against (the evidence formatter, the scanner behaviour and its item). Every other module keeps its documentation in the code. - Usage rules for agents (§21). The
mix surfex.infopages ship asusage-rules.mdandusage-rules/, somix usage_rules.syncgathers them into a project'sAGENTS.md. The main file carries the core rules for an agent as well as the map. - The baseline adopts the tags already written, and says so (§18.1).
mix surfex.baselinerefuses when the trusted tests declare noverifies:tags, since a one-shot step would spend itself on test versions alone, unless--no-tagssays that is intended. It ends by reporting the trusted test versions, theverifiesadopted and the spec units left without one, and the adoption guide now tags first.
Changed
- Surfex is described as keeping a spec, its tests and its code aligned, and the README opens with the problems it catches when building with an LLM.
Fixed
- A moved baseline relation stayed out of CI's check (§17).
--evidencefound its claims partly by the note "confirmed by evidence", which a move replaces, so a baseline relation carried by a move (a split test file, a renamed section) was no longer checked. Claims are now found by basis,evidenceorbaseline.
[0.5.0] — 2026-10-02
Validated, not asserted. Every implements relation is now shown by the process: a test
that failed and then passed against the code, or a reviewed test that passes against
it, recorded with the basis that validated it. A test version's red→green is kept in the
log, so it survives a clean checkout. An established project can adopt its suite on
trust, once, and earn evidence as its tests next discriminate. Surfex now explains itself
to an agent (mix surfex.info), scores completeness, marks a spec that is wrong in use,
hands found work to a project's own process, checks a suite split across CI jobs, and
keeps what the log decided across renames. A minor release that breaks:
implements can no longer be confirmed by hand (mix surfex.confirm refuses it), the
log enforces its own grammar when it reads an entry, and the unused config end kind is
gone. Existing logs load unchanged, with every id as it was.
Added
Declining a suggestion (§14).
mix surfex.retireon a pair never related records the decision not to relate it, with a required note, sosuggestnever proposes it. Before, declining took arelatewhose only purpose was to be retired.Excusing a module family (§8). A rule's
parent:regex matches a member's parent module, so scaffolding a generator emits (MyAppWeb.CoreComponents,Layouts, …) is excused by family rather than by a list of function names that also catches real entry points elsewhere. A class whose rules don't use it keeps its version.Moving a test brings its records (§14).
mix surfex.movecarries a test's red→green and baseline records to its new id when its version is unchanged, as when a test file is split into sub-modules or adescriberegrouped. A test that changed earns them again, and the task lists what stayed behind. A carried baseline is not a second one.mix surfex.suggestspots these moves itself (same version, one to one), and lists a version found under several ids as ambiguous rather than guessing.A suite split across CI jobs can pass
--evidence(§17). The formatter records an excluded or skipped test as such, at its version. A claim whose test this run left out is listed as not checked here in every report and doesn't fail; a test with no record at all still fails, so a broken job can't hide behind an exclusion. A final job checks every job's evidence together withmix surfex.status --merge PATH(once per file): a disproof in any job fails, and so does a claim no job ran.mix surfex.info [TOPIC](§21): Surfex explains itself to an agent from the installed version. With no topic, a directory of under 100 lines: what Surfex is, a topic per line, and every command grouped by job. With a topic (model, process, agent, status, recording, validation, marks, adoption, completeness, drafts, goldens, config), a dense page with exact commands. The pages ship inpriv/info/; a test keeps every command listed.Adopting an existing suite (§18.1):
adoption:in.surfex.exsis:reevaluate(the default: every test earns its relations by discriminating),:trust, or[trust: globs, reevaluate: globs]by area. Under trust,mix surfex.baseline --note Ntakes a one-shot baseline: abaselineobservation per trusted test version that has run green, and its declaredverifieswith the new basisbaseline. A baselined test carriesimplementsthroughconfirm --evidenceasbaselinetoo. Trust only shrinks: a changed test version isn't baselined, narrowingadoption:leaves its relations unvalidated, and a test's first red→green moves them toevidence. Every report counts baseline relations with the mode,--no-baseline(baseline: :fail) fails on them, and completeness counts a baseline that holds as validated. A new guide, Adopting an existing suite, says when to trust, what the baseline is and isn't, and what each change costs afterwards.Needs-update marks (§12.1, §13.1, §14):
mix surfex.mark SPEC_UNIT --needs-update --note Nrecords that a spec unit itself needs to change, because the tests reflect it and the code passes them but the result is wrong. A mark is open while the unit is at the version marked and resolved when the spec changes;--withdrawwithdraws one. Status reports open and orphaned marks in every report, and--no-marksfails on them. Entries recorded before marks keep their ids.Change drafts and the hand-off (§19):
mix surfex.draft [ID…] [--format markdown|json] [--file]writes up every open mark, unmet id and triangle gap (or the items named) as a draft: the problem, the unit's text, the tests and code it touches, and the process's steps.process:in.surfex.exs(:print, or{:command, argv}with{title},{body}and{file}) is how--filehands them to the project's own change process.mix surfex.markprints the new mark's draft.Completeness (§20):
mix surfex.completeness [--format text|json]scores how much of the spec, the tests and the code is covered by validated relations, per kind and overall, and lists each incomplete item with what it lacks.completeness: [min: N]makesmix surfex.statusfail below a floor, and:completenessingoldens:commits the report. Surfex scores 100% and holds itself there.Discrimination is kept in the log (§12.1, §17):
mix surfex.confirm --evidencerecords each test version that went red then green as ared_greenobservation. From then on, aftermix clean, on a fresh checkout or in another worktree, a green run against the current code re-confirms that test's relations. Observations are one-ended entries (op: observe), never relations.
Changed
The log enforces its own grammar (§12.1). Each type's end kinds and direction, and the bases each type and op may carry, are checked when an entry is built or decoded, so a malformed line from a bad merge or a hand edit is refused where it is read, naming the entry and the rule.
mix surfex.log --verifygives each problem's file and line. Entries written before bases existed still load (a basis-lessimplements,verifiesorexcuses), and every existing id is unchanged.implementsnever carriesjudgement; adepends_onjoins code to code. The unusedconfigend kind is gone.The README opens with what Surfex does and the situations it handles, without commands; the how-to list gave way to
mix surfex.info.A relation is validated by the process, never asserted (§18).
- Code relations (
implements) become current only on evidence (a verifying test that went red and then green) or a review (mix surfex.validate). - Test relations (
verifies) are recorded on the test's failing run. - A citation, a tag on a test that never failed, or a pair named by hand is recorded as
proposed, which fails the check until validated.
mix surfex.suggest --acceptvalidates nothing. - Each entry records its
basis(evidence,review,judgement,proposed). It is written only when set, so every existing entry keeps its id. - Relations current without a validating basis are reported as unvalidated, and
mix surfex.status --validatedfails on them. - A move keeps the basis it carries.
- The text report lists proposed relations with the other failing states, and counts
unvalidated ones, listing them under
--validated. The JSON report lists them asunvalidated.
- Code relations (
mix surfex.confirmconfirms one relation, with a note:confirm FROM TO --type T --note N. It is the judgement path (a spec reworded without a change of behaviour, an excuse), and it refusesimplements.confirm ID, which confirmed every relation touching an id, is removed, as areSurfex.Record.confirm/4and/5(now/6and/7, one relation).mix surfex.confirm --evidencealso records a test relation on its failing run.mix surfex.validate TEST SPEC_UNIT --note N(Surfex.Record.validate/6) records a review: the test was examined against the unit, judged to validate it, and passes against the code. The unit may be a section whose hint or block the test verifies, once that relation is validated: the review then records the section'simplementsalone.mix surfex.suggest --acceptrefreshes structural relations (§15): a danglingtestsrelation whose test still calls the code, orrefinesrelation whose block is still within its unit, is recorded again. They record facts read from source, so reading it again re-establishes them. Judgement relations are never refreshed.Surfex's own relations are all validated by review (§2–§17), and its CI now runs
mix surfex.status --verify --evidence --validated.Spec §10.4 said
mix surfex.goldens --writefails after regenerating a drifted golden. It never did, and it shouldn't: regenerating is how a drift is resolved. The spec and the task's docs now say it succeeds, and a test pins it (#84).The README's worked example, and the guide's test-first and LLM sections, now describe the process.
Surfex closes its own spec/test/code triangle, and gates it (
triangle: :fail). Every section that code implements now states its claims as test hints (46 in all), each verified by tagged tests that exercise the implementing code; new tests cover the claims that were unchecked (the gate, item keys, the scanner contract, the log's vocabulary, the config readers, and more). Relations that existed only because a section mentioned code described elsewhere were retired.
Fixed
A move keeps the relations someone retired (§14).
mix surfex.movecarried only live relations, so after an anchor was added the retired ones were forgotten andsuggestproposed them again. A retired relation now comes across as retired, with its reason, andsuggestfinds a move whose old id only retirements name.A name glued to a root is no citation of it (§5.2).
MyAppCollector.Forge,MyAppWeb.…and aMyApp-Profileheader were read as citations of the root moduleMyAppand suggested asimplements, hiding a stale name as a plausible relation. A name now ends where a name ends, and every top-level module the code defines is a root (a Phoenix app'sMyAppWebbesideMyApp), so a stale name under any root is reported as an unresolved citation.exclude:drops a file from the spec entirely (§8). It left an excluded file's headings in as spec sections and dropped only its citations, so an excluded README became sections in no relation.A test's calls see aliases where they're declared (§11). An alias inside a test body was ignored, so a call through it was recorded under the short name and the test had no
testsrelation to the code it plainly calls. Adescribe's alias, meanwhile, reached every describe in the module. Aliases now apply as the compiler sees them.A planned
verifiesis proposed (§14).mix surfex.relate --plannedwrote one with no basis, so it read as a legacy entry.Surfex.Recordnow refuses to write any basis-lessimplementsorverifies.Resolving a conflict keeps the chosen tip's basis (§14, §18).
mix surfex.resolvere-recorded the tip without it, so resolving between validated tips left the relation unvalidated, and resolving between proposed ones made a claim current.A
verifiesrelation outlived its test's declaration. Removing a@tag verifies:left the relation current, because a tag isn't part of a test's version. Such a relation is now undeclared, and fails the check;mix surfex.suggest --acceptretires it, since the test's own source says the claim is gone.A test of the scanner contract could fail when its scanner module, defined later in the file, wasn't loaded yet as async tests started.
The triangle reported false gaps. A test's
callsnow include every module it calls or names (a module handed to a helper, as a Mix task is), so a module a section names counts as exercised. The private helpers defined inside adescribeblock are followed, for a test's calls and for its version: weakening such a helper now changes the test's version, as weakening a top-level one always did. Code is compared by definition (Surfex.Scan.definition/1), so one function's default arities are one code. On surfex itself this removed 20 of 99 gaps, all false.
[0.4.0] — 2026-09-28
Specs and tests in step. Tests are scanned and say what they verify, and each spec unit is checked from three sides: its code implements it, a test verifies it, and that test exercises the code. Test runs record evidence, and a test that went red and then green confirms its code, with no human confirmation, while CI checks every such claim against its own run and records nothing. The spec gains finer units (anchors, marked requirements, test hints), code the spec doesn't describe is excused by class, and a spec naming what doesn't exist fails. A minor release that breaks: the v0.2 trace is removed, and a config written for it fails naming the keys and why (see the README's upgrade section).
Removed
The v0.2 trace. It was deprecated in 0.3.0, and the relation log now does everything it did. Removed:
Surfex.Traceandmix surfex.trace;- the
:tracegoldens entry (goldens:now defaults to[:status]) andSPEC_TRACE.md; Surfex.Coverage.verdicts/3;Surfex.Cite.by_item/2,Surfex.Cite.section_label/2andSurfex.Cite.headings/2;- the
file_labels:profile key.
A
.surfex.exsthat still has a trace-only key (output,purpose,columns,groups,prose, …) raises, naming the keys and why. The README describes the upgrade.Surfex.Gate.drift/2no longer formats aCited bycolumn specially: only the trace's golden had one.
Changed
- Every task reads
.surfex.exsthroughSurfex.Status.Config.read!/1, which rejects unknown keys rather than ignoring them. Surfex.Suggest.candidates/5andall/5take aSurfex.Profile(Surfex.Status.Config.profile!/2) instead of a trace.
Added
Test evidence.
Surfex.ExUnitFormatterrecords each test's result at its exact version, with the versions of the code it calls, to_build/surfex/evidence.jsonl(Surfex.Evidence). The file is scratch and never committed. A test version discriminates once it has failed against one version of its code and passed against another, unchanged itself. That is what confirmation by evidence rests on. Surfex records its own test runs.Confirmation by evidence.
mix surfex.confirm --evidence(Surfex.Record.confirm_by_evidence/4) confirms:- a dangling
testsrelation whose test version has failed once and passes now against the current code; - then each dangling
implementsrelation a verifying test with such evidence carries.
verifiesstays a judgement, confirmed by name. After a spec change, only a test verifying that exact unit can carryimplements. The evidence is written into each entry's note.require_red: truemakes atestsrelation unconfirmable by hand too until its test was red.- a dangling
CI validates evidence claims, and records nothing.
mix surfex.status --evidencechecks every relation confirmed by evidence against the lastmix test's evidence. It fails on one the run doesn't bear out: its test didn't run, failed, or ran against other code. Surfex's CI runs its tests from an empty evidence file, thenmix surfex.status --verify --evidence, in one job.A specification guide,
guides/writing-specs.md: how to write a spec Surfex relates precisely (section sizing, stable headings, naming the code, checkable claims, examples and invariants, test-first work, working with an LLM), with a worked example that Surfex's tests run.Planned relations.
mix surfex.relate --planned(Surfex.Record.plan/7) relates a section to code that doesn't exist yet, or the other way round. The missing end is recorded without a hash. The relation is planned until the id is scanned, then dangling until someone confirms it, so spec-first and test-first work can record intent before the code. A planned relation meets arequire:policy. A section whose onlyimplementsrelations are planned is reported as unimplemented.mix surfex.status --no-planned(Surfex.Status.derive/4withplanned: :fail) also fails on anything planned and not built, for a release's check. A plausibility check refuses a planned id the project couldn't have, so a typo doesn't become a plan.Finer spec units. A heading anchor (
## Adding items {#cart-add}) gives a section an id that survives renaming its heading. A marked block (the lines between<!-- surfex: ID -->and<!-- /surfex -->) is one requirement, and a test hint (a fence whose info string istest ID) says how to test something. Each is a spec record of its own, with its own version, and is left out of the version of what it sits in, so editing one requirement no longer dangles its neighbours.Surfex.Scangainsroleandwithin.mix surfex.suggestrelates a citation in a block to the block. A spec that uses none of these scans exactly as before.Moving relations.
mix surfex.move OLD NEW(Surfex.Record.move/5) carries every live relation of a renamed or re-anchored spec id onto its new id. It retires the old relation and relates the new one at the versions that were recorded, so a move never confirms anything.More suggestions.
mix surfex.suggest(Surfex.Suggest.all/5andaccept_all/4) now also proposes:- moves, for a related id that is gone and a new id at the same version;
refines, from each block and hint to what it sits in.
Tests as scanned items.
tests:in.surfex.exsturns onSurfex.Scan.ExUnit, which reads ExUnit tests from source without compiling them.- A test's version covers its body, the private helpers and attributes it reads, its setups, and the generators of a comprehension that defines it. Weakening a test through any of them changes its version.
- A test says what it verifies with a plain ExUnit tag,
@tag verifies: "id"(@describetag,@moduletagtoo).mix test --only verifies:idthen runs one requirement's tests. - A declaration naming no spec unit is broken and fails the check.
Surfex.Scan.resolve/2resolves a full or bare id. - The new relation type
verifiesruns from a test to a spec unit. require:takes spec roles as keys:test_hint: [:verifies]requires a test for every hint.
The spec/test/code triangle. When tests are scanned,
mix surfex.statuschecks each spec unit that something implements.- It reports the unit if no test verifies it, if a verifying test calls none of the implementing code, or if implementing code is called by no verifying test.
- Gaps are reported, and fail the check with
triangle: :fail. mix surfex.suggestproposesverifiesfrom tests' tags, andtestsfrom what each test calls, with aliases, pipes, captures, imports and private helpers followed.- Surfex runs on it: its spec carries test hints, the tests that verify them are tagged, and every hint must be verified.
Excusals as relations. Classes in
.surfex.exs(the trace'sclasses:andrules:) are scanned as items (Surfex.Scan.Classes), andmix surfex.suggestproposes anexcusesrelation between an item and the class of the first rule it matches.- Only an item nothing implements is proposed.
require: [code: [:implements, :excuses]]then means every public item is either described or deliberately excused, on record.- Rewording a class's reason or changing its rules dangles its excuses.
- On the reference fixture, the suggested excusals are exactly the trace's verdicts.
- An excuse its class no longer covers is stale and fails the check: the item is now implemented, no longer matches a rule, or another class's rule matches it first.
- Code records now carry the item's kind as
roleand its parent aswithin. - The guide has a section on excusing code.
Broken citations fail
mix surfex.status. A name the spec cites that resolves to nothing (a deleted or misspelt function) or to more than one item is reported and fails the check, read bySurfex.Citeas the trace read it. It was the trace's last check the relation log lacked.Surfex.Status.Config.load/3scans once for everything status needs.The status reports count spec units by role (
Surfex.Status.units/1), and the JSON gives each id's role and what it sits in.Surfex's own spec now has an anchor on every heading. Its relations moved across and the old ones were retired, with their history kept.
Fixed
The JSON status report wrote a missing value as the string
"nil". A gone end's hash and location, and a conflicted relation's recorded hashes, reached tools as a hash namednil. They are nownull.The markdown scanner read code fences wrongly. A tilde fence wasn't a fence, and a shorter inner fence closed a longer outer one, so a
#line in a code block could become a section and shift the ids and versions after it. Fences now follow CommonMark. A spec with neither form scans as before.Two code items sharing a key couldn't be related. A C scanner's function and constant both called
twinhad one id, so the relation log couldn't tell them apart: relating either was refused with a misleading message, and status judged whichever came last. Their ids now carry their kind (twin (function),twin (const)), and status raises on two records with one kind and id. Unique keys are unchanged.
[0.3.0] — 2026-09-28
The relation log. Surfex now records which versions of the spec and the code were confirmed to belong together, and fails on anything that changed since, by name, on either side. A minor release: a new public API, and every module's and function's version changes once. The v0.2 trace is deprecated.
Added
- Scan records, the first part of the relation log:
Surfex.Scan({kind, id, hash, location}), a markdown spec scanner that hashes each section's own body (Surfex.Scan.Markdown), and line ranges on code items (Surfex.Itemlines,Surfex.SourceScan.line_range/1). - The relation log:
Surfex.Log.Entry(canonical JSON lines, content-hash ids) andSurfex.Log(append-only segments in.surfex/, verified loading, union merge), withmix surfex.log --init | --break | --verify | --rechain. Nothing is ever edited or removed. - Relation status:
Surfex.Statusderives each relation's state (current, dangling with the side that changed, orphaned, conflicted, retired; impacted as a flag), the new ids and the ids arequire:policy leaves unmet.mix surfex.status [--format json] [--verify]reports it and is the check. Directed relation types (depends_on,refines,tests) keep their ends in order. - Recording:
Surfex.Recordandmix surfex.relate,confirm,retire,resolveandhistory. A relation moves back to current only when someone names it inconfirm. - Suggesting relations:
Surfex.Suggestandmix surfex.suggest [--accept]proposeimplementsrelations from the spec's existing citations, which is also how a project adopts the relation log.--acceptnever confirms a dangling relation. - A committed status golden:
:status(or{:status, output}) ingoldens:gatesRELATIONS.md, the relation status as a reviewable record. - Surfex runs on its own relation log:
.surfex/holds 120 relations adopted fromspec.md, every public item must implement a section,RELATIONS.mdis committed, and CI runsmix surfex.status --verify.
Deprecated
- The trace (
Surfex.Trace,mix surfex.trace,:tracegoldens): the relation log replaces it. It keeps working until a later release removes it.
Changed
- The README leads with the relation log.
- A module's version is its public surface (
Surfex.SourceScan.module_hash/1): its moduledoc, public definitions, behaviours,uses, struct fields and types, not its functions' bodies. A function edit no longer dangles its module's relations as well. Every module's version moves once with this change. Surfex.SourceScan.project_root/2takes a starting directory;/1is unchanged. Its tests had to change the VM-wide working directory, which made the suite fail about once in fifteen runs, and a test now keeps async tests from doing that.- A function's version covers what it depends on. It used to hash only the function's own clauses, so a change made through a private helper, or a module attribute, went unseen. It now also covers every private definition the function calls (transitively, including piped calls, captures and default arguments) and the module attributes they read, and renaming a variable no longer counts as a change. Every function's version changes once, with this release; regenerate goldens after upgrading.
- The README is rewritten: shorter, installing from GitHub, with one worked example, and
spec.mdfor everything else.spec.mdnow ships in the package and the docs.
[0.2.8] — 2026-09-26
The first release published to GitHub. It fixes a GAP that a shared key could hide.
Fixed
- A GAP could be hidden by a key two items share.
Surfex.Coverage.verdicts/3kept one verdict per key, so when two items shared a key, one item's verdict overwrote the other's. A GAP could then vanish from the golden and from the gate. Every item now keeps its own verdict, and a failure about an item whose key is shared names its kind.
Changed
Surfex.Coverage.verdicts/3returns[{item, verdict}]in item order, not a map keyed by item key. Strictly a breaking change, it is made in a patch release because the trace has shipped only in 0.2.0, with no dependent yet, and the map was the defect.- The package points at its public repository, https://github.com/dcoai/surfex: the
linksHex requires, and the docs' source links, pinned to the release's tag.
[0.2.0] — 2026-09-25
The first release with two-way spec↔code traces. A minor release: a whole public API has been added since 0.1.0.
Added
- Two-way spec↔code traces. A specification's prose already names the code it
describes, and Surfex now checks both directions. Every name the spec cites must exist,
and every public module and function must be cited or excused by a class. The result
is a gated golden,
SPEC_TRACE.md.Surfex.Item,Surfex.Cite,Surfex.CoverageandSurfex.Profile: citations in five statuses (resolved, ambiguous, unresolved, external, documented absence) and a verdict per item (cited, excused by a class, or GAP), configured entirely by data. Subject sections, citing table columns, member paths and alias families (Mod.funcites every arity) are general features, not any project's quirks.Surfex.Scanner, a language-agnostic scanner contract, andSurfex.Scanner.Elixir, which reads a project's public API from source without compiling it.Surfex.SourceScan.defs/1gives a module's public definitions with one content hash per function.Surfex.Traceandmix surfex.trace: a whole trace defined in.surfex.exs, with every failure (drift, GAPs, broken citations, uncited required sections) reported in one run.Surfex.Surface,Surfex.Goldens,Surfex.Gateandmix surfex.goldens: a project's own goldens, gated alongside the trace with one command.
spec.md, the full specification of Surfex, traced against Surfex's own code in CI.- The release method: derived patch numbers, this changelog, and a maintainer's release guide.
Fixed
Surfex.SourceScan.lib_sources/1no longer counts test fixtures or thetmp/trees ExUnit leaves behind as first-party source. Alib/counts only when its parent has amix.exsand no directory on the way isdeps,_build,test,tmpor hidden. Before, a golden could drift on the machine that had just run the tests, and never in CI.
[0.1.0] — 2026-09-01
Added
Surfex.SourceScan(read source without compiling it, and version a definition by a hash of its structure) andSurfex.Golden(the one renderer for surface goldens: typed cells, stats lines, order-invariant output, no dates). Extracted from agentronic, where ten goldens use them.