1888 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
26 lines
2.1 KiB
Python
26 lines
2.1 KiB
Python
from pathlib import Path
|
|
import sys,json,hashlib,collections
|
|
sys.path.insert(0,'ops')
|
|
from item_catalog_stage import refresh_failed_basic_components,compose_metadata_batch
|
|
from item_batch_stage import BASIC_INPUTS,json_bytes
|
|
from item_sparse_compat import fields
|
|
from item_package_preflight import target_index
|
|
root=Path('runtime/catalog-items-20261018');cat=root/'catalogue-full-curves';out=root/'refreshed-clothing-metadata-20261019'
|
|
def digest(p):return hashlib.sha256(p.read_bytes()).hexdigest()
|
|
manifest=json.loads((cat/'manifest.json').read_text());pins={cat/'manifest.json':digest(cat/'manifest.json')};items=[]
|
|
for f in manifest['files']:
|
|
if not f['path'].startswith('items-'):continue
|
|
p=cat/f['path'];assert digest(p)==f['sha256'];pins[p]=f['sha256']
|
|
items.extend(r for r in json.loads(p.read_bytes()) if r['errors'].get('Item')=='Unreviewed equipment class/subclass/slot combination')
|
|
basic=Path(BASIC_INPUTS['full_basic']);assert digest(basic)==manifest['input_sha256']['full_basic'];pins[basic]=digest(basic)
|
|
fresh,refresh=refresh_failed_basic_components(items,target_index(json.loads(basic.read_bytes()),'Item'))
|
|
base=root/'source-duration-metadata-20261019/package.json';pins[base]=digest(base)
|
|
schema_path=Path(BASIC_INPUTS['dbd']);pins[schema_path]=digest(schema_path)
|
|
result=compose_metadata_batch(json.loads(base.read_bytes()),fresh,[dict(entry=r['entry'],selection_reason='current-reviewed-clothing-identity')for r in fresh if not r['errors']],fields(schema_path),complete_partial_pairs=True)
|
|
package=result.pop('package');result.pop('header');result.pop('added')
|
|
result.update(refresh=refresh,kind='reviewed-clothing-metadata-refresh',installed=False,engine_verified=False,inputs={str(k):v for k,v in pins.items()},rows=len(package['rows']))
|
|
assert all(digest(p)==pin for p,pin in pins.items())
|
|
out.mkdir(exist_ok=False)
|
|
(out/'package.json').write_bytes(json_bytes(package));(out/'report.json').write_bytes(json_bytes(result))
|
|
print(json.dumps(dict(refreshed=len(refresh['refreshed']),still_blocked=len(refresh['blocked']),new_pairs=len(result['selected']),rows=len(package['rows']),tabard109=any(r['entry']==109 for r in result['selected']),installed=False)))
|