Port Cataclysm to chatsnack - #21
Draft
Mattie wants to merge 3 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Ports Cataclysm’s code-generation backend from the legacy plunkylib flow to a chatsnack-backed adapter while keeping the existing public doom / consume entrypoints, and adds offline + notebook-oriented test coverage to lock in the documented behaviors.
Changes:
- Introduce
cataclysm/chatsnack_adapter.pyand routeCataclysmCreatorgeneration through chatsnack (with utensil support + legacy plunkylib YAML fallback). - Update packaged defaults (
env.template, default prompt YAMLs) andinitialize_datafiles()to install chatsnack assets by default. - Add offline regression tests for public API + README/notebook examples, and gate live tests behind
OPENAI_API_KEY+CATACLYSM_RUN_LIVE_TESTS=1.
Reviewed changes
Copilot reviewed 36 out of 38 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_public_api_offline.py | Offline unit coverage for consume interception and CataclysmCreator execution/caching/retry behaviors. |
| tests/test_notebooks.py | Notebook cell execution harness (pytest) for replaying notebook code cells. |
| tests/test_notebook_metadata.py | Ensures notebook cells only use the allowed execution tags and flags legacy tags. |
| tests/test_init_files.py | Validates packaged defaults and initialize_datafiles() copy behavior for chatsnack assets. |
| tests/test_doom_retry.py | Gates live doom retry tests behind env vars and markers. |
| tests/test_doom_offline.py | Offline coverage for chatsnack generation plumbing + retry semantics + import-time plunkylib absence. |
| tests/test_doom_inspection.py | Gates live inspection tests behind env vars and markers. |
| tests/test_doom_impending_basics.py | Gates live impending tests behind env vars and markers. |
| tests/test_doom_callstack.py | Gates live callstack tests behind env vars and markers. |
| tests/test_doom_basics.py | Gates live basics tests behind env vars and markers. |
| tests/test_docs_examples_offline.py | Offline regression checks for README + notebook-presented examples remaining valid. |
| tests/test_chatsnack_adapter.py | Unit tests for chatsnack adapter YAML loading, tool-choice shaping, and code extraction/validation. |
| tests/notebook_support.py | Shared notebook parsing/execution utilities used by notebook tests. |
| README.md | Updates docs to reflect chatsnack configuration and fixes the Chosen Doom example to use doom.chosen. |
| pyproject.toml | Swaps plunkylib for chatsnack dependency, adds pytest markers, and updates package include paths. |
| examples/image_resizer/datafiles/plunkylib/prompts/CataclysmPrompt.yml | Removes legacy plunkylib prompt asset. |
| examples/image_resizer/datafiles/plunkylib/petition/CataclysmQuery.yml | Removes legacy plunkylib petition asset. |
| examples/image_resizer/datafiles/plunkylib/params/CataclysmLLMParams.yml | Removes legacy plunkylib params asset. |
| examples/image_resizer/datafiles/plunkylib/params/CataclysmLLMParams_3-5.yml | Removes legacy plunkylib params asset. |
| examples/image_resizer/datafiles/chatsnack/CataclysmQuery.yml | Adds chatsnack prompt asset for the image_resizer example. |
| examples/hangman/datafiles/plunkylib/prompts/CataclysmPrompt.yml | Removes legacy plunkylib prompt asset. |
| examples/hangman/datafiles/plunkylib/petition/CataclysmQuery.yml | Removes legacy plunkylib petition asset. |
| examples/hangman/datafiles/plunkylib/params/CataclysmLLMParams.yml | Removes legacy plunkylib params asset. |
| examples/hangman/datafiles/plunkylib/params/CataclysmLLMParams_3-5.yml | Removes legacy plunkylib params asset. |
| examples/hangman/datafiles/chatsnack/CataclysmQuery.yml | Adds chatsnack prompt asset for the hangman example. |
| datafiles/chatsnack/CataclysmQuery.yml | Adds repo-level chatsnack prompt asset. |
| cataclysm/doomed.py | Replaces plunkylib generation with generate_code_with_chatsnack() and adds invalid-code retry handling. |
| cataclysm/default_files/env.template.cataclysm | Updates env template to chatsnack base dir configuration. |
| cataclysm/default_files/datafiles/plunkylib/prompts/CataclysmPrompt.yml | Removes packaged legacy plunkylib prompt asset. |
| cataclysm/default_files/datafiles/plunkylib/petition/CataclysmQuery.yml | Removes packaged legacy plunkylib petition asset. |
| cataclysm/default_files/datafiles/plunkylib/params/CataclysmLLMParams.yml | Removes packaged legacy plunkylib params asset. |
| cataclysm/default_files/datafiles/plunkylib/params/CataclysmLLMParams_3-5.yml | Removes packaged legacy plunkylib params asset. |
| cataclysm/default_files/datafiles/chatsnack/CataclysmQuery.yml | Adds packaged default chatsnack prompt asset. |
| cataclysm/chatsnack_adapter.py | New chatsnack adapter handling YAML loading, tool-choice forcing, and generated-code validation. |
| cataclysm/main.py | Updates init logic and logging disables for chatsnack; copies chatsnack defaults at call time. |
| cataclysm/init.py | Mirrors initialize_datafiles() and logging disable changes for chatsnack. |
| .gitignore | Ignores chatsnack completions output directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SKIP_TEST_TAG = "skip_test" | ||
| ALLOWED_EXECUTION_TAGS = {INPUT_TAG, SKIP_TEST_TAG} | ||
| LEGACY_EXECUTION_TAGS = {"test", "live", "manual"} | ||
| LIVE_ENV_VALUES = {"1", "true", "yes"} |
| ### What forces are at work to bring about `cataclysm`? | ||
|
|
||
| > The devastation is powered by OpenAI's ChatGPT API for the `gpt-4` large language model (LLM). It also works with `gpt-3.5-turbo`, but GPT4+ is highly recommended. The API is called via `plunkylib` (a yaml-friendly layer not totally unlike `langchain`), so you need an OpenAI API key. Include your own API key in your `.env` file, using `.env.template` as a reference. | ||
| > The devastation is powered by OpenAI's API through `chatsnack`, so you need an OpenAI API key. Include your own API key in your `.env` file, using `.env.template` as a reference. |
| import os | ||
| from plunkylib import PLUNKYLIB_BASE_DIR | ||
|
|
||
| CHATSNACK_BASE_DIR = os.getenv("CHATSNACK_BASE_DIR", "./datafiles/chatsnack").rstrip("/\\") |
| import os | ||
| from plunkylib import PLUNKYLIB_BASE_DIR | ||
|
|
||
| CHATSNACK_BASE_DIR = os.getenv("CHATSNACK_BASE_DIR", "./datafiles/chatsnack").rstrip("/\\") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chatwith internal utensil support for concrete exec-body submission while preserving Cataclysm's public API.doom.chosen.Validation
C:\Users\matti\AppData\Local\pypoetry\Cache\virtualenvs\cataclysm-VR7vj-Wl-py3.10python -m pytest tests\test_chatsnack_adapter.py tests\test_notebook_metadata.py tests\test_notebooks.py -q->15 passed, 18 skippedpython -m pytest -q->35 passed, 31 skippedpoetry check-> passedgit diff --check-> passed with CRLF warnings onlyCATACLYSM_RUN_LIVE_TESTS=1 poetry run pytest tests/test_notebooks.py -q -m notebooks_live->18 passedNotes
OPENAI_API_KEYandCATACLYSM_RUN_LIVE_TESTS=1.