Commit Graph

421 Commits

Author SHA1 Message Date
2a0c797051 refactor(cache): improve file handling and introduce robust locking mechanisms
- Refactor `FileCache` methods to enhance file operation consistency and error handling.
- Integrate `LockableStorage` for improved locking with fallback to manual lock implementations.
- Replace `glob` usage with `FileSystem` module for directory operations, improving maintainability and testability.
- Optimize cache file listing, filtering, and expiration handling for better performance and reliability.
- Streamline directory and file deletion logic with additional error resilience.
2025-11-03 23:30:07 +01:00
a071bea39e refactor(view): replace DefaultContainer with Container in TemplateProcessorInitializer
- Simplify constructor dependency by substituting `DefaultContainer` with `Container`.
2025-11-03 22:56:49 +01:00
1af63ed7ec refactor(view): simplify dependency injection for template initializers
- Replace `DefaultContainer` lookups with direct constructor injection in `TemplateProcessorInitializer` and `TemplateRendererInitializer`.
- Streamline method logic by removing redundant operations and ensuring dependencies are passed explicitly.
- Enhance readability and maintainability by reducing unnecessary indirections.
2025-11-03 22:48:27 +01:00
84a5a3fa21 chore(ci): update build workflow for targeted path triggers and concurrency management
- Refine branch and path filters for efficient CI triggers.
- Add concurrency control to avoid overlapping builds.
- Improve runtime base build logic with conditional evaluation and skipping.
- Enhance image info generation with fallback handling and deployment readiness checks.
2025-11-03 22:41:06 +01:00
a93a086ee4 refactor(di): add analysis components for dependency parsing and resolution
- Introduce `CodeParser` to extract dependencies from `container->get()` calls and `return new` statements.
- Add `DependencyPathAnalyzer` for recursive analysis of dependency paths with cycle detection.
- Implement `InitializerFinder` to locate initializers based on naming conventions.
- Include `InterfaceResolver` to determine interface implementations using introspection and initializers.
- Add `NamespaceResolver` for resolving class names from use statements and namespaces.
- Introduce `ReturnTypeAnalyzer` for method and closure return type analysis.
2025-11-03 22:38:06 +01:00
703d9b04fe refactor(di): enhance InitializerDependencyAnalyzer with fallback namespace resolution and improved return type handling
- Add fallback logic to resolve classes in the same namespace from file contents.
- Simplify `getInitializerInvokeReturnType` by reducing redundancy in return type validation.
- Extend support for detecting and resolving full class names from method return statements.
- Introduce named parameter pattern matching for return type extraction.
2025-11-03 22:08:49 +01:00
d0c36b9245 refactor(di): enhance InitializerDependencyAnalyzer with fallback and initializer-based return type analysis
- Add fallback mechanism to resolve return types for closures without explicit return types.
- Introduce methods for discovering initializer classes based on naming conventions and interface analysis.
- Implement functionality to analyze the `__invoke()` method's return types, including actual return class extraction.
- Improve dependency resolution with comprehensive initializer discovery strategies.
2025-11-03 21:56:27 +01:00
ca30385f97 refactor(di): remove debug logging from dependency analyzers
- Eliminate debug logging clutter in `CyclicDependencyException` and `InitializerDependencyAnalyzer` for cleaner production code.
- Simplify and streamline logic by removing unnecessary logs and redundant error tracing.
2025-11-03 21:45:58 +01:00
f4f367bae4 refactor(di): add debug logging for dependency and cycle analysis
- Enhance `CyclicDependencyException` and `InitializerDependencyAnalyzer` with detailed debug logging for improved diagnostics.
- Add logs for cycle detection, dependency path analysis, and interface implementation resolution.
- Refine try-catch blocks and exception handling for more granular error tracing.
2025-11-03 21:30:12 +01:00
f1888b0448 refactor(di): clean up imports and improve formatting in CyclicDependencyException 2025-11-03 21:14:35 +01:00
247a046f51 feat(di, cache): add proactive initializer discovery and caching mechanics
- Introduce `InitializerDependencyAnalyzer` to support dependency analysis during cyclic exceptions.
- Add proactive initializer discovery with `InitializerCacheUpdater` for improved performance.
- Integrate discovery cache updates and error handling for seamless caching of found initializers.
- Extend `CyclicDependencyException` with `InitializerDependencyAnalyzer` for enhanced diagnostics and cycle analysis.
2025-11-03 21:08:20 +01:00
1655248de5 feat(di): implement attribute resolver system for dependency injection
- Introduce `ParameterAttributeResolverInterface` for handling attribute-based parameter resolution.
- Add `EnvAttributeResolver` to inject environment variables with type conversion.
- Add `LogChannelAttributeResolver` to inject channel-specific loggers.
- Create `ParameterAttributeResolverRegistry` to manage available resolvers.
- Update `ParameterResolver` to delegate attribute resolution to the registry.
- Add comprehensive unit tests for all attribute resolvers and registry functionality.
2025-11-03 21:00:04 +01:00
9f0dfd131a refactor(di): enhance CyclicDependencyException with full path analysis and improved messaging
- Add support for full dependency path detection in `CyclicDependencyException` to identify complex cycles.
- Extend `InitializerDependencyAnalyzer` with recursive path analysis up to a maximum depth.
- Update error messages with detailed full path and actionable resolutions for improved debugging.
- Refactor problematic dependency detection to include full path context where applicable.
2025-11-03 20:52:16 +01:00
8919da8a5c refactor(logging, queue): replace RedisQueue with FileQueue for async logging
- Update `LoggerInitializer` to use `FileQueue` instead of `RedisQueue` for async logging, improving local file-based queuing.
- Remove unused `RedisQueue` and related Redis configurations.
- Modify `createQueue` to accept `PathProvider` for file path resolution.
- Revise `AGENTS.md` to add detailed AI agent usage and updated guidelines.
- Refactor `ComponentRegistryInitializer` to use explicit dependency injection for `__invoke` method, ensuring cleaner and more maintainable initialization logic.
2025-11-03 20:09:32 +01:00
f8fb9b5a45 refactor(di): add InitializerDependencyAnalyzer for enhanced dependency analysis and messaging
- Introduce `InitializerDependencyAnalyzer` to analyze constructor and `container->get()` dependencies.
- Enhance `CyclicDependencyException` with warnings for `container->get()` usage and explicit guidance for resolving cycles.
- Improve error messaging with detailed dependency sources and actionable best practices.
2025-11-03 19:51:26 +01:00
522e76e86a refactor(di): enhance CyclicDependencyException with initializer detection and improved messaging
- Extend `CyclicDependencyException` to include detailed initializer cycle analysis.
- Refactor chain message generation with initializer-specific context.
- Add methods for problematic dependency detection and initializer dependency analysis.
- Improve error messages with clearer actionable tips for initializer-related cycles.
2025-11-03 19:02:28 +01:00
da1dee7a01 refactor(di): replace end() with array_last() 2025-11-03 18:46:06 +01:00
12e793b95f refactor(di): implement temporary variable for referencing in end() function 2025-11-03 18:36:42 +01:00
6b5aaf47a4 refactor(di): enhance CyclicDependencyException with detailed chain and cycle context
- Add full dependency chain and pre-cycle segmentation for enhanced error context.
- Improve error messages with clearer formatting, initializer-specific hints, and actionable resolutions.
- Introduce initializer cycle detection to provide targeted solutions for common scenarios.
2025-11-03 18:27:09 +01:00
2b4772a922 refactor(di, cache): improve cyclic dependency handling and enhance error logging
- Refactor `CyclicDependencyException` to streamline cycle extraction logic and variable assignments.
- Improve error message formatting with clearer structure and actionable tips.
- Add detailed stack trace logging in `CacheInitializer` when Redis fails, for better debugging.
2025-11-03 18:17:31 +01:00
0fa163276e refactor(di): improve cyclic dependency handling and error messages
- Replace `FrameworkException` with `ContainerException` in `CyclicDependencyException`
- Add detection logic for cycle start and improved message formatting
- Provide actionable resolution tips in error messages
- Enhance `ClassResolutionException` to reuse `CyclicDependencyException` messages
- Add context for available bindings when a cycle is detected
2025-11-03 18:07:50 +01:00
9cad445aaf feat(di): add proactive initializer finder for interface resolution
- Add ProactiveInitializerFinder to search for initializers when not found in registry
- Add InitializerInfo value object to store initializer metadata
- Implement multi-step search strategy: DefaultImplementation, naming convention, directory, subdirectories, module
- Integrate proactive finder into DefaultContainer for better interface resolution
- Simplify AppBootstrapper by moving initialization logic to DefaultContainer
- Improve error messages in ClassNotInstantiable with proactive finder context
2025-11-03 17:45:47 +01:00
8c264f3781 feat(di): improve initializer error handling with FailedInitializerRegistry
- Add FailedInitializerRegistry to track failed initializers
- Add FailedInitializer value object to store failure context
- Enhance exception messages with failed initializer context
- Improve ClassNotInstantiable and ClassResolutionException with detailed context
- Update InitializerProcessor to register failed initializers
2025-11-03 16:48:13 +01:00
c4a4f6de07 refactor: cleanup debug logs and add explicit exit in error handling flow
- Remove redundant `error_log` statements in `RouterSetup`
- Comment out unused route analysis and subdomain checks
- Add `exit()` after error rendering in `ErrorKernel`
2025-11-03 15:59:32 +01:00
0ca382f80b refactor: add circular dependency detection and error handling in DI container
- Introduce `InitializerCycleException` for detailed cycle reporting
- Enhance `InitializerProcessor` fallback with explicit discovery order handling and logging
- Implement proactive cycle detection in `InitializerDependencyGraph`
- Improve `ClassName` and `MethodName` with `Stringable` support
2025-11-03 15:37:40 +01:00
376fcd5fc1 refactor: improve lazy loading and logging in DI container
- Enhance lazy loading fallback with detailed logging of failures
- Simplify singleton resolution logic, removing redundancy
- Add `canAutoWire` method for cleaner class auto-wiring checks
- Optimize logging resolution in `InitializerProcessor`
- Remove unused code and redundant debug logs across DI components
2025-11-03 15:12:54 +01:00
b6bff8b19b refactor: remove unused dependencies and legacy code from ShowHome controller 2025-11-03 14:42:04 +01:00
ef4a941c8b refactor: remove unused dependencies and legacy code from ShowHome controller 2025-11-03 14:40:46 +01:00
bc7cdf5fed refactor: enhance error reporting and logging, add installer script
- Update `LogReporter` and `Reporter` interface to handle `Throwable` instead of `string`
- Simplify initializer discovery message in `ClassNotInstantiable` exceptions
- Remove unnecessary debug logs in `HttpRouter`
- Add `scripts/install-aliases.sh` for setting up console aliases
- Add minimal `console` script for Docker execution
2025-11-03 14:21:10 +01:00
1109b0f94b fix: add error handling for initializer method invocation in InitializerProcessor
- Log errors when initializer method invocation fails
- Re-throw exception after logging
2025-11-03 13:24:47 +01:00
a06a73c2f7 fix: correct method name tryFromHost in HttpRouter 2025-11-03 13:03:50 +01:00
35ce316f98 chore: update HttpRouter 2025-11-03 12:50:19 +01:00
ee06cbbbf1 chore: update console components, logging, router and add subdomain support 2025-11-03 12:44:39 +01:00
6d355c9897 refactor(logging): update context manager and log path configuration
- Replace `environment` with `type` for global context data
- Update default log directory path from `storage/logs` to `logs`
- Comment out Nginx log paths to disable by default
- Change `DockerJsonHandler` contract from `FormattableHandler` to `LogHandler`
2025-11-03 01:43:38 +01:00
d90f4386d9 Make sure port is read as int from environment 2025-11-03 01:06:36 +01:00
a60b4b6ac2 fix: Allow root to read Docker Secret files with restrictive permissions
- Remove is_readable() check when running as root
- Root can read files even with 0700 permissions
- Should fix issue where REDIS_PASSWORD file exists but is not readable (0700, owner 1000, process 0)
- Docker secrets may have restrictive permissions that root can bypass
2025-11-03 01:05:13 +01:00
4be249a57b fix: Normalize Docker Secret file paths to support both formats
- Handle paths like /redis_password and convert to /run/secrets/redis_password
- Docker Swarm may set *_FILE variables with just the secret name
- Add file permission debugging to diagnose read issues
- Should fix issue where REDIS_PASSWORD_FILE points to /redis_password instead of /run/secrets/redis_password
2025-11-03 00:57:20 +01:00
b070767d0a refactor: simplify Redis configuration initialization
- Use RedisConfig::fromEnvironment() in LoggerInitializer
- Remove fallback logic in QueueInitializer, always use connection pool
- Make RedisConfig constructor private
- Clean up Redis connection error message
2025-11-03 00:43:28 +01:00
7a2cb0b63e fix: staging deployment configuration and redis secrets handling 2025-11-03 00:15:43 +01:00
ff572534e9 ci: update deploy-staging job dependencies and conditions 2025-11-02 23:25:31 +01:00
7f3ce7f969 fix: update build workflow default branch to staging
- Change default branch from 'main' to 'staging'
- Add choice input type for branch selection
- Add debug check for RUNTIME_IMAGE_NAME
- Remove unused env variable
2025-11-02 23:12:18 +01:00
77c656af62 feat(deployment): update Semaphore stack and Traefik configuration
- Add QUICKSTART.md and SETUP_REPOSITORY.md for Semaphore stack
- Add playbooks directory for Semaphore deployment
- Update Semaphore docker-compose.yml, env.example, and README
- Add Traefik local configuration files
- Disable semaphore.yml in Traefik dynamic config
- Update docker-compose.local.yml and build-image workflow
2025-11-02 22:55:51 +01:00
0c4ff1283c fix: Add workaround for REDIS_PASSWORD_FILE not being set by Docker Compose
- Manually set REDIS_PASSWORD_FILE if file exists but variable is not set
- Handles cases where Docker Compose doesn't set the variable correctly
- Should fix issue where REDIS_PASSWORD_FILE is missing even though configured
2025-11-02 22:48:10 +01:00
73de91c2d3 debug: Add logging for all *_FILE environment variables
- Log all *_FILE variables from getenv() and $_ENV
- Help diagnose why REDIS_PASSWORD_FILE is not set
- Check if other *_FILE variables are present
2025-11-02 22:38:27 +01:00
3f7c6e79fb fix: Add explicit secrets definition to docker-compose.staging.yml
- Add secrets section at end of docker-compose.staging.yml
- Ensures secrets are properly loaded even if inherited from base file
- Should fix issue where REDIS_PASSWORD_FILE variable is not set
- Secrets are now explicitly defined: redis_password, db_user_password, app_key, vault_encryption_key, git_token
2025-11-02 22:31:46 +01:00
64400a317b debug: Add extended Docker Secrets debugging
- Check getenv(), $_ENV and $_SERVER for REDIS_PASSWORD_FILE
- Check if /run/secrets/redis_password file exists
- Help diagnose why REDIS_PASSWORD_FILE is not in environment
2025-11-02 22:25:13 +01:00
14900940c5 debug: Add Docker Secrets debugging to AppBootstrapper
- Add debug logging for REDIS_PASSWORD_FILE and REDIS_PASSWORD
- Check if REDIS_PASSWORD_FILE exists and has correct value
- Check if secret file exists and is readable
- Help diagnose why REDIS_PASSWORD_FILE is not in logs
2025-11-02 22:17:10 +01:00
bd9df7e630 fix: Don't store empty values when Docker Secret resolution fails in all()
- Update all() first pass to skip storing empty values when secret resolution fails
- Ensures second pass can still resolve secrets from *_FILE variables
- Prevents empty values from blocking secret resolution in second pass
- Should fix issue where REDIS_PASSWORD was empty even though REDIS_PASSWORD_FILE existed
2025-11-02 21:58:40 +01:00
c530fbf8f1 fix: Resolve Docker Secrets from *_FILE variables even if base variable is missing
- Update all() method to check for *_FILE variables and resolve their base variables
- Ensures APP_KEY, DB_PASSWORD, etc. are resolved even if they don't exist in the array
- Two-pass approach: first processes existing variables, second checks for *_FILE patterns
- Fixes issue where APP_KEY was empty even though APP_KEY_FILE existed
2025-11-02 21:52:04 +01:00
417b451be1 fix: Add REDIS_PASSWORD_FILE Docker Secret to staging-app service
- Add REDIS_PASSWORD_FILE=/run/secrets/redis_password to staging-app environment
- Add redis_password to staging-app secrets list
- Ensures REDIS_PASSWORD can be resolved from Docker Secret via *_FILE pattern
- Fixes issue where REDIS_PASSWORD was empty in staging-app even though secret exists
2025-11-02 21:48:01 +01:00