HSLG Media

check_build_worker.py

check_build_worker.py

Source file: tools/governance/check_build_worker.py

Module: tools-governance

Size: 77 lines

SHA-256: 46c8e804fc2ac6e18deb6f4adbb2522a37364fbfb15bfe7761d1d612aff6c2f8

Responsibility

Verifies dependency, documentation, source and release boundaries without suppressing failures.

Declared entry points

  • require — source line 12.

Imports and dependencies

  • Line 7: import hashlib,json,subprocess,sys,zipfile
  • Line 23: require(m['schema']==1,'Bad native manifest schema')
  • Line 24: require(m['android_min_sdk']==26,'Android barcode scanner requires minSdk 26')
  • Line 25: require(m['app_id']=='uk.hslg.app','Wrong native app ID')
  • Line 26: require(hashlib.sha256(payload.read_bytes()).hexdigest()==m['payload_sha256'],'Bundled native payload hash mismatch')
  • Line 27: require(payload.read_bytes().startswith(b'<?php if (!defined("ABSPATH"))'),'Native source is not protected against direct PHP HTTP access')
  • Line 30: require(z.testzip() is None,'Bundled mobile source corrupted')
  • Line 32: require(file in names,'Native source missing '+file)
  • Line 40: require('import { CapacitorBarcodeScanner,' in adapter_text and 'CapacitorBarcodeScanner.scanBarcode(' in adapter_text,
  • Line 42: require('import { BarcodeScanner,' not in adapter_text, 'Unsupported Capacitor scanner import reintroduced')
  • Line 47: require(forbidden not in code,'WordPress must not expose shell or destructive writes: '+forbidden)
  • Line 49: require(required in code,'Missing WordPress request guard '+required)
  • Line 53: require(required in code,'Missing restricted worker operation '+required)
  • Line 57: require(required in code,'Restricted PHP CLI fallback guard missing: '+required)
  • Line 60: require('crontab -' in code and '[ "$(id -un)" = media ]' in code,'Rootless worker bootstrap unverified')
  • Line 62: require(r.returncode==0,'Worker bootstrap shell syntax failed: '+r.stderr)

Behaviour and audit locations

  • Line 37: scanner_adapter=ROOT/'apps/mobile/native-adapters/CapacitorDeviceServices.ts'
  • Line 40: require('import { CapacitorBarcodeScanner,' in adapter_text and 'CapacitorBarcodeScanner.scanBarcode(' in adapter_text,
  • Line 41: 'Capacitor scanner 3.1.3 uses the CapacitorBarcodeScanner export, NOT BarcodeScanner')
  • Line 42: require('import { BarcodeScanner,' not in adapter_text, 'Unsupported Capacitor scanner import reintroduced')
  • Line 43: else: errors.append('Missing native Capacitor barcode adapter')

Relationship to the system

This page is the file-level source reference, not the architecture rationale. Read the module explanation, the corresponding architecture decision and user guide before changing behaviour. Names and line locations above are extracted from this exact source version; they are reference points, not proof that an external service or a phone feature works.

Change verification

Review the entry points and errors in this file, then run the module’s associated tests, source dependency gate, history gate and documentation coverage check. If the file changes an API response, user interaction, data model, deployment or third-party dependency, revise those human explanations and disaster recovery/licensing when relevant. Do not infer actual native or external API operation from source presence.