Repository navigation
Contributing
As of v1.0.0
This page is for people who change Typify itself. Using Typify needs only a release archive and no Racket; see Install.
Racket 9.3 CS (the full distribution), with racket and raco on your path. The release build pins Racket 9.3 CS by each installer's sha256, so the releases are built with that version. The reader in src/ uses no third-party Racket packages (src/info.rkt lists base, and src/ requires only modules included in the Racket 9.3 CS distribution).
Typify is defined by its own pattern dialect, its own string domain and a public corpus, not by a host (see Test your own host). Two defining languages are named and pinned:
- The reader's host language, Racket, pinned at 9.3. It supplies the line shapes, the term syntax, the meta forms, module reading, the nine library functions and the normalization order.
- Each consumer's host language. It supplies the execution of its primitives and nothing else.
A host that passes the public corpus may replace Racket without any change to the language.
The repository, https://github.com/CMZN-Consulting/typify, holds these top-level entries (checked by scripts/leak-check.rkt):
-
README.md, the first screen: the one-sentence claim, the download, and a first checked program. -
LICENSE.md, Typify's MIT license and the notices for Unicode 17.0 data, the Racket CS 9.3 runtime and embedded native libraries. -
docs/, operator and wire guides:install.md,diagnostics.md,inputs.md,plan-wire.mdandstage5.md. -
src/, the Racket packagetypify:info.rkt,main.rkt,lang/reader.rkt(which makes#lang typifya Racket language), and the reader's modules. -
test/, the test suites and fixtures: the public corpus intest/corpus/(MANIFEST.md), the ask gate intest/ask-gate/(README.md), the Stage 4 wire overlay intest/overlays/(README.md) and frozen release fixtures intest/release-fixtures/,test/corpus/hostile.json,test/decoder-corpus.json, the emission matcher, the generated-plan bound check, and the second facts collector (test/facts-collector.sh). -
scripts/, the release build and verification tooling (release.sh,release.rkt,release-verify.sh,docs-smoke.sh,inspect-native.py,check-release-attestations.py,capture-release-corpus.py,release-corpus.rkt) and the CI, formatting, leak, registry and license checks (ci.rkt,format.rkt,leak-check.rkt,check-diagnostic-registry.rkt,license-check.rkt,license-inventory.json, and stage evidence scripts). -
mcp/, the optional Model Context Protocol authoring server (mcp/README.md). -
.github/, the CI, native-probe and release workflows and Dependabot configuration, alongside.gitattributesand.gitignore.
No hand-written .typify source file sits outside test/: the .typify files under test/ are test inputs, not reader source, and .rkt source files carry no comments. The self-declaration typify.typify is not committed in the repository: the reader holds the meta forms as one table in src/meta.rkt, the release build writes that table's declaration source into every release archive at typify/share/typify.typify (beside typify/bin/), and typify emit Typify prints its JSON grammar (or GBNF under --gbnf). See Emission.
Prose belongs in documentation and in a program's comments, never in a declaration, beyond the text of a note line. A declaration documents itself by its names, its example lines and the answers to ? : <word> (see Questions). A caveat that the model of v1 does not check is attached to a constructor by a note, note : <constructor> = <text>, which ? : <word> prints.
git clone https://github.com/CMZN-Consulting/typify.git
cd typify
raco pkg install --scope user --no-setup --deps fail --name typify --link ./src
raco make src/main.rkt
racket test/smoke.rktThe package's info.rkt sits in src/, so the install links ./src under the package name typify. After editing or pulling reader sources, run raco make src/main.rkt again so the embedded reader-source digest is refreshed. racket test/smoke.rkt runs a small integration check that needs only Racket 9.3 CS. Running the full raco test test suite also needs the pinned external grammar validator built with Git, CMake and a C++ compiler and bound in TYPIFY_GBNF_VALIDATOR, as .github/workflows/ci.yml and README.md describe.
Releases are built by scripts/release.sh (with scripts/release.rkt) and verified by scripts/release-verify.sh and .github/workflows/release.yml.
- Pinned inputs. GitHub Actions are pinned by 40-digit commit SHA, and each platform's Racket 9.3 CS installer is pinned by sha256 (runner images are named by label).
- No secrets. The build jobs hold no secrets and run with read-only contents permission.
- Four platforms. Linux x86_64, Linux aarch64, macOS aarch64 and Windows x86_64, built and checked on Ubuntu 22.04 (and its glibc), macOS 15 and Windows Server 2022.
-
Version-less asset names.
typify-linux-x86_64.tar.gz,typify-linux-aarch64.tar.gz,typify-macos-aarch64.tar.gzandtypify-windows-x86_64.zip, so the README's download line stays true at every tag. Each unpacks totypify/bin/typify(typify/bin/typify.exeon Windows), with no solver (neither Rosette nor Z3) in the executable's module graph. -
A manifest. Each archive carries
typify/MANIFEST.txt: one line per file, sorted by path in UTF-8 byte order,sha256 mode path. It lists every file of the archive but itself, each by its path relative to the archive root, as intypify/bin/typify. The mode is four octal digits,0755or0644; on Windows every file in the archive is written with0644and the unpacked tree check compares no modes, so every line of its manifest gives0644. The manifest hash is the sha256 of that file. The manifest is checked from a new, empty directory that holdstypify/alone. -
Hashes and provenance attestation. The sha256 of each archive and each manifest hash are subjects of the release's Sigstore build-provenance attestation and are listed in its release notes. The workflow creates a draft release; when published with GitHub's release immutability enabled, its tag and archive assets are locked. Each archive or
typify/MANIFEST.txtis verified withgh attestation verify FILE --repo CMZN-Consulting/typify --signer-workflow CMZN-Consulting/typify/.github/workflows/release.yml --source-ref refs/tags/v1.0.0. -
A second build and four-platform parity. An independent second build (
b) is made on every platform and compared with the first (a) before attestation. Their captured native transcripts across the baseline and extension corpora must be byte-identical, and all four platforms' transcripts must agree byte for byte, or the workflow fails. A difference in archive bytes betweenaandbis reported and does not block in 1.0 (byte identity on macOS remains a goal until a Racket release carries Chez Scheme's reproducibility fix). -
A canary matrix. Four tampered archives per platform (flipped byte, extra file, missing file, rewritten manifest) are checked against the archive hash, the manifest tree check and
gh attestation verify, and every one must be refused. -
Repository and archive hygiene scans. In CI,
scripts/leak-check.rktchecks the repository layout, refuses comments in.rktsource files, and scans repository files for unapproved IPv4 literals, POSIX and Windows home-directory paths, private-key headers, credential tokens, PEM key-file names and any supplied deny-list words; generic private-range IPv4 examples in the corpus are admitted only by exact file sha256. At build time,scripts/release.rktscans every archive and refuses one whose bytes contain the build machine's home or checkout path.
The programs in the 1.0 archives carry no publisher's code signature, and the macOS program is not notarized. The Install page quotes what Apple and Microsoft document for such programs, notes that what the two systems show for typify has not been observed, and explains how to verify an archive. Release tags are to be signed with a maintainer's key, which the Install page will publish once it exists; no such key exists yet, so the tags of 1.0.x are unsigned, and the release workflow does not check a tag's signature.
emit is gated by six law tests. Emission owns them.
- A verdict corpus with refusals, the public corpus in
test/corpus/, written blind by someone other than the author of the meta table. Its comparison reads a case'sstdout_json,diagnostics, exit status and, for a--gbnfinvocation,gbnf_assertions, an object{"required_nonterminals": [...], "accepts_lines": [...], "rejects_lines": [...]}whoserequired_nonterminalsholds the root alone, the root rule's presence and the membership ofaccepts_linesandrejects_linesin the language the GBNF text recognizes; any other field of the case'sexpected.json, aliases and LSP or SARIF projections included, is the case author's note and is not compared (see The runner contract). - A structural round trip,
read(print(D)) = D, whereprintis the reader's internal declaration printer (emit-declarations, nottypify emit), over the public and blind declarations. - A differential with delimiter insertions, against a matcher in
test/and a pinned decoder, comparing the formation of lines only, over five multi-slot line formats (restricted test dialects of documented formats outside this repository, kept intest/decoder-corpus.json). - The declaration-time emptiness check, which rejects a declaration whose class can hold the literal that follows its placeholder. The derived work bounds of the emptiness and overlap checks are reported by
typify check DECLARATIONS --bounds, apart from the normalcheckresponse and from the grammar (see Command line); they depend on the host, the corpus never compares them, and the report claims neither CPU steps nor a representation another host must copy. - Mutation strength of at least 95 percent over the meta definitions: every single-point mutation fails a test other than the round trip.
- Byte identity of
typify.typifyread and printed again by the declaration printer (and deterministic JSON grammar emission), kept as a smoke test.
The emitted grammar recognizes exactly the lines the reader accepts as well formed under a declaration's forms, classes and comment prefix, with the three line shapes, blank lines and comment lines; two bodies that differ only in their comment line accept different lines. Where the reader and a constrained decoder disagree on whether a line is well formed, the reader ships and the disagreement is a failing test. Counts, order, the results of library calls and the resolution of names are judgments on programs and declarations, which the reader makes after formation and a line grammar cannot carry. A refusal such as parent of /, a library result outside its receiving class, or an empty program under count = 1 whose constructor has no default line is therefore a semantic test beside the differential, never a grammar failure. See Emission.
- The self-declaration
typify.typifychecks under itself. The meta body declares primitives, so each of its constructors is a primitive, is rewritten by a rule, or is declaredfact : <constructor>, with zero exemptions. The meta body declares its kernel primitives external, so the reader treats each as external, andplanover the meta body is refused withE_USAGE. - All 107 hostile tokens in
test/corpus/hostile.jsonare refused (beside its 10 delimiter cases and 9 accepted positive controls). See Test your own host. - The build writes every class's witnesses: its shortest member, a boundary member and a near miss; an empty class is recorded as
empty. See Classes. - Ten thousand generated declarations produce no plan or state past the printed bound. See Rules and plans.
- Rule cycles (
E_RULE_CYCLE) and duplicate rules (E_RULE_DUPLICATE) are rejected with a column. - The second facts collector,
test/facts-collector.sh, disagrees withtypify factszero times. The gate compares the two facts files as canonical JSON. Both write one wire: canonical absolute paths inrootand in every argument, modes as four-digit octal strings, the owner as the decimal uid in text, no symbolic link followed (asymlinkfact carries the link's target text as its value), the root itself included, and an entry whose path is not acanonical-path, a space (U+0020) in a component included, omitted, with"omitted": nbesidefacts,ncounting each omitted entry once, the descendants of an omitted directory included, since the traversal is not pruned, and never once per fact, whennis positive and noomittedmember otherwise,omittedbeing part of the wire, a positive integer when present and zero when absent; a fact over an omitted entry is absent, andcleandoes not see below it. Both read each entry by lstat:existsholds for every entry they do not omit, dangling links included,directoryonly for a real directory and never for a link's target, andmodeandownerare the entry's own metadata, a link's included. Neither writesclean, the sixth fact, which the reader derives from the facts file: it is not on the wire. See Primitives and state. -
askanswers every word of each gate declaration's typo, unknown and witness sets exactly as the reference reader does: the lines, the object and the exit status, compared as canonical JSON, a refused word's diagnostics by theircode,file,rangeand the data fields of the code,actualforE_USAGE, and never by theirseverity,message,fixorrelated. The typo set holds every word one edit from a candidate ofnear(see Questions), and every word two deletions or two exchanges from a candidate of six code points or more; an edit inserts, deletes or substitutes one code point of the verb class's alphabet, its 63 code pointsAtoZ,atoz,0to9and-, or exchanges two adjacent code points, and two exchanges are two adjacent exchanges applied in succession at any positions, overlapping included. The unknown set holds, for each hyphenated candidate, its form with_for-, its form with no separator, its parts in reverse order and each of its parts. A word whose status in the asked language isdeclared, a form's verb, the constructor of atermorprimitiveline, a class or a cell, leaves both sets. A word the verb class refuses leaves the typo set; the unknown set keeps the form with_for-, which the verb class refuses, answered with the refusal object and exit status 2, so that every hyphenated candidate witnesses the class once. Both sets are deduplicated and stand in code-point order. The witness set holds the words that the corpus's author adds beyond the two generated sets. For each reading ofaskthat is pinned against a rival reading, the gate declarations hold one word on which the rival reading answers differently, generated or added. The gate lives intest/ask-gate/. ItsREADME.mdnames the reference reader's language and version and the command that generates the gate file, and carries a table from each pinned reading to the word that witnesses it.reference/holds the reference reader's source, which the build's test never runs; the corpus's author writes it from the language's text alone and is the only one who changes it.declarations/holds the gate declarations, one.typifyfile each.gate.json, generated by the reference reader and frozen with the corpus, which is written blind, holds{"declarations": [...]}: for each gate declaration itspath, asdeclarations/<name>.typify, itslanguage, itscandidates, thesizesof its three sets,typo,unknownandwitness, and itswords, each with itsword, itsset, itsexit_code, 0 or 2, and itsstdout_json, theask --jsonobject or the refusal object{"ok": false, "diagnostics": [...]}, the words in code-point order within each set; the gate file carries no other field. The build's test replays the gate file in process and prints the size of each set and every failure. The round trip parses every string oflinesas a line under?, rebuilds the status line and thenearlines fromword,statusandnear, and requires them equal to the printed lines. - Every diagnostic kind converts to SARIF and to LSP, and every diagnostic that carries a range keeps an equal range in both, lines outside the Basic Multilingual Plane included; the
rangeofE_REQUIRED,E_FILEandE_USAGEisnull. See Diagnostics. - The registry of diagnostic codes is closed: no code outside it exists, and a kind it lacks is added to it before that kind ships (see Diagnostics). Codes may be renamed freely before 1.0.0. From the first tag on, the registry is diffed against the previous release commit pinned in the release workflow (
scripts/check-diagnostic-registry.rkt), and a removed or renamed code fails the release. - Native CLI transcripts (
--jsonand text output, stdout, stderr and exit codes) are byte-identical across the four platforms on the baseline and extension corpora, including a term with two failing library calls. - Every file of the repository is covered by
scripts/license-inventory.json, andracket scripts/license-check.rktfails closed on anything it does not cover: a new file that no entry lists, a data file whose bytes changed, a license whose notice is missing fromLICENSE.md, a third-party or derived file with no upstream URL, version and sha256, and a locked dependency of the optional MCP server that is new, changed or under a license the inventory does not allow. A change that adds or alters a data file adds its inventory entry in the same change, with the upstream source and its hash. With--unicode FILE, given the pinnedDerivedGeneralCategory.txtof Unicode 17.0.0, the check recomputes the letter and unsafe-character tables ofsrc/classes.rktandtest/facts-path.pyfrom it and compares them; with--releaseit also fails while a contributed group lacks a recorded confirmation (confirmed,confirmed-by,confirmed-on); with--archive DIRit checks that an unpacked release holdstypify/LICENSE.md, equal to the repository's and listed in its manifest; and with--native-receipt FILEit checks an inspection receipt fromscripts/inspect-native.pyand fails on any shipped or embedded native library not listed with its exact sha256 and license notice.
No solver ships in 1.0. test/test-plan-generated.rkt checks 10,000 distinct generated declarations across shadow, first and join cells, partitioned stacking cells, staged put and delete writes, rewrite chains and split loops against an independent finite-fold oracle, verifying that no plan or state exceeds its printed bound, together with a positive-control canary that catches an understated per-line bound. scripts/release.rkt checks that the built executable's module graph carries neither Rosette nor Z3.
The release workflow's docs job (scripts/docs-smoke.sh) is required before attestation at every tag. On the four runner images it runs:
- an assertion that neither
racketnorraco(nor a Racket installation directory) is present on the runner image; - the archive sha256 check, followed by the unpacked-tree check extracted from
docs/install.md(shon Linux and macOS, PowerShell on Windows); -
typify --version,typify check typify/share/typify.typify --json, and the Catalog example extracted fromREADME.mdwith the unpackedtypify/binonPATH; - the four tampered canary archives, requiring both the archive-hash check and the extracted tree check to refuse every one.
Every wiki page except Home opens with the release stamp line, As of v1.0.0 for this release.