Signal Forms: `validateStandardSchema` throws a TypeError for an issue whose path runs through a key the model lacks
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- angular, typescript
- 領域
- frontend
調査の方向性
@angular/forms/signals の validateStandardSchema で使用されている standardIssueToFormTreeError() の実装から始め、次にこの issue の最小再現を ['ghost'] と ['ghost', 'name'] の両方に対して実行します。中間キーのケースでスローされなくなり、未知の末尾キーのフォールバックと同様に、ルート上に Wrong. エラーが 1 つ報告されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Which @angular/* package(s) are the source of the bug?
forms
Is this a regression?
No
Description
standardIssueToFormTreeError() walks an issue's path with target = target[pathKey]. For an unknown last key, target ends up undefined and the error falls back to the field the schema validates, which is fine. For an unknown key anywhere before the last one, the next step reads a property of undefined, and reading errors() throws.
import { signal } from '@angular/core';
import { form, validateStandardSchema } from '@angular/forms/signals';
import type { StandardSchemaV1 } from '@standard-schema/spec';
function reportsOn(path: PropertyKey[]): StandardSchemaV1<{ name: string }> {
return {
'~standard': {
version: 1,
vendor: 'repro',
validate: () => ({ issues: [{ message: 'Wrong.', path }] }),
},
};
}
// In an injection context:
const lastKey = form(signal({ name: '' }), (p) => validateStandardSchema(p, reportsOn(['ghost'])));
lastKey().errors(); // one error, 'Wrong.', on the root
const middleKey = form(signal({ name: '' }), (p) => validateStandardSchema(p, reportsOn(['ghost', 'name'])));
middleKey().errors(); // TypeError: Cannot read properties of undefined (reading 'name')
A Standard Schema can easily report outside the bound model: a schema written for a wider object, a refinement with a computed path, a Vest test whose name is not a model key. Today one such issue makes errors() throw.
Expected: the same fallback as for an unknown last key. target = target?.[pathKey] in that loop would give it.
Minimal reproduction
The snippet above.
Exception or error
TypeError: Cannot read properties of undefined (reading 'name')
Environment
Angular CLI 22.2.0, Angular 22.2.0, Node.js 26.7.0, darwin arm64. standardIssueToFormTreeError() is the same in 22.2.1, 22.3.0-next.0 and on main.
Anything else?
No.
- 主要言語
- TypeScript
- スター
- 102k
- フォーク
- 28.2k
- 平均マージ
- 2日 10分
- マージ済み PR(30日)
- 402
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/angular のほかの issue
-
Two-way binding documentation is missing important information再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンarea: docs
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
angular/angular#71796 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: core
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
angular/angular#71585 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Assigning to a template reference in an event binding isn't reported by the compiler再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンarea: compiler
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
angular/angular#71511 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
`Symbol.iterator in FieldTree` is always false再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンarea: forms forms: signals
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
angular/angular#70252 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
area: docs gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
angular/angular#68808 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
angular/angular の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
gofish-graphics/gofish-graphics#1384 ·
メンテナーはふだん 1 日以内に返信
-
adapter bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Olanetsoft/agent-lookout#353 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
vicharanashala/vibe#1542 ·
メンテナーはふだん 1 日以内に返信
-
bug chore P2 size:XS
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
josephfung/curia#2666 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
devarshishimpi/codra#178 ·
メンテナーはふだん 1 日以内に返信