Skip to content

fix: harden service boundaries, persistence, and dashboard synchronization - #16

Merged
simota merged 8 commits into
mainfrom
fix/comprehensive-review-20261012
Oct 12, 2026
Merged

simota merged 8 commits into
mainfrom
fix/comprehensive-review-20261012

Conversation

@simota

@simota simota commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

変更の目的

サービス境界、保存の失敗・再起動、子プロセスの終了、ダッシュボードの同期を横断してレビューし、再現できた不具合を修正しました。担当を入れ替えた独立レビュー、実際のCLIと通信を使った再現、CodexのPRレビューを行い、検出した問題には回帰テストを追加しています。

主な変更

  • 保存先の保護: init / reset が親ディレクトリ参照やsymlinkを通して .devcloud 外を変更する経路を拒否。削除前にすべての保存先を検証します。
  • HTTPの受信境界: 不正・重複・競合するContent-Length / Transfer-Encoding、途中EOF、ヘッダー・chunk行の上限超過を拒否。UTF-8を含む不正なpercent escapeによるpanicを防ぎます。有効な小さいchunkの連続送信は維持します。
  • 保存と復旧: GCS resumable uploadの確定offset、atomic metadata、末尾rollbackを整合させます。オブジェクト確定時の内部upload IDと不変の完了receiptにより、最終chunk直後の停止や後続の上書き・削除があっても、再送には同じ完了結果を返します。S3の未完了bucket作成も再試行で復旧します。
  • 共有ストアの条件付き更新: S3とGCSの同一キーへの条件付き作成が両方成功する競合を実通信で再現し、GCSの条件判定と保存を共通のwrite lock内にまとめます。通常・resumable upload、copy/rewrite/composeの宛先、metadata PATCH、DELETEを対象とし、generation selectorも更新直前に確認します。GETやコピー元は同じsnapshotの本文とmetadataを使います。
  • 実行と認可: Cloud Runのslot待機後に公開権限を再確認。取消時のport予約とDocker cleanupを回収します。Redisは通常停止でSIGTERMによる保存機会を確保し、期限後のkill/reapと取消時の回収を行います。
  • Redisとstrict認証: external URLの接続先・password・DBをcontrol接続へ適用し、表示から資格情報を除去。CONFIGが制限されていても上流で検証できたDB20などを起動時に受け入れ、画面から再選択できるようにします。Mail / Redis-controlのブラウザ境界とstrict時のdashboard転送も修正します。
  • 画面の同期と状態表示: relayの実イベントenvelopeを解釈し、初回接続・再接続・resyncでsnapshotを更新。全12サービスと詳細取得を古い応答から保護します。GCSのbucket切替・削除・Inspectorの応答競合を解消し、実際に有効なサービスだけをrunningと表示します。
  • 継続検証: CIを追加し、Rust、Node、実Chromium、生成bundleの一致、Rust/npm監査を実施。h2 / anyhow / Vite等を更新し、単体crate buildに必要なTokio featureを明示しました。

変更は8コミットに分けています。既存の Redis終了処理の設計 と GCS共有Object Coreの設計 に沿う範囲で修正しています。GCS条件の確認には 公式precondition仕様 も参照しました。

PRレビューでの指摘への対応

  • GCS最終upload後の停止・再送に関するP2: 完了ID/receiptの回復と通知claimを追加。元のgeneration/metageneration/etagを再生し、後続の更新・削除や保存失敗も回帰で確認しました。修正内容を返信し、threadを解決済みです。
  • CONFIGが制限されたRedisのDB選択に関するP2: 初期DBを上流SELECT/PINGで検証し、成功したDBを選択可能な範囲へ反映。実CLIでCONFIG NOPERM + DB20の起動・DB0→20再切替・GETを検証し、threadを解決済みです。
  • 追加の独立確認で、無効サービスのrunning誤表示とS3/GCSの条件付き書込み競合も検出・修正しました。

最新コミットのローカル検証

対象: 9a04677f059efd764e2652056ab3295759896b87

検証 結果
S3 / GCS 192 passed / 0 failed
Rust workspace 1,567 passed / 0 failed
実CLIによるS3/GCS条件付き同時作成 10試行すべて200が1件・412が1件。GCS勝利8回、S3勝利2回。最終objectは成功側と一致
条件不一致後のresumable復旧 途中checkpointと末尾rollbackを確認。競合object削除後の最終chunk再送で200
GCS JSON API E2E 成功
変更Rustファイルのformat / diff check 成功

実通信の競合検証は、GCSで96 MiBを途中受信した後に最終1バイトを送り、同じキーへのS3 If-None-Match: * PUTを競合させています。修正前は両方200となり、成功済みのS3本文が上書きされることを再現しました。修正後は両サービスが勝つ場合を含め、一方だけが成功しています。

ローカル環境に /proc がないため、workspace実行ではそれを必須とする既存テスト1件だけを除外しました。CIではこの除外を使いません。 既存のdoctest 1件は元からignore指定です。

cargo test --locked -p devcloud-s3 -p devcloud-gcs --no-fail-fast
cargo test --locked --workspace --no-fail-fast -- \
  --skip instances::tests::readiness_requires_the_child_to_own_its_listener
cargo build --locked -p devcloud-orchestrator
bash scripts/gcs-e2e.sh

前段の変更についてはDashboard Node/React回帰12件、TypeScript/Vite build、MailのSMTP→API→raw→delete E2Eも確認しています。最新CIのbrowser検証では実CLIとprovider APIを使い、有効サービスの表示、初回snapshot、liveイベント、再接続後のsnapshot、object inspectorを確認し、すべて成功しました。

最新コミットの最終CI・再レビュー結果

CI run 38199189481 は completed / success です。対象headは 9a04677f059efd764e2652056ab3295759896b87、mainとの検証用merge commitは 64bcbcfba3c54add6fd3da80ff04ea38e6d5d75c です。

CIの確認項目 最終結果
Rust workspace(133 suites) 1,568 passed / 0 failed / 1 ignored / 0 filtered
Dashboard Node / React 12 passed / 0 failed
実Chromium 5ケースすべて成功、再接続hello 2回、pageErrors 0
Rustfmt / TypeScript / Vite build 成功
埋め込みassetsとsource buildの一致 成功
6サービスの独立build / CLI build 成功
Clippy 成功。warningは残っていますが、直前head 60c8ed2 からの追加は0
npm audit 80 packages、0 vulnerabilities
RustSec audit 182 crate dependencies、脆弱性・警告の報告なし

ローカルで除外した readiness_requires_the_child_to_own_its_listener もCIでは成功しています。ignored 1件は既存のevent-relayのdoctestです。Clippyはwarningをerrorとして扱う設定ではないため、成功とwarningなしを区別しています。

ブラウザartifactのdigestを照合し、スクリーンショットも確認しました。GCSだけがrunning、上部が 1/12 running、他11サービスがdisabledとなり、接続前・接続中・切断中に作成した3オブジェクトと、再接続後のInspectorが正しく表示されています。

Codexの最新head再レビューは2026-10-12 03:22:09 UTCにCompleted。追加指摘はなく、PRに👍が付いています。 結果コメント は対象commit 9a04677f05 を明示しています。既存2件のreview threadは両方解決済みで、未解決threadは 0件 です。

PRはopen・未マージです。

Validate request framing and percent escapes, bound chunk metadata without
rejecting valid small chunks, and recover GCS resumable checkpoints and S3
bucket creation after interrupted persistence. Add focused regressions and
explicit Tokio features for independent service builds.
Validate reset/init paths and symlinks before touching storage. Recheck
Cloud Run invocation authorization after slot waits and reclaim cancelled
resources. Honor external Redis targets and graceful child shutdown.
Protect Mail/Redis control HTTP and forward strict dashboard credentials.
Keep relay handshakes from blocking other clients or shutdown.
Decode the relay event envelope and refresh snapshots on every hello and
resync. Cancel obsolete sockets and protect all service snapshots from
out-of-order responses. Fix GCS bucket and inspector races, add React and
real-browser regression coverage, and rebuild embedded dashboard assets.
Run formatting, independent crate checks, workspace tests, Clippy, browser
smoke verification, generated-asset checks, and Rust/npm audits. Update h2
and anyhow, document reproducible verification, and accept successful 204
responses in the Mail E2E helper.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T03:22:09.967946Z 9a04677 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

simota commented Oct 12, 2026

Copy link
Copy Markdown
Owner Author

@codex security review

保存先の制約、Cloud Runの認可、Mail / Redis HTTPのブラウザ境界、資格情報の転送・表示を含むため、通常のコードレビューと併せて確認をお願いします。

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90c4844e7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread services/gcs/src/http.rs
Comment thread services/redis-control/src/lib.rs

simota commented Oct 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

最新 head 60c8ed2c10b082c94c9547ce7efece82971d4d15 を再レビューしてください。前回の GCS 完了後の再送と Redis CONFIG 権限の指摘に対応し、停止中サービスの誤表示も修正しました。

GCS は object commit と同時に保存する内部 ID、後続変更前の完了 receipt 保全、通知の一度だけの claim で回復を扱います。共有 S3 ストアの version・metadata・削除経路も回帰で確認済みです。ローカル workspace 1,558件、Node/React 12件が成功しています。差分全体について、追加の不具合・回帰・セキュリティ境界を確認してください。

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 60c8ed2c10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

simota commented Oct 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please re-review the complete PR at 9a04677f059efd764e2652056ab3295759896b87 for any remaining actionable correctness, regression, concurrency, persistence, or security issues.

The latest commit fixes an additional reproduced S3/GCS race: both create-only writes could return 200 and the GCS commit overwrote the successful S3 write. GCS mutation predicates now run under the shared store write lock, including generation selectors and same-key copy/compose source conditions. Snapshot reads keep metadata/body together, and completed resumable receipts are replayed before evaluating conditions.

Validation of this commit: 192 S3/GCS tests passed; the local workspace passed 1,567 tests (one existing ignored doctest and the previously documented local /proc-only skip). Ten real CLI races each produced exactly one 200 and one 412, with both services winning across the trials. The losing GCS final chunk retained its checkpoint and succeeded on retry after the competing object was deleted. GCS E2E also passed. The latest CI run will execute the workspace without the local skip.

The two earlier P2 review threads remain fixed and resolved. Please report any further issues you find in the latest head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 9a04677f05

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@simota
simota merged commit 755b5c2 into main Oct 12, 2026
2 checks passed
@simota
simota deleted the fix/comprehensive-review-20261012 branch October 12, 2026 03:31
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.

1 participant