'string'] && $entries['recharge.methods.select']['parameters'] === ['amount' => 'string'] && $entries['invite.link.help']['parameters'] === ['days' => 'integer'], 'Account/commerce placeholder contracts drifted from their call sites.'); $paths = [ $root . '/resources/views/venix/user/edit.tpl', $root . '/resources/views/venix/user/disable.tpl', $root . '/resources/views/venix/user/paytaro.tpl', $root . '/resources/views/venix/user/pay_success.tpl', $root . '/resources/views/venix/user/invite.tpl', $root . '/public/theme/venix/js/user-home.js', $root . '/public/theme/venix/js/recharge.js', ]; $violations = UserCopyCoverageScanner::scanFiles($paths); $assert($violations === [], 'Account/commerce pages retain direct user-visible copy: ' . json_encode($violations, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); $referenced = []; foreach ($paths as $path) { $source = (string) file_get_contents($path); preg_match_all( '/(?:user_copy\s+key=|\bt\()[\'\"]((?:account|recharge|invite)\.[a-z0-9_.]+)[\'\"]/', $source, $matches ); array_push($referenced, ...$matches[1]); } foreach (array_unique($referenced) as $key) { $assert(isset($entries[$key]), 'Account/commerce source references an undeclared key: ' . $key); } $homeModule = (string) file_get_contents( $root . '/public/theme/venix/js/user-home.js' ); $rechargeModule = (string) file_get_contents( $root . '/public/theme/venix/js/recharge.js' ); $assert(!preg_match('/data\.(?:msg|errmsg)|error\.message/', $homeModule . "\n" . $rechargeModule) && !preg_match('/payload\?\.(?:detail|message|msg|error)/', $homeModule . "\n" . $rechargeModule), 'Account/commerce feedback must not expose raw backend messages.'); $assert(str_contains($homeModule, 'responseMessage(data, "account.email.updated", "account.email.update_failed")') && str_contains($homeModule, 'responseMessage(data, "invite.withdraw.submitted", "invite.withdraw.failed")') && str_contains($rechargeModule, '? "recharge.payment.expired" : "recharge.payment.failed"'), 'Account mutations and payment states must resolve through stable copy keys.'); foreach ([ 'WALLET', 'REFERRAL LINK', '>Payment<', '>Order Status<', ] as $targetTranslation) { $templates = implode("\n", array_map( static fn (string $path): string => (string) file_get_contents($path), array_slice($paths, 0, 5) )); $assert(!str_contains($templates, $targetTranslation), 'Target-locale copy must not remain in source templates: ' . $targetTranslation); } echo "Account, recharge and invite user-copy contracts passed.\n";