test: Phase 5 — 24 tests for filterEdited, filterEphemeral, ContextEdit validation#29
Merged
test: Phase 5 — 24 tests for filterEdited, filterEphemeral, ContextEdit validation#29
Conversation
…it validation filterEdited tests (8): - No-edit passthrough, hidden removal, superseded removal, hidden=false kept - Mixed visibility filtering, synthetic placeholder on all-hidden - Message alternation preservation, identity optimization filterEphemeral tests (6): - No-ephemeral passthrough, all-ephemeral removal, partial-ephemeral kept - Paired assistant removal via parentID, user kept when only assistant ephemeral - Multiple ephemeral messages filtered ContextEdit validation tests (10): - Ownership: privileged bypass, user protection, cross-agent block, self-edit - Budget: under 70% allowed, over 70% blocked - Recency: last 2 turns protected, older messages editable - Tool protection: skill tool parts blocked - General: successful hide returns CAS hash 1512 tests passing (up from 1488), 0 tsgo errors.
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.
Phase 5: Remaining Tests
24 new tests covering the core message filtering and context edit validation logic. These test Frankencode-specific features — none of these systems exist in upstream OpenCode.
Origin and Attribution
The features being tested were designed and built entirely for Frankencode. They are not backports — upstream OpenCode has no equivalent context editing, lifecycle markers, or ephemeral command system.
Original design and implementation:
@e6qu) — designed the context editing architecture (CAS, edit graph, 6 operations, lifecycle markers, deterministic sweeper, ephemeral commands, side threads, focus agents)Upstream contributions that informed the design:
toModelMessages,convertToModelMessages) was designed by the upstream OpenCode team (Dax Raad, Kit Langton) — ourfilterEditedandfilterEphemeralplug into this existing pipelinePermissionNext) used by ContextEdit validation was originally by Jason Quense (anomalyco/opencode#17064) — we extended it with ownership, budget, and recency rulesAsyncLocalStoragecontext propagation pattern (InstanceALS) used in test fixtures was refactored by Kit Langton (anomalyco/opencode#17544) — we further refactored it into InstanceALS + InstanceLifecycle + InstanceContextBug fixes found during implementation (by Frankencode):
unhide/annotatemissing transaction — found and fixed in code reviewfilterEditedbreaks message alternation — fixed with synthetic placeholder (the exact behavior tested here)filterEphemeral()(tested here)filterEphemeral()(tested here)context-edit mark()not in transaction — found and fixed in PR fix: bug fixes (B47-B52), type safety audit, architecture docs #22filterEdited (8 tests) —
test/session/filter-edited.test.tsTests for
MessageV2.filterEdited()(source).Pure function tests (no DB):
edit.hidden === true)edit.supersededByset)edit.hidden === falsekept"[Content edited out]",synthetic: true)filterEphemeral (6 tests) —
test/session/filter-ephemeral.test.tsTests for
MessageV2.filterEphemeral()(source).Pure function tests (no DB):
parentIDlinkContextEdit validation (10 tests) —
test/context-edit/validation.test.tsTests for validation logic in
ContextEdit(source).Integration tests (DB-backed via
Instance.provide):"skill"tool parts blockedhide()returns CAS hashSee docs/context-editing.md for full architecture documentation.
Test plan
bun run typecheck(tsgo) — 0 errorsbun test— 1512 pass, 0 fail (24 new)