Refactor filename naming system and apply convention-based renames

Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-13 19:10:02 +00:00
parent fc494c1e08
commit 77b4d10af8
28155 changed files with 2191860 additions and 12967 deletions

View File

@@ -163,7 +163,7 @@ class Ajax
throw new AjaxUnauthorizedException($reason);
case 'response_form_error':
throw new AjaxFormErrorException($reason, $details);
case 'response_fatal_error':
case 'fatal':
$message = $reason;
if (!empty($details)) {
$message .= ' - ' . json_encode($details);
@@ -314,7 +314,7 @@ class Ajax
$type = $response->get_type();
// Handle fatal error - always throw exception
if ($type === 'response_fatal_error') {
if ($type === 'fatal') {
$details = $response->get_details();
$message = $response->get_reason();
if (!empty($details)) {
@@ -326,7 +326,7 @@ class Ajax
// Build error response based on type
$json_response = [
'success' => false,
'_success' => false,
'error_type' => $type,
'reason' => $response->get_reason(),
];
@@ -369,6 +369,46 @@ class Ajax
return static::$ajax_response_mode;
}
/**
* Validate Ajax endpoint return value
*
* Ensures developers don't manually add 'success' field to their responses.
* The framework automatically wraps responses with success/failure metadata.
*
* @param mixed $response The Ajax method return value
* @throws Exception If response contains manual success field
*/
protected static function _validate_ajax_response($response): void
{
// Only validate if response is an array
if (!is_array($response)) {
return;
}
// Check if response contains '_success' or 'success' key with boolean value
if ((array_key_exists('_success', $response) && is_bool($response['_success'])) ||
(array_key_exists('success', $response) && is_bool($response['success']))) {
$wrong_way = "return ['_success' => false, 'message' => 'Error'];";
$right_way_validation = "return response_form_error('Validation failed', ['email' => 'Invalid']);";
$right_way_success = "return ['user_id' => 123, 'data' => [...]];\n// Framework wraps: {_success: true, _ajax_return_value: {...}}";
$right_way_exception = "// Let exceptions bubble - framework handles them\n\$user->save(); // Don't wrap in try/catch";
throw new Exception(
"YOU'RE DOING IT WRONG: Ajax endpoints must not return arrays with '_success' or 'success' boolean key.\n\n" .
"The '_success' field is reserved for framework-level Ajax response wrapping.\n\n" .
"WRONG WAY:\n" .
" {$wrong_way}\n\n" .
"RIGHT WAY (validation errors):\n" .
" {$right_way_validation}\n\n" .
"RIGHT WAY (success):\n" .
" {$right_way_success}\n\n" .
"RIGHT WAY (exceptions):\n" .
" {$right_way_exception}\n\n" .
"See: php artisan rsx:man ajax_error_handling"
);
}
}
/**
* Format Ajax response with standard wrapper structure
*
@@ -381,8 +421,11 @@ class Ajax
*/
public static function format_ajax_response($response): array
{
// Validate response before formatting
static::_validate_ajax_response($response);
$json_response = [
'success' => true,
'_success' => true,
'_ajax_return_value' => $response,
];