Skip to content

Contributing

A. Arda UZAN edited this page Nov 24, 2026 · 2 revisions

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.

What you need

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).

The two defining languages

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

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.md and stage5.md.
  • src/, the Racket package typify: info.rkt, main.rkt, lang/reader.rkt (which makes #lang typify a Racket language), and the reader's modules.
  • test/, the test suites and fixtures: the public corpus in test/corpus/ (MANIFEST.md), the ask gate in test/ask-gate/ (README.md), the Stage 4 wire overlay in test/overlays/ (README.md) and frozen release fixtures in test/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, license and metalogic checks (ci.rkt, format.rkt, leak-check.rkt, check-diagnostic-registry.rkt, license-check.rkt, license-inventory.json, metalogic-check.py, and stage evidence scripts).
  • lean/, the self-contained Lean 4 Lake package (lean-toolchain, lakefile.toml, lake-manifest.json and the six comment-free statement and proof modules of TypifyMetalogic) checked by scripts/metalogic-check.py in the Lean / zero sorry CI job (see Metalogic).
  • mcp/, the optional Model Context Protocol authoring server (mcp/README.md).
  • .github/, the CI, native-probe and release workflows and Dependabot configuration, alongside .gitattributes and .gitignore.

No hand-written .typify source file sits outside test/: the .typify files under test/ are test inputs, not reader source, and .rkt and .lean 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.

Install from a clone and run the tests

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.rkt

The 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.

The release script

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.gz and typify-windows-x86_64.zip, so the README's download line stays true at every tag. Each unpacks to typify/bin/typify (typify/bin/typify.exe on 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 in typify/bin/typify. The mode is four octal digits, 0755 or 0644; on Windows every file in the archive is written with 0644 and the unpacked tree check compares no modes, so every line of its manifest gives 0644. The manifest hash is the sha256 of that file. The manifest is checked from a new, empty directory that holds typify/ 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.txt is verified with gh 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 between a and b is 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.rkt checks the repository layout, refuses comments in .rkt and .lean source 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.rkt scans 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.

What a change must keep green

The law tests of the emission gate

emit is gated by six law tests. Emission owns them.

  1. 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's stdout_json, diagnostics, exit status and, for a --gbnf invocation, gbnf_assertions, an object {"required_nonterminals": [...], "accepts_lines": [...], "rejects_lines": [...]} whose required_nonterminals holds the root alone, the root rule's presence and the membership of accepts_lines and rejects_lines in the language the GBNF text recognizes; any other field of the case's expected.json, aliases and LSP or SARIF projections included, is the case author's note and is not compared (see The runner contract).
  2. A structural round trip, read(print(D)) = D, where print is the reader's internal declaration printer (emit-declarations, not typify emit), over the public and blind declarations.
  3. 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 in test/decoder-corpus.json).
  4. 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 normal check response 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.
  5. Mutation strength of at least 95 percent over the meta definitions: every single-point mutation fails a test other than the round trip.
  6. Byte identity of typify.typify read 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.

Other measures

  • The self-declaration typify.typify checks under itself. The meta body declares primitives, so each of its constructors is a primitive, is rewritten by a rule, or is declared fact : <constructor>, with zero exemptions. The meta body declares its kernel primitives external, so the reader treats each as external, and plan over the meta body is refused with E_USAGE.
  • All 107 hostile tokens in test/corpus/hostile.json are 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 with typify facts zero times. The gate compares the two facts files as canonical JSON. Both write one wire: canonical absolute paths in root and in every argument, modes as four-digit octal strings, the owner as the decimal uid in text, no symbolic link followed (a symlink fact carries the link's target text as its value), the root itself included, and an entry whose path is not a canonical-path, a space (U+0020) in a component included, omitted, with "omitted": n beside facts, n counting each omitted entry once, the descendants of an omitted directory included, since the traversal is not pruned, and never once per fact, when n is positive and no omitted member otherwise, omitted being part of the wire, a positive integer when present and zero when absent; a fact over an omitted entry is absent, and clean does not see below it. Both read each entry by lstat: exists holds for every entry they do not omit, dangling links included, directory only for a real directory and never for a link's target, and mode and owner are the entry's own metadata, a link's included. Neither writes clean, the sixth fact, which the reader derives from the facts file: it is not on the wire. See Primitives and state.
  • ask answers 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 their code, file, range and the data fields of the code, actual for E_USAGE, and never by their severity, message, fix or related. The typo set holds every word one edit from a candidate of near (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 points A to Z, a to z, 0 to 9 and -, 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 is declared, a form's verb, the constructor of a term or primitive line, 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 of ask that 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 in test/ask-gate/. Its README.md names 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 .typify file each. gate.json, generated by the reference reader and frozen with the corpus, which is written blind, holds {"declarations": [...]}: for each gate declaration its path, as declarations/<name>.typify, its language, its candidates, the sizes of its three sets, typo, unknown and witness, and its words, each with its word, its set, its exit_code, 0 or 2, and its stdout_json, the ask --json object 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 of lines as a line under ?, rebuilds the status line and the near lines from word, status and near, 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 range of E_REQUIRED, E_FILE and E_USAGE is null. 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 (--json and 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, and racket scripts/license-check.rkt fails 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 from LICENSE.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 pinned DerivedGeneralCategory.txt of Unicode 17.0.0, the check recomputes the letter and unsafe-character tables of src/classes.rkt and test/facts-path.py from it and compares them; with --release it also fails while a contributed group lacks a recorded confirmation (confirmed, confirmed-by, confirmed-on); with --archive DIR it checks that an unpacked release holds typify/LICENSE.md, equal to the repository's and listed in its manifest; and with --native-receipt FILE it checks an inspection receipt from scripts/inspect-native.py and fails on any shipped or embedded native library not listed with its exact sha256 and license notice.

Generated plan bounds

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 docs job

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 racket nor raco (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 (sh on Linux and macOS, PowerShell on Windows);
  • typify --version, typify check typify/share/typify.typify --json, and the Catalog example extracted from README.md with the unpacked typify/bin on PATH;
  • 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.

Clone this wiki locally