Fix code quality violations and rename select input components
Move small tasks from wishlist to todo, update npm packages Replace #[Auth] attributes with manual auth checks and code quality rule Remove on_jqhtml_ready lifecycle method from framework Complete ACL system with 100-based role indexing and /dev/acl tester WIP: ACL system implementation with debug instrumentation Convert rsx:check JS linting to RPC socket server Clean up docs and fix $id→$sid in man pages, remove SSR/FPC feature Reorganize wishlists: priority order, mark sublayouts complete, add email Update model_fetch docs: mark MVP complete, fix enum docs, reorganize Comprehensive documentation overhaul: clarity, compression, and critical rules Convert Contacts/Projects CRUD to Model.fetch() and add fetch_or_null() Add JS ORM relationship lazy-loading and fetch array handling Add JS ORM relationship fetching and CRUD documentation Fix ORM hydration and add IDE resolution for Base_* model stubs Rename Json_Tree_Component to JS_Tree_Debug_Component and move to framework Enhance JS ORM infrastructure and add Json_Tree class name badges 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,48 @@ class InstanceMethods_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
|
||||
// Check JavaScript classes
|
||||
$this->check_javascript_classes($files);
|
||||
|
||||
// Check JS model monoprogenic enforcement
|
||||
$this->check_js_model_monoprogenic($files);
|
||||
}
|
||||
|
||||
/**
|
||||
* HACK #3 - JS Model Monoprogenic Enforcement
|
||||
*
|
||||
* Ensures that JS model classes cannot be extended. Only Base_ stubs can be extended,
|
||||
* not the PHP model class names directly. This prevents broken inheritance chains.
|
||||
*
|
||||
* Monoprogenic = can only produce one level of offspring
|
||||
*/
|
||||
private function check_js_model_monoprogenic(array $files): void
|
||||
{
|
||||
foreach ($files as $file => $metadata) {
|
||||
// Skip if not a JavaScript class
|
||||
if (!isset($metadata['class']) || ($metadata['extension'] ?? '') !== 'js') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if no parent class
|
||||
$parent_class = $metadata['extends'] ?? null;
|
||||
if (!$parent_class) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if parent is a PHP model class name (not Base_)
|
||||
if (\App\RSpade\Core\Manifest\Manifest::is_php_model_class($parent_class)) {
|
||||
$this->add_violation(
|
||||
$file,
|
||||
1,
|
||||
"Class '{$metadata['class']}' extends PHP model '{$parent_class}' directly. " .
|
||||
"JS model classes are monoprogenic - they cannot be extended further.",
|
||||
"extends {$parent_class}",
|
||||
"JavaScript model classes must extend the Base_ stub instead:\n" .
|
||||
" - Change: class {$metadata['class']} extends Base_{$parent_class}\n" .
|
||||
" - The Base_ stub is auto-generated and properly inherits from Rsx_Js_Model",
|
||||
'critical'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,6 +305,17 @@ class InstanceMethods_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
*/
|
||||
private function is_js_class_instantiatable(string $class_name, array $files): bool
|
||||
{
|
||||
// HACK #2 - JS Model instantiatable bypass: If this is a PHP model class name or
|
||||
// a Base_ stub for a PHP model, it's automatically instantiatable because model
|
||||
// stubs are generated with @Instantiatable during bundle compilation.
|
||||
$model_check_name = $class_name;
|
||||
if (str_starts_with($class_name, 'Base_')) {
|
||||
$model_check_name = substr($class_name, 5); // Remove "Base_" prefix
|
||||
}
|
||||
if (\App\RSpade\Core\Manifest\Manifest::is_php_model_class($model_check_name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Find the class metadata
|
||||
$class_metadata = null;
|
||||
foreach ($files as $file => $metadata) {
|
||||
|
||||
Reference in New Issue
Block a user