Skip to content

[codex] Modularize chat prompts and tests#92

Open
anth-volk wants to merge 2 commits into
mainfrom
codex/modular-chat-prompts-tests
Open

[codex] Modularize chat prompts and tests#92
anth-volk wants to merge 2 commits into
mainfrom
codex/modular-chat-prompts-tests

Conversation

@anth-volk

@anth-volk anth-volk commented May 29, 2026

Copy link
Copy Markdown

Fixes #91

Summary

  • Move UK chat runtime prompts into a dedicated backend/prompts.py module.
  • Add factual-neutrality and row-level microdata rules to prompts and exposed tool metadata.
  • Add PR CI for backend pytest and frontend production build.
  • Clean up backend tests around live Anthropic calls, compiled-engine availability, conversation table isolation, and stale compute coverage.
  • Add model-agnostic AI guidance docs under docs/engineering/skills/ with thin adapters for AGENTS, Claude, and Copilot.

Validation

  • PYTHONPATH=backend python -m pytest backend/tests/test_prompts.py backend/tests/test_agent_tools.py
  • npm run build in frontend/
  • git diff --check --cached before commit

Notes

The full backend suite is intended to run in CI after installing backend/requirements.txt. Local compiled-engine-dependent tests skipped cleanly where policyengine_uk_compiled was not installed.

@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-uk-chat Ready Ready Preview, Comment May 29, 2026 5:10pm

Request Review

@github-actions

Copy link
Copy Markdown

Beta preview is ready.

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Solid, low-risk refactor. Extracting prompts into backend/prompts.py as composable sections, adding the neutrality/privacy rules to both the system prompt and the exposed tool metadata, wiring up PR CI, and the test cleanup all look good. Approving with a couple of things to confirm.

1. CI now hard-requires the compiled engine to import. requires_compiled skips only when CI != "true", so on GitHub Actions the compiled-dependent tests (TestCalculateHousehold, TestGetBaselineParameters, TestRunPython, etc.) are forced to run rather than skip. requirements.txt pins policyengine-uk-compiled>=0.20.0, so import should succeed — but several of these tests actually execute simulations. Please confirm they pass in the runner without a POLICYENGINE_UK_DATA_TOKEN / dataset download; otherwise the first green-looking CI run will fail on data access, not code.

2. requires_compiled is now duplicated verbatim in test_agent_tools.py (and again in test_structural_tools.py on the stacked PR). Consider hoisting it into conftest.py so the CI/skip policy lives in one place.

Minor: the old ANALYTICAL NOTES line "Stay analytically neutral" is dropped, but the new dedicated NEUTRALITY_RULES section more than covers it — net improvement, just flagging the wording moved. The good regression test here is test_system_blocks_preserve_cache_breakpoints_after_prompt_refactor, which guards the prompt-cache breakpoint after the refactor.

Prompt contract tests, the cache-breakpoint assertion, and the compute-removal coverage are all in place. Did not run the suite locally (compiled engine unavailable); author reports the focused tests pass.

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.

Modularize chat prompts and add PR test workflow

2 participants