Skip to content

test(task-bridge): structural tests for context-drop result archiving (#969) - #1192

Closed
bassilkhilo-ag2 wants to merge 1 commit into
sonichi:mainfrom
bassilkhilo-ag2:test/task-bridge-context-drop-969
Closed

bassilkhilo-ag2 wants to merge 1 commit into
sonichi:mainfrom
bassilkhilo-ag2:test/task-bridge-context-drop-969

Conversation

@bassilkhilo-ag2

Copy link
Copy Markdown
Collaborator

Summary

What is tested

main.swift writeTask() (2 tests):

task-bridge.ts result watcher (6 tests):

  • Has the /^source:\s*context-drop/m detection regex
  • Context-drop check is inside the !clientConnected block (not outside, which would archive results even when voice is live)
  • Branch calls _sendTaskStatus, _deliveredResults.add, _pendingTasks.delete
  • ≥2 archiveFile() calls — both the result file and the task file are archived

Pure regex contract (5 tests):

  • Matches well-formed context-drop task body
  • Matches with extra whitespace after colon
  • Does NOT match voice / discord tasks
  • Does NOT match source: context-drop appearing mid-line in task body prose (line-start anchor with /m)

Test plan

🤖 Generated with Claude Code

@VasiliyRad VasiliyRad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The context-drop test file (tests/task-bridge-context-drop.test.ts) is solid — source-inspection approach is correct given the inline implementation, the 13 tests cover the right properties (regex, placement in !clientConnected block, archiveFile × 2, _sendTaskStatus, _deliveredResults.add, _pendingTasks.delete), and the pure regex contract suite is a good addition.

Two bundled unrelated changes need to come out before merge:

  1. src/health-check.py + tests/health-check-bridge-multi-pid.test.py — these belong to the multi-pid path-display fix (Pass 207), not the context-drop archive fix. They should go in their own PR so the test/fix pair stays together and reviewable independently.

  2. build_log.md — this is a workspace runtime file, not repo source. It should not be committed to the repo at all (it lives under SUTANDO_WORKSPACE, not SUTANDO_REPO_DIR). Please drop it from this branch and add build_log.md to .gitignore if it isn't there already.

Once those two are removed, this PR is ready to approve.

…sonichi#969)

Companion test PR for sonichi#1189 (fix: archive context-drop results when
voice client is offline). Tests will fail on main until sonichi#1189 is merged.

13 tests across 3 suites:
- main.swift writeTask() emits `source: context-drop` before `task:`
- task-bridge.ts result watcher has the detection regex in the offline
  branch, calls _sendTaskStatus/_deliveredResults/_pendingTasks, and
  archives both result + task file (2× archiveFile calls)
- Pure regex unit tests pin the /^source:\s*context-drop/m contract:
  matches well-formed context-drop tasks, rejects voice/discord tasks,
  and rejects inline occurrences inside the task body prose

Source-inspection approach (no import of task-bridge.js) avoids the
node:sqlite availability constraint that affects task-bridge-format.test.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bassilkhilo-ag2
bassilkhilo-ag2 force-pushed the test/task-bridge-context-drop-969 branch from 8468433 to d95b60d Compare May 26, 2026 20:27
@bassilkhilo-ag2

Copy link
Copy Markdown
Collaborator Author

Rebased to single commit d95b60d — just the context-drop test file, no unrelated commits. PR diff: tests/task-bridge-context-drop.test.ts (183 lines, 13 tests). Tests gate on #1189 code: will pass 13/13 after #1189 merges, expected to show 3 failures on current main (source: context-drop field not yet present in main.swift).

@VasiliyRad VasiliyRad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Companion test for PR #1189 (which I approved earlier this pass cycle). Source-inspection over both halves — Swift writeTask() emits source: context-drop, TS task-bridge.ts detects + archives. The structural-test choice (vs spinning up the bridge) is the right level here because the new logic is inline rather than exported. 1 file, no bundling.

LGTM 👍

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