feat(cv): qualify templates and reliable local import processing
This commit is contained in:
@@ -91,7 +91,7 @@ def sources(commands):
|
||||
'scripts/verify-cv-fidelity.py', 'docs/redesign/phase-9/p9-requal-01/pdf-proof.py'}
|
||||
selected = [name for name in paths if name.startswith(prefixes) or name in exact
|
||||
or name.startswith(('Directory.', 'job-tracker-ui/playwright', 'job-tracker-ui/scripts/'))
|
||||
or name.startswith('docs/cv-redesign/') and name.endswith(('.py', '.ts', '.json'))]
|
||||
or name.startswith(('docs/cv-redesign/', 'docs/pre-phase10-ux/')) and name.endswith(('.py', '.ts', '.json'))]
|
||||
return {name: digest((ROOT / name).read_bytes()) for name in sorted(set(selected)) if (ROOT / name).is_file()}
|
||||
|
||||
|
||||
@@ -240,6 +240,8 @@ def run(args):
|
||||
record['frontend'] = tree(static)
|
||||
if not record['frontend']:
|
||||
raise ValueError('Prebuilt frontend output is required.')
|
||||
if not any(b'http://localhost:5302/api' in file.read_bytes() for file in static.rglob('*.js')):
|
||||
raise ValueError('Build the static frontend with NEXT_PUBLIC_API_BASE_URL=http://localhost:5302/api; serving-time environment cannot change compiled client routing.')
|
||||
record.update({'buildRecord': str(Path(args.build_record).resolve()), 'buildRecordSha256': digest(Path(args.build_record).read_bytes()),
|
||||
'sourceSha256': build_record['sourceSha256'], 'imageId': args.image, 'commit': build_record['commit'],
|
||||
'schema': schema, 'dbContainer': db, 'dbProject': project, 'apiContainer': api, 'network': network})
|
||||
@@ -316,12 +318,18 @@ def run(args):
|
||||
'NEXT_PUBLIC_API_BASE_URL': 'http://localhost:5302/api', 'CV_FIDELITY_OUTPUT': str(out / 'fidelity'),
|
||||
'CV_SETTINGS_FIDELITY_OUTPUT': str(out / 'settings-fidelity'), 'LETTER_FIDELITY_OUTPUT': str(out / 'letter-fidelity'),
|
||||
'PLAYWRIGHT_JSON_OUTPUT_NAME': str(out / 'linux-renderer.json')}
|
||||
commands.run(['node', 'node_modules/@playwright/test/cli.js', 'test', '--config=' + CONFIG, '--retries=0',
|
||||
config = CONFIG
|
||||
if args.include_template_library:
|
||||
config = '../docs/pre-phase10-ux/linux-template.config.ts'
|
||||
env.update({'PRE_P10_DESIGN_VERSION': '2', 'CV_TEMPLATE_OUTPUT': str(out / 'template-library'),
|
||||
'LETTER_LIBRARY_OUTPUT': str(out / 'letter-library')})
|
||||
commands.run(['node', 'node_modules/@playwright/test/cli.js', 'test', '--config=' + config, '--retries=0',
|
||||
'--reporter=list,json', '--output=' + str(out / 'test-results')], cwd=ROOT / 'job-tracker-ui', env=env, timeout=1800)
|
||||
native = json.loads((out / 'linux-renderer.json').read_text(encoding='utf-8'))
|
||||
stats = native.get('stats', {})
|
||||
if stats.get('expected') != 6 or any(stats.get(key) != 0 for key in ('unexpected', 'flaky', 'skipped')) or native.get('errors'):
|
||||
raise ValueError('Expected six passing browser cases with no skips, retries or errors.')
|
||||
expected_cases = 8 if args.include_template_library else 6
|
||||
if stats.get('expected') != expected_cases or any(stats.get(key) != 0 for key in ('unexpected', 'flaky', 'skipped')) or native.get('errors'):
|
||||
raise ValueError(f'Expected {expected_cases} passing browser cases with no skips, retries or errors.')
|
||||
record['browserStats'] = stats
|
||||
if sql(migration_sql).splitlines() != record['migrations'] or sources(commands) != current_sources or tree(static) != record['frontend']:
|
||||
raise ValueError('Source/runtime/migration drift during rendering.')
|
||||
@@ -335,6 +343,10 @@ def run(args):
|
||||
raise ValueError('The original CV16 + settings8 document membership is incomplete.')
|
||||
if {fixture.get('fixture') for fixture in letter.get('fixtures', [])} != {'light-en-a4', 'dark-nb-a4', 'light-nb-letter', 'dark-en-letter'}:
|
||||
raise ValueError('The independent letter4 document membership is incomplete.')
|
||||
if args.include_template_library:
|
||||
for folder, count in (('template-library', 36), ('letter-library', 18)):
|
||||
if len(json.loads((out / folder / 'measurements.json').read_text(encoding='utf-8')).get('fixtures', [])) != count:
|
||||
raise ValueError('Incomplete revised design corpus: ' + folder)
|
||||
record['exitCode'] = 0
|
||||
except Exception as error:
|
||||
record['error'] = scrub(error)
|
||||
@@ -373,6 +385,7 @@ def main():
|
||||
renderer.add_argument('--output', required=True)
|
||||
renderer.add_argument('--build-record', required=True)
|
||||
renderer.add_argument('--image', required=True)
|
||||
renderer.add_argument('--include-template-library', action='store_true', help='Also render the separate PRE-P10 revised CV and matching-letter corpora.')
|
||||
args = parser.parse_args()
|
||||
return build(args) if args.mode == 'build' else run(args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user