refactor(envelope): drop the reply counter and the injects line, keep time and vault changes

This commit is contained in:
hh
2026-08-29 02:38:39 +02:00
parent bc4233977d
commit 12728b2eb4
3 changed files with 16 additions and 48 deletions
+5 -13
View File
@@ -83,23 +83,21 @@ def test_envelope_respects_ceilings_and_names_only_window() -> None:
watch.note(root / "люди" / f"{name}.md")
watch.note(diary)
envelope = Envelope(watch=watch, tz="Europe/Warsaw")
text = envelope.build(streak=7, injects=2)
text = envelope.build()
lines = text.splitlines()
assert lines[0] == HEADER
assert "(Warsaw)" in lines[1]
assert lines[2] == "мастер: 7 реплик подряд без ветки"
assert f"дни/{today}.md (+200)" in lines[3]
assert "люди/Петя.md (+50)" in lines[3]
assert "инжекты со старта: (2) ниже" in lines[4]
assert lines[2].startswith("vault, изменено со старта: ")
assert f"дни/{today}.md (+200)" in lines[2]
assert "люди/Петя.md (+50)" in lines[2]
assert sum(1 for line in lines if line.startswith("+ ")) == 31
assert "+ … ещё 170" in lines
assert len(lines) <= 120
append(diary, "- ещё одна\n")
watch.note(diary)
second = envelope.build(streak=8, injects=0)
second = envelope.build()
assert f"дни/{today}.md (+1)" in second
assert "+ - ещё одна" not in second
assert "инжекты" not in second
def test_render_hits_total_ceiling() -> None:
@@ -117,17 +115,14 @@ def test_render_hits_total_ceiling() -> None:
text = render(
now=now,
tz="Europe/Warsaw",
streak=1,
changes=changes,
since=now - timedelta(hours=1),
names_only=False,
injects=0,
)
lines = text.splitlines()
assert len(lines) <= 120
assert "… (потолок конверта)" in lines
assert lines[1] == "время: 2026-08-26 13:04 (Warsaw)"
assert lines[2] == "мастер: 1 реплика подряд без ветки"
async def test_master_turn_gets_envelope_after_text_and_before_injects(
@@ -146,13 +141,10 @@ async def test_master_turn_gets_envelope_after_text_and_before_injects(
assert head == "hello"
assert rest.startswith(HEADER)
assert "люди/Прохор.md (+1)" in rest
assert "мастер: 0 реплик подряд без ветки" in rest
assert rest.index("[инжекты") > rest.index(HEADER)
assert (await world.conversations.get(master.external_id)).flags["streak"] == 1
branch = await world.conversations.spawn(
kind="branch", parent=master, seed="brief", text="do X"
)
await world.settle(branch, 1)
assert (await world.conversations.get(master.external_id)).flags["streak"] == 0
assert "[конверт" not in ScriptedClient.instances[-1].prompts[0]
await asyncio.sleep(0)