Skip to content

test(users): clear devices after the HWID count tests - #994

Merged
T3ST3ST3R0N merged 1 commit into
devfrom
fix/hwid-count-test-cleanup
Oct 10, 2026
Merged

T3ST3ST3R0N merged 1 commit into
devfrom
fix/hwid-count-test-cleanup

Conversation

@T3ST3ST3R0N

Copy link
Copy Markdown
Collaborator

Summary

  • The two device count tests added in feat(users): display and sort registered HWID counts #951 delete their users at the end, but on SQLite a deleted user's devices stay behind (foreign keys are not enforced there), and the next test's user can get the same id and inherit them.
  • Running tests/api/test_permission_leaks.py::test_user_list_shows_device_counts_only_with_hwids_read before tests/api/test_hwid.py made test_hwid_respects_admin_role_policy fail with assert 3 == 1. The default file order happens to run test_hwid.py first, so the full suite passed.
  • Both tests now clear their users' devices before deleting the users.

Tests

  • That order, the count test followed by test_hwid.py, and tests/api/test_user.py tests/api/test_permission_leaks.py tests/api/test_hwid.py in that order all pass (143 passed for the last one).

SQLite keeps a deleted user's devices (foreign keys off) and can give its id to the next test's user, so the two device count tests from #951 left devices that a later test inherited: running them before tests/api/test_hwid.py made test_hwid_respects_admin_role_policy see 3 devices instead of 1. Clear the devices before deleting the users.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

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: f2d70bbc-5572-4569-86d1-6b8788987ba6

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@T3ST3ST3R0N
T3ST3ST3R0N merged commit 3ef603b into dev Oct 10, 2026
18 checks passed
@T3ST3ST3R0N
T3ST3ST3R0N deleted the fix/hwid-count-test-cleanup branch October 22, 2026 12:34
Free-Guy-IR added a commit to Free-Guy-IR/panel that referenced this pull request Nov 2, 2026
…ain bba95f274

Checked with git ls-remote on 2026-10-11 02:55 UTC. Panel dev moved from
d94e157 to 83fe90e with 22 commits; main is still v5.4.1.

- PasarGuard#879 (2d0ca81, loopback Xray client inbounds) is ported by design: the
  fork took the open pull request on 2026-09-25 as 2e7fc45 with migration
  bfd88026565b, the same listener rewrite.
- PasarGuard#934 (a5b28f3) moves from the port queue to a dated waiver until
  2026-11-09: the fork refuses to delete a core that nodes still use
  (W3-013, fix/node-health) instead of restarting those nodes.
- PasarGuard#993 (Hysteria2 FinalMask without a udp mask) is queued until 2026-10-18:
  the fork has the same FinalMask | dict field and the same non-null-safe
  udpHop reads, so a udpHop-only host can fail the whole subscription.
- PasarGuard#984, PasarGuard#985, PasarGuard#986, PasarGuard#989, PasarGuard#944, PasarGuard#864, PasarGuard#948, PasarGuard#951, PasarGuard#778, PasarGuard#774, PasarGuard#787, PasarGuard#994,
  PasarGuard#865, PasarGuard#875, PasarGuard#718, PasarGuard#967, PasarGuard#772, PasarGuard#662, PasarGuard#995 and PasarGuard#913 are queued as
  security: no until 2026-10-25, each with its reason; PasarGuard#913's node-removal
  half is already in the fork through sync_remove_users.
- The branch commits that upstream squash-merged (the three dashboard
  branches, telegram/tests, fix/core-editor-api-section-followup,
  fix/hwid-count-test-cleanup, fix/hysteria-finalmask-quic-only) follow
  their squash, by patch-id or by an equal tree.

Scripts main moved to bba95f274 (PasarGuard#35, PasarGuard#36, PasarGuard#37 after PasarGuard#34). The three
squashes are queued security: no until 2026-10-25, and their pre-squash
branch commits are waived as superseded (equal trees).

Against live upstream the panel gate now fails only on the 17 port-queue
commits classified security: yes, and the forks gate only on node
f72ac0ef (security: yes). No upstream commit is undecided.
Free-Guy-IR added a commit to Free-Guy-IR/panel that referenced this pull request Nov 4, 2026
SQLite keeps a deleted user's devices (foreign keys off) and can give its id to the next test's user, so the two device count tests from PasarGuard#951 left devices that a later test inherited: running them before tests/api/test_hwid.py made test_hwid_respects_admin_role_policy see 3 devices instead of 1. Clear the devices before deleting the users.
(cherry picked from commit 3ef603b)

Fork port: tests/api/test_permission_leaks.py is not in the fork; the same clean-up is in tests/api/test_user_list_hwid_count_scope.py.

(cherry picked from commit 8aa3b56483275da41b5d4e749b8be06d4f829c94)
Free-Guy-IR added a commit to Free-Guy-IR/panel that referenced this pull request Nov 4, 2026
… users

Ports the device count test of upstream tests/api/test_permission_leaks.py (PasarGuard#951, with the PasarGuard#994 clean-up), which the fork does not have, and adds an own-scope admin with hwids.read that sorts by hwid_count both ways over a search that also matches three other admins' users with more devices: the total stays 1 and only its own user and count are returned.

(cherry picked from commit c2f34e699400c06bdb179769acaf2bfd596e16c6)
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.

1 participant