← Back to Pull requests

docs(device): 取り消せる操作の待ちは stop で戻す契約を書く #1479

Open
unknown opened this pull request with 307 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 22, 2026 00:29 UTC
Author

Summary

#1451 の 1 つ目(docs)。device-bridge-contracts §11 に従い、続く bluetooth-le・tts の修正より先に契約を入れる。

bluetooth-le の走査と tts の発話は OS 側の処理を取り消せるため、§8.2 の begin / poll / discard ではなく、既存の停止の入口(stop_shared_scan・Tts::stop)で同期の入口の待ちを戻す。期限は置かない(走査には権限ダイアログの応答待ちが入り、発話には長さの上限がない)。

  • consumer-app-structure §8.2 に 1 項を足す

  • bluetooth-le の contract.rs に「待ちを戻す」節(走査開始後は各 OS の自前タイマーで必ず完了、開始前とアダプタの取得・停止の確認には期限がなく別スレッドからの stop_shared_scan で Cancelled)

  • Tts::stop の doc(Ok の後は止める前の発話の wait_outcome が戻る)

  • 対応表の note(bluetooth-le 4 OS、tts の iOS・Android)
  • main に今ある挙動だけを現在形で書き、まだ無い分(画面の走査を同じ呼び出しで終わらせる、iOS・Android の stop で wait_outcome を戻す)は「#1451 で入れる」と明記した。コードは変えない。

    Test plan

  • cargo fmt --all -- --check・cargo clippy --workspace --all-targets -- -D warnings

  • build-capabilities.mjs --check・migrate-capability.mjs sync --check・node --test scripts/device/*.test.mjs

  • markdownlint の件数が origin/main と同じ(24)
  • Refs #1451

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Low Risk

    Documentation-only contract and capability-table updates; no behavioral or API implementation changes in this PR.

    > Overview

    Documents device-bridge-contracts §11 ahead of #1451 implementation: cancellable capabilities (bluetooth-le scan, tts speak) do not need begin / poll / discard; callers unblock synchronous waits through existing stop APIs, with no timeouts.

    > consumer-app-structure.md §8.2 gains a new bullet contrasting this with non-cancellable sync entry points, and spells out stop_shared_scan → Cancelled on scan, and Tts::stop → pending wait_outcome should complete after Ok(()).

    > BluetoothLe contract adds a 「待ちを戻す」 section (post-start SCAN_DURATION_MS, unlimited pre-scan / adapter waits, stop_shared_scan from another thread). Tts::stop trait docs state the same wait_outcome contract (CommandTts already meets it).

    > Capability JSON notes for bluetooth-le (all native OSes) and tts (iOS/Android) are updated to match; gaps (screen-driven cancel, mobile wait_outcome without OS callback) are flagged as #1451. No runtime code changes.

    > <sup>Reviewed by Cursor Bugbot for commit 70d4ad7017018755b8538c7d98f655540c893193. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    Diff: 307 lines (+230 / -77) across 3 files Reviewer: cursor[bot] Review duration: 41m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.45) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 307 lines diff across 3 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.343
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1479"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.2% (MEDIUM) · Higher = larger blast radius
    45.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.8% · Safe to merge
    25.8%