From 830eb8ba00c9a2d3b2694b83a3bd0cd7dbcfa2db Mon Sep 17 00:00:00 2001 From: Patrick Buckley Date: Fri, 3 Apr 2026 15:32:04 -0700 Subject: [PATCH] fix: include prompt .md files in wheel, add wheel-completeness CI (#289) (#291) * fix: include prompt .md files in wheel, add wheel-completeness CI (#289) Prompt markdown files were missing from PyPI wheels since the modular prompts refactor, causing FileNotFoundError on startup for pip-installed users. Add the missing include pattern and a new CI job that diffs source-tree data files against wheel contents so omissions are caught before merge. * fix: sanitise ALLOW patterns in wheel-completeness check Strip blank lines and leading whitespace from the allowlist before passing to grep -vFxf so empty patterns cannot silently match all lines. --- .github/workflows/ci.yml | 47 ++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 48 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 551d4e61..ef45bc9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,53 @@ jobs: env: TURNSTONE_TEST_PG_URL: postgresql+psycopg://postgres:postgres@localhost:5432/turnstone_test + wheel-completeness: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + with: + python-version: "3.14" + - run: pip install build + - run: python -m build --wheel + - name: Check all data files are in wheel + run: | + SOURCE=$(find turnstone -type f \ + ! -name '*.py' ! -name '*.pyc' ! -path '*__pycache__*' \ + | sort) + WHEEL=$(python -m zipfile -l dist/*.whl \ + | awk '{print $1}' \ + | grep -v '\.py$' | grep -v '\.dist-info' | grep -v '\.pyc' | grep -v '^File$' \ + | sort) + + # Files intentionally excluded from the wheel (one per line) + ALLOW=" + turnstone/core/storage/migrations/script.py.mako + " + + MISSING=$(comm -23 <(echo "$SOURCE") <(echo "$WHEEL") \ + | grep -vFxf <(echo "$ALLOW" | sed '/^[[:space:]]*$/d; s/^[[:space:]]*//' ) || true) + + if [ -n "$MISSING" ]; then + echo "::error::Data files in source tree but missing from wheel:" + echo "$MISSING" + echo "" + echo "Add them to [tool.hatch.build.targets.wheel] in pyproject.toml" + echo "or to the ALLOW list in this job if intentionally excluded." + exit 1 + fi + echo "All source data files present in wheel" + - name: Smoke-test entry points from installed wheel + run: | + python -m venv /tmp/smoke + /tmp/smoke/bin/pip install dist/*.whl + /tmp/smoke/bin/turnstone --help + /tmp/smoke/bin/turnstone-server --help + /tmp/smoke/bin/turnstone-console --help + /tmp/smoke/bin/turnstone-admin --help + /tmp/smoke/bin/turnstone-channel --help + /tmp/smoke/bin/turnstone-bootstrap --help + lock-check: runs-on: ubuntu-latest steps: diff --git a/pyproject.toml b/pyproject.toml index d7670707..fb55ede5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ turnstone-bootstrap = "turnstone.bootstrap:main" [tool.hatch.build.targets.wheel] include = [ "turnstone/**/*.py", + "turnstone/prompts/**/*.md", "turnstone/tools/*.json", "turnstone/ui/static/*.html", "turnstone/ui/static/*.css",