Skip to content

Conversation

@kastov
Copy link
Collaborator

@kastov kastov commented Nov 7, 2025

No description provided.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This release (v2.2.3) includes dependency updates, documentation URL changes, enhanced logging, and a critical fix for Xray policy configuration handling.

Key Changes:

  • Policy Configuration Fix: Refactored generateApiConfig to preserve user-provided policy settings while enforcing required stats tracking fields (statsUserUplink, statsUserDownlink, statsUserOnline). Previously, the function was completely overwriting user policy config with defaults.
  • Documentation Updates: Updated all documentation links from remna.st to docs.rw across README, error messages, and startup messages
  • Enhanced Logging: Added log messages to improve observability during module destruction, Xray stop requests, and internal service cleanup
  • Dependency Updates: Updated @nestjs/common, @nestjs/core, @nestjs/platform-express, and various dev dependencies to latest versions
  • Build Configuration: Removed ARM64 platform support from dev workflow, now building only for linux/amd64
  • Logger Adjustment: Changed error log to warning in stats.service.ts for outbound stats retrieval failures

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • All changes are well-structured and purposeful. The policy configuration refactoring properly preserves user settings while enforcing required fields using the spread operator. Documentation updates are consistent across all locations. Logging enhancements improve observability without affecting functionality. Dependency updates are minor version bumps within the same major version.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
package.json 5/5 Version bump to 2.2.3 and dependency updates for NestJS packages
.github/workflows/build-dev.yml 5/5 Removed ARM64 platform support, now building only for linux/amd64
libs/contract/constants/xray/stats.ts 5/5 Added statsUserOnline: false to default policy model level 0
src/common/utils/interfaces/xray-config-policy.interfaces.ts 5/5 New interface file defining policy configuration types for Xray
src/common/utils/generate-api-config.ts 5/5 Refactored to preserve user policy config while enforcing required stats settings

Sequence Diagram

sequenceDiagram
    participant User as Remnawave Panel
    participant Controller as XrayController
    participant Service as XrayService
    participant Internal as InternalService
    participant Config as generateApiConfig
    participant Xray as Xray Core

    Note over User,Xray: Xray Configuration & Start Flow
    
    User->>Controller: POST /start (config + hashPayload)
    Controller->>Service: startXray(body, ip, hashPayload, forceRestart)
    Service->>Internal: isNeedRestartCore(hashPayload)
    alt Config Changed or Force Restart
        Service->>Config: generateApiConfig(config)
        Note over Config: Preserves user policy settings<br/>Enforces required stats tracking<br/>(statsUserUplink, statsUserDownlink, statsUserOnline)
        Config-->>Service: Enhanced config with policy
        Service->>Xray: Start Xray Core with new config
        Service->>Internal: extractUsersFromConfig(hashPayload, config)
        Internal-->>Service: Users extracted
    else Config Unchanged
        Service-->>Controller: No restart needed
    end
    Controller-->>User: StartXrayResponse

    Note over User,Xray: Xray Stop Flow
    
    User->>Controller: GET /stop
    Note over Controller: Logs "Remnawave requested to stop Xray"
    Controller->>Service: stopXray()
    Service->>Xray: Kill Xray processes
    Service->>Internal: cleanup()
    Note over Internal: Logs "Cleaning up internal service"
    Internal-->>Service: Cleanup complete
    Controller-->>User: StopXrayResponse

    Note over Service,Xray: Module Destroy Lifecycle
    
    Note over Service: onModuleDestroy triggered
    Note over Service: Logs "Destroying module"
    Service->>Xray: killAllXrayProcesses()
Loading

13 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@kastov kastov merged commit 0934329 into main Nov 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants