Repository navigation
Closed
Labels
ready-for-agentScoped and ready for a contributor or agent to pick up
Milestone
Description
Parent: #127 · Epic: #126 · Blocked by: none
Work on branch 127-record-golden-fixtures-*; commit the changes and close the ticket.
Problem
The detectors epic rebuilds TransformerDetector on top of EncoderDetector. Nothing records today's predict* output, so no later adapter can prove it keeps today's shape. This ticket also adds the golden-file helper the other 01* tickets reuse.
Current behavior
lettucedetect/detectors/transformer.py:449predict,:489predict_prompt,:528predict_prompt_batchreturn token dicts or span dicts depending onoutput_format.- Passage grouping:
transformer.py:84_group_passages_into_chunks; aggregation across groups::341_predict_chunked. - Typed spans come from
lettucedetect/detectors/taxonomy_head.py:96type_spans, attached intransformer.py:69-82. - Existing tests build a stub model with the local tokenizer:
tests/test_inference_pytest.py,tests/conftest.py(local_wordpiece_tokenizer).
Steps
- Add
tests/golden.py:assert_golden(name, data)comparesdatawithtests/fixtures/golden/<name>.jsonand fails on any difference. WithUPDATE_GOLDEN=1it rewrites the file instead. - Add
tests/test_golden_transformer_pytest.py. Copy the stub-model and tokenizer fixtures fromtest_inference_pytest.py(copy the fixtures, not the patching). - Record
predict,predict_promptandpredict_prompt_batch, each in"tokens"and"spans"format, on two or three small inputs. - Include one context that needs more than one passage group, and one run with spans typed by a stub typer.
- Check the JSON files in.
Acceptance criteria
-
tests/golden.pyexists; a changed output makes the test fail with a readable diff. - Checked-in JSON covers the three methods × two formats, the multi-group case and the stub-typer case.
- Tests are network-free and need no API key.
- No production code and no existing test changes.
Start here
uv run --extra dev pytest tests/test_inference_pytest.py -q
Metadata
Metadata
Assignees
Labels
ready-for-agentScoped and ready for a contributor or agent to pick up
Activity
chore: add golden test fixtures for TransformerDetector (#128)
test: pin today's TransformerDetector output with golden fixtures (#128)