Skip to content

Commit c7a3394

Browse files
Merge pull request #30 from Chinchill-AI/process/test-fidelity-enforcement
process: test fidelity verification script + enforcement docs
2 parents ba5125d + 925adea commit c7a3394

10 files changed

Lines changed: 500 additions & 6983 deletions

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,18 @@ See docs/UPSTREAM_SYNC.md for TS->Python translation patterns.
4141
- Markdown parser handles common cases but is not full CommonMark
4242
- StreamingMarkdownRenderer's _remend is simplified vs the npm `remend` library
4343
- No setext headings, no footnotes, no HTML nodes in the parser
44+
45+
## Test Fidelity Verification
46+
47+
After modifying or adding tests, run:
48+
```bash
49+
python3 scripts/verify_test_fidelity.py
50+
```
51+
This verifies every TS `it("...")` test has a matching Python `def test_...()`.
52+
The script must show `0 missing` before committing test changes.
53+
54+
When porting a new TS test file:
55+
1. Add the mapping to `scripts/verify_test_fidelity.py` MAPPING dict
56+
2. Run with `--fix` to generate stubs
57+
3. Translate each stub by reading the TS test body line-by-line
58+
4. Verify with the script before committing

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,16 @@ All PRs must pass `ruff check` with zero errors.
5353
## License
5454

5555
By contributing you agree that your contributions will be licensed under the MIT License.
56+
57+
## Test Translation Process
58+
59+
When porting tests from the TypeScript SDK:
60+
61+
1. **Add the mapping** to `scripts/verify_test_fidelity.py`
62+
2. **Generate stubs**: `python3 scripts/verify_test_fidelity.py --fix`
63+
3. **Translate each stub** by reading the TS `it("...")` block line-by-line
64+
4. **Verify names match**: `python3 scripts/verify_test_fidelity.py` must show 0 missing
65+
5. **Run tests**: `uv run pytest tests/ -q`
66+
67+
Test function names MUST be derivable from the TS `it("...")` description.
68+
Do NOT write new tests — translate the EXISTING TS tests.

src/chat_sdk/shared/mock_adapter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ def get_channel_visibility(self, thread_id: str) -> ChannelVisibility:
169169

170170
async def open_modal(
171171
self,
172+
<<<<<<< Updated upstream
172173
trigger_id: str = "",
173174
modal: Any = None,
175+
=======
176+
trigger_id: str,
177+
modal: Any,
178+
>>>>>>> Stashed changes
174179
context_id: str | None = None,
175180
) -> dict[str, str]:
176181
return {"view_id": "V123"}

0 commit comments

Comments
 (0)