Skip to content

Commands: Fix xray api adrules c1.json c2.json - #7276

Merged
RPRX merged 3 commits into
XTLS:mainfrom
Eljees:n/fix-api-add-rules-multiple-configs
Oct 28, 2026
Merged

RPRX merged 3 commits into
XTLS:mainfrom
Eljees:n/fix-api-add-rules-multiple-configs

Conversation

@Eljees

@Eljees Eljees commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

The documented xray api adrules c1.json c2.json command sends a replacement for each file by default. Both RPCs succeed, but only the rules from c2.json remain.

Apply the requested append mode to the first file, then append subsequent files in argument order. This preserves the existing single-file and --append behavior.

Local validation of the current head (d0ad893):

  • Three regression scenarios pass through the real RoutingService and router: replacement with two files, append with two files, and replacement with one file. The harness is retained locally and is not included in the current diff. The two-file replacement fails on the original implementation.
  • The built CLI passes the same three scenarios; native Windows build and repository format check pass.
  • go vet ./main/commands/... ./app/router/... reports one existing discarded-cancellation diagnostic in app/router/command/command.go:101, also reproduced on unchanged main.

The original submitted fix also passed the affected package suites on Windows and with -race on Linux (60 leaf tests each); the subsequent edits remove the test file and add a comment, with executable logic unchanged.

AI-assisted implementation and local tests with OpenAI Codex; the production change and regression evidence were independently reviewed before submission.

@Fangliding Fangliding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

旧行为的确不符合直觉

@RPRX RPRX changed the title Preserve rules from all api adrules config files Commands: Fix xray api adrules c1.json c2.json Oct 28, 2026
@RPRX
RPRX merged commit 9948aef into XTLS:main Oct 28, 2026
40 checks passed
RPRX pushed a commit that referenced this pull request Oct 28, 2026
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.

3 participants