Skip to content

fix(packaging): ship the diagnosis prompt files in the wheel (regression from #80)#82

Merged
JumpTechCode merged 1 commit into
mainfrom
fix/package-prompt-data
Jun 16, 2026
Merged

fix(packaging): ship the diagnosis prompt files in the wheel (regression from #80)#82
JumpTechCode merged 1 commit into
mainfrom
fix/package-prompt-data

Conversation

@JumpTechCode

Copy link
Copy Markdown
Collaborator

A regression introduced by #80. The multistage image switched to a non-editable pip install ., and setuptools packages only *.py by default — so the diagnosis prompt bundle (sentinel/diagnosis/prompts/v1.md + v1.sha256), read at boot by PromptBundle.load via a package-relative path, was dropped from the wheel. The production image crashed on startup:

FileNotFoundError: .../site-packages/sentinel/diagnosis/prompts/v1.md

#80's verification used a build_app() import smoke, which doesn't run the lifespan where PromptBundle.load lives — so it only surfaced on a real container boot (found while wiring up the README's live-demo path).

Fix

  • [tool.setuptools.package-data] declares "sentinel.diagnosis" = ["prompts/*.md", "prompts/*.sha256"] so the wheel ships them. The eval corpus/cassettes (the other non-.py files in the package) are deliberately not packaged — they're dev/CI-only and run from the source tree, never from the installed wheel (eval_mode defaults off; the production CMD is sentinel-api).
  • A contract test (tests/unit/test_packaging.py) pins the declaration to the files it must cover, since CI never builds the wheel.

Verified

  • pip wheel --no-deps . now produces a wheel containing both prompts/v1.md and v1.sha256.
  • The rebuilt image boots healthy, and the full webhook → enrichment → diagnosis demo works end-to-end (diagnosis served via the API).
  • Full unit suite: 513 passed, 84.85% coverage; ruff + mypy --strict clean. Senior review: no Critical/Important findings.

Follow-up (tracked, not in this PR)

A CI job that builds and boots the image would be the stronger guard than a source-only contract test — it's the gap that let this through. Deferred because it adds a slow Docker build to every PR.

🤖 Generated with Claude Code

…ion from #80)

The multistage image (#80) switched to a non-editable `pip install .`. setuptools
packages only *.py by default, so `sentinel/diagnosis/prompts/v1.md` (+ its
`.sha256` baseline) — read at boot by PromptBundle.load via a package-relative
path — was dropped from the wheel, and the production image crashed on startup:

    FileNotFoundError: .../site-packages/sentinel/diagnosis/prompts/v1.md

The #80 verification used a build_app() import smoke, which doesn't run the
lifespan where PromptBundle.load lives — so the crash only surfaced on a real
container boot.

- Declare the prompts as package-data so the wheel ships them. The eval
  corpus/cassettes are deliberately left out (dev/CI-only, run from source).
- Contract test guards the declaration (CI never builds the wheel).

Verified: `pip wheel .` now contains v1.md + v1.sha256; the rebuilt image boots
healthy and the full webhook → diagnosis demo works end-to-end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JumpTechCode
JumpTechCode merged commit f90ca1d into main Jun 16, 2026
6 checks passed
@JumpTechCode
JumpTechCode deleted the fix/package-prompt-data branch June 16, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant