Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/dlm/replay/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ def _snapshot_to_rows(snap: SectionSnapshot) -> list[Row]:

if snap.section_type == "instruction":
from dlm.data.instruction_parser import parse_instruction_body
from dlm.data.sections_to_rows import _normalize_probe_markers

pairs = parse_instruction_body(snap.content, section_id=snap.section_id)
pairs = parse_instruction_body(
_normalize_probe_markers(snap.content), section_id=snap.section_id
)
return [
{
"messages": [
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/replay/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ def test_instruction_expands_to_messages_rows(self, tmp_path: Path) -> None:
assert all("messages" in r for r in rows)
assert rows[0]["messages"][0]["content"] == "q1"

def test_instruction_probe_marker_normalized(self, tmp_path: Path) -> None:
"""Replay snapshots with `### Q !probe` headers parse like plain Q/A."""
s = _store(tmp_path)
body = "### Q !probe\nq1\n### A\na1"
s.append(_snap("a" * 16, "instruction", body, added=datetime(2026, 1, 1)))
rows = s.sample_rows(k=10, now=datetime(2026, 4, 1), rng=random.Random(0))
assert len(rows) == 1
assert rows[0]["messages"][0]["content"] == "q1"
assert rows[0]["messages"][1]["content"] == "a1"

def test_preference_expands_to_pref_rows(self, tmp_path: Path) -> None:
s = _store(tmp_path)
body = "### Prompt\np\n### Chosen\nc\n### Rejected\nr"
Expand Down
Loading