883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
46 lines
2.3 KiB
Python
46 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Only the captured literal-ampersand Source member family and refusals."""
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
from item_model_assets import canonical_member
|
|
|
|
|
|
def check(job):
|
|
root=job/'model800-resource-link-closure'
|
|
old=json.loads((root/'complete800-SKIN-SFID-TXID-dependency-join.json').read_text())
|
|
affected=[slot for r in old['records']for slot in r['texture_slots']if slot['state']=='NAMED_TEXTURE_PATH_HELD']
|
|
assert len(affected)==20
|
|
paths=[]
|
|
for row in affected:
|
|
expected=row['source_name'].replace('\\','/').lower()
|
|
assert '&'in expected and canonical_member(row['source_name'])==expected
|
|
paths.append(expected)
|
|
capture=json.loads((root/'literal-ampersand-Source-capture-proof.json').read_text())
|
|
assert len(capture['records'])==2
|
|
for row in capture['records']:
|
|
assert row['source_reference']in paths
|
|
assert canonical_member(row['source_reference'])==row['source_reference']
|
|
assert row['reference_source_selection']['source_client_sha256']=='5014ca1cfedf860f10e93fe7d955c56c28eb11a2bb503030dbb9b1c777f00470'
|
|
invalid=['../world/a&b.blp','world/a&b/../x.blp','/world/a&b.blp',
|
|
'world//a&b.blp','C:\\world\\a&b.blp','world/a&b\x00.blp',
|
|
'world/a&b\n.blp','world/'+('a'*257)+'&b.blp','world/a&b.exe']
|
|
for value in invalid:
|
|
try:canonical_member(value)
|
|
except ValueError:pass
|
|
else:raise AssertionError('Unsafe Source member admitted')
|
|
result=dict(status='PASS_ACTUAL20_LITERAL_AMPERSAND_SLOTS_AND_SOURCE_MEMBER_REFUSALS',
|
|
actual_slots=20,distinct_Source_paths=len(set(paths)),qualified_Source_capture_paths=2,
|
|
unsafe_control_refusals=len(invalid),destination_asset_paths_unchanged=True,
|
|
Source_or_Native_body_reads=0,model_or_texture_conversion_repeated=False)
|
|
(root/'literal-ampersand20-focused-check.json').write_text(json.dumps(result,indent=2)+'\n')
|
|
|
|
|
|
if __name__=='__main__':
|
|
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--job',type=Path,required=True)
|
|
args=parser.parse_args();check(args.job)
|
|
print('PASS:20 exact Source member slots; literal ampersand only;9 unsafe refusals.')
|