Repository navigation
Add security, recovery, operations, and bundle budget features - #70
Merged
BigDella merged 1 commit intoSep 26, 2026
Conversation
Implements comprehensive operational and security improvements: - Role-based access control system with viewer, maintainer, and service roles - Server-side permission enforcement for privileged operations - Disaster recovery validation with read-only invariant checks - Operational health dashboard for monitoring system status - Per-feature bundle size budget enforcement in CI All features include automated tests and comprehensive documentation.
|
@Georgechisom Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements four critical operational and security improvements for Utix, establishing foundations for production readiness and maintainer workflows.
Changes
Role-Based Access Control
Implements a permission system for privileged operations with three roles: viewer, maintainer, and service. All permission checks are enforced server-side and cannot be bypassed through UI manipulation.
Files:
core/auth/types.tsRole and permission type definitionscore/auth/middleware.tsServer-side authorization middlewarecore/auth/__tests__/permissions.test.tsComprehensive permission testsdocs/RBAC.mdComplete RBAC documentationKey Features:
Centralized permission definitions
Server-side enforcement for all privileged actions
Higher-order function wrappers for route protection
Full test coverage for all role-permission combinations
Disaster Recovery Validation
Provides read-only validation checks to verify data integrity after restore or migration operations. Validates core domain invariants including registry consistency and network configuration.
Files:
core/recovery/types.tsInvariant violation type definitionscore/recovery/validator.tsValidation engine and checkscore/recovery/__tests__/validator.test.tsValidator test suitescripts/validate-recovery.mjsCLI command for recovery validationdocs/DISASTER_RECOVERY.mdRecovery validation guideKey Features:
Detects missing, orphaned, duplicate, and inconsistent records
Read-only by design
Human-readable and JSON output formats
Actionable failure reporting with escalation guidance
Operational Health Dashboard
Aggregates system health indicators, unresolved exceptions, and stale records into a maintainer dashboard for operational monitoring.
Files:
core/health/types.tsHealth monitoring type definitionscore/health/monitor.tsHealth check engine and reportingcore/health/__tests__/monitor.test.tsHealth monitor test suitescripts/health-check.mjsCLI command for health checksdocs/OPERATIONAL_HEALTH.mdHealth dashboard documentationKey Features:
Monitors feature registry, network connectivity, and environment config
Tracks unresolved exceptions with full context
Identifies stale records by age threshold
Human and machine-readable output formats
Bundle Size Budget Enforcement
Enforces per-feature-slice bundle size budgets in CI to prevent dependency bloat. Each lazy-loaded feature has its own budget, preventing one heavy tool from hiding behind another.
Files:
scripts/bundle-budget.mjsBundle analysis and budget enforcementbundle-baseline.jsonBaseline bundle sizes for regression tracking__tests__/bundle-budget.test.tsBundle budget configuration testsdocs/BUNDLE_BUDGET.mdBundle budget documentationKey Features:
Per-feature budgets with configurable limits
Baseline tracking for regression detection
Excludes shared core code from feature attribution
Fails CI on budget violations
Testing
All new features include comprehensive test coverage:
Permission system: All role-permission combinations tested
Recovery validation: All checks executable and produce valid output
Health monitoring: All indicators check properly
Bundle budgets: Configuration and baseline validation
Run tests with:
npm run testDocumentation
Complete documentation added for all features:
docs/RBAC.mdRole and permission referencedocs/DISASTER_RECOVERY.mdRecovery validation guidedocs/OPERATIONAL_HEALTH.mdHealth monitoring guidedocs/BUNDLE_BUDGET.mdBundle budget enforcement guideMain README updated with new commands and operations section.
CI Integration
GitHub Actions workflow updated to run:
Bundle budget checks after build
Disaster recovery validation
Operational health checks
These checks provide early detection of issues before deployment.
Commands
New npm scripts:
Migration Notes
No breaking changes. All features are additive.
The default user role is viewer, maintaining current behavior. Set
UTIX_USER_ROLEenvironment variable to enable elevated permissions for maintainers.Bundle baseline is included with initial values. Update with
npm run build && node scripts/bundle-budget.mjs --update-baselinewhen making intentional bundle size changes.Design Decisions
RBAC Scope: Focused on operational workflows rather than user data access since Utix is read-only by design. Permissions target maintainer tools and admin dashboards.
Recovery Validation: Read-only checks that never modify data. Designed for post-restore verification, not automatic repair.
Health Dashboard: Aggregates multiple health dimensions into single report. Designed for both human review and monitoring system integration.
Bundle Budgets: Per-feature approach aligns with lazy-loaded architecture. Default 150KB budget allows typical implementations while preventing bloat.
Future Work
Extend RBAC when user-facing features require authorization
Add domain-specific recovery checks as data model evolves
Integrate health metrics with external monitoring systems
Refine bundle budgets based on real-world usage patterns
Closes #47
Closes #62
Closes #60
Closes #28