Skip to content

sweep reconcile: licence canonicalisation, test-suite repair, full Julia+TLC CI gating - #72

Merged
hyperpolymath merged 3 commits into
mainfrom
chore/sweep-reconcile
Jul 21, 2026
Merged

sweep reconcile: licence canonicalisation, test-suite repair, full Julia+TLC CI gating#72
hyperpolymath merged 3 commits into
mainfrom
chore/sweep-reconcile

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Sitrep-driven remediation. Local main had drifted 4 ahead / 2 behind origin with three unpushed, unreviewed AI-generated "sweep" commits; the mathematical core of the test suite ran in no CI; and actually running that suite surfaced two genuine upstream bugs plus three test-harness defects.

1. Sweep reconciliation (minus the AGPL landmine)

Only the licence-text canonicalisation survives review (MPL-2.0 https Exhibit A + canonical CC-BY-SA-4.0 plaintext). Deliberately dropped:

  • LICENSES/AGPL-3.0-or-later.txt — no file here declares AGPL and .machine_readable/6a2/AGENTIC.a2ml forbids it ("Never use AGPL license (use MPL-2.0)").
  • mise.toml / CODEOWNERS / funding.yml / MAINTAINERS / GOVERNANCE.md / ARCHITECTURE.md — generic boilerplate crediting @metadatastician (this repo is hyperpolymath) and describing a directory layout this repo does not have.

2. Test-harness fixes (they were hiding real results)

  • test_quandle_axioms.jl: @testset label begin with a bare variable ×9 — Julia hard-errors, so §3 onward (including both Reidemeister suites) never executed.
  • seam_test.jl: KRLLexError never imported — errored Seam 1, masking the rest.
  • Evaluator.jl: the max_rows cap was pushed down as an exact provider limit, making truncation silent and — for stage-free queries — not applied at all. Now fetches one row past the cap and enforces it after source resolution, so the "row cap applied" warning fires whenever data was actually dropped.

3. Two genuine upstream KnotTheory.jl defects, tracked honestly

Both marked @test_broken (reports "Broken"; flips to a hard error the moment the upstream fix lands, forcing marker removal):

  • r2_simplify removes a bigon without re-splicing the severed arcs (4 arc labels occur once instead of twice) → trefoil 5-colouring count 25 instead of 5. Repro: r2_simplify(from_braid_word("s1.S1.s1.s1.s1").pd).
  • The alexander/conway/homfly segments of quandle_key are crossing-order sensitive (no canonical ±t^k unit normalisation): 25/200 seeded BR-5 trials disagree after a crossing shuffle, while presentation_hash and colouring counts agree.

4. CI: the mathematical core is now gated

krl-verification.yml:

  • seam_test.jl joins the dependency-free fast step (pure Julia + stdlib).
  • Sibling KnotTheory.jl / Skein.jl / AcceleratorGate.jl are checked out under deps/ and symlinked to the server/../../../ layout server/Project.toml [sources] expects; Pkg.instantiate; then axioms / EXPLAIN / BR-5 fuzz as separately-named steps.
  • New tlaplus-model-check job: TLC (pinned v1.7.4, sha256-verified) checks TypeOK / IsEquivalence / SoundBelow / Confluent on MCEGraph. -deadlock disables deadlock reporting only (the merge sequence terminates by design).
  • Fixed the stale header claim that this repo has no mix.exs.

Verification

  • All seven Julia suites run locally (Julia 1.12.6, sibling checkouts): lexer / parser / sql / seam / query_explain fully green; axioms + fuzz green with exactly the two documented Broken marks.
  • TLC: 8 distinct states, all four invariants, exit 0 in 2s.
  • Negative-tested both new gate types: a real test failure exits 1 (observed twice during diagnosis); an injected false TLA+ invariant exits 12.
  • The six startup_failure workflows (Secret Scanner, Governance, Mirror, Instant Sync, Push email, Pages) are pre-existing shared hyperpolymath/standards reusable rot — out of scope here.

🤖 Generated with Claude Code

hyperpolymath and others added 3 commits July 21, 2026 06:51
Salvaged from an unpushed local AI sweep (sweep3, Mistral Vibe): MPL-2.0
Exhibit A URL http->https + trailing-whitespace cleanup; CC-BY-SA-4.0
replaced with the canonical creativecommons.org plaintext rendering.

The same sweep's LICENSES/AGPL-3.0-or-later.txt is deliberately NOT
taken: no file in this repo declares AGPL, and .machine_readable/6a2/
AGENTIC.a2ml policy forbids it (MPL-2.0 canon). The sweep's other
payload (mise.toml, CODEOWNERS, GOVERNANCE.md, MAINTAINERS,
ARCHITECTURE.md, funding.yml) is dropped too: generic boilerplate
crediting a different account and describing directories this repo
does not have.

Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three test-harness defects hid real results:

* test_quandle_axioms.jl used '@testset label begin' with a bare variable
  (x9) — Julia hard-errors on this, so §3 onward (including both
  Reidemeister suites) never executed at all.
* seam_test.jl never imported KRLLexError, erroring out Seam 1 and
  masking the remaining seams.
* Evaluator: the max_rows cap was pushed down into the data provider as
  an exact limit, so truncation was silent (no warning possible) and,
  with a stage-free query, the cap never applied at all. Fetch one row
  past the cap and enforce it after source resolution, so 'row cap
  applied' warnings are always emitted when data was actually dropped.

With the suite actually running, two genuine defects surfaced, both
upstream in KnotTheory.jl, both now tracked with @test_broken (flips to
a hard error the moment the fix lands, forcing marker removal):

* r2_simplify removes a bigon without re-splicing the severed arcs
  (4 arc labels occur once instead of twice), so the trefoil's
  5-colouring count comes out 25 instead of 5.
* the alexander/conway/homfly segments of quandle_key are
  crossing-order sensitive (no canonical unit normalisation):
  25/200 seeded BR-5 trials disagree after a crossing shuffle.

Verified locally on Julia 1.12.6 with sibling KnotTheory/Skein/
AcceleratorGate checkouts: lexer, parser, sql, seam, query_explain all
green; axioms + fuzz green with the two Broken marks reported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Previously only lexer/parser/sql tests and the Agda proof ran in CI;
the mathematical core (quandle axioms, R1/R2 invariance, BR-5 fuzz,
EXPLAIN, integration seams) and the TLA+ specs ran nowhere — these are
the tests READINESS.md cites as its evidence.

* krl-tests: seam_test.jl joins the dependency-free fast step; the
  sibling KnotTheory.jl / Skein.jl / AcceleratorGate.jl repos are
  checked out under deps/ and symlinked to the ../../ layout that
  server/Project.toml [sources] expects; Pkg.instantiate; then the
  three server suites as separately-named steps.
* tlaplus-model-check: TLC (pinned v1.7.4 jar, sha256-verified) checks
  TypeOK / IsEquivalence / SoundBelow / Confluent on MCEGraph.
  -deadlock disables deadlock reporting only (the merge sequence
  terminates by design); invariant violations still exit non-zero.
  Negative-tested locally: an injected false invariant exits 12.
* header comment: repo does have a mix.exs (beam/mix.exs) — the GitLab
  'exists:' rules just never match non-root paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hyperpolymath
hyperpolymath marked this pull request as ready for review July 21, 2026 12:06
@hyperpolymath
hyperpolymath merged commit 28505a5 into main Jul 21, 2026
6 of 7 checks passed
@hyperpolymath
hyperpolymath deleted the chore/sweep-reconcile branch July 21, 2026 12:06
hyperpolymath added a commit that referenced this pull request Jul 21, 2026
…nicalize_presentation (#76)

## Summary

Two follow-ups to #72 (squash-merged as 28505a5 with its first CI run
still red):

### 1. CI: the new Julia job needs Julia ≥ 1.11

The `krl-tests` job added in #72 installed Julia **1.10**, but
`server/Project.toml` resolves its unregistered sibling deps
(`KnotTheory.jl` / `Skein.jl` / `AcceleratorGate.jl`) through a
`[sources]` table — a **Pkg 1.11+** feature that 1.10 silently ignores.
`Pkg.instantiate` therefore fell back to a registry lookup and died with
`expected package KnotTheory [215268c9] to be registered` (observed on
#72's CI run). Local verification had run on 1.12.6, which is why it
passed there. CI now pins the 1.12 juliaup channel, with a comment
explaining the floor.

### 2. `canonicalize_presentation` was not idempotent

The single BFS-relabelling pass can change the very ordering it derived
labels from, so `blob(canonicalize(p)) ≠
blob(canonicalize(canonicalize(p)))` — **measured at 95/200 seeded BR-5
trials** once the upstream KnotTheory.jl PD-integrity bugs
(hyperpolymath/KnotTheory.jl#43) were fixed and the harness could see
real diagrams. A fingerprint that changes when you canonicalise twice
cannot serve as a semantic identity.

Fix: iterate the pass, detect the inevitable cycle of serialised states,
and return the **lexicographically minimal state on the cycle** — a
fixed point reached from every presentation in its orbit. Where the old
pass was already stable (the entire shipped test corpus), output is
unchanged, so stored fingerprints remain valid.

## Verification

BR-5 fuzz, 200 trials, against KnotTheory.jl with the #43 fixes applied:

| Suite | Result |
|---|---|
| presentation well-formedness | 6752/6752 pass |
| descriptor determinism | 800/800 pass |
| crossing-order invariance | 600 pass + 1 expected Broken (11/200
`quandle_key` residual → upstream KnotTheory.jl#42) |
| canonical-blob round-trip (incl. idempotency) | 600/600 pass — was
95/200 failing before the fix |

## Merge order

This PR is independent of KnotTheory.jl#43 (it validates against both
old and fixed KnotTheory — the idempotency fix only touches quandledb's
own layer). Once #43 merges upstream, the `@test_broken` R2 marker in
`test_quandle_axioms.jl` flips to "unexpected pass" by design; a
marker-removal PR follows then.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant