Tests for the start_recording startWhen/stopWhen arm path and its consent carry-over

Offen
#349 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
backend, testing

Rechercherichtung

Read src/tools/startRecording.ts around the listed arm and watcher paths, then inspect src/__tests__/startRecording.test.ts, src/__tests__/consentLogging.test.ts, and src/utils/triggers.ts. Extend the fake spawn tests with an elicitation capable client and mocked window and text checks, then run npm test. Done means the listed startWhen, consent carry-over, failed arm, and stopWhen cases pass.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

effort: medium priority: medium testing

Summary

armRecording asks for consent once at arm time, adds the args object to approvedAtArm, and later calls tool.handler(startArgs, ...). prepareStart skips the consent prompt when approvedAtArm.has(args). This relies on the handler receiving the very same object. watchStopWhen stops a session when OCR text appears. No test covers startWhen, stopWhen or approvedAtArm: triggers.test.ts covers only the utils. startRecording.ts is the highest-churn file and is at 47% lines / 34% branches locally.

Where

  • src/tools/startRecording.ts:237, 450-461, 466-511, 538, 654
  • src/__tests__/triggers.test.ts:41-54

Impact

If a refactor or the SDK clones args before the handler, armed recordings either re-prompt (and fail when no one is there) or, worse, a change to the WeakSet logic lets an unarmed call skip consent.

Suggested fix

Extend src/__tests__/startRecording.test.ts (fake spawn) with an elicitation-capable client (the pattern in src/__tests__/consentLogging.test.ts:76-77) and mocked window/text checks:

  • startWhen {}: isError "startWhen needs window and/or text."
  • startWhen {window}: status "armed" with an arm- id, and consent asked exactly once.
  • When the condition is met, a session starts through the same handler and the elicitation handler is not called a second time.
  • A plain start_recording after an arm still prompts (approval does not leak).
  • Consent declined at arm: isError, and no arm is registered.
  • fire() returning isError: arm status "failed" with that error text.
  • stopWhen text met: the session stops with the stopWhen reason; a session that ends first aborts the watcher.

Getting started

  • Relevant files: src/tools/startRecording.ts, src/utils/triggers.ts
  • How to run tests: npm test

Filed by repo-audit/full-audit at b9b94fa. Severity: medium. Effort: M. audit-key: testing|src/tools/startRecording.ts|armRecording

Vorherrschende Sprache
TypeScript
Sterne
1
Forks
4
Ø Merge
14 Std. 8 Min.
Gemergte PRs (30 T.)
48

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/screencast-mcp

Alle Issues in TMHSDigital/screencast-mcp

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.