Skip to content

test: pin ambiguous preview contract - #79

Merged
HarryHeYu merged 2 commits into
mainfrom
r15-contract-tests
Nov 24, 2026
Merged

HarryHeYu merged 2 commits into
mainfrom
r15-contract-tests

Conversation

@HarryHeYu

Copy link
Copy Markdown
Owner

What this changes

R15 traced the WorkThread ambiguity contract across Core CLI/API/Bridge, the DSH Plugin and the VS Code extension. On the current main (351cb45) the write paths already refuse ambiguous threads: continue and switch exit 2, MCP refuses, DSH write tool uses explicit session ids, and VS Code one-click switch passes the clicked thread id.

The earlier R14 claim that an ambiguous preview JSON still returned selected_thread is not reproducible: selected_thread is only added by cli.cmd_preview when --thread was explicitly supplied. An ambiguous preview only carries thread_ambiguous, thread_candidates, thread_default_reason, scope and the read-only bundle.

This PR adds regression tests that pin that contract:

  • ambiguous CLI preview: no selected_thread, no thread;
  • explicit --thread preview: selected_thread and thread_requested, no ambiguity marker;
  • ambiguous continue_context: no selected_thread, no thread;
  • fixes the existing preview fixture so the second thread really owns its member session.

No production logic, JSON field, Bridge op, BRIDGE_SCHEMA_VERSION, Plugin tool, or published Tag/Release is changed.

Evidence

  • Isolated synthetic experiments: E:/sessionflow-scratch/r15/evidence-20261124-104633-60936.json, dsh-tool-evidence2.json, zero-session/zero-session-evidence.json.
  • Targeted tests: 85 passed before the new assertions; 44 passed after.
  • Mutation verification: reintroducing a default selected_thread in CLI preview makes test_cli_preview.py fail; adding default thread/selected_thread to ambiguous continue_context makes test_thread_ambiguity.py fail. Workspace was not mutated.

No user-visible feature is added. This is a test-only contract pin.

R15 found no ambiguity write bug on the current main. These tests pin that an ambiguous CLI/bridge preview carries ambiguity markers but no selection-shaped fields, while an explicit --thread still returns selected_thread and thread_requested.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 02:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

The Unreleased block only accepts Keep a Changelog headings; Tests was rejected by test_docs.py in CI.
@HarryHeYu
HarryHeYu merged commit 6222243 into main Nov 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants