Skip to content

feat: TDnet要約を共通構造で整理し、増減と部分結果を表示 - #27

Merged
ivgtr merged 65 commits into
mainfrom
feat/summary-format
Oct 6, 2026
Merged

ivgtr merged 65 commits into
mainfrom
feat/summary-format

Conversation

@ivgtr

@ivgtr ivgtr commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

TDnet開示の主要数値・増減・事業別の状況を素早く把握できるよう、要約を共通の意味構造から表示します。補足の生成や点検が一部未完了でも、原文照合済みの数値を表示・保存し、未整理部分と確認理由を原文トグルに残します。

変更

  • 冒頭の要点と詳細を話題別に整理し、会社名・期間・範囲・会計基準の反復と長い原文転載を減らす。

  • 対象・期間・指標・量の意味・原文数量・比較関係・条件を共通モデルにする。事業別業績、受注、CFを同じ形式で扱い、会社固有の指標名や期間名を保持する。

  • 当期値・比較値・増減率を同じ行に表示する。赤字転落/黒字転換/赤字縮小・拡大、比較値ゼロ、CFの金額差を区別し、原文の率と表示金額からの計算率を明示する。

  • 表の根拠対応、IFRS中間利益、複数予想期間・共通見出し・複数行範囲を改善する。比較軸と報告期間、符号付き収支と本文の正の支出額の矛盾は共通検査で拒否する。

  • 確定事実と任意の補足生成・独立点検を分離する。通常3要求、候補修復最大1回、全体300秒。補足生成・点検は各60秒/8,192出力tokenに制限し、点検をID付き配列へ正規化して空白反復による出力上限を対策する。

  • 診断をクリップボードへコピーできるようにし、コピー失敗時はJSON欄から手動でコピーできる。

  • レビュー4指摘に対応し、確認済み出来事・選択原文の要点表示、物理セル単位の網羅判定、採点の事実抽出を分離。隣接監査で、別注記条件の欠落、3期比較の最古値欠落、分割単位の途中採用と同一セル別名も修正。

  • 再レビューで確認した管理欄の根拠なし数値を除外し、段落の点検要求を最大24件へ制限。全説明/指標の判定と保存の全原文ID検査を維持し、対象外段落は未点検として残す。

  • テストを部品・固定応答の結合・拡張境界・手動の実モデル品質に分け、重複する修復経路とfixtureを統合。Hook番号のmockを実Reactの公開状態テストへ置換し、追加基準を既存ガイドへ明記。

検証

  • Codex再レビュー: 最新a26f504に重大な問題なし(2026-10-06)。
  • npm test: 最新a26f504で1,143件/35ファイル成功(レビュー境界修正後の最終確認)。
  • npm run type-check、npm run lint、npm run build: 成功。
  • 新しい固定応答smokeの事前検査: 実PDF.js→HTTP応答→検証→表示→保存再検証の成功・説明未確認・最終失敗を確認。実API呼出し0。独立レビューで既存の競合・保存・数値/符号/期間の保証を維持していることを確認。
  • 最終v96の実モデル確認: OpenRouter/deepseek-v4.1-flash/全文抽出、World・BlueMeme各1回、計6要求。主要数値期待値・表示は2/2、補足は両方partial。点検の出力上限・タイムアウトは0。
  • v96時点の実応答を固定再生した拡張画面で、事業別利益と増減率の同一行表示、閉じた原文トグルと展開時の全原文、追加APIなしの保存復元、診断コピーを確認。
  • v96時点の配置確認では、指定されたChrome読み込み先へ検証済みビルドを配置し、24ファイルのチェックサム、manifest 0.7.4、固定keyを確認。

残る条件

  • v99では表示数量・段落点検対象の生成入力が変わる。今回の追加修正に対する実モデル・実拡張画面・配置は未実施で、v96の成功をv99の実績へ読み替えない。

  • 新しい実拡張smokeは、この環境のChromium起動がsocket権限制約で止まるため画面部分は未確認。ブラウザーなしの事前検査成功と区別する。

  • 任意の指標・説明には未整理部分が残る。部分結果を完全抽出・完全要約の成功とは扱わない。

  • 過去のモデル評価で発生した上限・期間・符号の失敗は保持する。最終2実行での上限未再発をモデル全般の保証とはしない。

  • 候補v4/確定事実v6/表示v6/補足保存v3/点検応答v2/分析指紋v99。旧形式を黙って変換しないため、更新後は再要約が必要。

設計と検証の正本: docs/development.md、evaluation/README.md。

ivgtr added 30 commits October 5, 2026 14:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 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-06T09:44:07.200291Z a26f504 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.

@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: 61cf9f5ab3

ℹ️ 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 src/lib/summary-renderer.ts Outdated
Comment on lines +397 to +401
for (const fact of members.filter((f) => !numeric(f))) {
const statement = statementText(fact);
if (/^(?:配当予想|業績予想):/.test(statement))
lines.push('- ' + overviewStatement(fact, facts));
else if (fact.kind === 'status') lines.push('- ' + statement);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Render verified event facts instead of dropping them

When a section contains a verified event fact, this loop renders only forecast-related statements and status facts, so the event falls through without being shown. This affects event-centric disclosures such as M&A, capital policy, and governance changes; if the optional organization request is unavailable or rejects its generated claim, the confirmed event disappears from the visible summary and is available only inside the raw-source toggle. Render the verified event statement independently of the optional generated claims. CLAUDE.mdL173-L173

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5eb9a11 と 3e33a5f で対応しました。event/status の確認済み本文を、任意の補足生成・点検の成否と独立して通常表示します。隣接経路も監査し、別注記にある「当局の承認が条件」などが本文から落ちるケースを追加修正しました。原文内の重複を避けつつ条件・限定と根拠ページを表示します。

補足タイムアウトでも、出来事と別注記の条件が可視HTMLに残り、保存再照合後も同じ表示になることを担当テストで確認しました。最新HEADの全1,141件、型チェック・lint・buildは成功しています。

Comment thread src/lib/summary-renderer.ts Outdated
Comment on lines +305 to +308
for (const id of presentation.overview) {
const f = byId.get(id);
if (f && !numeric(f) && /^(?:配当予想|業績予想):/.test(statementText(f)))
lines.push('- ' + overviewStatement(f, facts));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render selected source highlights in the overview

When buildPresentation selects a reason or condition excerpt for presentation.overview (for example, an earnings reason with no corresponding verified event fact), its ID starts with source: and therefore byId.get(id) returns nothing here. The selected highlight is silently omitted from 「開示の要点」, despite being deliberately added to the overview; resolve these IDs through presentation.excerpts and render the selected excerpt. CLAUDE.mdL173-L173

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5eb9a11 で source: ID を presentation.excerpts から解決し、その原文に対応する点検済み説明を「開示の要点」へ表示するようにしました。説明が不支持・生成不可の場合や未要約部分が残る場合も、未整理の表示と原文への導線を残し、選択したIDを黙って落としません。

冒頭を長い原文転載に戻さないため、未点検の抜粋は要約として表示せず、全文は詳細の原文欄に保持します。この表示方針も含めて再レビューをお願いします。理由のsource: ID、説明の採否、部分未整理、保存復元をsummary-presentationの担当テストで確認済みです。

Comment thread src/lib/summary-organization.ts Outdated
Comment on lines +154 to +158
? c.decimal === v.decimal
: c.raw.normalize('NFKC').replace(/\s/g, '') ===
v.raw.normalize('NFKC').replace(/\s/g, '')) &&
c.unit === v.unit &&
c.sourceIds.includes(e.id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Track unresolved table cells by identity

When two distinct cells in the same source row have the same decimal and unit, this value-based fallback treats the unshown cell as covered merely because a shown value cites that row. Equal current/prior values or different metrics with the same amount can therefore make unresolvedTableSources return no warning and allow statusOf to report ready, even though one cell was never summarized. Coverage should use the cell/value ID rather than decimal, unit, and row equality. CLAUDE.mdL158-L158

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5eb9a11 で decimal・unit・同じ行だけによる網羅判定を削除し、物理セル/数量IDで追跡するようにしました。追加監査の 3e33a5f では、金額と単位が別文字片だと同じセルの行内別名が残る問題と、「120百+万円」が「120百」で通る問題も修正しています。

同一行の連続した原文字・位置から完全単位を確認し、全範囲が一意に一致する別名だけを統合します。同額の別セルは別々に残します。単位一体/分割で、一方だけ表示→未整理、両方表示→解消を確認し、完全数量でのready判定と保存再照合も検証しました。最新HEADは3e33a5f、全1,141件・型・lint・build成功です。

Comment thread src/lib/fact-summary.ts
Comment on lines +410 to +411
presentation.organization = await generateSummaryOrganization(
{ ...config, ...factSummaryRequestLimits(config) },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip presentation generation for scoring documents

When experimental scoring fetches a past disclosure, extractScoreInput still calls generateVerifiedFactSummary for that document and discards its presentation. This wrapper now performs the supplemental organization and review requests here, adding up to two unnecessary LLM calls and 120 seconds per candidate inside the candidate loop before the actual scoring request. Use the facts-only generation path for historical scoring documents so optional display organization is not generated and billed when it cannot be used. CLAUDE.mdL158-L160

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5eb9a11 で過去資料の経路を generateVerifiedFacts に切り替えました。任意の表示用補足生成・点検を呼ばず、原文照合済みの事実だけを採点へ渡します。既存の信号/期限と候補修復の境界も維持しています。

score-extractionの代表例では、過去事実抽出+採点入力生成の通常2要求だけで、100→80の値・確定ID・比較元URLが保たれることを確認しました。最新3e33a5fの全検査も成功しています。実API呼出しは行っていません。

ivgtr added 4 commits October 6, 2026 16:57
Render confirmed event statements independently from optional explanations,
resolve reviewed overview claims through source IDs, and keep incomplete
source coverage visible. Track table quantities by physical identity and
remove duplicate row aliases only with exact positional proof.

Skip optional organization requests for historical scoring documents and
align prose numeric candidate instructions with the quantity contract.
Advance the analysis fingerprint to v97.

Verified: 1127 tests (34 files), type-check, lint, and build. No live model
calls. The existing extension repair fixture remains blocked by its legacy
v4 fact schema before browser launch.
…ity identities

Keep verified event conditions visible without optional organization, retain comparison-owning rows, and bind split quantity units to their complete physical identity. Add focused boundary regressions and advance the analysis fingerprint to v98.

Verified: 1141 tests across 35 files, type-check, lint, and build. Fixed-response PDF.js/HTTP/render/save checks pass; no live model or extension browser checks.

ivgtr commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

最新HEAD 3e33a5f の再レビューをお願いします。前回レビュー対象61cf9f5からの差分です。

  • 既存4指摘:確認済みevent/statusを補足の成否と独立して表示、選択source: IDを点検済み説明/未整理表示へ接続、表の網羅判定を物理セルIDへ変更、過去資料の採点を事実抽出だけへ分離。各スレッドに対応内容を返信しました
  • 同傾向の先回り修正:出来事の別注記条件を通常表示し、3期比較で中間の比較所有行を残す。分割単位を全原文字・位置で照合し、同額別セルを統合せず同一セルの別名だけを除去します
  • テスト整理:責務を部品・固定応答の結合・Chrome境界・手動モデル品質に分け、実React公開状態と薄い実拡張smokeへ整理。反例を全経路に複製せず、今回の境界は担当テストへ集約しました
  • 確認:最終ツリーで1,141件/35ファイル、type-check・lint・build成功。固定応答のPDF.js→HTTP→検証→HTML→保存再照合を含みます。分析指紋v98

特に、表示済み判定と実際に見える事実・条件の一致、同額/分割セルの同一性、生成と保存再照合の整合をご確認ください。冒頭の未点検原文は長文転載せず、未整理表示と詳細の全文へ導く方針です。

今回の実API呼出しは0で、v98の実モデル品質・実拡張画面・配置は未確認です。Chrome起動のsocket制約は残っています。該当HEADのPR用CI/checkは未設定で、ローカル検査成功と区別しています。

@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: 3e33a5ffce

ℹ️ 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".

raw: q.text,
decimal: parsed.decimal,
unit: parsed.unit ?? adjacentUnit ?? columnUnit ?? commonUnit,
sourceIds: [...new Set([...sources, ...unitSources].map((e) => e.id))],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip source-less administrative quantities

When PDF.js emits an excluded administrative field as separate spans—for example コード番号 and 1234 with a normal gap—sourceInventory intentionally creates no excerpt for that block, but this still inserts a NarrativeValue whose sourceIds is empty. renderSummary then calls validatePresentation, which rejects any such value, so an otherwise valid disclosure cannot be rendered or cached; omit quantities with no owning excerpt before inserting them. CLAUDE.mdL173-L173

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a26f504 で修正しました。PDF.jsの分割spanで「コード番号 1234」を再現し、sourceInventoryが除外したブロック由来の値に空のsourceIdsが残り、表示検証で全体が失敗することを確認しました。

数量自身の所有原文が1件もない場合は、NarrativeValueへ入れる前に除外します。近くの単位注記だけで所有関係を補うことはしません。担当テストで管理欄の除外と、有効な100百万円の通常表示・保存再照合が両立することを確認しました。最終1,143件/35ファイル、型・lint・build成功です。

];
lines.push(`| ${cells.join(' | ')} |`);
}
for (const condition of first.conditions) lines.push(`- 比較条件:${text(condition)}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Render every grouped observation's conditions

When multiple observations collapse into the same observationGroup but have different conditions, only the first row's conditions are emitted here. This affects cases such as the newly retained middle row in a three-period comparison carrying a restatement or scope qualifier; moreover, shownConditions is later populated from every structured row, so a matching accepted claim is suppressed even though its condition was never rendered, leaving the qualifier visible only in the raw-source toggle. Deduplicate and render conditions from the entire group rather than only first. CLAUDE.mdL173-L173

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この指摘は3e33a5fの実装では再現しませんでした。observationGroupはtopic/scope/basisに加え、conditions配列全体をcanonicalJSONのキーに含めています(src/lib/disclosure-observation.ts:290–292)。異なる条件を持つ行は別groupになるため、first.conditionsはそのgroup全行に共通する条件です。比較元の条件もfactObservationに含めています。

既存の3期比較テスト(逆順・保存復元を含む)に加え、renderer境界で条件配列の異なる行を与え、9事実→6比較行→3groupとなり、両方の条件が順序によらず表示されることを確認しました。後者は表示責務の検査で、注記抽出の追加証明ではありません。今回この点の製品コードは変更していません。別の再現入力があれば確認します。

Comment thread src/lib/summary-organization.ts Outdated
Comment on lines +632 to +635
sources: checked(
review.sources,
prose.map((e) => e.id)
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound source verdicts before the review request

For a long full-mode disclosure with more prose excerpts than the 8,192-token review response can enumerate, this requires review.sources to contain one verdict for every prose excerpt, even though claims and observations themselves are capped. Because prose has no corresponding limit or chunking, the review response must eventually truncate or exceed the model limit; the catch path then clears every generated claim and observation, making the optional organization consistently unavailable on large reports. Review source IDs in bounded batches or mark unreviewed excerpts unresolved without requiring them all in one response. CLAUDE.mdL158-L158

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a26f504 で対応しました。段落判定の要求を、説明の参照→観測指標の参照の順で最大24件へ制限しました。全claims/observationsの個別判定、全文の意味点検入力、IDの完全一致・重複拒否は維持しています。

要求対象外の段落は保存時に「点検対象外のため未整理」を明示し、review.sourcesの全原文ID集合を維持します。未点検をnullやreadyへ変えず、支持された説明・指標と未整理部分を共存させます。長文境界の担当1例で、API schema/promptの上限、採用維持、未整理、保存復元、保存キー欠落の拒否を確認しました。

分析指紋はv99。全1,143件、型・lint・build成功です。実モデルは今回未評価で、24件上限を全モデルでのtoken上限回避の保証とは扱いません。

Skip values from intentionally excluded administrative blocks. Review at most 24 referenced prose sources while retaining all claim verdicts and explicit unresolved markers for every omitted source. Preserve full storage identity checks and advance the analysis fingerprint to v99.

Verified: 1143 tests across 35 files, type-check, lint, build, and independent contract review. No live model or extension browser calls.

ivgtr commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

更新HEAD a26f504 を再レビューしてください。前回3e33a5fへの3指摘は各スレッドへ返信しました。

  • 管理欄の根拠なし数量:実際に再現し、所有原文がない値を表示候補から除外
  • 段落判定の無制限:要求を最大24件へ制限。全claims/observationsの判定・全文根拠は維持し、対象外sourceは未点検の理由と共に保存。保存の全ID検査も維持
  • 表の条件漏れ:conditions配列全体がgroupキーに含まれるため前提が成り立ちません。3期比較とrenderer境界の実行結果を添えて説明し、不要なコード変更はしていません

特に今回の差分で、原文所有のない値が混入しないこと、点検対象外が確認済み扱いにならず支持された項目は残ること、保存再照合との整合を確認してください。

分析指紋v99。最終1,143件/35ファイル、type-check・lint・build成功。固定応答の結合検査と独立差分レビュー済み。実API0、v99の実モデル・実拡張画面・配置は未確認です。最大24件は出力義務を有界にする対策で、全モデルでの上限回避を保証するものではありません。PR CIは未設定です。

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: a26f504eba

ℹ️ 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".

@ivgtr
ivgtr merged commit 580ad34 into main Oct 6, 2026
@ivgtr
ivgtr deleted the feat/summary-format branch October 6, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant