test: restore 32 e2e compaction tests + fix rehydrate partial_note regression#184
Merged
Conversation
…2e401
Restores 32 e2e tests covering production features whose tests were over-
zealously dropped during the dual-write retirement. Migrates seed pattern
from removed ContextStore::push_* / record_assistant_activity API to
TurnStore-based seed via HarnessBuilder::messages + new tool_history helper.
Restored coverage (new src/test-support helpers + agent_loop test files):
- microcompact_e2e (5): idle scrub / noop on recent / non-scrubbable / all
10 supported tool types / disabled when idle=0
- rehydrate_e2e (9): real Read tool / empty touched / unreadable paths /
partial success / total bytes budget / stream event / model-visible
partial-failure note / pre-cancel / mid-cancel
- compact_force_e2e (5): reduces turns / manual-* strategy label /
preserves most-recent user / short-circuits tiny history / empty store
- compact_instructions_e2e (3): custom instructions injected /
omitted when None / whitespace-only treated as absent
- compact_bare_summary_e2e (4): falls back on LLM failure / deterministic
outline / empty-response fallback / tagged summary extraction
- compact_phases_e2e (2): full phase sequence with rehydrate / skips
rehydrate when no files touched
- compact_hooks_e2e (3): PreCompact fires on manual /compact / skipped
on tiny history / fires on auto check_and_compact
- governance_bridge (3): DataPlaneBridge sentinel mock /
make_governance_feedback empty handling / multi-line text
Also fixes a real regression revealed by rehydrate_partial_failure_appends_
model_visible_note: the partial-failure Text note ("rehydrate partial: N
of M ...") was constructed in compact_rehydrate's user message builder but
never persisted — CompactionRehydrate carried only file pairs, no note.
Add CompactionRehydrate.partial_note: Option<String> and project it in both
the wire-format anthropic emitter and the projection layer.
Test-support additions:
- tool_history::tool_history_turn — builds LlmCall(tool_calls) + ToolBatch
Turn pair so tests can seed tool-result history without per-test
boilerplate.
- tool_history::backdate_activity — uses TurnTracker::with_wire_mut to
retroactively age last_step_at, replacing the removed
record_assistant_activity API.
- tool_history::reopen_for_test — reopens the seeded Complete turn so
rehydrate's append_step_record finds an InProgress host.
Skipped (genuinely obsolete — original API removed):
- e2e_compact_partial_save_test (1): tested save_message failure path;
message_store is gone
- e2e_compact_resume_test (2): tested messages.jsonl-anchored compact
boundary marker survival; turns.jsonl is the only resume source now
- e2e_compact_test::auto_compact_on_large_context: covered by new
compact_hooks::precompact_hook_fires_on_auto_compact
- e2e_compact_edge_test::test_thinking_blocks_stripped: covered by
turn_degradation::strips_thinking_from_old_turns_only unit test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
443dd444,3d4111f4,ce82e401).ContextStore::push_*/record_assistant_activityAPI to TurnStore-based seed viaHarnessBuilder::messages+ newtool_historyhelper.rehydrate_partial_failure_appends_model_visible_note: the partial-failure Text note was constructed incompact_rehydratebut never persisted becauseCompactionRehydrateonly carried file pairs.Restored coverage
microcompact_e2e_test.rsrehydrate_e2e_test.rscompact_force_e2e_test.rscompact_instructions_e2e_test.rscompact_bare_summary_e2e_test.rscompact_phases_e2e_test.rscompact_hooks_e2e_test.rsgovernance_bridge_test.rsmake_governance_feedbackempty handling / multi-line textRegression fix
CompactionRehydrate.partial_note: Option<String>is now persisted and projected in both:loopal_provider_api::wire::turn_projection::project_compaction_rehydrateloopal_provider::anthropic::request_turns::push_compaction_rehydrateso the model sees
[rehydrate partial: N of M ...]after partial-success rehydration.Test-support additions
crates/loopal-test-support/src/tool_history.rs:tool_history_turn()— builds anLlmCall(tool_calls) + ToolBatchTurn pair.backdate_activity()— usesTurnTracker::with_wire_mutto retroactively agelast_step_at(replaces removedrecord_assistant_activity).reopen_for_test()— reopens the seeded Complete turn so post-seedappend_step_recordcalls find an InProgress host.Genuinely obsolete (NOT restored)
e2e_compact_partial_save_test(1)save_messagefailure;message_storeis gonee2e_compact_resume_test(2)messages.jsonl-anchored boundary survival;turns.jsonlis the only resume sourcee2e_compact_test::auto_compact_on_large_contextcompact_hooks::precompact_hook_fires_on_auto_compacte2e_compact_edge_test::test_thinking_blocks_strippedturn_degradation::strips_thinking_from_old_turns_onlyunit testTest plan
bazel build / test / clippy / rustfmt)