Include standard error/code/timestamp fields on 409 responses from /api/docker-containment routes

オープン 初心者向け
#18,137 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, express, javascript, react
領域
api, backend

調査の方向性

featureOff ヘルパーと、server/routes/dockerContainment.js の拒否分岐(31〜37行目、48行目、62行目付近)から始めて、それらが返す 409 のレスポンスボディと比較してください。次に、client/src/services/apiDockerContainment.js が apiCore.js の throwApiError を通じてエラーをどのように受け渡しているかを確認してください。/pull と /run からの 409 拒否に error、code、timestamp が含まれ、既存の status、reason、state、contained フィールドが維持され、server/routes/dockerContainment.test.js がこれを検証していれば完了です。

索引モデルが issue の本文から書いたものです。

説明

api-contract area:devtools effort:low in-progress model:light plan planner:gemini-4-neon-high

Problem

server/routes/dockerContainment.js:31-37 (featureOff) and server/routes/dockerContainment.js:62 (refusal from runContained) return HTTP 409 JSON bodies carrying { status: 'refused', code: 'CONTAINMENT_UNAVAILABLE', state, reason, contained: false } with no error or timestamp field. The UI caller pullDockerContainmentImage (client/src/services/apiDockerContainment.js:18-19, invoked from client/src/components/settings/DockerContainmentCard.jsx:40-43) goes through apiCore.js request() -> throwApiError() (client/src/services/apiCore.js:56), which reads error.error || 'HTTP ' + response.status. On a 409 featureOff response, error.error is undefined so the UI toasts "HTTP 409". Similarly, failed POST /pull responses at line 48 omit code and timestamp.

Impact

If Docker containment is disabled in another tab before the operator clicks "Pull image", DockerContainmentCard.jsx:43 toasts raw "HTTP 409" instead of "Docker containment is off. Turn it on in Settings > Features first.", and any apiCore.js caller receives no .error string on 409 refusals.

Decided Fix

Include error: reason and timestamp: Date.now() in featureOff (server/routes/dockerContainment.js:31-37), and ensure 409 payloads in POST /pull (line 48: include code: CONTAINMENT_UNAVAILABLE and timestamp: Date.now() when !result.ok) and POST /run (line 62: include error: result.reason and timestamp: Date.now() when result.status === 'refused') carry the standard error/code/timestamp keys without removing the existing status/reason/state/contained fields consumed by scripts/contained-run.js. Add assertions in server/routes/dockerContainment.test.js.

Affected Files

  • server/routes/dockerContainment.js
  • server/routes/dockerContainment.test.js
  • client/src/services/apiDockerContainment.js
  • client/src/components/settings/DockerContainmentCard.jsx

Acceptance Criteria

  • featureOff in server/routes/dockerContainment.js:31-37 and refusal responses returned with HTTP 409 from POST /api/docker-containment/pull and POST /api/docker-containment/run include error (set to the refusal reason) and timestamp alongside the existing { status, code, state, reason, contained } fields.
  • pullDockerContainmentImage (client/src/services/apiDockerContainment.js:18-19) surfaces the refusal message via throwApiError so DockerContainmentCard.jsx:43 toasts the real reason instead of 'HTTP 409'.
  • server/routes/dockerContainment.test.js verifies error, code, and timestamp on 409 refusals while keeping all existing assertions for scripts/contained-run.js green.

Origin: PortOS api-contract baseline audit (2026-11-24) · Severity: 4/10

主要言語
JavaScript
スター
38
フォーク
32
平均マージ
20分
マージ済み PR(30日)
996

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

atomantic/PortOS のほかの issue

atomantic/PortOS の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。