@@ -414,58 +414,11 @@ def test_statusmessage():
414414 except Exception as e :
415415 return jsonify ({"error" : str (e )}), 500
416416
417-
418-
419- # ============================================================================
420- # CONFIRMED BUG TEST ENDPOINTS
421- # These endpoints expose confirmed bugs in the psycopg instrumentation.
422- # See BUG_TRACKING.md for detailed documentation of each bug.
423- #
424- # Bug Summary:
425- # 1. /test/cursor-scroll - scroll() broken during RECORD mode
426- # 4. /test/nextset - nextset() iteration broken during RECORD mode
427- # 5. /test/server-cursor-scroll - scroll() broken during RECORD mode
428- # ============================================================================
429-
430- @app .route ("/test/cursor-scroll" )
431- def test_cursor_scroll ():
432- """Test cursor.scroll() method.
433-
434- BUG: During RECORD mode, the instrumentation's _finalize_query_span calls
435- fetchall() which breaks the cursor position tracking. After fetchall(),
436- scroll(0, absolute) doesn't properly reset the cursor position because
437- the patched fetch methods use _tusk_index instead of _pos.
438- """
439- try :
440- with psycopg .connect (get_conn_string ()) as conn , conn .cursor () as cur :
441- cur .execute ("SELECT id, name FROM users ORDER BY id" )
442-
443- # Fetch first row
444- first = cur .fetchone ()
445-
446- # Scroll back to start
447- cur .scroll (0 , mode = 'absolute' )
448-
449- # Fetch first row again
450- first_again = cur .fetchone ()
451-
452- return jsonify ({
453- "first" : {"id" : first [0 ], "name" : first [1 ]} if first else None ,
454- "first_again" : {"id" : first_again [0 ], "name" : first_again [1 ]} if first_again else None ,
455- "match" : first == first_again
456- })
457- except Exception as e :
458- return jsonify ({"error" : str (e )}), 500
459-
460417@app .route ("/test/nextset" )
461418def test_nextset ():
462419 """Test cursor.nextset() for multiple result sets.
463420
464- BUG: During RECORD mode, the interaction between executemany with
465- returning=True and the fetch method patching breaks nextset() iteration.
466- The instrumentation's fetch patching may consume results before nextset()
467- can iterate through them, causing 0 results in RECORD but correct
468- results in REPLAY.
421+ Tests whether the instrumentation correctly handles nextset() for multiple result sets.
469422 """
470423 try :
471424 with psycopg .connect (get_conn_string ()) as conn , conn .cursor () as cur :
@@ -497,16 +450,38 @@ def test_nextset():
497450 except Exception as e :
498451 return jsonify ({"error" : str (e )}), 500
499452
453+ @app .route ("/test/cursor-scroll" )
454+ def test_cursor_scroll ():
455+ """Test cursor.scroll() method.
456+
457+ Tests whether the instrumentation correctly handles scroll() for cursor position tracking.
458+ """
459+ try :
460+ with psycopg .connect (get_conn_string ()) as conn , conn .cursor () as cur :
461+ cur .execute ("SELECT id, name FROM users ORDER BY id" )
462+
463+ # Fetch first row
464+ first = cur .fetchone ()
465+
466+ # Scroll back to start
467+ cur .scroll (0 , mode = 'absolute' )
468+
469+ # Fetch first row again
470+ first_again = cur .fetchone ()
471+
472+ return jsonify ({
473+ "first" : {"id" : first [0 ], "name" : first [1 ]} if first else None ,
474+ "first_again" : {"id" : first_again [0 ], "name" : first_again [1 ]} if first_again else None ,
475+ "match" : first == first_again
476+ })
477+ except Exception as e :
478+ return jsonify ({"error" : str (e )}), 500
500479
501480@app .route ("/test/server-cursor-scroll" )
502481def test_server_cursor_scroll ():
503482 """Test ServerCursor.scroll() method.
504483
505- BUG: Same root cause as /test/cursor-scroll. During RECORD mode,
506- the instrumentation breaks scroll() functionality by consuming all
507- rows via fetchall() in _finalize_query_span. ServerCursor.scroll()
508- sends MOVE commands to the server, but the position tracking is
509- inconsistent after the instrumentation patches the fetch methods.
484+ Tests whether the instrumentation correctly handles scroll() for server-side cursors.
510485 """
511486 try :
512487 with psycopg .connect (get_conn_string ()) as conn :
0 commit comments