Skip to content

Commit 59b8b4e

Browse files
authored
🧪 Add multi-error network-local parity fixture (#1735)
Adds `network_local_multi_error` — a network-context `local` whose linked target (`SPEC_1`) violates **two** property `const` constraints at once (`asil` and `comment`). `_validate_need_local` collects all of `iter_errors` (one `OntologyWarning` per error), so both failures are reported. This pins that behaviour as the parity oracle for the ubcode port, whose network-local path currently surfaces only the first error (the remaining half of the #1461-style "condense network local errors" divergence). No behaviour change — fixture + snapshot only.
1 parent cbf245c commit 59b8b4e

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

‎tests/schema/__snapshots__/test_schema.ambr‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5090,6 +5090,60 @@
50905090
}),
50915091
})
50925092
# ---
5093+
# name: test_schemas[schema/fixtures/network-network_local_multi_error]
5094+
'''
5095+
ERROR: Need 'SPEC_1' has schema violations:
5096+
Severity: violation
5097+
Field: asil
5098+
Need path: IMPL_1 > links > SPEC_1
5099+
Schema path: [0] > validate > network > links > items > local > properties > asil > const
5100+
Schema message: "A" was expected [sn_schema_violation.network_local_fail]
5101+
ERROR: Need 'SPEC_1' has schema violations:
5102+
Severity: violation
5103+
Field: comment
5104+
Need path: IMPL_1 > links > SPEC_1
5105+
Schema path: [0] > validate > network > links > items > local > properties > comment > const
5106+
Schema message: "ok" was expected [sn_schema_violation.network_local_fail]
5107+
5108+
'''
5109+
# ---
5110+
# name: test_schemas[schema/fixtures/network-network_local_multi_error].1
5111+
dict({
5112+
'validated_needs_count': 2,
5113+
'validation_warnings': dict({
5114+
'IMPL_1': list([
5115+
dict({
5116+
'children': list([
5117+
]),
5118+
'details': dict({
5119+
'field': 'asil',
5120+
'need_path': 'IMPL_1 > links > SPEC_1',
5121+
'schema_path': '[0] > validate > network > links > items > local > properties > asil > const',
5122+
'severity': 'violation',
5123+
'validation_msg': '"A" was expected',
5124+
}),
5125+
'log_lvl': 'error',
5126+
'subtype': 'network_local_fail',
5127+
'type': 'sn_schema_violation',
5128+
}),
5129+
dict({
5130+
'children': list([
5131+
]),
5132+
'details': dict({
5133+
'field': 'comment',
5134+
'need_path': 'IMPL_1 > links > SPEC_1',
5135+
'schema_path': '[0] > validate > network > links > items > local > properties > comment > const',
5136+
'severity': 'violation',
5137+
'validation_msg': '"ok" was expected',
5138+
}),
5139+
'log_lvl': 'error',
5140+
'subtype': 'network_local_fail',
5141+
'type': 'sn_schema_violation',
5142+
}),
5143+
]),
5144+
}),
5145+
})
5146+
# ---
50935147
# name: test_schemas[schema/fixtures/network-network_local_unevaluated_reduced_error]
50945148
'''
50955149
ERROR: Need 'SPEC_1' has schema violations:

‎tests/schema/fixtures/network.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,44 @@ network_local_unevaluated_reduced_error:
697697
type: {const: spec}
698698
unevaluatedProperties: false
699699

700+
network_local_multi_error:
701+
# A network-context ``local`` whose target violates *two* property constraints at
702+
# once. ``_validate_need_local`` lists ALL of ``iter_errors`` (one warning per error),
703+
# so both the ``asil`` and ``comment`` const failures on SPEC_1 are reported — the
704+
# oracle for ubcode, whose network-local path historically surfaced only the first.
705+
conf: |
706+
extensions = ["sphinx_needs"]
707+
needs_from_toml = "ubproject.toml"
708+
needs_schema_definitions_from_json = "schemas.json"
709+
ubproject: |
710+
[needs.fields.asil]
711+
schema.type = "string"
712+
[needs.fields.comment]
713+
schema.type = "string"
714+
rst: |
715+
.. spec:: title
716+
:id: SPEC_1
717+
:asil: QM
718+
:comment: nope
719+
720+
.. impl:: title
721+
:id: IMPL_1
722+
:links: SPEC_1
723+
schemas:
724+
$defs: []
725+
schemas:
726+
- select:
727+
properties:
728+
type: {const: "impl"}
729+
validate:
730+
network:
731+
links:
732+
items:
733+
local:
734+
properties:
735+
asil: {const: "A"}
736+
comment: {const: "ok"}
737+
700738
link_name_contains:
701739
conf: |
702740
extensions = ["sphinx_needs"]

0 commit comments

Comments
 (0)