-
-
Notifications
You must be signed in to change notification settings - Fork 0
test: make the suites capable of failing — and fix the 19 lexer defects that exposed #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
21a9a23
test: make the test suites capable of failing, and wire `lake test`
hyperpolymath 0077806
fix(lexer): two-character lookahead was off by one
hyperpolymath 60947bb
docs: add governance files, written for this repo rather than swept in
hyperpolymath 62a2027
fix(lake): build the test executables by default
hyperpolymath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Code owners for hyperpolymath/gnpl. | ||
| # | ||
| # NB: an earlier unmerged sweep proposed this file naming @metadatastician, which owns | ||
| # other repositories in the estate but not this one. Ownership here is @hyperpolymath. | ||
|
|
||
| * @hyperpolymath | ||
|
|
||
| # The proof surface and the FFI boundary carry the load-bearing correctness claims; | ||
| # call them out so changes there are never merged unreviewed. | ||
| /src/GqlDt/ @hyperpolymath | ||
| /src/GQLdt/ABI/ @hyperpolymath | ||
| /bridge/ @hyperpolymath | ||
| /docs/proof-debt.md @hyperpolymath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # https://docs.github.com/en/repositories/managing-your-repositorys-custom-fields/displaying-a-sponsor-button-in-your-repository | ||
| github: hyperpolymath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <!-- | ||
| SPDX-License-Identifier: CC-BY-SA-4.0 | ||
| SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> | ||
| --> | ||
|
|
||
| # Architecture | ||
|
|
||
| > An earlier unmerged sweep proposed a generic `ARCHITECTURE.md` describing a | ||
| > `src/ tests/ config/` layout with "modular, maintainable architecture designed for | ||
| > clarity, scalability and long-term sustainability". This repository has none of those | ||
| > directories and that text described nothing. What follows is the actual structure. | ||
|
|
||
| ## Two layers, one repository | ||
|
|
||
| ``` | ||
| GNPL narration: "what account does this evidence support?" <-- design only | ||
| │ lowers to | ||
| GQLdt query: "what is in the store?" <-- built, tested | ||
| │ FFI (liblith_bridge.a) | ||
| Form.Bridge Zig, C ABI <-- built, tested | ||
| │ | ||
| Lithoglyph Form.Model / Form.Blocks (Forth, append-only journal) <-- separate repo | ||
| ``` | ||
|
|
||
| This is why a repository named `gnpl` contains sources namespaced `GqlDt`: GQLdt is not | ||
| a leftover, it is GNPL's compilation target. See `README.adoc`, and `docs/THEORY.adoc` | ||
| for why the narration layer is the point. | ||
|
|
||
| ## Layout | ||
|
|
||
| | Path | Language | Role | | ||
| |---|---|---| | ||
| | `src/GqlDt/` | Lean 4 | the query core — types, lexer, parser, IR, pipeline | | ||
| | `src/GqlDt/Types/` | Lean 4 | refinement types: `BoundedNat`, `NonEmptyString`, `Confidence` | | ||
| | `src/GqlDt/Provenance/` | Lean 4 | `ActorId`, `Rationale`, `Tracked` — the warrant substrate | | ||
| | `src/GqlDt/Prompt/` | Lean 4 | PROMPT six-dimension source scoring | | ||
| | `src/GQLdt/ABI/` | Idris2 | ABI definitions + memory-layout proofs | | ||
| | `bridge/` | Zig | FFI implementation; emits `zig-out/lib/liblith_bridge.a` | | ||
| | `test/` | Lean 4 | executable suites, run by `lake test` | | ||
| | `spec/` | Markdown/EBNF | the normative grammar and lexical specification | | ||
| | `docs/` | AsciiDoc/Markdown | design rationale and proof debt | | ||
|
|
||
| Per the estate standard, **ABI is Idris2 and FFI is Zig** — no hand-written C. | ||
| `bridge/` is the only Zig tree; two pre-0.15-API skeletons were removed in #7. | ||
|
|
||
| ## Build order (it matters) | ||
|
|
||
| `lakefile.lean` links against `bridge/zig-out/lib/liblith_bridge.a`, so the Zig archive | ||
| must exist *before* the Lean executables link: | ||
|
|
||
| ```sh | ||
| cd bridge && zig build && zig build test # produces liblith_bridge.a | ||
| cd .. && lake build && lake test | ||
| ``` | ||
|
|
||
| Getting this backwards is why the `Containerfile` used to mask both steps with | ||
| `|| echo`, which meant a wholly broken build still produced a "successful" image. | ||
|
|
||
| ## Verification posture | ||
|
|
||
| The claims this repository makes about itself are gated, and the gates are tested: | ||
|
|
||
| | Gate | What it establishes | | ||
| |---|---| | ||
| | `lake build` | the Lean core typechecks | | ||
| | `lake test` | 163 executable checks across Lexer / Parser / TypeSafety | | ||
| | `scripts/check-lean-proofs.sh --build-log` | Lean reports no *incomplete* proof (`sorry`) | | ||
| | estate `check-trusted-base.sh` | every `axiom` is enumerated in `docs/proof-debt.md` | | ||
| | `cd bridge && zig build test` | the FFI bridge builds and its unit tests pass | | ||
|
|
||
| **A green proof gate means "nothing is admitted mid-proof", not "nothing is assumed".** | ||
| Lean's `sorry` warning does not fire on `axiom`, and 16 axioms remain — five of them in | ||
| *executable* position, so those functions have no implementation at all. Read | ||
| `docs/proof-debt.md` before relying on any verification claim here. | ||
|
|
||
| New gates are only accepted once they have been shown to go red on a seeded fault. The | ||
| test driver and the proof gate were both canary-tested this way; the repository has a | ||
| history of gates that could not fail, and the remedy is evidence, not intent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <!-- | ||
| SPDX-License-Identifier: CC-BY-SA-4.0 | ||
| SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> | ||
| --> | ||
|
|
||
| # Governance | ||
|
|
||
| `hyperpolymath/gnpl` is maintained by @hyperpolymath (see `MAINTAINERS`). Decisions are | ||
| made by the maintainer; this document records *how* they are made and what a change has to | ||
| clear, so the bar is legible rather than tacit. | ||
|
|
||
| ## Scope of decisions | ||
|
|
||
| | Kind | Who decides | Evidence expected | | ||
| |---|---|---| | ||
| | Bug fix, doc correction, gate repair | maintainer or contributor PR | the gate that now fails, or the measurement | | ||
| | Grammar / lexical behaviour | maintainer, against `spec/GQL-DT-*.md` | the spec clause being conformed to | | ||
| | ABI or FFI surface | maintainer | layout proof in `src/GQLdt/ABI/`, both sides updated together | | ||
| | Adding or discharging an `axiom` | maintainer | `docs/proof-debt.md` updated in the same change | | ||
| | Semantics of PROMPT scoring | maintainer | affects a proof field — see below | | ||
|
|
||
| ## The rules a change must clear | ||
|
|
||
| These are not style preferences; each exists because it was violated and cost something. | ||
|
|
||
| 1. **No handwaving.** A claim in a README, a manifest or a commit message must be | ||
| verifiable by running something. "Verified" without a command that verifies it is a | ||
| defect. | ||
| 2. **Gates must be able to fail.** A new or repaired gate is not accepted until it has been | ||
| shown to go red on a deliberately seeded fault, and green when removed. This repository | ||
| has shipped a naming gate that compared a string to itself, a `lake test` step that | ||
| swallowed real failures, test suites whose `main : IO Unit` always exited 0, and a | ||
| container build that masked both its steps with `|| echo`. | ||
| 3. **Specs are normative.** Where `spec/GQL-DT-Lexical.md` and the implementation disagree, | ||
| the implementation is wrong until the spec is deliberately amended. | ||
| 4. **The trusted base is enumerated.** Every `axiom` appears in `docs/proof-debt.md` with | ||
| `file:line` and a disposition. Nothing may be recorded as "budgeted" without a stated | ||
| refutation budget — untested assurance is unfalsifiable. | ||
| 5. **Foundation before depth.** Work that makes the codebase *verifiable* precedes work | ||
| that deepens any one strand. The 19 lexer defects found in July 2026 were invisible for | ||
| as long as they were because nothing could run and fail. | ||
|
|
||
| ## Cross-cutting changes | ||
|
|
||
| Two areas cannot be changed on one side only: | ||
|
|
||
| - **The FFI boundary.** `bridge/lith_types.zig` and the Lean types must agree. A change to | ||
| one without the other silently breaks the proofs that cross it. | ||
| - **PROMPT scoring.** `PromptScores` carries a proof field, | ||
| `overall_correct : overall.val = (…sum…) / 6`. The averaging rule is welded into the | ||
| type, so changing it is a proof obligation change on every value, in Lean and in Zig | ||
| simultaneously — not an edit to one function. | ||
|
|
||
| ## Estate context | ||
|
|
||
| This repository consumes shared workflows from `hyperpolymath/standards`. Faults in those | ||
| are reported upstream rather than patched around locally; where a local shim is | ||
| unavoidable it carries a comment naming the upstream issue. | ||
|
|
||
| ## Contributing | ||
|
|
||
| See `CONTRIBUTING.md`. Code is MPL-2.0, documentation is CC-BY-SA-4.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Maintainers — hyperpolymath/gnpl | ||
|
|
||
| ## Active | ||
|
|
||
| | Name | GitHub | Role | | ||
| |-------------------------|-----------------|---------| | ||
| | Jonathan D.A. Jewell | @hyperpolymath | Primary | | ||
|
|
||
| ## Scope | ||
|
|
||
| GNPL (the narration/projection layer) and GQLdt (the query layer it lowers to) live in | ||
| this repository together — see `README.adoc`. The Zig FFI bridge under `bridge/` and the | ||
| Idris2 ABI under `src/GQLdt/ABI/` are maintained here too; the Lithoglyph data store they | ||
| talk to is maintained separately. | ||
|
|
||
| ## Expectations | ||
|
|
||
| - Changes touching `src/GqlDt/`, `src/GQLdt/ABI/` or `bridge/` need review — they carry the | ||
| correctness claims. | ||
| - `docs/proof-debt.md` must be updated in the same change as any axiom added or discharged. | ||
| The estate trusted-base policy enforces this in CI. | ||
| - Gates must be able to fail. A new gate is not accepted until it has been shown to go red | ||
| on a seeded fault. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.