Repository navigation
feat: 事実要約・採点・追加分析を分離 - #22
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 127124a006
ℹ️ 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".
| if (result.twoPassMode !== undefined) | ||
| throw new Error('旧要約モード設定が残っています。設定画面で保存し直してください'); |
There was a problem hiding this comment.
Migrate the legacy two-pass setting automatically
Existing configured installations have twoPassMode in chrome.storage.sync because the previous options page saved it with every settings update, and the extension's fixed ID preserves that storage across upgrades. Rejecting the key here makes every summarize, score, and analyze request fail until the user discovers that they must open the options page and save again; remove or ignore this obsolete key during installation/settings loading instead.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(0407b0d)。保存済みの廃止キー twoPassMode を設定読込時に削除し、現在の設定で処理を続行します。旧キーが残る状態から要約できるテストを追加しました。
| if (!has(/売上高|売上収益/, 'actual') || !has(/営業利益/, 'actual') || !has(/純利益/, 'actual')) | ||
| throw new Error('決算実績の重要指標を確認できません'); |
There was a problem hiding this comment.
Accept IFRS parent profit in earnings coverage
For IFRS earnings PDFs, the supported profit label is commonly 親会社の所有者に帰属する当期利益, which this parser explicitly recognizes elsewhere but which does not match /純利益/. Consequently even a successfully verified IFRS fact set always fails this mandatory coverage check, triggers a repair, and then fails the summary again; the coverage predicate needs to include the accepted IFRS label.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(0407b0d)。IFRSの「親会社の所有者に帰属する当期/四半期/中間利益」を実績・予想の必須利益項目に含め、テストを追加しました。
| const row = line.replace(/^.*?(?:第[1-4]四半期|通期|\(予想\))\s*/, ''); | ||
| const values = [...row.matchAll(/-?\d+(?:\.\d+)?/g)].map((match) => Number(match[0])); |
There was a problem hiding this comment.
Strip fiscal-year prefixes before table slot validation
In a standard full-year results row such as 2025年3月期 10000 2.1 500 ..., none of the three markers in this replacement is present, so values begins with 2025, 3 rather than the revenue and percentage columns. numericSlot() then compares every requested metric against the wrong position, causing table-only full-year actuals to be discarded and the mandatory earnings coverage check to reject the entire summary. Strip the leading fiscal period for ordinary annual rows as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(0407b0d)。通期行の年度を数値列から除外し、増減率を含む8列の表を照合します。テストに加え、公開済みのギークリー決算PDFの物理1ページで営業利益2,156百万円を確認しました。
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0407b0d4f5
ℹ️ 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".
| if (/親会社.*(?:純利益|当期利益|四半期利益|中間利益)|四半期純利益/.test(label)) | ||
| return financial ? 6 : 4; |
There was a problem hiding this comment.
Map non-percentage net profit to slot 3
For a standard full-year forecast row containing 売上高 / 営業利益 / 経常利益 / 親会社株主に帰属する当期純利益 / 1株当たり当期純利益, percentageColumns is false, so this returns slot 4—the EPS value—instead of the net-profit value at slot 3. Fresh evidence after 0407b0d is that the fiscal-year prefix is now stripped, but the added test covers only an eight-value actual row; table-only forecast profit is still discarded, and verifyCoverage then rejects the entire earnings summary whenever 業績予想 is present.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(081e85b)。増減率のない通期予想表では純利益を4番目、EPSを5番目の数値列として照合します。純利益1,600百万円を採用し、EPS 10.5を純利益として拒否するテストを追加しました。
| const key = buildSummaryCacheKey(pdfUrl, response.metadata.analysisFingerprint); | ||
| if (key !== keyRef.current) return; |
There was a problem hiding this comment.
Preserve forced full-mode summary responses
When the configured extraction mode is smart, clicking 「全文で再要約」 calls summarize('full'), so the response carries a full fingerprint while keyRef.current still contains the configured smart cache key. This condition silently discards the successful response after removing the existing summary row, leaving the user with no full-mode result despite completing the PDF and API work.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(081e85b)。設定上のsmartモードと表示中のfullモードを別のキーとして保持し、全文再要約の応答を正しいキーで表示・保存します。通常の再要約へ戻る経路と、スコア設定変更で表示を消さない経路をテストしました。
| key.startsWith(CACHE_PREFIX) || | ||
| key.startsWith('scoreCacheV1:') || | ||
| key.startsWith('scoreCacheV2:') || | ||
| key.startsWith('analysisCacheV1:') || |
There was a problem hiding this comment.
Delete current V3 score cache entries
useSummarize stores scores under scoreCacheV3:, but both the per-entry deletion list and the all-cache filter only remove V1/V2 score keys. Consequently deleting summaries—or selecting 「すべて削除」—leaves every current score entry orphaned in chrome.storage.local, so repeated scoring can continue consuming the extension's storage quota while the UI reports that the cache is empty.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(081e85b)。個別削除と「すべて削除」の双方に現行の scoreCacheV3: を追加しました。
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 081e85be7c
ℹ️ 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".
| /業績予想/.test(source) && | ||
| (!has(/売上高|売上収益/, 'forecast') || | ||
| !has(/営業利益/, 'forecast') || | ||
| !has(parentProfit, 'forecast')) |
There was a problem hiding this comment.
Gate forecast coverage on actual forecast values
When an earnings release states that guidance is undecided or omitted, it can still contain 業績予想 in the heading, explanatory text, or standard cautionary boilerplate. This condition then requires three numeric forecast facts that do not exist, so both generation attempts fail and the otherwise valid actual-results summary is rejected. Detect a populated forecast table or explicit numeric guidance rather than the phrase alone.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(7d538dd)。予想必須項目は、検証済みの予想事実、数値入りの予想表、明示的な数値予想がある場合だけ要求します。「業績予想は未定」の実績要約を通し、数値予想の欠落は拒否するテストを追加しました。
| if (/親会社.*(?:純利益|当期利益|四半期利益|中間利益)|四半期純利益/.test(label)) | ||
| return financial ? 6 : 3; |
There was a problem hiding this comment.
Map IFRS parent profit to its own table slot
In the standard IFRS results layout, 当期利益 precedes 親会社の所有者に帰属する当期利益, with each metric followed by a percentage; the parent-attributable profit is therefore slot 8, while this branch always selects slot 6. A correctly extracted IFRS parent-profit value is consequently discarded and mandatory earnings coverage rejects the summary. The slot selection needs to account for the additional IFRS profit column.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(7d538dd)。IFRSで独立した当期・四半期利益列が親会社帰属利益列の前にある場合は、その追加列を考慮します。公開PDFの物理1ページで親会社帰属利益5,700百万円を採用し、当期利益6,000百万円を誤採用しないことを確認しました。
| } | ||
|
|
||
| function numericBindingVerified(fact: VerifiedFact): boolean { | ||
| const quote = fact.quote.normalize('NFKC').replace(/[,,]/g, ''); |
There was a problem hiding this comment.
Normalize triangle minus signs during binding
For TDnet tables that represent losses with △ or ▲, the earlier value-existence check converts the marker to -, but this binding pass reparses the original quote without that conversion. Thus a valid value such as △2,000 is seen as positive 2000, the negative fact is discarded, and a loss in any mandatory earnings metric can make the entire summary fail. Apply the same triangle-sign normalization before slot and prose binding.
AGENTS.md reference: AGENTS.md:L1-L1
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(7d538dd)。数値存在確認と表・文章の結合検証で同じ△・▲の負数化を使います。符号と数字の間に空白がある場合も含めて回帰テストを追加しました。旧条件の要約キャッシュは分析指紋v16で再利用しません。
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d538dd136
ℹ️ 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".
| const row = line.replace( | ||
| /^\s*(?:20\d{2}年\d{1,2}月期(?:第[1-4]四半期|\(予想\))?|第[1-4]四半期|通期|\(予想\))\s*/, | ||
| '' |
There was a problem hiding this comment.
Allow whitespace before the quarter marker
When PDF extraction renders a row label as 2027年2月期 第1四半期, this prefix pattern consumes only the fiscal year and leaves 第1四半期 in row; the 1 is then treated as the first financial value, shifting every table slot. Valid quarterly metrics—including IFRS parent-attributable profit—are consequently discarded, and mandatory earnings coverage can reject the entire summary. Permit whitespace between 月期 and the optional quarter marker before parsing the numeric columns.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(9af8203)。年度・決算月と第1~第4四半期の間に空白があっても、期間表記を数値列から除外します。空白入りIFRS表の回帰テストと、公開PDFの物理1ページで親会社帰属利益2,217百万円を採用し隣の2,359百万円を拒否する確認を行いました。
| set({ loading: false, data, error: null }); | ||
| await chrome.storage.local.set({ [cache]: data }); |
There was a problem hiding this comment.
Keep failed score responses out of the cache
When score extraction or inference encounters a transient API error or validation failure, the background returns an ExperimentalScore with value: null; this path still treats it as successful data and stores it in scoreCacheV3. Because score.data then prevents automatic scoring and the retry button is only available for score.error, the failed result becomes unretryable until the cache is manually deleted. Treat null-valued score responses as errors or avoid caching them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
対応しました(9af8203)。算出不能の採点はbackgroundでエラーとして返し、content側でもnull値を成功扱いせず保存しません。既存のnull値V3キャッシュは読み込み時に削除し、要約を保ったまま再採点できる状態にします。回帰テストを追加しました。
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9af820350b
ℹ️ 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".
| function periodVerified(page: string, period: string): boolean { | ||
| const body = normalize(page); | ||
| const target = normalize(period); | ||
| if (body.includes(target)) return true; |
There was a problem hiding this comment.
Bind each value to its declared fiscal period
When a quoted earnings table contains both current- and prior-year rows, this page-wide check accepts the declared period as long as it appears anywhere on the page; numericBindingVerified can then select the value from either row. For example, a prior-year operating-profit value can pass with the current year's period and be rendered and cached as a verified current result. Validate the candidate row's fiscal-year/month/quarter prefix against fact.period rather than only checking the page.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
ご指摘の通りです。数値を含む表の行から年度・四半期を読み取り、fact.period と一致する場合だけ採用するよう修正しました。前年の営業利益703百万円を当年値として扱うケースは拒否し、前年値としては採用するテストと公開PDF確認を追加しました。修正は 85ee02f です。
| if (/親会社.*(?:純利益|当期利益|四半期利益|中間利益)|四半期純利益/.test(label)) | ||
| return financial ? 6 : 3; | ||
| if (/^当期利益$/.test(label)) return financial ? 6 : 3; |
There was a problem hiding this comment.
Recognize non-consolidated annual net profit
For a standard non-consolidated annual table whose fourth metric is 当期純利益, neither this pattern nor the following exact 当期利益 branch selects slot 6. The net-profit fact is therefore discarded, and because earnings coverage requires a /純利益/ actual, an otherwise valid table-only summary is rejected. Include 当期純利益 in the fourth financial-metric mapping.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
ご指摘の通りです。個別決算表の 当期純利益 を第4指標に対応させました。公開PDFの物理1ページで1,516百万円を採用し、隣の経常利益2,130百万円は誤採用しないことを確認しました。修正は 85ee02f です。
| if (fact.valueKind === 'forecastBefore' && !/前回|従来/.test(near)) continue; | ||
| if (fact.valueKind === 'forecastAfter' && /前回|従来/.test(near) && !/今回|修正/.test(near)) | ||
| continue; |
There was a problem hiding this comment.
Verify actual and forecast classifications against the row
The binding logic checks contextual markers only for forecastBefore and forecastAfter; ordinary actual and forecast values are accepted from any matching row. If the model labels a first-page actual-results row as forecast, the fact passes validation and can satisfy forecast coverage, so the UI reports historical results as guidance. Require an actual/forecast row marker or section context before accepting these two value kinds.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
ご指摘の通りです。値がある行と近くの見出しから実績/予想を判定し、fact.valueKind と一致する場合だけ採用するよう修正しました。実績を予想として扱うケースと逆方向のケースをテストで拒否しています。引用位置の重複見出しによるずれも修正し、旧キャッシュを無効化するため分析指紋をv17に更新しました。修正は 85ee02f です。
|
@codex review 最新の修正(85ee02f)を含めて再レビューをお願いします。対象期間と表の行の照合、実績・予想の区分、個別決算の当期純利益の照合を修正しました。 |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
変更内容
更新時の設定と権限
検証
deepseek/deepseek-v4.1-flashを使用しました。確認範囲と制限