From cfc27891023a2728328f155860a286aae7cb8bfc Mon Sep 17 00:00:00 2001 From: Agando Date: Sun, 18 Oct 2026 14:19:47 +0200 Subject: newOS4 course: post-exec review fixes (telemetry detail sanitize, skill-sync retry, atlas check) --- scripts/newos4-maintain.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'scripts/newos4-maintain.py') diff --git a/scripts/newos4-maintain.py b/scripts/newos4-maintain.py index 6321a3f..10ac62b 100644 --- a/scripts/newos4-maintain.py +++ b/scripts/newos4-maintain.py @@ -55,10 +55,11 @@ def check_index(): idxp = os.path.join(ROOT, 'modules-index.json') atlas = json.load(open(os.path.join(ROOT, 'course/atlas.json'))) idx = json.load(open(idxp)) - cur = len(set(c for m in idx.get('modules', {}).values() for c in m.get('commands', []))) - if cur == atlas['coverage']['commands']: - add('PASS', f'modules-index {cur} commands'); return - add('WARN', f'modules-index stale {cur} vs {atlas["coverage"]["commands"]}') + index_cmds = set(c for m in idx.get('modules', {}).values() for c in m.get('commands', [])) + missing = sorted(c for c, e in atlas.get('commands', {}).items() if not e.get('builtin') and c not in index_cmds) + if not missing: + add('PASS', f'modules-index covers {len(index_cmds)} commands'); return + add('WARN', f'modules-index missing {len(missing)}: ' + ', '.join(missing[:5])) if not FIX: return for name, m in atlas['modules'].items(): e = idx['modules'].get(name, {'name': name, 'file': m['file'], 'type': 'core' if m['tier'] == 'core-bundle' else 'ext', @@ -87,6 +88,14 @@ def check_live(): code = sh(f"curl -s -o /dev/null -w '%{{http_code}}' '{url}'") add('PASS' if code == '200' else 'FAIL', f'HTTP {code} {url.replace(WEB, "")}') +def check_atlas(): + p = os.path.join(ROOT, 'course/atlas.json') + before = (json.load(open(p)).get('coverage', {}).get('commands') if os.path.exists(p) else None) + r = run([sys.executable, 'scripts/gen-course-atlas.py'], cwd=ROOT) + after = (json.load(open(p)).get('coverage', {}).get('commands') if os.path.exists(p) else None) + add('PASS' if r.returncode == 0 else 'FAIL', + f'atlas {after} commands' + (' (refreshed from ' + str(before) + ')' if before != after else '')) + def check_course(): r = run([sys.executable, 'scripts/course-validate.py'], cwd=ROOT) add('PASS' if r.returncode == 0 else 'FAIL', 'course ' + ('valid' if r.returncode == 0 else 'INVALID: ' + r.stdout[-160:])) @@ -106,7 +115,7 @@ def check_links(): def main(): os.chdir(ROOT) - check_versions(); check_bundles(); check_syntax(); check_perms(); check_index(); check_data(); check_live(); check_course(); check_links() + check_versions(); check_bundles(); check_syntax(); check_perms(); check_index(); check_data(); check_live(); check_atlas(); check_course(); check_links() fails = [m for l, m in issues if l == 'FAIL'] print('newOS4 maintenance — ' + datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%MZ') + (' [fix]' if FIX else '') + (' [deep]' if DEEP else '')) for l, m in issues: print(f'{l}: {m}') -- cgit v1.2.3