…nown keys
`validateStandardSchema` maps each issue onto a field by walking the issue's path through the
field tree. When a key before the last one doesn't exist in the model (e.g. the schema was written
for a wider object or a refinement reports a computed path), the next step read a property of
`undefined` and `errors()` threw a `TypeError`.
Such issues are now reported on the field being validated, which is the same fallback that is
already used when only the last key of the path is unknown.
Fixes angular#71128
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
standardIssueToFormTreeError() walks a Standard Schema issue's path with target = target[pathKey]. When the last key is unknown to the model, target ends up undefined and the error falls back to the field being validated. When a key before the last one is unknown, the next step reads a property of undefined and errors() throws:
Issue Number: #71128
What is the new behavior?
The path walk stops descending once it leaves the model (target?.[pathKey]), so the issue is reported on the field being validated, the same fallback that already applies when only the last key is unknown.
Does this PR introduce a breaking change?
Other information
Added two tests to packages/forms/signals/test/node/api/validators/standard_schema.spec.ts: one for an unknown last key (existing behavior) and one for a path that runs through an unknown key. //packages/forms/signals/test/node:test passes locally (543 specs); without the fix the new test fails with the TypeError above.
An alternative would be to report the issue on the deepest existing field instead of the validated field. I kept the existing fallback for consistency, but happy to change it if preferred.
🤖 Generated with Claude Code