Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE/knowledge-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
- [ ] `.lokf/pyproject.toml` changes on the `ktl` line alone, to the release, and `.lokf/uv.lock` on the `ktl` entry alone.
- [ ] Any workflow changes held above are read and applied on this branch, or left for the next sync on purpose.
- [ ] You read the [release notes of Knowledge Trust Ladder](https://w3id.org/ktl/changelog/) for a step the sync cannot do, such as setting a new variable or secret. If there is one, you do it in this pull request or straight after the merge.
- [ ] Where the gate fails on a convention the release adds or tightens, such as rule 16's one `excerpt` for each source `id`, the bundle is fixed through the pen in a pull request of its own, and this one runs again once that merges.
- [ ] `CHANGELOG.md` has the entry under `## [Unreleased]` and `### Security`, and the title carries `security(sidecar):`, so the merge releases.
10 changes: 10 additions & 0 deletions .github/workflows/knowledge-librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ jobs:
# trusts the wheels it unpacked there without hashing them again. So a
# cache this job saved after the agent ran could be what the release
# restores and packs.
# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
Expand Down Expand Up @@ -431,7 +436,12 @@ jobs:

# No uv cache, as in `refresh`, so nothing the agent's job unpacked is
# what this job's checks run on.
# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
Expand Down
268 changes: 183 additions & 85 deletions .github/workflows/knowledge-registrar.yaml

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion .github/workflows/knowledge-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,13 @@ jobs:
# .lokf/uv.lock. A cache is shared by every job on the default branch,
# the librarian's agent job among them, and uv trusts the wheels it
# unpacked there without hashing them again.
- name: Set up uv
# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
if: steps.compare.outputs.changed == 'true'
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.compare.outputs.changed == 'true' && steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
Expand Down
38 changes: 34 additions & 4 deletions .github/workflows/knowledge-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ on:

permissions: {} # deny by default; each job requests only the scopes it needs

concurrency:
group: knowledge-sync
cancel-in-progress: false

jobs:
earlier:
name: Read the pin, the newest release and the last pull request (read-only)
Expand Down Expand Up @@ -128,7 +124,12 @@ jobs:
with:
persist-credentials: false

# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
Expand Down Expand Up @@ -295,7 +296,12 @@ jobs:
with:
persist-credentials: false # keep GITHUB_TOKEN off disk while the release is read

# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
Expand Down Expand Up @@ -358,6 +364,11 @@ jobs:
if: needs.sync.outputs.changed == 'true'
runs-on: ${{ vars.KNOWLEDGE_RUNNER || 'ubuntu-latest' }}
timeout-minutes: 10
# The two jobs that push take turns. A run waiting for the review
# Environment holds no turn, so it blocks no later sync.
concurrency:
group: knowledge-sync
cancel-in-progress: false
# KNOWLEDGE_SYNC_TOKEN belongs in this Environment, limited to the
# default branch, so a workflow on any other branch cannot read it. It
# records no deployment.
Expand Down Expand Up @@ -386,7 +397,12 @@ jobs:
name: knowledge-sync-patch
path: ${{ runner.temp }}

# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
python-version: "3.12"
Expand Down Expand Up @@ -607,6 +623,9 @@ jobs:
needs: [earlier, publish, review]
runs-on: ${{ vars.KNOWLEDGE_RUNNER || 'ubuntu-latest' }}
timeout-minutes: 10
concurrency:
group: knowledge-sync
cancel-in-progress: false
environment:
name: knowledge-sync
deployment: false
Expand Down Expand Up @@ -665,6 +684,17 @@ jobs:
printf '%s\n' "$wrong" | sed '/^$/d; s/^/ /'
exit 1
fi
# A pull request merged, closed or refreshed while the approval
# waited leaves these changes stale; the next sync carries them.
tip="$(git ls-remote "https://x-access-token:${SYNC_TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" refs/heads/knowledge-sync | cut -f1)"
if [ -z "$tip" ]; then
echo "::warning::The knowledge-sync branch is gone: its pull request was merged or closed while this approval waited. Nothing is pushed; the next sync proposes any workflow change still missing."
exit 0
fi
if [ "$tip" != "$LEASE" ]; then
echo "::error::The knowledge-sync branch moved from $LEASE to $tip while this approval waited, so these held changes are stale. Nothing is pushed; apply the ones the pull request lists now, or let the next sync propose them."
exit 1
fi
git apply --index "$held"
git config user.name "knowledge-sync[bot]"
git config user.email "knowledge-sync[bot]@users.noreply.github.com"
Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/knowledge-website.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Knowledge website

# Builds the site in website/ (or in ktl-website/, where website/ was another
# site's) from the knowledge bundle, the README, docs/, the figures, the
# changelog and a LinkML schema, each when the repository has it, and
# site's) from the knowledge bundle, the README, SPEC.md, docs/, the figures,
# the changelog and a LinkML schema, each when the repository has it, and
# publishes the default branch's build to GitHub Pages. A pull request that
# touches any of them gets the same build, link check included, and no
# deployment. A weekly run rebuilds the site from the default branch. It
Expand Down Expand Up @@ -33,6 +33,7 @@ on:
- ".lokf/**"
- "knowledge_bundle/**"
- "README.md"
- "SPEC.md"
- "docs/**"
- ".assets/**"
- "CHANGELOG.md"
Expand All @@ -47,6 +48,7 @@ on:
- ".lokf/**"
- "knowledge_bundle/**"
- "README.md"
- "SPEC.md"
- "docs/**"
- ".assets/**"
- "CHANGELOG.md"
Expand Down Expand Up @@ -88,7 +90,12 @@ jobs:
persist-credentials: false
fetch-depth: 0

# A runner that holds uv keeps its own; setup-uv fetches one from github.com.
- name: Find uv on the runner
id: uv
run: if command -v uv >/dev/null 2>&1; then echo "found=true" >> "$GITHUB_OUTPUT"; fi
- name: Set up uv
if: steps.uv.outputs.found != 'true'
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
Expand All @@ -111,26 +118,32 @@ jobs:
# runner the runner image lacks. Where .lokf/uv.lock pins rust-just,
# the step links the copy uv checked by hash, alone, so the toolkit's
# other commands stay off PATH; else it installs the same version by
# name.
# name. uv-env.sh installs what that lock pins, as the build does. The
# step reads site.toml through site-values.py, as prepare.sh does, so
# a file that is not TOML stops the run here.
- name: Install just, when the site builds its data with it
env:
SITE_DIR: ${{ steps.site.outputs.dir }}
run: |
if grep -q '^browseBuild = "just ' "$SITE_DIR/site.toml"; then
mkdir -p "$HOME/.local/bin"
if grep -qx 'name = "rust-just"' .lokf/uv.lock; then
uv sync --project .lokf --frozen --quiet
ln -sf "$PWD/.lokf/.venv/bin/just" "$HOME/.local/bin/just"
else
uv tool install rust-just==1.47.0
fi
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
fi
build="$(python3 -I "$SITE_DIR/scripts/site-values.py" "$SITE_DIR/site.toml" | sed -n 's/^browseBuild=//p')"
case "$build" in
"just "*)
mkdir -p "$HOME/.local/bin"
if grep -qx 'name = "rust-just"' .lokf/uv.lock; then
bash "$SITE_DIR/scripts/uv-env.sh" .lokf > /dev/null
ln -sf "$PWD/.lokf/.venv/bin/just" "$HOME/.local/bin/just"
else
uv tool install rust-just==1.47.0
fi
echo "$HOME/.local/bin" >> "$GITHUB_PATH" ;;
esac

# build.sh runs prepare.sh first, which runs `lokf export` and, for a
# LinkML schema, gen-doc, both from the toolkit .lokf/uv.lock pins. Then
# Hugo and Pagefind, from the site's own uv.lock, the cleaning of raw
# HTML, and the link check.
# HTML, and the link check. Behind a package mirror, scripts/uv-env.sh
# installs what each lock pins from it, checked against the lock's
# hashes. The site's README.md says what a blocked CDN needs.
- name: Build the site and check its links
env:
SITE_DIR: ${{ steps.site.outputs.dir }}
Expand Down
10 changes: 7 additions & 3 deletions .lokf/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ lokf-serve:
# outside base_iri alone, since `source` and `definedBy` take an external
# resource. --check-excerpts (lokf 0.9.0 or later) finds each
# `sources[].excerpt` in its local file, and counts an excerpt on a URL
# without fetching it.
# without fetching it. --shacl checks the projected graph against LOKF's
# SHACL shapes, such as a relation's target class and one excerpt per source
# node. It runs where uv.lock holds pyshacl, so a broken install fails
# rather than skipping the shapes; without it the recipe says so.
#
# Audit: every typed-relation target must resolve to a concept, and every local excerpt must match its file
# Audit: every typed-relation target must resolve to a concept, every local excerpt must match its file, and the graph must keep LOKF's shapes
lokf-check-refs:
uv run lokf validate {{ _schema }} --check-refs --check-excerpts {{ bundle }}
@grep -qx 'name = "pyshacl"' uv.lock 2>/dev/null || echo "SHACL shapes not checked: give lokf the shacl extra in pyproject.toml, then run uv lock"
uv run lokf validate {{ _schema }} --check-refs --check-excerpts $(grep -qx 'name = "pyshacl"' uv.lock 2>/dev/null && echo --shacl) {{ bundle }}

# The knowledge_bundle doorway shows the bundle under a visible name at the
# host root, for tools that hide dot-folders: folder pickers, file managers
Expand Down
4 changes: 2 additions & 2 deletions .lokf/m365/ktl-docent-m365.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ This is the Microsoft 365 Copilot build of the ktl-docent skill from [knowledge-

A bare `verified: { by, at }` counts as one event. Absent `status` means stable. Give each concept's labels on one line, in the order and form below. The repository's report script prints them the same way, so a reader sees the same words in Copilot and in the repository.

- Label a *retired* concept *retired*, and give it no other label. Add *replaced by* and the path when its newest `**Deprecation**` line in `log.md` links the concept that replaced it.
- Label a *retired* concept *retired*, and give it no other label. Add *replaced by* and the path of the concept that replaced it: the first that its `isReplacedBy` names, or else the one its newest `**Deprecation**` line in `log.md` links.
- Otherwise, start with the first of *edited since a person last confirmed it*, *confirmed by a person*, *checked by automation only* and *nobody has checked this yet* that applies. Add *still a draft*, then *past its review date*, where they apply.
- After *confirmed by a person*, give the date of the latest `human:` event. When that event carries a `revision`, add "against" and the revision: a commit hash cut to its first seven characters, or an ETag or digest as written.
- After *confirmed by a person*, give the date of the latest `human:` event. When that event carries a `revision`, add "against" and the revision: a commit hash cut to its first seven characters, a `sha256:` digest cut to the seven after `sha256:`, or an ETag as written.
- *Edited since a person last confirmed it* takes the place of *confirmed by a person*, because the person confirmed an earlier text. Give both dates, as in "(confirmed 2026-09-01, edited 2026-09-20)", or both full times when they fall on one day. Compare `generated.at` with the latest `human:` `verified[].at` whole, as strings, never cut to the day: an edit at 14:00 follows a confirmation at 10:00 the same day. Use the v0.1 `timestamp` where `generated.at` is missing. A concept with neither cannot carry this label.
- After *past its review date*, give the `stale_after` date in brackets. Compare it with today's date, not the snapshot's: a concept can pass its review date after the snapshot was built.

Expand Down
2 changes: 1 addition & 1 deletion .lokf/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "LOKF knowledge-bundle tooling for SLSA."
# Keep in sync with the `lokf` toolkit's own requires-python floor.
requires-python = ">=3.11"
dependencies = [
"ktl==0.66.0",
"ktl==0.69.2",
"lokf[build]>=0.9.0",
"rust-just==1.59.0",
]
Expand Down
Loading
Loading