Some checks failed
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Security Audit (push) Has been cancelled
CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
CI/CD Pipeline / Build Docker Image (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Cleanup (push) Has been cancelled
7.1 KiB
7.1 KiB
Foundation Dependency Analysis - COMPLETE MAPPING
CIRCULAR DEPENDENCIES IDENTIFIED
1. CORE CIRCULAR DEPENDENCY CHAIN
tools → core-lib → components → tools
Details:
tools/Cargo.tomldepends oncore-libfor shared functionalitycore-lib/build.rsusestools::build::PathResolverand comprehensive analysiscomponents/build.rsusestools::comprehensive_analysis::generate_components_documentationtoolsprovides build-time analysis thatcore-libandcomponentsconsume
2. BUILD-TIME CIRCULAR DEPENDENCY CHAIN
server → tools → shared → server
pages → tools → shared → pages
Details:
server/build.rsusestools::build::PathResolverandtools::comprehensive_analysis::generate_server_documentationpages/build.rsusestools::build::run_pages_scaffoldingand comprehensive analysistoolsdepends onsharedfor types and utilitiessharedmay reference server/pages components through generated code
3. CLIENT BUILD DEPENDENCY ISSUES
client/build.rs → external tools (pnpm, node) → CSS generation → client
Details:
- Client build runs
pnpm run buildfor CSS processing - CSS processing depends on UnoCSS config and package.json
- Generated CSS affects client compilation
- Creates external dependency cycle through Node.js toolchain
ALL BUILDERS IDENTIFIED AND ANALYSIS
1. client/build.rs - CSS BUILD COORDINATOR
fn coordinate_css_build(output_path: &Path, source_paths: &[PathBuf]) -> Result<bool, String>
fn run_direct_css_build()
Purpose:
- Manages CSS compilation via UnoCSS/Tailwind
- Coordinates pnpm install and build processes
- Handles freshness checking for CSS files
- Problem: External dependency on Node.js toolchain breaks isolation
2. pages/build.rs - PAGE SCAFFOLDING GENERATOR
build_page_generator::generate_page_components()
tools::build::run_pages_scaffolding()
tools::comprehensive_analysis::generate_pages_documentation()
Purpose:
- Generates page component implementations
- Creates scaffolding for new pages
- Generates page documentation
- Problem: Depends on tools crate, creates circular dependency
3. components/build.rs - COMPONENT DOCUMENTATION GENERATOR
fn generate_documentation_with_cache() -> Result<bool, Box<dyn std::error::Error>>
fn try_use_smart_cache() -> Result<bool, Box<dyn std::error::Error>>
Purpose:
- Generates comprehensive component documentation
- Implements smart caching system (L1/L2/L3 cache)
- Tracks component dependencies for cache invalidation
- Problem: Heavy dependency on tools crate for caching and analysis
4. server/build.rs - SERVER ROUTE DOCUMENTATION
fn generate_server_documentation() -> Result<(), Box<dyn std::error::Error>>
Purpose:
- Analyzes server-side API routes
- Generates route documentation and TOML configuration
- Documents route definitions and handlers
- Problem: Uses tools::build::PathResolver and comprehensive analysis
5. core-lib/build.rs - DISABLED CODE GENERATION
// PHASE 3.4: Code generation has been completely disabled in favor of
// pure trait-based runtime resolution. This build script now only
// provides configuration checks.
Purpose:
- Previously generated shared resources
- Now disabled in favor of trait-based resolution
- Only provides configuration checks
- Status: Correctly PAP compliant, no builders used
ENVIRONMENT VARIABLE DEPENDENCIES
Client Build Environment Variables:
SKIP_CSS_BUILD- Skip CSS compilationCARGO_MANIFEST_DIR- Build context- External:
pnpm,nodeexecutables required
Pages Build Environment Variables:
SKIP_SCAFFOLDING_BUILD- Skip page scaffoldingSKIP_DOCS_BUILD- Skip documentation generationSITE_INFO_PATH- Documentation output pathTARGET- Compilation target
Components Build Environment Variables:
SKIP_DOCS_BUILD- Skip documentation generationSITE_INFO_PATH- Documentation output pathCARGO_MANIFEST_DIR- Build contextFORCE_REBUILD_CACHE- Force cache invalidationSITE_DEVTOOLS_PATH- Cache directory path
Server Build Environment Variables:
SITE_INFO_PATH- Documentation output pathCARGO_MANIFEST_DIR- Build context
Shared/Core Environment Variables:
SKIP_SHARED_RESOURCES_BUILD- Skip resource generation
CODE GENERATION POINTS
1. Active Code Generation:
client/build.rs→ CSS files (public/website.css)pages/build.rs→ Page components and documentationcomponents/build.rs→ Component documentation with cachingserver/build.rs→ Route documentation and TOML configs
2. Disabled Code Generation:
core-lib/build.rs→ Completely disabled (PAP compliant)
3. Generated Output Locations:
public/website.css- Generated by client buildtarget/site_build/info/- Generated documentation- Page component files - Generated by pages build
- Route configuration files - Generated by server build
ROOT CAUSE ANALYSIS
1. Tools Crate as Central Dependency Hub
The tools crate has become a central dependency that creates circular references:
- Provides build-time utilities that all other crates need
- Contains comprehensive analysis functionality
- Implements smart caching system
- Solution: Break tools into smaller, focused trait-based crates
2. Build-time vs Runtime Confusion
Current architecture mixes build-time and runtime concerns:
- Build scripts generate code that affects runtime behavior
- Runtime traits depend on build-time generated content
- Solution: Pure runtime resolution without build-time generation
3. External Toolchain Dependencies
Client build depends on external Node.js toolchain:
- Breaks Rust-only compilation model
- Creates unpredictable build environment requirements
- Solution: Rust-only CSS processing or optional external dependency
4. Environment Variable Proliferation
Multiple environment variables control build behavior:
- Creates configuration complexity
- Breaks declarative configuration model
- Solution: Single configuration source (TOML files)
PROPOSED RESOLUTION STRATEGY
Phase 1: Break Circular Dependencies
- Extract tools functionality into zero-dependency trait crates
- Implement trait-based dependency injection for build concerns
- Remove cross-crate build script dependencies
Phase 2: Eliminate Build-time Generation
- Replace generated code with runtime configuration loading
- Move from build.rs to runtime initialization
- Use TOML configuration files instead of generated Rust code
Phase 3: Unify Client/SSR Architecture
- Create unified components that work in both environments
- Implement safe reactive patterns without reactive_graph panics
- Handle hydration mismatches at the framework level
Phase 4: Pure Configuration-Driven Design
- Replace all environment variables with TOML configuration
- Implement configuration discovery and validation
- Remove hardcoded paths and values
This analysis reveals the core architectural problems that prevent true PAP compliance and unified Client/SSR components.