Skip to content

Port Cataclysm to chatsnack - #21

Draft
Mattie wants to merge 3 commits into
masterfrom
codex/port-chatsnack-notebook-tests
Draft

Port Cataclysm to chatsnack#21
Mattie wants to merge 3 commits into
masterfrom
codex/port-chatsnack-notebook-tests

Conversation

@Mattie

@Mattie Mattie commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace the old plunkylib generation path with a chatsnack-backed adapter, default chatsnack prompt assets, env/init updates, and a legacy plunkylib YAML fallback.
  • Route generation through chatsnack Chat with internal utensil support for concrete exec-body submission while preserving Cataclysm's public API.
  • Add live notebook pytest coverage plus offline regression coverage for the README/notebook-presented Cataclysm behaviors.
  • Fix the README Chosen Doom example so it demonstrates doom.chosen.
  • Address PR review feedback by pinning chatsnack to an immutable rev, declaring the direct YAML dependency, improving missing-config errors, and hardening notebook tests.

Validation

  • Project venv: C:\Users\matti\AppData\Local\pypoetry\Cache\virtualenvs\cataclysm-VR7vj-Wl-py3.10
  • python -m pytest tests\test_chatsnack_adapter.py tests\test_notebook_metadata.py tests\test_notebooks.py -q -> 15 passed, 18 skipped
  • python -m pytest -q -> 35 passed, 31 skipped
  • poetry check -> passed
  • git diff --check -> passed with CRLF warnings only
  • Earlier branch live notebook check: CATACLYSM_RUN_LIVE_TESTS=1 poetry run pytest tests/test_notebooks.py -q -m notebooks_live -> 18 passed

Notes

  • Live OpenAI coverage remains opt-in behind OPENAI_API_KEY and CATACLYSM_RUN_LIVE_TESTS=1.
  • The branch includes the chatsnack port commit, offline coverage commit, and PR review feedback commit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.py and route CataclysmCreator generation through chatsnack (with utensil support + legacy plunkylib YAML fallback).
  • Update packaged defaults (env.template, default prompt YAMLs) and initialize_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.

Comment thread pyproject.toml
Comment thread pyproject.toml Outdated
Comment thread cataclysm/chatsnack_adapter.py
Comment thread tests/test_notebook_metadata.py
Comment thread tests/test_notebooks.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 36 out of 38 changed files in this pull request and generated 4 comments.

Comment thread tests/notebook_support.py
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"}
Comment thread README.md
### 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.
Comment thread cataclysm/__init__.py
import os
from plunkylib import PLUNKYLIB_BASE_DIR

CHATSNACK_BASE_DIR = os.getenv("CHATSNACK_BASE_DIR", "./datafiles/chatsnack").rstrip("/\\")
Comment thread cataclysm/__main__.py
import os
from plunkylib import PLUNKYLIB_BASE_DIR

CHATSNACK_BASE_DIR = os.getenv("CHATSNACK_BASE_DIR", "./datafiles/chatsnack").rstrip("/\\")
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.

2 participants