File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """Add trace to AdminActionLevel
2+
3+ Revision ID: 0169
4+ Revises: 0168
5+ Create Date: 2026-06-20 00:00:00.000000
6+
7+ """
8+
9+ from alembic import op
10+
11+ # revision identifiers, used by Alembic.
12+ revision = "0169"
13+ down_revision = "0168"
14+ branch_labels = None
15+ depends_on = None
16+
17+
18+ def upgrade () -> None :
19+ # 'trace' sorts below 'debug' so the enum's intrinsic ordering matches its severity
20+ op .execute ("ALTER TYPE adminactionlevel ADD VALUE IF NOT EXISTS 'trace' BEFORE 'debug'" )
21+
22+
23+ def downgrade () -> None :
24+ # PostgreSQL cannot drop a value from an enum type, so this is a no-op.
25+ pass
Original file line number Diff line number Diff line change 2323
2424
2525class AdminActionLevel (enum .Enum ):
26+ trace = enum .auto ()
2627 debug = enum .auto ()
2728 normal = enum .auto ()
2829 high = enum .auto ()
Original file line number Diff line number Diff line change 7777
7878
7979adminactionlevel2api = {
80+ AdminActionLevel .trace : admin_pb2 .ADMIN_ACTION_LEVEL_TRACE ,
8081 AdminActionLevel .debug : admin_pb2 .ADMIN_ACTION_LEVEL_DEBUG ,
8182 AdminActionLevel .normal : admin_pb2 .ADMIN_ACTION_LEVEL_NORMAL ,
8283 AdminActionLevel .high : admin_pb2 .ADMIN_ACTION_LEVEL_HIGH ,
8384}
8485
8586api2adminactionlevel = {
87+ admin_pb2 .ADMIN_ACTION_LEVEL_TRACE : AdminActionLevel .trace ,
8688 admin_pb2 .ADMIN_ACTION_LEVEL_DEBUG : AdminActionLevel .debug ,
8789 admin_pb2 .ADMIN_ACTION_LEVEL_NORMAL : AdminActionLevel .normal ,
8890 admin_pb2 .ADMIN_ACTION_LEVEL_HIGH : AdminActionLevel .high ,
Original file line number Diff line number Diff line change @@ -1277,6 +1277,17 @@ def test_admin_actions_level(db):
12771277 assert len (res .admin_actions ) == 3
12781278 assert res .admin_actions [2 ].level == admin_pb2 .ADMIN_ACTION_LEVEL_HIGH
12791279
1280+ # Explicitly set to TRACE
1281+ res = api .AddAdminNote (
1282+ admin_pb2 .AddAdminNoteReq (
1283+ user = normal_user .username ,
1284+ admin_note = "trace note" ,
1285+ level = admin_pb2 .ADMIN_ACTION_LEVEL_TRACE ,
1286+ )
1287+ )
1288+ assert len (res .admin_actions ) == 4
1289+ assert res .admin_actions [3 ].level == admin_pb2 .ADMIN_ACTION_LEVEL_TRACE
1290+
12801291
12811292def test_admin_actions_on_mutations (db , push_collector : PushCollector ):
12821293 super_user , super_token = generate_user (is_superuser = True )
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import "api.proto";
1111
1212enum AdminActionLevel {
1313 ADMIN_ACTION_LEVEL_UNSPECIFIED = 0 ;
14+ ADMIN_ACTION_LEVEL_TRACE = 4 ; // firehose, below debug
1415 ADMIN_ACTION_LEVEL_DEBUG = 1 ; // low-importance chatter
1516 ADMIN_ACTION_LEVEL_NORMAL = 2 ; // regular admin work
1617 ADMIN_ACTION_LEVEL_HIGH = 3 ; // significant state changes
You can’t perform that action at this time.
0 commit comments