Files
jobtrackingapp/docs/redesign/phase-9/reconcile.py
T

89 lines
7.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Build final ledgers from accepted portable cases; never upgrade preservation gaps."""
import json
import re
from pathlib import Path
HERE = Path(__file__).resolve().parent
def read(name):
return json.loads((HERE / name).read_text(encoding='utf-8'))
def cell(value):
return str(value).replace('|', '/').replace('\n', ' ')
def main():
inventory = read('p9-00/inventory.json')
groups = inventory['preservation']
assert len(groups) == len({row['id'] for row in groups}) == 57
# Later reconciliation supersedes historic Phase2 gaps, without rewriting them.
p7 = (HERE.parent / 'phase-7/PRESERVATION.md').read_text(encoding='utf-8')
remaining = {}
for line in p7.splitlines():
if line.startswith('| **PRES-'):
cols = [part.strip() for part in line.strip('|').split('|')]
remaining[re.search(r'PRES-[A-Z]\d{2}', cols[0]).group()] = cols[3]
assert set(remaining) == {row['id'] for row in groups}
cases = read('p9-01/ordinary-cases.json')
diagnostics = read('p9-05/phase9-cases.json')
assert len(cases) == 362 and len(diagnostics) == 18
assert all(row['status'] == 'expected' and len(row['results']) == 1 and row['results'][0]['status'] == 'passed' for row in cases + diagnostics)
validation = read('validation.json')['lanes']
for lane in ['ordinary', 'phase9', 'ai', 'auth', 'rate', 'ingress', 'pdf', 'preferences']:
record = validation[lane]
assert not record['fileFailures'] and not record['retries']
assert record['stats']['unexpected'] == record['stats']['flaky'] == record['stats']['skipped'] == 0
assert record['stats']['expected'] == record['cases']
assert sum(validation[lane]['cases'] for lane in ['ai', 'auth', 'rate', 'ingress', 'pdf', 'preferences']) == 23
assert validation['backend']['passed'] == '1084' and validation['backend']['failed'] == '0'
assert validation['frontend']['success'] and validation['frontend']['numPassedTests'] == 919
assert validation['frontend']['numFailedTests'] == validation['frontend']['numPendingTests'] == 0
assert validation['sidecar']['tests'] == '56' and validation['sidecar']['failures'] == validation['sidecar']['errors'] == '0'
for lane in ['ordinary-accepted', 'phase9-frozen', 'ai', 'auth', 'rate', 'ingress', 'pdf', 'preferences', 'backend', 'frontend', 'sidecar', 'build']:
assert validation[lane + 'Process']['exitCode'] == 0
rows = read('p9-02/route-results.json')
assert len(rows) == 396 and {row['pattern'] for row in rows} == set(inventory['routes'])
header = '# Phase 9 preservation reconciliation\n\nAll57 groups retain **56 PARTIAL / C11 DEFERRED**. Zero groups are promoted to PASS. These statuses retain mandatory human/provider/output obligations and are not57 defect findings. Phase9 adds finite executed evidence and two bounded UI fixes; it does not erase previous acceptance records. [Phase7](../phase-7/PRESERVATION.md) supplies the later residual obligations, superseding stale Phase2 gap descriptions (notably repaired P2-D01 and CV revision safety).\n\n'
header += 'Exact executed browser cases are in [ordinary-cases](p9-01/ordinary-cases.json); complete backend case results and frontend suite totals are linked from [validation](validation.json). The matches below use explicit IDs in test titles only; zero explicit matches means no direct title mapping, not absent unit/API coverage. A case may cover several groups; do not sum counts as independent tests.\n\n'
lines = [header, '| Group / owners | Entry → Phase9 | Direct native title matches | Current residual / closure |', '|---|---|---|---|']
portable = []
for group in groups:
identifier = group['id']
matches = [dict(file=c['file'], title=c['title']) for c in cases if identifier in c['title']]
residual = re.sub(r'\[([^]]+)\]\([^)]+\)', r'\1', remaining[identifier])
delta = 'Finite full regression retained; human/provider/output qualifications remain.'
if identifier in ['PRES-C01', 'PRES-W02', 'PRES-J06']:
delta += ' RD21 stale-write safety FAIL; see separate contract issue.'
if identifier == 'PRES-C11':
delta = 'P5-13 remains withheld; real model/semantic qualification not executed.'
if identifier == 'PRES-E01':
delta += ' P9-V01 wrapped heading fix and16-vector native geometry proof.'
if identifier in ['PRES-A01', 'PRES-E08']:
delta += ' P9-L01 installed vendor locale and2new Jest cases.'
if identifier == 'PRES-S02':
delta += ' Phase8 account-layout order/size/visibility/reset/conflict behaviour preserved.'
lines.append(f"| {identifier}: {cell(group['owners'])} | {group['entryStatus']} → {group['entryStatus']} | {len(matches)} | {cell(delta)} {cell(residual)} |")
portable.append(dict(id=identifier, capability=group['capability'], owners=group['owners'], entry=group['entryStatus'], phase9=group['entryStatus'], evidence=matches, remaining=residual, delta=delta))
assert sum(row['phase9'] == 'PARTIAL' for row in portable) == 56
assert sum(row['phase9'] == 'DEFERRED' for row in portable) == 1
(HERE / 'PRESERVATION.md').write_text('\n'.join(lines) + '\n', encoding='utf-8')
(HERE / 'preservation.json').write_text(json.dumps(portable, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
lines = ['# Final route/workflow QA matrix', '', 'All33 concrete patterns are retained. Each has12 native samples:320/768/1440px × EN/NB × light/dark, with actual applied theme/locale, heading, expected owned read states where applicable and root-overflow assertions. The correspondence review alias deliberately expects409 for unavailable mailbox configuration. Public invalid-token/unpublished states are deliberately identified; they do not prove successful external delivery/publication. Screenshots were inspected within the scope in [visual report](p9-02/README.md).', '', 'Route presence/DOM PASS is separate from workflow acceptance PARTIAL. Consult [ordinary executed cases](p9-01/ordinary-cases.json) and per-group [preservation](PRESERVATION.md) for connected mutation/failure journeys; route screenshots alone are not end-to-end capability proof.', '', '| Route → workflow owners | Feature contracts | Executed route evidence | Known risks / acceptance |', '|---|---|---|---|']
for route, owners in inventory['routes'].items():
samples = [r for r in rows if r['pattern'] == route]
assert len(samples) == 12
assert all(r['scrollWidth'] <= r['viewport'] + 1 and r['effectiveTheme'] == r['theme'] for r in samples)
related = [g['id'] for g in groups if route != '/' and route in g['entry'] or route == '/' and '`/`' in g['entry']]
extra = 'RD06/07 human/device; relevant provider/output gates; PARTIAL workflow qualification'
if route in ['/career', '/jobs/:id', '/applications/:id', '/jobs']:
extra += '; RD21 unsafe concurrent saves FAIL'
lines.append(f"| `{route}` → {cell(', '.join(owners))} | {', '.join(related) or 'Shared shell/nearest contracts; no invented group'} |12/12 applied-state/overflow samples; [rows](p9-02/route-results.json) | {extra} |")
(HERE / 'QA_MATRIX.md').write_text('\n'.join(lines) + '\n', encoding='utf-8')
print('Reconciled33 routes and57 unchanged preservation dispositions')
if __name__ == '__main__':
main()