fix(v3-vision): strict integer stripping and demo parity verification
1. Hardened all demo models to set non-string ID fields to None, ensuring full Vision Standard compliance.\n2. Added status_id_random to common field schema.\n3. Verified account_id availability in exhibit tracking.\n4. Added comprehensive E2E parity test suite for demo objects.\n5. Fixed NameError by importing root_validator.
This commit is contained in:
@@ -80,6 +80,7 @@ base_fields['post_comment_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['product_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['site_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['site_domain_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['status_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['sponsorship_cfg_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['sponsorship_id_random'] = xxx_id_random_field_schema
|
||||
base_fields['user_id_random'] = xxx_id_random_field_schema
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator, root_validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import log, logging
|
||||
@@ -55,14 +55,11 @@ class Event_Badge_Base(BaseModel):
|
||||
if ep_rid := values.get('event_person_id_random'): values['event_person_id'] = ep_rid
|
||||
if p_rid := values.get('person_id_random'): values['person_id'] = p_rid
|
||||
|
||||
# 2. Prevent "Collision Population" or leakage of integers during API responses
|
||||
# WE MUST NOT DELETE these if they are already integers during a POST operation
|
||||
# as they have been resolved by sanitize_payload.
|
||||
# 2. Prevent leakage of integers during API responses (Vision Standard)
|
||||
for k in ['id', 'event_badge_id', 'event_id', 'event_id_only', 'event_badge_template_id', 'event_person_id', 'person_id']:
|
||||
val = values.get(k)
|
||||
if val is not None and not isinstance(val, str):
|
||||
if values.get(f'{k}_random') or (k=='id' and values.get('id_random')) or (k=='event_id_only' and values.get('event_id_random_only')):
|
||||
del values[k]
|
||||
values[k] = None
|
||||
|
||||
return values
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator, root_validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import log, logging
|
||||
@@ -53,12 +53,11 @@ class Event_Exhibit_Base(BaseModel):
|
||||
if p_rid := values.get('person_id_random'): values['person_id'] = p_rid
|
||||
if s_rid := values.get('status_id_random'): values['status_id'] = s_rid
|
||||
|
||||
# 2. Prevent "Collision Population" or leakage of integers during API responses
|
||||
# 2. Prevent leakage of integers during API responses (Vision Standard)
|
||||
for k in ['id', 'event_exhibit_id', 'account_id', 'event_id', 'organization_id', 'contact_id', 'person_id', 'status_id']:
|
||||
val = values.get(k)
|
||||
if val is not None and not isinstance(val, str):
|
||||
if values.get(f'{k}_random') or (k=='id' and values.get('id_random')):
|
||||
del values[k]
|
||||
values[k] = None
|
||||
|
||||
return values
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import datetime, pytz
|
||||
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator
|
||||
from pydantic import BaseModel, EmailStr, Field, Json, PrivateAttr, ValidationError, validator, root_validator
|
||||
|
||||
from app.db_sql import redis_lookup_id_random
|
||||
from app.lib_general import log, logging
|
||||
@@ -53,12 +53,11 @@ class Event_Exhibit_Tracking_Base(BaseModel):
|
||||
if ep_rid := values.get('event_person_id_random'): values['event_person_id'] = ep_rid
|
||||
if eb_rid := values.get('event_badge_id_random'): values['event_badge_id'] = eb_rid
|
||||
|
||||
# 2. Prevent "Collision Population" or leakage of integers during API responses
|
||||
# 2. Prevent leakage of integers during API responses (Vision Standard)
|
||||
for k in ['id', 'event_exhibit_tracking_id', 'account_id', 'event_id', 'event_exhibit_id', 'event_person_id', 'event_badge_id']:
|
||||
val = values.get(k)
|
||||
if val is not None and not isinstance(val, str):
|
||||
if values.get(f'{k}_random') or (k=='id' and values.get('id_random')):
|
||||
del values[k]
|
||||
values[k] = None
|
||||
|
||||
return values
|
||||
|
||||
|
||||
Reference in New Issue
Block a user