From 71cac1cf7efaceef26a2ec233306fab5afd0d8a1 Mon Sep 17 00:00:00 2001 From: Fly Date: Sat, 28 Nov 2026 09:16:31 +0700 Subject: [PATCH 1/3] ci: fail when the wiki is not what the code generates The wiki in obsidian/ is committed, and a code change could land without its sync. The wiki-check job now runs the sync and fails when it would change anything but the commit the manifest names. Dependabot cannot sync, so its pull requests are let through. --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6797945..18fa9844 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,9 +50,11 @@ jobs: with: command: check ${{ matrix.checks }} - # CodeWiki's own `check` run on this repository. It reports to code - # scanning and never fails the build. It also proves that the backend CLI - # still compiles on Linux, which the Docker image depends on. + # CodeWiki run on this repository, which also proves that the backend CLI + # still compiles on Linux, as the Docker image needs. Its `check` reports + # to code scanning and never fails the build. Its `update` does: the wiki + # in `obsidian/` is committed, and it must be what this commit's code + # generates. wiki-check: runs-on: ubuntu-latest timeout-minutes: 30 @@ -77,3 +79,29 @@ jobs: with: sarif_file: codewiki.sarif category: codewiki + # A sync here may change nothing but the commit the manifest names. + # Source files are hashed with CRLF read as LF, so the result does not + # depend on the checkout. A failure means that code changed without + # its `docs(wiki)` commit: run `cargo run -p codewiki -- update` at the + # repository root, in a tree with no stray files, and commit + # `obsidian/`. Dependabot cannot do that, so its pull requests are let + # through, and the push to main that merges one is held to it. + - name: The wiki is in sync with the code + if: github.actor != 'dependabot[bot]' + shell: bash + env: + CODEWIKI_DATA_DIR: ${{ runner.temp }}/codewiki + run: | + cargo run --locked -p codewiki -- update + stale=0 + git diff --exit-code -I'"last_indexed_commit"' -- obsidian || stale=1 + added=$(git ls-files --others --exclude-standard -- obsidian) + if [ -n "$added" ]; then + echo "Notes the sync would add:" + echo "$added" + stale=1 + fi + if [ "$stale" = 1 ]; then + echo "::error::The wiki in obsidian/ is not what this commit's code generates. Run 'cargo run -p codewiki -- update' and commit obsidian/ as docs(wiki)." + exit 1 + fi From 4e3bb69d56504a02004490cbb69a640f847f6af7 Mon Sep 17 00:00:00 2001 From: Fly Date: Sat, 28 Nov 2026 09:22:49 +0700 Subject: [PATCH 2/3] ci: write the findings outside the checkout, and sync the wiki The first run of the new step failed for two reasons, both its own: codewiki.sarif in the checkout was one more file for the sync to count, and this change to ci.yml, a source of the Build and Test note, had no sync. --- .github/workflows/ci.yml | 6 ++++-- obsidian/.codewiki/manifest.json | 2 +- obsidian/.codewiki/notes.jsonl | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18fa9844..d3f93dde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,9 @@ jobs: fetch-depth: 0 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - - run: cargo run --locked -p codewiki -- check --format sarif --fail-on never --output codewiki.sarif + # The findings go outside the checkout: a file written into it would be + # one more file for the sync below to count. + - run: cargo run --locked -p codewiki -- check --format sarif --fail-on never --output "${{ runner.temp }}/codewiki.sarif" env: # The index is a cache; it is built on first use in a scratch # folder. The runner context exists only at step level. @@ -77,7 +79,7 @@ jobs: - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: codewiki.sarif + sarif_file: ${{ runner.temp }}/codewiki.sarif category: codewiki # A sync here may change nothing but the commit the manifest names. # Source files are hashed with CRLF read as LF, so the result does not diff --git a/obsidian/.codewiki/manifest.json b/obsidian/.codewiki/manifest.json index bf300317..ac1784fd 100644 --- a/obsidian/.codewiki/manifest.json +++ b/obsidian/.codewiki/manifest.json @@ -2,5 +2,5 @@ "schema": 1, "template_pack": "default", "template_version": 2, - "last_indexed_commit": "f819f88e16c355ecc78e505d7a305227b3a18e0d" + "last_indexed_commit": "71cac1cf7efaceef26a2ec233306fab5afd0d8a1" } diff --git a/obsidian/.codewiki/notes.jsonl b/obsidian/.codewiki/notes.jsonl index ef7e1643..600f60b9 100644 --- a/obsidian/.codewiki/notes.jsonl +++ b/obsidian/.codewiki/notes.jsonl @@ -227,7 +227,7 @@ {"id":"mod:openui_lang::eval","path":"01-Core/openui-lang/Eval Module.md","kind":"concept","origin":"generated","sources":[{"path":"crates/openui-lang/src/eval.rs","hash":"b2da5011746700a6cf2c001e12da14a6cb88c984d332987f44054fc8735c52ff"}],"body_hash":"92c37c50a507bd447a80ef1c202119a526cb95ca3dde26ec9fc934ec41364e83","input_hash":"c4312918c748b718f2117fe94de1d0114c41a7ee07279916d79fc58c58b3c1d6","commit":"a1045089a63dba5abca03a77ddfb2c7e465e895d","model":"claude-code","explained":{"sections":["What it does","How it works","Gotchas"],"sources":[{"path":"crates/openui-lang/src/eval.rs","hash":"b2da5011746700a6cf2c001e12da14a6cb88c984d332987f44054fc8735c52ff"}],"commit":"0131c9bc448caa84be306b09421bd9f1ae44d6d0"}} {"id":"mod:openui_lang::lexer","path":"01-Core/openui-lang/Lexer Module.md","kind":"concept","origin":"generated","sources":[{"path":"crates/openui-lang/src/lexer.rs","hash":"dee133eea67c357aac84f9fcde8444fd42eb7d5c46f20eaa3d85729507733cd9"}],"body_hash":"f159b5ee5dba4e34d8d3476e309478c2c914f063a3630db666dcf0b72b40a2a0","input_hash":"0e327efdae316bb8736a8dc8b5919b9091d5f4344650666657b4ef064377870f","commit":"9b5d0e8a90d891f935aac59a73dfed18b10dca7d","model":"claude-code","explained":{"sections":["What it does","How it works","Gotchas"],"sources":[{"path":"crates/openui-lang/src/lexer.rs","hash":"dee133eea67c357aac84f9fcde8444fd42eb7d5c46f20eaa3d85729507733cd9"}],"commit":"0131c9bc448caa84be306b09421bd9f1ae44d6d0"}} {"id":"mod:openui_lang::parser","path":"01-Core/openui-lang/Parser Module.md","kind":"concept","origin":"generated","sources":[{"path":"crates/openui-lang/src/parser.rs","hash":"5fc3d91a50c0622b5cd5c3d5a155e698e73f43128fcb285bc94a6b1fd1248e76"}],"body_hash":"3c0c436728f3c05fc04c4e13f08dd675a0291ed1e17e5a135759e9842eaa3c93","input_hash":"54a56bd7eac7b0e7f178601a653684a6b6e41102504bf573a2b74f7e94ccb268","commit":"9b5d0e8a90d891f935aac59a73dfed18b10dca7d","model":"claude-code","explained":{"sections":["What it does","How it works","Gotchas"],"sources":[{"path":"crates/openui-lang/src/parser.rs","hash":"5fc3d91a50c0622b5cd5c3d5a155e698e73f43128fcb285bc94a6b1fd1248e76"}],"commit":"0131c9bc448caa84be306b09421bd9f1ae44d6d0"}} -{"id":"ops:build","path":"05-Operations/Build and Test.md","kind":"operations","origin":"generated","sources":[{"path":".github/workflows/ci.yml","hash":"e59cc6a74fca9e5ca2d1c258b91d8d3962dfea928547b9b5f6c85db5f7afa90c"},{"path":".github/workflows/docker.yml","hash":"3d88d7ffb8b39aa3ac39d7f60f619e72f3b3e837daf63ae7e932f434eb470174"},{"path":".github/workflows/release.yml","hash":"07256e83f05f48e1b8c0a43e2c5edc73e05df050ccb382c420c7534dc04a2f21"},{"path":".github/workflows/security.yml","hash":"53f9fa609d80bec6749e0db34063ec80a98520a7464fb3c4c9458414fcf95e06"},{"path":"Cargo.toml","hash":"c3ceed68526031114522f269c15d0b99574b34cec466988f213da4a8aff93d79"},{"path":"Dockerfile","hash":"431c4b7be458c4a7dfec880238d9fcd68d24005b158cc985e124ea63242f4c3f"},{"path":"deny.toml","hash":"961820d909e653008c38cbe0f278bafbbc1c987defb5fb2b8f793ece6d1e4142"},{"path":"rust-toolchain.toml","hash":"a6a0bbd29ffaa8182dc22d1d9149709f1091e47df40ed96eb8a78a711c66a4ce"}],"body_hash":"06478da070537a80cae42b422519ef8d91a70ba3593b08a4b0f0c8746ef0c700","input_hash":"cf1463a03ba375198bc840c9904473c5df7e3acd2b02dc9600e1a8c093447b76","commit":"63aedc391b0ff003aee1e040b41448d758724938","model":"claude-code","explained":{"sections":["How it works","Gotchas"],"sources":[{"path":".github/workflows/ci.yml","hash":"e59cc6a74fca9e5ca2d1c258b91d8d3962dfea928547b9b5f6c85db5f7afa90c"},{"path":".github/workflows/docker.yml","hash":"3d88d7ffb8b39aa3ac39d7f60f619e72f3b3e837daf63ae7e932f434eb470174"},{"path":".github/workflows/release.yml","hash":"07256e83f05f48e1b8c0a43e2c5edc73e05df050ccb382c420c7534dc04a2f21"},{"path":".github/workflows/security.yml","hash":"53f9fa609d80bec6749e0db34063ec80a98520a7464fb3c4c9458414fcf95e06"},{"path":"Cargo.toml","hash":"aad52ad2fa5d895351b87be56f96576c20562e74945b07b97b75b67a4fe1e1d7"},{"path":"Dockerfile","hash":"431c4b7be458c4a7dfec880238d9fcd68d24005b158cc985e124ea63242f4c3f"},{"path":"deny.toml","hash":"961820d909e653008c38cbe0f278bafbbc1c987defb5fb2b8f793ece6d1e4142"},{"path":"rust-toolchain.toml","hash":"a6a0bbd29ffaa8182dc22d1d9149709f1091e47df40ed96eb8a78a711c66a4ce"}],"commit":"1334bf47a1c6dd66dc5ffb4bc1e578273d9c41db"},"behind":["Cargo.toml changed"]} +{"id":"ops:build","path":"05-Operations/Build and Test.md","kind":"operations","origin":"generated","sources":[{"path":".github/workflows/ci.yml","hash":"0ab0115ae9e5ea15837ad19d47d903e4ebe7f9fcd8e9435decd4ba119370f13b"},{"path":".github/workflows/docker.yml","hash":"3d88d7ffb8b39aa3ac39d7f60f619e72f3b3e837daf63ae7e932f434eb470174"},{"path":".github/workflows/release.yml","hash":"07256e83f05f48e1b8c0a43e2c5edc73e05df050ccb382c420c7534dc04a2f21"},{"path":".github/workflows/security.yml","hash":"53f9fa609d80bec6749e0db34063ec80a98520a7464fb3c4c9458414fcf95e06"},{"path":"Cargo.toml","hash":"c3ceed68526031114522f269c15d0b99574b34cec466988f213da4a8aff93d79"},{"path":"Dockerfile","hash":"431c4b7be458c4a7dfec880238d9fcd68d24005b158cc985e124ea63242f4c3f"},{"path":"deny.toml","hash":"961820d909e653008c38cbe0f278bafbbc1c987defb5fb2b8f793ece6d1e4142"},{"path":"rust-toolchain.toml","hash":"a6a0bbd29ffaa8182dc22d1d9149709f1091e47df40ed96eb8a78a711c66a4ce"}],"body_hash":"06478da070537a80cae42b422519ef8d91a70ba3593b08a4b0f0c8746ef0c700","input_hash":"cf1463a03ba375198bc840c9904473c5df7e3acd2b02dc9600e1a8c093447b76","commit":"63aedc391b0ff003aee1e040b41448d758724938","model":"claude-code","explained":{"sections":["How it works","Gotchas"],"sources":[{"path":".github/workflows/ci.yml","hash":"e59cc6a74fca9e5ca2d1c258b91d8d3962dfea928547b9b5f6c85db5f7afa90c"},{"path":".github/workflows/docker.yml","hash":"3d88d7ffb8b39aa3ac39d7f60f619e72f3b3e837daf63ae7e932f434eb470174"},{"path":".github/workflows/release.yml","hash":"07256e83f05f48e1b8c0a43e2c5edc73e05df050ccb382c420c7534dc04a2f21"},{"path":".github/workflows/security.yml","hash":"53f9fa609d80bec6749e0db34063ec80a98520a7464fb3c4c9458414fcf95e06"},{"path":"Cargo.toml","hash":"aad52ad2fa5d895351b87be56f96576c20562e74945b07b97b75b67a4fe1e1d7"},{"path":"Dockerfile","hash":"431c4b7be458c4a7dfec880238d9fcd68d24005b158cc985e124ea63242f4c3f"},{"path":"deny.toml","hash":"961820d909e653008c38cbe0f278bafbbc1c987defb5fb2b8f793ece6d1e4142"},{"path":"rust-toolchain.toml","hash":"a6a0bbd29ffaa8182dc22d1d9149709f1091e47df40ed96eb8a78a711c66a4ce"}],"commit":"1334bf47a1c6dd66dc5ffb4bc1e578273d9c41db"},"behind":[".github/workflows/ci.yml changed","Cargo.toml changed"]} {"id":"pattern:cw_embed::Embedder","path":"04-Patterns/Implementing Embedder Pattern.md","kind":"pattern","origin":"generated","sources":[{"path":"crates/cw-embed/src/lib.rs","hash":"4c4961ccb5327412e48031bcf7905f353d58c4131b719df402ef4eafd1d57b90"}],"body_hash":"87556c5e28763bbe2a05f0a491ce5dcb00d2ad8fa79c8437b118eb6c3cff680a","input_hash":"36d627a8abfc6cf6c4e26bfe370fe997231248951f3b9725c8812ef62983d1ee","commit":"63aedc391b0ff003aee1e040b41448d758724938","model":"claude-code","explained":{"sections":["Why","Don't"],"sources":[{"path":"crates/cw-embed/src/lib.rs","hash":"4c4961ccb5327412e48031bcf7905f353d58c4131b719df402ef4eafd1d57b90"}],"commit":"695ad7dc8ee2f552725a15ae46d4ca6821e34943"}} {"id":"pattern:cw_wiki::manifests::PackageInfo","path":"04-Patterns/Implementing PackageInfo Pattern.md","kind":"pattern","origin":"generated","sources":[{"path":"crates/cw-wiki/src/manifests.rs","hash":"33eb4709c3e1576dced4ae4bd0d2a1951f430437f5a6f9bff9eae6b7fd9ffb46"}],"body_hash":"467ce6817affef4ecfe02c424ed6557b08d12cabc9cdb9c757b7325225cf6230","input_hash":"7163f3a2fb247441c564ad9ceb4c2d98acfce23446142377db812ede372aa097","commit":"406c29a03c1a9fb83018c57a351e37ba2d760a93","model":"claude-code","explained":{"sections":["Why","Don't"],"sources":[{"path":"crates/cw-wiki/src/manifests.rs","hash":"c01f864da7f3cd767f5afd611288de54bb796d22ab2157abfca589817296402a"}],"commit":"0131c9bc448caa84be306b09421bd9f1ae44d6d0"},"behind":["crates/cw-wiki/src/manifests.rs changed"]} {"id":"pattern:cw_wiki::testmap::TestLanguage","path":"04-Patterns/Implementing TestLanguage Pattern.md","kind":"pattern","origin":"generated","sources":[{"path":"crates/cw-wiki/src/testmap.rs","hash":"5fbf95450ac0d83cfa7ba738afa4e44fd09817596ea26787ab285fdcd8dc66a6"}],"body_hash":"81b0b3021b1b909520ffac3bcb688ef811d3621148b68ed9515cede3f0ce83e9","input_hash":"ec4e2e82ca216d4e11a79a44a370bd0d93e8efc29ad32e49933f01f69450bc6d","commit":"406c29a03c1a9fb83018c57a351e37ba2d760a93"} From dc57e0dc07ad52c752a1088da727687693ae3dbe Mon Sep 17 00:00:00 2001 From: Fly Date: Sat, 28 Nov 2026 09:24:30 +0700 Subject: [PATCH 3/3] docs: say that CI holds the wiki to the code, and what keeps it so AGENTS.md gets the rule and the three things that make the sync give the same result on every machine. ROADMAP records the line-ending fix as not released yet. --- AGENTS.md | 2 +- ROADMAP.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 289ed5d1..21fb8ba0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -218,7 +218,7 @@ After the zip, `package.ps1` builds `dist\CodeWiki--windows-x64-setup.e `.github/workflows/` holds four workflows: -- `ci.yml` runs the four commands above, with `--locked`: format, clippy and the tests on Windows, and `cargo deny` on Linux in two legs (advisories; bans and sources). The licenses of dependencies are not checked, by the owner's decision of 2026-11-20: `deny.toml` has no list of allowed licenses, so a bare `cargo deny check` fails on every crate. The advisories leg can fail with no change in this repository, when a new advisory is published: fix the dependency, or add the advisory's ID to `ignore` in `deny.toml` with a reason. It also runs `codewiki check` on this repository and uploads the findings to code scanning; that job never fails the build. +- `ci.yml` runs the four commands above, with `--locked`: format, clippy and the tests on Windows, and `cargo deny` on Linux in two legs (advisories; bans and sources). The licenses of dependencies are not checked, by the owner's decision of 2026-11-20: `deny.toml` has no list of allowed licenses, so a bare `cargo deny check` fails on every crate. The advisories leg can fail with no change in this repository, when a new advisory is published: fix the dependency, or add the advisory's ID to `ignore` in `deny.toml` with a reason. Its job `wiki-check` runs CodeWiki on this repository, on Linux: `codewiki check` uploads its findings to code scanning and never fails the build, and `codewiki update` does fail it. The wiki in `obsidian/` must be what the commit's code generates: the sync there may change nothing but `last_indexed_commit` in the manifest. So a push that changes code, a script, a workflow or a manifest carries its `docs(wiki)` commit (`cargo run -p codewiki -- update` at the repository root); a change to README, ROADMAP, this file or the guide needs none. Three things keep the result the same on every machine. A source file is hashed with CRLF read as LF (`cw_core::source_hash`), because git hands out one file with either ending. The sync counts every file it finds, tracked or not, so sync in a tree with no stray files, and put a folder that is no part of the project into `.codewikiignore`, where `docs/guide/` is. And the job writes `codewiki.sarif` outside the checkout. Dependabot cannot sync, so its pull requests skip the step, and the push that merges one must bring the sync. - `security.yml` runs gitleaks over new commits. Never commit a secret, not even a test value that looks real. A confirmed false positive goes in `.gitleaksignore` by its fingerprint. - `release.yml` and `docker.yml` run on a `v*` tag. The tag must equal `v` plus the workspace `version` in the root `Cargo.toml`. A tag publishes the Windows zip, the setup program and a `.sha256` for each as a GitHub Release, and pushes the image to GHCR. `release.yml` also builds the package, without publishing, on pushes to main and on pull requests that change `scripts/setup/**`, `package.ps1`, `install.ps1`, `uninstall.ps1` or `release.yml`. Do not push a tag unless asked. The package carries the DSN of the repository variable `SENTRY_DSN`; after the release, the programs' debug files (`dist\symbols-\`, written by `package.ps1` and never put in the zip) go to the Sentry project `fly-theonlyone/codewiki` with `sentry-cli`, when the secret `SENTRY_AUTH_TOKEN` is set. The token is given to that step alone, never to the build. diff --git a/ROADMAP.md b/ROADMAP.md index ccae1100..44e0f2d5 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -4,7 +4,8 @@ Status as of 2026-11-28. "Verified" means covered by automated tests or by a liv ## Current state -- 17 crates. `cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace` (1294 tests) and `cargo deny check advisories bans sources` all pass. The licenses of dependencies are no longer checked, by the owner's decision of 2026-11-20. +- 17 crates. `cargo fmt --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace` (1295 tests) and `cargo deny check advisories bans sources` all pass. The licenses of dependencies are no longer checked, by the owner's decision of 2026-11-20. +- Not released yet, on main since 2026-11-28: a source file hashes the same with CRLF and LF line endings. Until 0.6.0 the hash was that of the raw bytes, so the same commit gave other hashes in another checkout: notes were marked behind though nothing had changed, and a synced wiki was out of sync on the next machine. Found when CI was made to fail on a wiki that is not what the code generates (`wiki-check` in `ci.yml`); that check has passed on Linux against the wiki written on Windows. Unit tests only; no VM run. - Version 0.6.0 is the seventh release, tagged on 2026-11-28 as `v0.6.0`. It brings: - parsers for C#, Go, Kotlin, C and C++, and a file-level map for every other language; - TypeScript path aliases, Python packages without `__init__.py`, and pnpm, yarn and bun projects;