Skip to content

test(hosts): use a valid FinalMask noise fixture - #889

Merged
ImMohammad20000 merged 1 commit into
PasarGuard:devfrom
Rerowros:codex/finalmask-noise-compat
Sep 12, 2026
Merged

ImMohammad20000 merged 1 commit into
PasarGuard:devfrom
Rerowros:codex/finalmask-noise-compat

Conversation

@Rerowros

@Rerowros Rerowros commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Problem

tests/api/test_host.py::test_host_finalmask_new_types used type: "rand" for a FinalMask noise item. Clean origin/dev rejects that fixture with a Pydantic string_pattern_mismatch, so the same baseline test fails independently of the feature changes in #758 and #879.

Xray treats FinalMask noise type as the packet encoding (array, str, hex, or base64). Random padding is configured through the separate rand field, and the documented contract says packet and rand conflict:

Change

Use a valid array packet in the existing API fixture and verify its POST/GET serialization. The assertion also confirms that the serialized item does not acquire a random-padding value or the Freedom-only apply_to field.

This is a test-only compatibility correction. The production FinalMaskNoiseItem model on origin/dev already matches Xray's accepted type values, so no application code or dependencies change.

Validation

  • python -m pytest -q --tb=short tests/api/test_host.py::test_host_finalmask_new_types — 1 passed
  • direct FinalMaskNoiseItem validation — valid array packet accepted; prior type: "rand" fixture rejected with string_pattern_mismatch
  • python -m ruff check tests/api/test_host.py — passed
  • python -m ruff format --check tests/api/test_host.py — passed
  • git diff --check — passed

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d6c0b968-98b5-4adc-bc38-adb96a31a758

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ImMohammad20000
ImMohammad20000 merged commit 38fb380 into PasarGuard:dev Sep 12, 2026
10 checks passed
x0sina added a commit that referenced this pull request Sep 12, 2026
Keep the #889 payload ([1, 2, 255], no rand) so it agrees with the merged assertions after pref-boost picked up both that change and the older #886 sample.
x0sina added a commit that referenced this pull request Sep 12, 2026
)

* feat(user): enhance user inbound tag retrieval and subscription update handling

- Improved the `inbounds` method in the User model to efficiently gather inbound tags from enabled groups.
- Updated user subscription update logic to queue updates for background processing, enhancing performance.
- Refactored user status change notifications to streamline the process and ensure accurate user state management.
- Introduced caching for usage coefficients to optimize node user statistics collection.
- Enhanced subscription generation with caching mechanisms for improved performance.

* fix: discard stale subscription updates and align FinalMask test (#886)

* fix: read flushed subscription updates from a fresh snapshot (#888)

* perf(nats): optimize user sync and bound queue processing (#892)

Reuse live key indexes, replay snapshots in bounded batches, and clear queues from cached keys and recent revisions. Bound bulk operations, safely compact old deletion markers, and preserve claim recovery across delayed notifications and reconnects.

Add concurrency, recovery, compaction, and idle-traffic regression coverage.

* test(hosts): match FinalMask noise fixture to Xray array packet

Keep the #889 payload ([1, 2, 255], no rand) so it agrees with the merged assertions after pref-boost picked up both that change and the older #886 sample.

* fix(cleanup): add timeout handling for node-sync key compaction and improve logging

- Introduced asyncio timeout for the compaction process to prevent indefinite blocking.
- Added a warning log for timeout occurrences to ensure visibility of potential issues.
- Updated Cache-Control header in subscription responses to "no-store" for better caching behavior.
- Refactored subscription update buffer to use a drain lock for concurrent flush operations, improving reliability and performance.

---------

Co-authored-by: DrSaeedHub <122322581+DrSaeedHub@users.noreply.github.com>
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