---
title: Message Editor のデータの取り扱い
description: Message Editor のプロトタイプが、判定データをどう受け取り、どこに残り、どこに残らないか。
sidebar:
  label: データの取り扱い
  badge: Preview
---

preview
[Message Editor](/message-editor)
のプロトタイプ（editor.cre.run）が、判定データをどう扱うかをまとめています。 判定データを URL
以外で受け渡す仕組みができたら、このページを更新します。

## どこに届き、どこに届かないか

| 経路                                   | 判定データ                                                                                       | テスト                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| サーバー（Cloudflare）                 | **届きません。** URL の `#` 以降はブラウザがサーバーに送らないためです                           | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L49">E2E</a></span>                                                                                                                                           |
| 画面からの送信・外部サービスへの連携   | **行いません。** データはブラウザの中だけで復号・表示します                                      | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L48">単体</a></span>                                                                                                                                                            |
| 外部スクリプト・解析タグ               | **読み込みません。** 検索エンジンにも載せません                                                  | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L59">単体</a></span>                                                                                                                                                            |
| ブラウザへの保存                       | **行いません。** 編集した本文は画面を閉じると消えます                                            | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L69">E2E</a></span>                                                                                                                                           |
| 根拠のリンクの遷移先                   | **渡しません。** リンクは新しいタブで開き、元の URL（判定データ）も `window.opener` も渡しません | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L91">E2E</a></span>                                                                                                                                           |
| `encode` で URL を作る手順             | **キャッシュに残しません。** `vp run` ではなく `node` で直接実行する手順を案内します             | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L68">単体</a> <a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L85">単体</a></span> |
| ブラウザの履歴・ブックマーク           | **残ります**                                                                                     | —                                                                                                                                                                                                                                                                                                                                                                   |
| URL を貼ったチャット・チケット・メール | **残ります。** URL を知っている人は誰でも内容を読めます                                          | —                                                                                                                                                                                                                                                                                                                                                                   |

URL には判定データ（問い合わせ本文・宛名・返信文・根拠の引用）が圧縮されただけで、暗号化はされずに入っています。
実際のお客様の情報を含む URL は、社内の権限管理された場所にだけ貼ってください。

## 受け付けないデータ

次のデータは表示せず、見本データとエラーを表示します。

| 受け付けないデータ                                               | 扱い                                                       | テスト                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 形式が違うもの（`version` が違う、圧縮データが壊れている、など） | 表示せず、見本データとエラーを表示します                   | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L93">単体</a> <a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L156">E2E</a></span>  |
| 必須の項目がない・値が不正・段落 ID が重複しているもの           | 表示せず、見本データとエラーを表示します                   | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L99">単体</a></span>                                                                                                                                                                               |
| 根拠のリンクが `http(s)` 以外のもの                              | `javascript:` などはリンクにせず、データごと受け付けません | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L150">単体</a> <a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L119">E2E</a></span> |
| 圧縮データが 10 万文字を超えるもの                               | 展開せずにエラーを表示します                               | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L177">単体</a> <a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L138">E2E</a></span> |
| 展開後が 1 MB を超えるもの                                       | 展開しながら大きさを見て、超えた時点で打ち切ります         | <span style={{ whiteSpace: "nowrap" }}><a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/tests/data-handling.test.ts#L182">単体</a> <a href="https://github.com/cre-run/cre/blob/main/apps/message-editor/e2e/guide-message-editor-data-handling.e2e.ts#L144">E2E</a></span> |

## 作成者を検証しないこと

URL は誰でも作れ、署名もありません。画面が「確認済み」と表示しても、それは URL に書かれていた値です。
出所の分からない URL の内容を根拠にしないでください。

## 確かめ方

「テスト」列のバッジは、その約束を確かめ続けているテスト（`apps/message-editor`）へのリンクです。

E2E

は実際のブラウザで、
単体

はコードの形で確かめます。リンク先はテストの行です。 バッジのテスト名と実際のテストは
`tests/guide-promises.test.ts` が突き合わせるので、どちらかだけを変えると落ちます。

テストしない約束: ブラウザの履歴・ブックマークと、URL を貼った先に残ることは、ブラウザや外部サービスの振る舞いなので確かめません。
作成者を検証しないことは、検証の仕組みがないという事実なので、テストではなく本文に書いています。
