## Implementation Plan: Remove Void-World Preamble from AI Gateway ### Goal Merge the existing fix branch that adds preamble filtering logic, resolving all conflicts and pre-existing failures so that tests pass and lint is clean. ### Steps 1. **Resolve merge conflicts** in these files (all unrelated to the preamble change): - `devplacepy/config.py` - `devplacepy/docs_devrant.py` - `devplacepy/models.py` - `devplacepy/services/devii/actions/catalog/comments.py` - `devplacepy/templates/_comment_form.html` For each, accept the correct version (usually master’s side unless the branch introduced an intentional change). Verify no semantic changes are lost. 2. **Verify the preamble filter code** – ensure the file `devplacepy/services/openai_gateway/system_message.py` contains: - The `PREAMBLE_PROHIBITED_PATTERNS` list with the 7 void-world patterns. - The logic in `apply_system_directives()` that discards the preamble when any pattern matches. - A warning log line. 3. **Fix the unrelated test failure** in `tests/unit/content.py::test_owns_instance_true_for_creator`. - Inspect `devplacepy/content.py:83-93` (`owns_instance`). The test expects `False` for a creator but gets `True`. This is likely a regression from an earlier merge. - Correct the logic or the test (prefer fixing the implementation to match the intended behavior). After fix, run only this test to confirm it passes. 4. **Run lint with auto-fix** and then re-check: ```bash pip install -q ruff ruff check --fix . ruff check . ``` Ensure zero new violations reported. (If existing violations are unfixable, verify they are pre-existing and note them as not introduced by this change; but the plan must aim for clean output.) 5. **Run unit tests** – execute `make test-unit` (which runs `pip install -e '.[dev] -q && make test-unit` under the hood). Confirm all tests pass, especially the seven new tests in `tests/unit/services/openai_gateway/system_message_test.py`. 6. **Final verification** – manually inspect that `devplacepy/services/openai_gateway/CLAUDE.md` line 49 still documents the prohibited preamble feature. No further changes needed. ### Definition of Done All checks below must pass: - [ ] Merge conflicts resolved; no merge markers remain in any file. - [ ] `devplacepy/services/openai_gateway/system_message.py` exists and contains the preamble filtering logic with all 7 prohibited patterns. - [ ] `tests/unit/services/openai_gateway/system_message_test.py` exists and contains the 7 test cases (including the parametrized pattern test). - [ ] The previously failing test `tests/unit/content.py::test_owns_instance_true_for_creator` now passes. - [ ] `ruff check .` exits with code 0 (no new violations introduced). - [ ] `make test-unit` exits with code 0 and all tests pass. - [ ] Documentation in `devplacepy/services/openai_gateway/CLAUDE.md` still references the prohibited preamble feature.