M141 — AP203 PRODUCT_CATEGORY hierarchy contains a cycle

§12.8 (sub-class: AP203 category hierarchy integrity)

P1 — silent data loss

spec-violation

Sources

Sender

deduced — PDM exporter that produced category links from a graph rather than a tree without cycle detection

Description

`PRODUCT_CATEGORY_RELATIONSHIP` entries form a cycle: category 'electronics' is sub-of 'mechanical_assembly' which is sub-of 'electronics'. Walking the category tree to discover a part's parent class loops indefinitely. Bug-reporter language: "AP203 category cycle", "infinite hierarchy", "PDM categorization loops".

Reproducer recipe

two `PRODUCT_CATEGORY_RELATIONSHIP` entries forming an `A -> B -> A` cycle.

Expected kernel behavior

detect cycles in the category graph; reject or break the cycle with a warning.

Notes

Synonyms: "AP203 hierarchy loop", "category infinite recursion", "PRODUCT_CATEGORY contains cycle", "PDM category tree loops", "category sub-of forms cycle".

Expected validation

occt=empty/empty gmsh=empty ifc=schema_n/a

Byte assertions

Tier-3 assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* M141: AP203 PRODUCT_CATEGORY hierarchy contains a cycle */
3/* DEFECT: electronics sub-of mechanical_assembly sub-of electronics */
4/* Two PRODUCT_CATEGORY_RELATIONSHIP entries form cycle: A->B->A */
5/* Category tree walkers loop indefinitely; PDM tools hang or stack-overflow */
6/* Per ISO 10303-44 PRODUCT_CATEGORY_RELATIONSHIP graph must be acyclic */  
7/* Byte assertion: contains(b'CONFIG_CONTROL_DESIGN') */
8/* Byte assertion: count_entity_def(b'PRODUCT_CATEGORY_RELATIONSHIP') >= 2 */
9/* Byte assertion: count_entity_def(b'PRODUCT_CATEGORY') >= 2 */
10HEADER;
11FILE_DESCRIPTION(('M141: AP203 PRODUCT_CATEGORY hierarchy cycle electronics mechanical_assembly'),'2;1');
12FILE_NAME('M141.stp','2026-06-21T00:00:00',(''),(''),'cad-research-suite','','');
13/* Byte assertion: contains(b'CONFIG_CONTROL_DESIGN') */
14FILE_SCHEMA(('CONFIG_CONTROL_DESIGN { 1 0 10303 203 1 0 0 }'));
15ENDSEC;
16DATA;
17#1=APPLICATION_CONTEXT('configuration controlled 3D designs of mechanical parts and assemblies');
18#2=APPLICATION_PROTOCOL_DEFINITION('international standard',
19  'config_control_design',1994,#1);
20/* Standard unit context (mm) */
21#10=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
22#11=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
23#12=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
24#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#10,
25  'distance_accuracy_value','maximum model space distance between geometric entities');
26#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3)
27  GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13))
28  GLOBAL_UNIT_ASSIGNED_CONTEXT((#10,#11,#12))
29  REPRESENTATION_CONTEXT('ctx','3D'));
30/* Byte assertion: count_entity_def(b'PRODUCT_CATEGORY') >= 2 */
31/* First category node: 'electronics' — typically a leaf or mid-level category */  
32#20=PRODUCT_CATEGORY('electronics','Electronic components and sub-assemblies');
33/* Second category node: 'mechanical_assembly' — normally a parent category */
34#21=PRODUCT_CATEGORY('mechanical_assembly','Mechanical assembly components');
35/* Byte assertion: count_entity_def(b'PRODUCT_CATEGORY_RELATIONSHIP') >= 2 */
36/* DEFECT leg 1: 'electronics' declared as sub-category of 'mechanical_assembly' */
37/* This makes electronics appear as a specialization of mechanical_assembly */
38#30=PRODUCT_CATEGORY_RELATIONSHIP('elec-sub-mech',
39  'electronics is sub-category of mechanical_assembly',#20,#21);
40/* DEFECT leg 2: 'mechanical_assembly' declared as sub-category of 'electronics' */
41/* This makes mechanical_assembly appear as a specialization of electronics */   
42/* Together #30 and #31 form the cycle: electronics->mechanical_assembly->electronics */
43/* Walking parent links from either node never reaches a root — infinite loop */  
44#31=PRODUCT_CATEGORY_RELATIONSHIP('mech-sub-elec',
45  'mechanical_assembly is sub-category of electronics',#21,#20);
46/* Part assigned to the 'electronics' category — triggers the cycle on class lookup */
47#35=PRODUCT('PART-505','Sensor PCB','Printed circuit board for sensor module',(#1));
48#36=PRODUCT_DEFINITION_FORMATION('rev_B','Rev B sensor board',#35);
49#37=PRODUCT_DEFINITION('design','',#36,PRODUCT_DEFINITION_CONTEXT(#1,'design'));
50/* Classification assignment binds #37 to category 'electronics' (#20) */
51/* A BOM exploder walking the hierarchy from #20 enters the A->B->A cycle */  
52#40=APPLIED_CLASSIFICATION_ASSIGNMENT(#20,CLASSIFICATION_ROLE('classification'),(#37));
53/* GEOMETRIC_CURVE_SET IS the model entity — OCC yields empty */
54#500=GEOMETRIC_CURVE_SET('ap203-product-category-relationship-cycle-A-B-A',
55  (#20,#21,#30,#31,#35,#36,#37,#40));
56/* Product chain */
57#600=APPLICATION_CONTEXT('mechanical design');
58#601=PRODUCT_CONTEXT('',#600,'mechanical');
59#602=PRODUCT('M141','M141','M141',(#601));
60#603=PRODUCT_DEFINITION_FORMATION('','',#602);
61#604=PRODUCT_DEFINITION_CONTEXT(#600,'design');
62#605=PRODUCT_DEFINITION('','',#603,#604);
63#606=PRODUCT_DEFINITION_SHAPE('','',#605);
64#607=SHAPE_REPRESENTATION('',(#500),#14);
65#608=SHAPE_DEFINITION_REPRESENTATION(#606,#607);
66ENDSEC;
67END-ISO-10303-21;