ECSS Simulation Infrastructure — Validation Rules (space-systems/ecss/e4008-validation-rules)
Use when the task is the validation rules of ECSS-E-ST-40-08C clause
5.7.2.2 -- what a reader checks in an exchange file once its format
declaration has been accepted. The clause carries two normative items,
one that can be decided entry by entry and one that needs the whole
file in hand, and they are run and reported as two separate passes.
Domain quick reference
- Structural validation is local. Each entry declares a kind, and the
kind fixes which fields are required, which are optional and what
type each field holds. Nothing outside that set may appear: an extra
field is a producer writing into a format the reader does not share.
- Referential validation is global. Identifiers have to be unique
across the whole file, every reference has to resolve, and a
reference has to land on an entry of the kind the field expects --
a link pointing at a type rather than a model resolves and is still
wrong.
- The two passes run in that order and the order matters. A
structurally broken entry has no trustworthy identifier and no
trustworthy reference fields, so resolving against it manufactures
findings that disappear once the real defect is fixed.
- An excluded entry is reported as excluded. Dropping it quietly makes
the reference pass look cleaner than the file is, and the next reader
hits the same defect with no warning.
- The parent, base and link references form a graph, and the graph has
to be acyclic. A model that is its own ancestor resolves at every
individual reference and only fails when something walks the chain.
- A duplicate identifier is not a merge. The second entry is refused
rather than overwriting the first, because a reference written before
the duplicate appeared meant the first one.
- A type check on a numeric field has to exclude booleans. A period of
True is an integer to the language and nonsense to the schedule.
Workflow
- Run the structural pass entry by entry: resolve the kind, refuse an
unknown one outright, then check required fields, undeclared fields
and the type of each value present.
- Record which entry positions failed structure; they are the ones the
reference pass will exclude.
- Build the identifier table from the structurally sound entries only,
refusing a duplicate rather than letting the later entry win.
- Resolve every reference field of every sound entry: report an
identifier no entry declares, and separately report one that
resolves to an entry of the wrong kind.
- Build the reference graph from the references that both resolved and
matched their expected kind, and walk it for cycles, naming every
identifier taking part rather than just the first one found.
- Report the exclusions explicitly as a finding of the reference pass.
- Grade the two items separately so a file with a structural defect
and a referential one gets both verdicts in a single run.
Pitfalls
- Running one merged validation pass. A missing required field then
produces an unresolved-reference finding as well, and the report
points at the wrong entry.
- Resolving references against entries that failed structure. Every
finding it produces is downstream of a defect already reported, and
they all vanish when that one is fixed.
- Dropping the excluded entries without saying so. The reference pass
reports clean on a file that was only partly validated.
- Letting a duplicate identifier overwrite the first entry. References
written against the first now silently point at the second, and
nothing in the file says the target changed.
- Checking that a reference resolves and stopping there. A link whose
source points at a type is resolvable and still meaningless, and the
defect surfaces as a type error deep inside the simulator.
- Checking only the direct parent for a self-reference. A three-step
parent cycle passes every single-hop check and only shows up when the
tree is walked.
- Accepting a boolean where a positive integer is required. It passes
an integer type check in most languages and configures a schedule
period of one tick.
Behavior contract (gate 3)
Identifier validation, per-kind structural schemas, undeclared-field
and type checking, the structural pass, exclusion of unsound entries,
identifier uniqueness, reference resolution, expected-kind matching,
cycle detection over the reference graph and the two-item grading are
exercised by the gate 3 contract test:
scripts/test_e4008_validation_rules.py against
scripts/e4008_validation_rules_logic.py (stdlib unittest, offline). Run:
python3 scripts/test_e4008_validation_rules.py
Compliance
- ECSS standards are freely downloadable (ESA); cite the source and
paraphrase per standards-map.yaml.
- compliance: STANDARDS-REF, gated: false.
1---2name: e4008-validation-rules3description: "Validate the body of a simulator exchange file against the rules of ECSS-E-ST-40-08C clause 5.7.2.2. Use when the task is running the structural pass over each entry for required fields, declared types and smuggled-in extra fields, then the referential pass over the whole file for identifier uniqueness, references that resolve to an entry of the kind the field expects, and cycles in the parent, base and link graph, keeping a structurally broken entry out of the reference graph and saying so rather than dropping it. Grades a file against the two normative items. Trigger: ecss, e-st-40-08c, exchange-file-validation-pass, exchange-file-structural-validation, exchange-file-referential-integrity, duplicate-exchange-identifier, unresolved-entry-reference, exchange-reference-cycle."4license: Apache-2.05compliance: STANDARDS-REF6standards:7 - id: ecss8 reference-only: true9gated: false10domain: space-systems11pack: space-systems12compatibility: "agentskills.io SKILL.md; any SKILL.md host (Claude Code, Hermes, OpenClaw)"13metadata:14 source: https://skillmd.com/skills/ashfordeou/e4008-validation-rules15 domain: space-systems16 subdomain: ecss17 tags: [ecss, e-st-40-08-simulation-scope, e4008-validation-rules, exchange-file-validation-pass, exchange-file-structural-validation, exchange-file-referential-integrity, unresolved-entry-reference, exchange-reference-cycle]18 version: 0.1.019 author: Aero Agent Skills20---2122# ECSS Simulation Infrastructure — Validation Rules (space-systems/ecss/e4008-validation-rules)2324Use when the task is the validation rules of ECSS-E-ST-40-08C clause255.7.2.2 -- what a reader checks in an exchange file once its format26declaration has been accepted. The clause carries two normative items,27one that can be decided entry by entry and one that needs the whole28file in hand, and they are run and reported as two separate passes.2930## Domain quick reference3132- Structural validation is local. Each entry declares a kind, and the33 kind fixes which fields are required, which are optional and what34 type each field holds. Nothing outside that set may appear: an extra35 field is a producer writing into a format the reader does not share.36- Referential validation is global. Identifiers have to be unique37 across the whole file, every reference has to resolve, and a38 reference has to land on an entry of the kind the field expects --39 a link pointing at a type rather than a model resolves and is still40 wrong.41- The two passes run in that order and the order matters. A42 structurally broken entry has no trustworthy identifier and no43 trustworthy reference fields, so resolving against it manufactures44 findings that disappear once the real defect is fixed.45- An excluded entry is reported as excluded. Dropping it quietly makes46 the reference pass look cleaner than the file is, and the next reader47 hits the same defect with no warning.48- The parent, base and link references form a graph, and the graph has49 to be acyclic. A model that is its own ancestor resolves at every50 individual reference and only fails when something walks the chain.51- A duplicate identifier is not a merge. The second entry is refused52 rather than overwriting the first, because a reference written before53 the duplicate appeared meant the first one.54- A type check on a numeric field has to exclude booleans. A period of55 True is an integer to the language and nonsense to the schedule.5657## Workflow58591. Run the structural pass entry by entry: resolve the kind, refuse an60 unknown one outright, then check required fields, undeclared fields61 and the type of each value present.622. Record which entry positions failed structure; they are the ones the63 reference pass will exclude.643. Build the identifier table from the structurally sound entries only,65 refusing a duplicate rather than letting the later entry win.664. Resolve every reference field of every sound entry: report an67 identifier no entry declares, and separately report one that68 resolves to an entry of the wrong kind.695. Build the reference graph from the references that both resolved and70 matched their expected kind, and walk it for cycles, naming every71 identifier taking part rather than just the first one found.726. Report the exclusions explicitly as a finding of the reference pass.737. Grade the two items separately so a file with a structural defect74 and a referential one gets both verdicts in a single run.7576## Pitfalls7778- Running one merged validation pass. A missing required field then79 produces an unresolved-reference finding as well, and the report80 points at the wrong entry.81- Resolving references against entries that failed structure. Every82 finding it produces is downstream of a defect already reported, and83 they all vanish when that one is fixed.84- Dropping the excluded entries without saying so. The reference pass85 reports clean on a file that was only partly validated.86- Letting a duplicate identifier overwrite the first entry. References87 written against the first now silently point at the second, and88 nothing in the file says the target changed.89- Checking that a reference resolves and stopping there. A link whose90 source points at a type is resolvable and still meaningless, and the91 defect surfaces as a type error deep inside the simulator.92- Checking only the direct parent for a self-reference. A three-step93 parent cycle passes every single-hop check and only shows up when the94 tree is walked.95- Accepting a boolean where a positive integer is required. It passes96 an integer type check in most languages and configures a schedule97 period of one tick.9899## Behavior contract (gate 3)100101Identifier validation, per-kind structural schemas, undeclared-field102and type checking, the structural pass, exclusion of unsound entries,103identifier uniqueness, reference resolution, expected-kind matching,104cycle detection over the reference graph and the two-item grading are105exercised by the gate 3 contract test:106scripts/test_e4008_validation_rules.py against107scripts/e4008_validation_rules_logic.py (stdlib unittest, offline). Run:108python3 scripts/test_e4008_validation_rules.py109110## Compliance111112- ECSS standards are freely downloadable (ESA); cite the source and113 paraphrase per standards-map.yaml.114- compliance: STANDARDS-REF, gated: false.