Skip to content

Commit 4180a6f

Browse files
aapelivclaude
andcommitted
Restore original comments on pack/unpack_thread_id
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent cf11811 commit 4180a6f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

app/backend/src/couchers/servicers/threads.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@
3232
logger = logging.getLogger(__name__)
3333

3434

35-
def pack_thread_id(database_id: int, depth: int) -> int:
36-
"""Pack (database_id, depth) into a single API thread id.
35+
# Since the API exposes a single ID space regardless of nesting level,
36+
# we construct the API id by appending the nesting level to the
37+
# database ID.
38+
3739

38-
The API exposes a single ID space regardless of nesting level, so we append
39-
the nesting level (depth) as the trailing digit of the database id: depth 0
40-
= Thread, depth 1 = Comment, depth 2 = Reply.
41-
"""
40+
def pack_thread_id(database_id: int, depth: int) -> int:
4241
return database_id * 10 + depth
4342

4443

4544
def unpack_thread_id(thread_id: int) -> tuple[int, int]:
46-
"""Inverse of pack_thread_id; returns (database_id, depth)."""
45+
"""Returns (database_id, depth) tuple."""
4746
return divmod(thread_id, 10)
4847

4948

0 commit comments

Comments
 (0)