opcn1214-generator: cg.improvements.expense compares raw floats, so a valid report can fail to generate
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- backend
調査の方向性
まず packages/opcn1214-generator/src/validate/capital-gains-rules.ts:178 を開き、shareholders.dividendRights.total にある既存の百分の一単位の比較を調べてください。減価償却のテストを更新して 14.46 + 49.59 + 35.95 を含め、その後 src/validate/ を検索して、金額を浮動小数点数のまま直接比較している箇所を探してください。回帰テストが成功し、そのディレクトリに金額を浮動小数点数のまま直接比較している箇所がほかにない状態が完了条件です。
索引モデルが issue の本文から書いたものです。
説明
Problem
packages/opcn1214-generator/src/validate/capital-gains-rules.ts:178, in cg.improvements.expense:
if (typeof depreciation === 'number' && depreciation > expense) {
This compares raw doubles, so float residue decides the result. A depreciation summed in JS can land just above the expense: 14.46 + 49.59 + 35.95 is 100.00000000000001.
Repro: a 3077 improvement with expense: 100 and accumulatedDepreciation: 14.46 + 49.59 + 35.95.
field.decimalsaccepts the value. The file would hold000000010000for both amounts (10000 hundredths each).validate1214reportscg.improvements.expense: "Improvement 1 has an accumulated depreciation (100.00000000000001) above its expense (100)." Sogenerate1214throwsOpcn1214ValidationError.- The file written for
accumulatedDepreciation: 100is byte-identical, andparse1214of it reports nothing.
So validating the input and parsing the file disagree, and a fully depreciated improvement can block generation.
Fix
Compare in hundredths, as written to the file. shareholders.dividendRights.total already does this:
// Compared in hundredths, as written to the file: 14.46 + 49.59 + 35.95 is above 100.
if (
typeof depreciation === 'number' &&
Math.round(depreciation * 100) > Math.round(expense * 100)
) {
Done when
- The comparison works in hundredths.
- The test "accepts a depreciation equal to the expense…" includes the
14.46 + 49.59 + 35.95vector. - No other amount comparison in
src/validate/compares raw doubles. The same kind of bug came up in several places during the stack review.
Raised in the review of #5081 (FIX-3), which added this rule. The review wasn't posted because the PR merged first. Re-checked on main at 31245bc7f.
- 主要言語
- TypeScript
- スター
- 30
- フォーク
- 10
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 276
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Urigo/accounter-fullstack のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
Urigo/accounter-fullstack#5302 ·
メンテナーはふだん 2 日以内に返信
-
1214 annual-audit-workflow
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Urigo/accounter-fullstack#5256 ·
メンテナーはふだん 2 日以内に返信
-
annual-audit-workflow
難易度 1/5 1〜3時間 初心者へのやさしさ 87/100
Urigo/accounter-fullstack#5252 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Urigo/accounter-fullstack#4919 ·
メンテナーはふだん 2 日以内に返信
-
Business-trip attendee mutations throw TypeError instead of a clear error when no row is affectedオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Urigo/accounter-fullstack#4917 ·
メンテナーはふだん 2 日以内に返信
Urigo/accounter-fullstack の issue をすべて見る
似ている issue
-
area: integrations documentation priority: P2 size: XS
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
eddiejaoude/StackDash#798 ·
メンテナーはふだん 1 日以内に返信
-
bot:ai-assisted component:midnight-js status:untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
midnightntwrk/midnight-js#1790 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area:vscode bug has repro platform:macos platform:vscode regression
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDオープンcheck:passed streams:add
難易度 1/5 1時間未満 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信