Update beads metadata

Fix Form_Utils bugs and unify error handling documentation
Protect framework files from auto-modification when not in developer mode

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-03 22:44:48 +00:00
parent 8d92b287be
commit 45cf44edeb
355 changed files with 82 additions and 71 deletions

View File

@@ -93,28 +93,15 @@ class Frontend_Clients_Edit {
## 2025-11-20: Unified Ajax Error Response System
**Component**: Ajax error handling
**Impact**: Medium - Existing error handling code continues to work, but new pattern recommended
**Impact**: Documentation clarification - unified pattern is the only implemented pattern
### Change
Replaced fragmented error response helpers (`response_form_error()`, `response_auth_required()`, etc.) with unified `response_error()` function using constants for error codes. Same constant names on server and client for zero mental translation.
Adopted unified `response_error()` function with error code constants. Same constant names on server and client for zero mental translation.
### Previous Pattern
**Note**: The fragmented helper functions (`response_form_error()`, `response_auth_required()`, etc.) shown in earlier documentation were a planned design that was superseded before implementation. Only `response_error()` exists.
```php
// Server - different functions for each error type
return response_form_error('Validation failed', ['email' => 'Invalid']);
return response_not_found('Project not found');
return response_unauthorized('Permission denied');
```
```javascript
// Client - string matching with different names
if (error.type === 'form_error') { ... }
if (error.type === 'not_found') { ... }
```
### New Pattern
### Pattern
```php
// Server - single function with constants
@@ -129,13 +116,9 @@ if (e.code === Ajax.ERROR_VALIDATION) { ... }
if (e.code === Ajax.ERROR_NOT_FOUND) { ... }
```
### Migration Steps
### Documentation
1. **Update server-side error responses** to use `response_error()` with constants
2. **Update client-side error checks** to use `e.code === Ajax.ERROR_*` instead of `e.type === 'string'`
3. **Read updated documentation**: `php artisan rsx:man ajax_error_handling`
Old helpers still work but are deprecated. Framework code being updated to new pattern.
See `php artisan rsx:man ajax_error_handling` for complete usage.
### Benefits