From d436545a07e2163255ad33bd7c9e5a37bf815895 Mon Sep 17 00:00:00 2001 From: Titus Date: Tue, 17 Nov 2026 07:06:52 +0100 Subject: [PATCH 1/2] CI runs the OKF reference check, where a skip fails tests/test_okf.py reads the export with OKF's own parser and viewer at the commit onlyworlds.okf pins, and skips when that code is not importable. No CI job had it, so the check never ran there. A new job fetches OKF's repository at the pinned commit, read from the module so the pin stays one line, and fails unless the test passes. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cb58dd..f464519 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,31 @@ jobs: # Published text names no one inside the team and points at no internal room or tracker. - run: uv run python scripts/public_words.py + okf-reference: + # OKF's own parser and viewer, at the commit onlyworlds.okf pins, read this package's export. + # tests/test_okf.py skips that check when OKF's code is not importable, so the gates above + # never run it. Here the code is fetched at the pinned commit and a skip is a failure. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: astral-sh/setup-uv@v7 + - run: uv sync + - name: OKF's reference code at the pinned commit + run: | + REPO=$(uv run python -c "from onlyworlds import okf; print(okf.OKF_REPO)") + COMMIT=$(uv run python -c "from onlyworlds import okf; print(okf.OKF_COMMIT)") + echo "$REPO at $COMMIT" + git init -q "$RUNNER_TEMP/okf" + git -C "$RUNNER_TEMP/okf" fetch -q --depth 1 "$REPO" "$COMMIT" + git -C "$RUNNER_TEMP/okf" checkout -q FETCH_HEAD + test "$(git -C "$RUNNER_TEMP/okf" rev-parse HEAD)" = "$COMMIT" + - name: The reference check, where a skip fails + env: + OKF_REFERENCE_SRC: ${{ runner.temp }}/okf/src + run: | + uv run pytest -q -rs tests/test_okf.py::test_reference_parser_and_viewer | tee "$RUNNER_TEMP/okf.txt" + grep -q -E '^1 passed' "$RUNNER_TEMP/okf.txt" + wire: # keel's own OpenAPI document and the public demo world, read only, and a few writes to the # practice world (its published key, reset every night), each deleted again. Red here with From ac8f2f4695e9038e3c93318f9f012044e9b12290 Mon Sep 17 00:00:00 2001 From: Titus Date: Tue, 17 Nov 2026 07:12:27 +0100 Subject: [PATCH 2/2] The OKF reference check counts in-prose references as edges Since 0.74.1 the export writes an in-prose reference as a link to the element's concept, and OKF's viewer draws an edge for it. The check still expected one edge per link field's pair, 53 on the example world where the viewer draws 56, and nothing showed it: the check skips wherever OKF's code is not importable, which was everywhere it ran. Its first run in CI failed on that count. The expected pairs now include each in-prose reference, read from the source's own text. Co-Authored-By: Claude Fable 5.2 --- tests/test_okf.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/test_okf.py b/tests/test_okf.py index 9f1b7df..c1fa929 100644 --- a/tests/test_okf.py +++ b/tests/test_okf.py @@ -41,6 +41,7 @@ ROOT = Path(__file__).resolve().parents[1] HYPERION = ROOT / "codegen" / "schema-dist" / "example" / "hyperion" BODY_LINK = re.compile(r"\]\(([^)\s]+\.md)\)") +ELEMENT_ID = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}") if os.environ.get("OKF_REFERENCE_SRC"): sys.path.insert(0, os.environ["OKF_REFERENCE_SRC"]) @@ -289,7 +290,10 @@ def test_refuses_existing_out_dir(tmp_path: Path) -> None: def test_reference_parser_and_viewer(bundle: Bundle, tmp_path: Path) -> None: """OKF's own code at the pinned commit: every concept parses and has a type, indexes carry no frontmatter but the root's okf_version, and the - viewer draws one edge per distinct linked pair.""" + viewer draws one edge per distinct linked pair: a link field's, or an + in-prose reference's (the export writes each as a link to the concept; + read here from the source's own text, any element id inside a markdown + link's target).""" for rel, data in bundle.files.items(): doc = OKFDocument.parse(data.decode("utf-8")) if rel.endswith("index.md"): @@ -304,9 +308,19 @@ def test_reference_parser_and_viewer(bundle: Bundle, tmp_path: Path) -> None: for t in link_ids(s, s["type"], name) if t != s["id"] } + prose = { + (s["id"], t) + for s in bundle.sources.values() + for value in s.values() + if isinstance(value, str) + for target in re.findall(r"\]\(([^)\s]+)\)", value) + for t in ELEMENT_ID.findall(target) + if t in bundle.sources and t != s["id"] + } + assert prose - pairs, "Hyperion carries in-prose references that no link field repeats" stats = generate_visualization(bundle.out, tmp_path / "viz.html") assert stats["concepts"] == len(bundle.sources) + 1 - assert stats["edges"] == len(pairs) + assert stats["edges"] == len(pairs | prose) # --- the legacy layout