←
TRCKR-177
Created: 2025-12-09
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-10
Added 11 comprehensive edge case tests for snapshot creation and usage:
**Tests Added:**
1. test_merge_entity_created_then_deleted - Entity created and deleted between snapshots doesn't appear
2. test_merge_entity_in_snapshot_then_deleted - Entity in snapshot but deleted after is excluded
3. test_current_snapshot_used_directly - Fresh client with current snapshot (no delta) works correctly
4. test_snapshot_with_no_changes_since - Tests UNIQUE constraint on server_version
5. test_very_stale_snapshot - Old snapshot merged correctly with many delta changes (11 entities)
6. test_snapshot_with_special_characters - Unicode, emojis, quotes, newlines, tabs preserved
7. test_decompress_corrupted_snapshot - Corrupted data handling verification
8. test_create_snapshot_is_compressed - Verifies compression is effective (>50% reduction)
9. test_create_multiple_snapshots - Creating snapshots over time with incremental changes
10. test_fresh_client_snapshot_response_format - Response format validation
11. test_fresh_client_receives_all_entity_types - All entity types included in snapshot
**What I Found:**
- The sync_snapshots table has a UNIQUE constraint on server_version (client/schema.py:476)
- This means you cannot create multiple snapshots for the same server_version
- Tests needed to use sync endpoint to increment server_version between snapshots
**Changes Made:**
- File: tests/test_snapshot_e2e.py
- Added TestSnapshotEdgeCases class with 11 test methods
- Lines 645-1097 (new code)
- All tests use proper fixtures and follow existing patterns
**Test Results:**
- All 24 snapshot tests pass (13 existing + 11 new)
- Test runtime: ~3.2 seconds
- Coverage increased for server/routes/sync.py from 44% to 55%
**Verification:**
============================= test session starts ==============================
platform darwin -- Python 3.12.9, pytest-8.4.2, pluggy-1.6.0 -- /Users/joe/miniconda3/bin/python
cachedir: .pytest_cache
PyQt6 6.6.1 -- Qt runtime 6.6.1 -- Qt compiled 6.6.1
rootdir: /private/tmp/trckr-TRCKR-177
configfile: pyproject.toml
plugins: xdist-3.7.0, qt-4.4.0, asyncio-1.2.0, timeout-2.4.0, mock-3.14.1, pytest_httpserver-1.1.3, anyio-3.7.1, typeguard-4.4.4, hydra-core-1.3.2, requests-mock-1.12.1, cov-7.0.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collecting ... collected 11 items
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_merge_entity_created_then_deleted PASSED [ 9%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_merge_entity_in_snapshot_then_deleted PASSED [ 18%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_current_snapshot_used_directly PASSED [ 27%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_snapshot_with_no_changes_since PASSED [ 36%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_very_stale_snapshot PASSED [ 45%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_snapshot_with_special_characters PASSED [ 54%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_decompress_corrupted_snapshot PASSED [ 63%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_create_snapshot_is_compressed PASSED [ 72%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_create_multiple_snapshots PASSED [ 81%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_fresh_client_snapshot_response_format PASSED [ 90%]
tests/test_snapshot_e2e.py::TestSnapshotEdgeCases::test_fresh_client_receives_all_entity_types PASSED [100%]
================================ tests coverage ================================
_______________ coverage: platform darwin, python 3.12.9-final-0 _______________
Name Stmts Miss Cover Missing
-----------------------------------------------------------
client/__init__.py 4 0 100%
client/logging_config.py 18 4 78% 28, 45-46, 59
client/migration.py 198 161 19% 53-82, 99-132, 146-176, 190-234, 249-278, 292-315, 329-362, 376-403, 417-432, 443-454, 471-520, 536-544, 555-559, 572-580, 607-696
client/schema.py 85 11 87% 532, 620-622, 635-652
client/store.py 936 612 35% 65, 72, 93-101, 105, 109-116, 123, 143-144, 151-161, 177-180, 188, 194-196, 200-207, 214-217, 237-256, 268-271, 281-286, 383-389, 444-450, 470, 512-596, 636, 673-674, 677-678, 681-682, 685-686, 690-691, 695-696, 701-702, 705-706, 803-809, 838-903, 915-947, 974-975, 978-979, 982-983, 988-989, 992-993, 1092-1147, 1159-1183, 1208-1209, 1212-1213, 1218-1219, 1222-1223, 1252-1270, 1282-1288, 1311-1346, 1358-1366, 1385-1406, 1500-1501, 1504-1505, 1508-1509, 1514-1515, 1518-1519, 1549-1604, 1616-1636, 1663-1682, 1694-1700, 1723-1752, 1779-1818, 1830-1838, 1877-1900, 1912-1918, 1939-1964, 1995-2040, 2052-2060, 2106-2108, 2157-2158, 2161-2162, 2165-2166, 2169-2170, 2173-2174, 2179-2180, 2183-2184, 2202-2210, 2237-2253, 2265-2271, 2298-2342, 2354-2362, 2383-2408, 2419-2430, 2462, 2496, 2523, 2563, 2587
client/sync.py 475 405 15% 30, 35, 54, 115-116, 120-135, 154-171, 175-176, 180-188, 192-203, 207-224, 237-260, 278-301, 321-349, 373-567, 582-600, 624-668, 672-681, 685-690, 701-896, 942-1079, 1109-1111, 1139-1168, 1172-1177, 1186-1193, 1202-1212, 1216, 1235-1291, 1300-1351, 1366-1383, 1416-1517, 1546-1563, 1577-1626
server/__init__.py 2 0 100%
server/auth.py 26 13 50% 26-27, 34-35, 54-66
server/config.py 32 0 100%
server/database.py 39 7 82% 33-34, 72, 91-96
server/logging_config.py 18 1 94% 27
server/main.py 53 5 91% 93, 117-121, 130
server/models.py 202 0 100%
server/routes/__init__.py 9 0 100%
server/routes/auth.py 9 2 78% 23-25
server/routes/comments.py 62 44 29% 25, 49-67, 82-95, 104-114, 125-147, 157-169
server/routes/health.py 15 8 47% 23-33
server/routes/issues.py 126 105 17% 28-38, 43, 79-126, 141-170, 179-200, 211-255, 265-282
server/routes/milestones.py 69 51 26% 25, 50-80, 95-108, 117-127, 138-164, 174-186
server/routes/projects.py 91 72 21% 25-38, 43, 69-93, 108-129, 138-156, 167-197, 207-219
server/routes/sync.py 363 189 48% 36-57, 67-80, 85-88, 93-103, 194-198, 266-268, 341-345, 352, 375, 385, 405, 415, 435, 445, 462-474, 491-533, 541-543, 563, 566, 582, 603-610, 643-755, 765-855, 871, 883, 899-928, 942-950, 1074-1100, 1113-1135
server/routes/web.py 619 522 16% 25-26, 32-39, 55, 64-68, 91-128, 148-237, 243-258, 288-333, 342, 359-392, 407-437, 443-459, 484-512, 521-524, 543-558, 573-606, 612-623, 645-667, 682-736, 766-782, 812-828, 857-867, 879-889, 901-912, 924-935, 947-958, 973-1021, 1030-1068, 1086-1117, 1132, 1147-1150, 1156, 1174-1209, 1221-1271, 1277-1289, 1312-1363, 1369-1387, 1404-1449, 1455, 1475-1524, 1533-1546, 1567-1587, 1596-1612, 1621-1638
server/websocket.py 78 50 36% 32-35, 39-40, 44-50, 59-74, 79, 88, 120-158
trckr.py 1795 1271 29% 39-50, 55-66, 79-122, 135-152, 196, 206, 210-213, 217-221, 225-226, 231-232, 239-242, 246-252, 256-258, 269, 273, 277, 281, 284-286, 290, 294-296, 299, 302, 307, 314, 318-335, 339-342, 346-349, 355-370, 374-376, 381, 388, 394-408, 414-430, 436-442, 447-468, 473-484, 489-492, 496-499, 503-506, 510, 514-520, 528-535, 539-545, 549-556, 560-562, 575-576, 583-585, 591-595, 606-641, 648-667, 683-694, 703-722, 730-734, 741-753, 759, 766-809, 816-861, 868-917, 936, 959-1005, 1012-1025, 1069-1131, 1138-1168, 1198-1248, 1257-1273, 1282-1304, 1310, 1339-1397, 1417-1437, 1445-1449, 1468-1482, 1490-1494, 1499, 1522-1541, 1548-1551, 1577-1594, 1602-1642, 1660-1676, 1684-1707, 1715-1738, 1743, 1762-1770, 1777-1780, 1801-1814, 1822-1852, 1868-1880, 1888-1910, 1917-1935, 1940, 1956-1963, 1970-1973, 1994-2023, 2030-2033, 2041-2049, 2056-2071, 2076, 2096-2105, 2112-2115, 2133-2143, 2150-2153, 2171-2184, 2189, 2193, 2213-2232, 2240-2247, 2269-2305, 2312-2322, 2338-2353, 2358, 2362-2364, 2388-2442, 2449-2452, 2474-2500, 2507-2514, 2532-2548, 2554-2572, 2576-2588, 2604-2640, 2645-2901, 2905-2939, 2955-3001, 3008-3012, 3019-3093, 3105-3136, 3140
tui/__init__.py 12 12 0% 3-116
tui/app.py 994 994 0% 3-1893
tui/column_sizing.py 24 24 0% 8-108
tui/constants.py 46 46 0% 6-156
tui/dialogs.py 614 614 0% 3-1308
tui/filters.py 65 65 0% 1-80
tui/formatting.py 92 92 0% 3-149
tui/quick_edit.py 101 101 0% 3-231
tui/screens/__init__.py 4 4 0% 3-17
tui/screens/base.py 64 64 0% 3-151
tui/screens/detail.py 1071 1071 0% 3-2015
tui/screens/edit.py 393 393 0% 3-990
tui/settings.py 21 21 0% 3-45
tui/table_factory.py 38 38 0% 3-84
tui/widgets.py 14 14 0% 3-24
-----------------------------------------------------------
TOTAL 8877 7086 20%
Coverage HTML written to dir htmlcov
============================== 11 passed in 2.31s ==============================
Changes committed to TRCKR-177 branch and merged to master.