mirror of
https://github.com/logos-co/logos-liblogos.git
synced 2026-08-27 12:51:10 +00:00
The macOS doc-test job has been red since 2026-08-21: every module call came
back {"__logos_rpc_status__":"unauthorized"}, preceded in the daemon log by
capability_module rejecting the CLI's own requestModule handshake. Linux was
green throughout.
NOT MODULE ROT. A freshly-built test_basic_module failed identically to
accounts_module. Bisected on one macOS box, one variable, same CLI, same module:
liblogos 3893c833 (parent) -> "result":42
liblogos b2a9a0ba (#182) -> unauthorized
MECHANISM, from `nm -mu` on the logoscore binary:
pre-#182: TokenManager::instance() (from liblogos_core)
at-#182: TokenManager::instance() (from liblogos_module_client)
#182 made liblogos_core export ZERO TokenManager symbols -- they moved to
liblogos_protocol. macOS two-level namespace then rebound the CLI's imports to
the next image still statically absorbing a copy, so the CLI wrote its token
into one singleton while the runtime authorized against another. ELF cannot
show this: flat namespace collapses every definition onto the first-loaded
image, so Linux held the invariant by accident.
THE PIN IS THE BUG, not the linkage. The shared-runtime split landed as one pin
SET -- logos-protocol 2e3344a, logos-plugin-qt 1aa3e31, logos-liblogos b2a9a0b
(#182), logoscore-cli 2312a3a. This spec pinned the CLI at b92ade06
(2026-06-10) and overrode only logos-liblogos, manufacturing exactly the
half-migrated pairing the set exists to prevent. That pin's own commit (050f2d3)
called it "Temporary -- drop when the chain PRs merge"; nobody did. Dropping the
rev is the fix. logoscore master had already shed the deprecated
logos-module-client in its #48, so nothing there needs changing.
WHY THIS READ AS ONE FLAKY STEP rather than a total auth outage: "Call a method"
asserted on the bare string '"result"', which the unauthorized envelope also
contains. Both calls now assert values -- '"result":"hello"' and '"result":42'.
ALSO RETIRED: logos-accounts-module was archived on 2026-07-22. Both specs now
drive test_basic_module from logos-test-modules, via the
`#modules.$SYSTEM.<name>.lgx` attribute path the logoscore-cli doc-tests already
use. The module-runtime spec no longer clones a repo at all, so it loses its git
prerequisite and one step.
VERIFIED on aarch64-darwin against 959d11d9 -- the exact commit CI failed on:
34 passed, 0 failed (was 34 passed, 1 failed of 35), and zero "rejecting
unauthorized call" lines in the daemon log.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
248 lines
11 KiB
YAML
248 lines
11 KiB
YAML
name: liblogos Doc-Tests
|
|
|
|
# Runs the executable liblogos doc-tests end-to-end via the shared doctest CLI,
|
|
# both pinned to the commit of logos-liblogos under test (via --release-for):
|
|
# - doctests/liblogos-module-runtime.test.yaml — drives liblogos through the
|
|
# logoscore CLI frontend (build logoscore against this commit, install
|
|
# test_basic_module, start the daemon, load + call methods).
|
|
# - doctests/liblogos-as-a-library.test.yaml — embeds liblogos directly:
|
|
# builds liblogos_core from this commit, compiles a C++ program that links
|
|
# it, installs modules with lgpm, and loads test_basic_module via the C API.
|
|
# Both specs run in one invocation, producing a single combined report.
|
|
#
|
|
# ──────────────────────────────────────────────────────────────────────────────
|
|
# One-time setup required for the clickable report links to work:
|
|
#
|
|
# 1. Repo Settings → Pages → "Build and deployment" → Source: "Deploy from a
|
|
# branch", Branch: `gh-pages` / `(root)`. (The publish-report job creates
|
|
# the gh-pages branch on its first run.)
|
|
# 2. Nothing else — GITHUB_TOKEN already has the permissions granted below.
|
|
#
|
|
# Each run publishes the two-column HTML report to:
|
|
# https://<owner>.github.io/<repo>/pr-<N>/<os>/ (pull requests)
|
|
# https://<owner>.github.io/<repo>/main/<os>/ (pushes to main/master)
|
|
# and (for PRs) posts/updates a comment with the links.
|
|
#
|
|
# Note: pull requests opened from forks get a read-only GITHUB_TOKEN, so the
|
|
# Pages push and PR comment are skipped for them — the downloadable artifact is
|
|
# still produced. PRs from branches in this repo get the full clickable links.
|
|
# ──────────────────────────────────────────────────────────────────────────────
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [master, main]
|
|
push:
|
|
branches: [master, main]
|
|
|
|
concurrency:
|
|
group: doctests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
doctests:
|
|
name: liblogos doc-tests (${{ matrix.os }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 90
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Nix
|
|
uses: DeterminateSystems/nix-installer-action@main
|
|
|
|
- name: Setup Cachix
|
|
uses: cachix/cachix-action@v15
|
|
with:
|
|
name: logos-co
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
|
|
# Resolve the commit under test. For pull requests this is the PR's head
|
|
# commit (not the synthetic merge commit); for pushes it's the pushed
|
|
# commit. Passed to --release-for below so the doc-test builds logoscore
|
|
# against THIS commit of logos-liblogos instead of the latest release.
|
|
#
|
|
# Fork PRs are the exception: their head commit lives in the fork, not in
|
|
# logos-co/logos-liblogos, so nix could not fetch
|
|
# `github:logos-co/logos-liblogos/<sha>`. We blank the SHA for forks
|
|
# (--release-for repo= → pins that repo to latest), so the doc-test still
|
|
# runs for fork PRs, just against master.
|
|
- name: Resolve commit under test
|
|
id: commit
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "pull_request" ] && \
|
|
[ "${{ github.event.pull_request.head.repo.fork }}" = "true" ]; then
|
|
echo "sha=" >> "$GITHUB_OUTPUT"
|
|
echo "Fork PR detected — doc-test will run against latest master."
|
|
else
|
|
echo "sha=${{ github.event.pull_request.head.sha || github.sha }}" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
# The runner is the shared `doctest` CLI, invoked directly via its flake
|
|
# (github:logos-co/logos-doctest). The flake bundles Python + PyYAML
|
|
# (+ rich), so no pip install step is needed.
|
|
#
|
|
# --release-for pins the {release} placeholder for logos-liblogos to the
|
|
# commit under test, so the override URL in each spec
|
|
# (`github:logos-co/logos-liblogos{release}`) becomes `.../<sha>` — the
|
|
# logoscore runtime and the embedded liblogos_core are both rebuilt against
|
|
# this PR/push rather than master. Every other repo URL still resolves to
|
|
# latest. Passing both specs to one `run` produces a single combined report
|
|
# with a per-spec dropdown.
|
|
- name: Run liblogos doc-tests
|
|
run: |
|
|
# --continue-on-fail so the run walks every step and the published
|
|
# report is complete. The job still fails (non-zero exit) if any step
|
|
# failed; this only changes whether we stop early.
|
|
nix run github:logos-co/logos-doctest -- run \
|
|
doctests/liblogos-module-runtime.test.yaml \
|
|
doctests/liblogos-as-a-library.test.yaml \
|
|
--verbose \
|
|
--continue-on-fail \
|
|
--release-for logos-liblogos=${{ steps.commit.outputs.sha }} \
|
|
--report "${{ runner.temp }}/liblogos-doctest-report.html"
|
|
|
|
- name: Stage report for upload
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
mkdir -p report-out
|
|
# Name it index.html so the published directory URL renders directly.
|
|
if [ -f "${{ runner.temp }}/liblogos-doctest-report.html" ]; then
|
|
cp "${{ runner.temp }}/liblogos-doctest-report.html" report-out/index.html
|
|
else
|
|
echo "<h1>No report produced</h1>" > report-out/index.html
|
|
fi
|
|
|
|
- name: Upload liblogos execution report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: liblogos-doctest-report-${{ matrix.os }}
|
|
path: report-out/index.html
|
|
if-no-files-found: warn
|
|
|
|
- name: Verify markdown generation
|
|
run: |
|
|
nix run github:logos-co/logos-doctest -- generate \
|
|
doctests/liblogos-module-runtime.test.yaml \
|
|
--release-for logos-liblogos=${{ steps.commit.outputs.sha }} \
|
|
-o /tmp/liblogos-module-runtime.md
|
|
test -s /tmp/liblogos-module-runtime.md
|
|
nix run github:logos-co/logos-doctest -- generate \
|
|
doctests/liblogos-as-a-library.test.yaml \
|
|
--release-for logos-liblogos=${{ steps.commit.outputs.sha }} \
|
|
-o /tmp/liblogos-as-a-library.md
|
|
test -s /tmp/liblogos-as-a-library.md
|
|
echo "Generated markdown successfully"
|
|
|
|
publish-report:
|
|
name: Publish report to GitHub Pages
|
|
needs: doctests
|
|
# Run even when tests fail — a failing run is exactly when you want to open
|
|
# the report. Skip on forks, where GITHUB_TOKEN can't push or comment.
|
|
if: ${{ always() && github.event.pull_request.head.repo.fork != true }}
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: write # push to the gh-pages branch
|
|
pull-requests: write # post/update the PR comment
|
|
|
|
# Serialize Pages pushes so two refs can't race on the gh-pages branch.
|
|
concurrency:
|
|
group: gh-pages-publish
|
|
cancel-in-progress: false
|
|
|
|
steps:
|
|
- name: Download all reports
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
# No `name:` → downloads every artifact into artifacts/<name>/...
|
|
|
|
- name: Arrange site directory
|
|
id: arrange
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
BASE="pr-${{ github.event.pull_request.number }}"
|
|
else
|
|
BASE="main"
|
|
fi
|
|
echo "base=$BASE" >> "$GITHUB_OUTPUT"
|
|
|
|
mkdir -p "site/$BASE"
|
|
found=""
|
|
for os in ubuntu-latest macos-latest; do
|
|
src="artifacts/liblogos-doctest-report-$os/index.html"
|
|
if [ -f "$src" ]; then
|
|
mkdir -p "site/$BASE/$os"
|
|
cp "$src" "site/$BASE/$os/index.html"
|
|
found="$found $os"
|
|
fi
|
|
done
|
|
echo "found=$found" >> "$GITHUB_OUTPUT"
|
|
|
|
# Landing page for this ref linking to each OS report.
|
|
{
|
|
echo "<!doctype html><meta charset=utf-8>"
|
|
echo "<title>liblogos doc-test reports — $BASE</title>"
|
|
echo "<style>body{font:16px system-ui;margin:40px;max-width:640px}a{color:#2563eb}</style>"
|
|
echo "<h1>liblogos doc-test reports</h1>"
|
|
echo "<p><strong>$BASE</strong> · commit <code>${GITHUB_SHA::7}</code></p><ul>"
|
|
for os in ubuntu-latest macos-latest; do
|
|
if [ -d "site/$BASE/$os" ]; then
|
|
echo "<li><a href=\"./$os/\">$os</a></li>"
|
|
fi
|
|
done
|
|
echo "</ul>"
|
|
} > "site/$BASE/index.html"
|
|
|
|
- name: Deploy to gh-pages
|
|
if: steps.arrange.outputs.found != ''
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./site
|
|
keep_files: true # don't wipe other PRs' directories
|
|
commit_message: "Publish liblogos doc-test report for ${{ steps.arrange.outputs.base }} (${{ github.sha }})"
|
|
|
|
- name: Comment on PR with report links
|
|
if: ${{ github.event_name == 'pull_request' && steps.arrange.outputs.found != '' }}
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const base = "${{ steps.arrange.outputs.base }}";
|
|
const owner = context.repo.owner;
|
|
const repo = context.repo.repo;
|
|
const root = `https://${owner}.github.io/${repo}/${base}`;
|
|
const oses = "${{ steps.arrange.outputs.found }}".trim().split(/\s+/).filter(Boolean);
|
|
|
|
const links = oses.map(os => `- [\`${os}\` report](${root}/${os}/)`).join("\n");
|
|
const marker = "<!-- liblogos-doctest-report-links -->";
|
|
const body =
|
|
`${marker}\n` +
|
|
`### 📊 liblogos doc-test report\n\n` +
|
|
`A real module, run through a logoscore daemon built against ` +
|
|
`this commit of liblogos — rendered alongside the commands actually run ` +
|
|
`and their output (updated each run, commit \`${context.sha.slice(0,7)}\`):\n\n` +
|
|
`${links}\n\n` +
|
|
`_Pages can take a minute to update after the run finishes._`;
|
|
|
|
const { data: comments } = await github.rest.issues.listComments({
|
|
owner, repo, issue_number: context.issue.number, per_page: 100,
|
|
});
|
|
const existing = comments.find(c => c.body && c.body.includes(marker));
|
|
if (existing) {
|
|
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
|
|
} else {
|
|
await github.rest.issues.createComment({ owner, repo, issue_number: context.issue.number, body });
|
|
}
|