Task ID: task_e_682d3e8e7f9483238bf5716fe8898a20
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
itsdangerous ------------------------------ 15.85 KiB/15.85 KiB
pluggy ------------------------------ 20.06 KiB/20.06 KiB
execnet ------------------------------ 32.00 KiB/39.66 KiB
pytest-xdist ------------------------------ 30.90 KiB/45.03 KiB
requests ------------------------------ 48.00 KiB/63.41 KiB
packaging ------------------------------ 48.00 KiB/64.91 KiB
idna ------------------------------ 68.79 KiB/68.79 KiB
click ------------------------------ 78.88 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 62.88 KiB/125.66 KiB
jinja2 ------------------------------ 76.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 125.17 KiB/145.08 KiB
certifi ------------------------------ 155.88 KiB/155.88 KiB
werkzeug ------------------------------ 91.80 KiB/219.24 KiB
python-dateutil ------------------------------ 46.86 KiB/224.50 KiB
pytest ------------------------------ 190.34 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 32.00 KiB/5.31 MiB
ruff ------------------------------ 206.20 KiB/11.02 MiB
duckdb ------------------------------ 238.91 KiB/19.27 MiB
playwright ------------------------------ 30.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
itsdangerous ------------------------------ 15.85 KiB/15.85 KiB
execnet ------------------------------ 32.00 KiB/39.66 KiB
pytest-xdist ------------------------------ 30.90 KiB/45.03 KiB
requests ------------------------------ 48.00 KiB/63.41 KiB
packaging ------------------------------ 48.00 KiB/64.91 KiB
idna ------------------------------ 68.79 KiB/68.79 KiB
click ------------------------------ 78.88 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 62.88 KiB/125.66 KiB
jinja2 ------------------------------ 76.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 125.17 KiB/145.08 KiB
certifi ------------------------------ 155.88 KiB/155.88 KiB
werkzeug ------------------------------ 91.80 KiB/219.24 KiB
python-dateutil ------------------------------ 46.86 KiB/224.50 KiB
pytest ------------------------------ 190.34 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 32.00 KiB/5.31 MiB
ruff ------------------------------ 206.20 KiB/11.02 MiB
duckdb ------------------------------ 238.91 KiB/19.27 MiB
playwright ------------------------------ 30.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
itsdangerous ------------------------------ 15.85 KiB/15.85 KiB
execnet ------------------------------ 32.00 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
requests ------------------------------ 48.00 KiB/63.41 KiB
packaging ------------------------------ 48.00 KiB/64.91 KiB
idna ------------------------------ 68.79 KiB/68.79 KiB
click ------------------------------ 94.88 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 75.83 KiB/125.66 KiB
jinja2 ------------------------------ 76.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 125.17 KiB/145.08 KiB
werkzeug ------------------------------ 91.80 KiB/219.24 KiB
python-dateutil ------------------------------ 46.86 KiB/224.50 KiB
pytest ------------------------------ 190.34 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 32.00 KiB/5.31 MiB
ruff ------------------------------ 206.20 KiB/11.02 MiB
duckdb ------------------------------ 238.91 KiB/19.27 MiB
playwright ------------------------------ 30.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
requests ------------------------------ 48.00 KiB/63.41 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
idna ------------------------------ 68.79 KiB/68.79 KiB
click ------------------------------ 94.88 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 75.83 KiB/125.66 KiB
jinja2 ------------------------------ 92.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 141.17 KiB/145.08 KiB
werkzeug ------------------------------ 91.80 KiB/219.24 KiB
python-dateutil ------------------------------ 46.86 KiB/224.50 KiB
pytest ------------------------------ 190.34 KiB/335.58 KiB
greenlet ------------------------------ 63.29 KiB/589.71 KiB
pyright ------------------------------ 32.00 KiB/5.31 MiB
ruff ------------------------------ 238.20 KiB/11.02 MiB
duckdb ------------------------------ 270.91 KiB/19.27 MiB
playwright ------------------------------ 30.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
requests ------------------------------ 63.41 KiB/63.41 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
click ------------------------------ 94.88 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 75.83 KiB/125.66 KiB
jinja2 ------------------------------ 92.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 141.17 KiB/145.08 KiB
werkzeug ------------------------------ 91.80 KiB/219.24 KiB
python-dateutil ------------------------------ 46.86 KiB/224.50 KiB
pytest ------------------------------ 190.34 KiB/335.58 KiB
greenlet ------------------------------ 63.29 KiB/589.71 KiB
pyright ------------------------------ 32.00 KiB/5.31 MiB
ruff ------------------------------ 238.20 KiB/11.02 MiB
duckdb ------------------------------ 270.91 KiB/19.27 MiB
playwright ------------------------------ 30.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
click ------------------------------ 99.76 KiB/99.76 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 124.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 141.17 KiB/145.08 KiB
werkzeug ------------------------------ 107.80 KiB/219.24 KiB
python-dateutil ------------------------------ 124.54 KiB/224.50 KiB
pytest ------------------------------ 222.34 KiB/335.58 KiB
greenlet ------------------------------ 191.29 KiB/589.71 KiB
pyright ------------------------------ 205.45 KiB/5.31 MiB
ruff ------------------------------ 414.20 KiB/11.02 MiB
duckdb ------------------------------ 446.91 KiB/19.27 MiB
playwright ------------------------------ 46.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 124.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 141.17 KiB/145.08 KiB
werkzeug ------------------------------ 107.80 KiB/219.24 KiB
python-dateutil ------------------------------ 124.54 KiB/224.50 KiB
pytest ------------------------------ 222.34 KiB/335.58 KiB
greenlet ------------------------------ 191.29 KiB/589.71 KiB
pyright ------------------------------ 205.45 KiB/5.31 MiB
ruff ------------------------------ 414.20 KiB/11.02 MiB
duckdb ------------------------------ 446.91 KiB/19.27 MiB
playwright ------------------------------ 46.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 124.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 141.17 KiB/145.08 KiB
werkzeug ------------------------------ 107.80 KiB/219.24 KiB
python-dateutil ------------------------------ 124.54 KiB/224.50 KiB
pytest ------------------------------ 222.34 KiB/335.58 KiB
greenlet ------------------------------ 191.29 KiB/589.71 KiB
pyright ------------------------------ 205.45 KiB/5.31 MiB
ruff ------------------------------ 414.20 KiB/11.02 MiB
duckdb ------------------------------ 446.91 KiB/19.27 MiB
playwright ------------------------------ 46.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 124.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 145.08 KiB/145.08 KiB
werkzeug ------------------------------ 107.80 KiB/219.24 KiB
python-dateutil ------------------------------ 156.54 KiB/224.50 KiB
pytest ------------------------------ 222.34 KiB/335.58 KiB
greenlet ------------------------------ 223.29 KiB/589.71 KiB
pyright ------------------------------ 237.45 KiB/5.31 MiB
ruff ------------------------------ 446.20 KiB/11.02 MiB
duckdb ------------------------------ 478.91 KiB/19.27 MiB
playwright ------------------------------ 46.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 124.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 145.08 KiB/145.08 KiB
werkzeug ------------------------------ 107.80 KiB/219.24 KiB
python-dateutil ------------------------------ 156.54 KiB/224.50 KiB
pytest ------------------------------ 222.34 KiB/335.58 KiB
greenlet ------------------------------ 223.29 KiB/589.71 KiB
pyright ------------------------------ 253.45 KiB/5.31 MiB
ruff ------------------------------ 446.20 KiB/11.02 MiB
duckdb ------------------------------ 478.91 KiB/19.27 MiB
playwright ------------------------------ 46.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 124.96 KiB/131.74 KiB
charset-normalizer ------------------------------ 145.08 KiB/145.08 KiB
werkzeug ------------------------------ 123.80 KiB/219.24 KiB
python-dateutil ------------------------------ 172.54 KiB/224.50 KiB
pytest ------------------------------ 222.34 KiB/335.58 KiB
greenlet ------------------------------ 239.29 KiB/589.71 KiB
pyright ------------------------------ 253.45 KiB/5.31 MiB
ruff ------------------------------ 462.20 KiB/11.02 MiB
duckdb ------------------------------ 494.91 KiB/19.27 MiB
playwright ------------------------------ 46.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
flask ------------------------------ 100.88 KiB/100.88 KiB
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 131.74 KiB/131.74 KiB
werkzeug ------------------------------ 123.80 KiB/219.24 KiB
python-dateutil ------------------------------ 220.54 KiB/224.50 KiB
pytest ------------------------------ 238.34 KiB/335.58 KiB
greenlet ------------------------------ 335.29 KiB/589.71 KiB
pyright ------------------------------ 349.45 KiB/5.31 MiB
ruff ------------------------------ 542.20 KiB/11.02 MiB
duckdb ------------------------------ 590.91 KiB/19.27 MiB
playwright ------------------------------ 62.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
urllib3 ------------------------------ 91.83 KiB/125.66 KiB
jinja2 ------------------------------ 131.74 KiB/131.74 KiB
werkzeug ------------------------------ 139.80 KiB/219.24 KiB
python-dateutil ------------------------------ 224.50 KiB/224.50 KiB
pytest ------------------------------ 238.34 KiB/335.58 KiB
greenlet ------------------------------ 399.29 KiB/589.71 KiB
pyright ------------------------------ 413.45 KiB/5.31 MiB
ruff ------------------------------ 622.20 KiB/11.02 MiB
duckdb ------------------------------ 654.91 KiB/19.27 MiB
playwright ------------------------------ 62.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
urllib3 ------------------------------ 107.83 KiB/125.66 KiB
werkzeug ------------------------------ 139.80 KiB/219.24 KiB
python-dateutil ------------------------------ 224.50 KiB/224.50 KiB
pytest ------------------------------ 238.34 KiB/335.58 KiB
greenlet ------------------------------ 431.29 KiB/589.71 KiB
pyright ------------------------------ 445.45 KiB/5.31 MiB
ruff ------------------------------ 654.20 KiB/11.02 MiB
duckdb ------------------------------ 686.91 KiB/19.27 MiB
playwright ------------------------------ 62.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
urllib3 ------------------------------ 107.83 KiB/125.66 KiB
werkzeug ------------------------------ 139.80 KiB/219.24 KiB
pytest ------------------------------ 254.34 KiB/335.58 KiB
greenlet ------------------------------ 463.29 KiB/589.71 KiB
pyright ------------------------------ 525.45 KiB/5.31 MiB
ruff ------------------------------ 734.20 KiB/11.02 MiB
duckdb ------------------------------ 782.91 KiB/19.27 MiB
playwright ------------------------------ 78.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
urllib3 ------------------------------ 125.66 KiB/125.66 KiB
werkzeug ------------------------------ 139.80 KiB/219.24 KiB
pytest ------------------------------ 270.34 KiB/335.58 KiB
greenlet ------------------------------ 463.29 KiB/589.71 KiB
pyright ------------------------------ 605.45 KiB/5.31 MiB
ruff ------------------------------ 814.20 KiB/11.02 MiB
duckdb ------------------------------ 846.91 KiB/19.27 MiB
playwright ------------------------------ 94.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
werkzeug ------------------------------ 155.80 KiB/219.24 KiB
pytest ------------------------------ 302.34 KiB/335.58 KiB
greenlet ------------------------------ 479.29 KiB/589.71 KiB
pyright ------------------------------ 781.45 KiB/5.31 MiB
ruff ------------------------------ 1006.20 KiB/11.02 MiB
duckdb ------------------------------ 1.01 MiB/19.27 MiB
playwright ------------------------------ 94.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
werkzeug ------------------------------ 187.80 KiB/219.24 KiB
pytest ------------------------------ 335.58 KiB/335.58 KiB
greenlet ------------------------------ 479.29 KiB/589.71 KiB
pyright ------------------------------ 1.04 MiB/5.31 MiB
ruff ------------------------------ 1.25 MiB/11.02 MiB
duckdb ------------------------------ 1.30 MiB/19.27 MiB
playwright ------------------------------ 110.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
werkzeug ------------------------------ 219.24 KiB/219.24 KiB
greenlet ------------------------------ 495.29 KiB/589.71 KiB
pyright ------------------------------ 1.28 MiB/5.31 MiB
ruff ------------------------------ 1.48 MiB/11.02 MiB
duckdb ------------------------------ 1.53 MiB/19.27 MiB
playwright ------------------------------ 238.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
greenlet ------------------------------ 495.29 KiB/589.71 KiB
pyright ------------------------------ 1.33 MiB/5.31 MiB
ruff ------------------------------ 1.56 MiB/11.02 MiB
duckdb ------------------------------ 1.59 MiB/19.27 MiB
playwright ------------------------------ 254.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
greenlet ------------------------------ 511.29 KiB/589.71 KiB
pyright ------------------------------ 1.54 MiB/5.31 MiB
ruff ------------------------------ 1.87 MiB/11.02 MiB
duckdb ------------------------------ 1.92 MiB/19.27 MiB
playwright ------------------------------ 590.91 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
greenlet ------------------------------ 575.29 KiB/589.71 KiB
pyright ------------------------------ 1.79 MiB/5.31 MiB
ruff ------------------------------ 2.61 MiB/11.02 MiB
duckdb ------------------------------ 2.67 MiB/19.27 MiB
playwright ------------------------------ 1.31 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
pyright ------------------------------ 1.81 MiB/5.31 MiB
ruff ------------------------------ 3.08 MiB/11.02 MiB
duckdb ------------------------------ 3.15 MiB/19.27 MiB
playwright ------------------------------ 1.78 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
pyright ------------------------------ 1.82 MiB/5.31 MiB
ruff ------------------------------ 3.34 MiB/11.02 MiB
duckdb ------------------------------ 3.42 MiB/19.27 MiB
playwright ------------------------------ 2.02 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (25/33)
pyright ------------------------------ 1.86 MiB/5.31 MiB
ruff ------------------------------ 4.02 MiB/11.02 MiB
duckdb ------------------------------ 4.09 MiB/19.27 MiB
playwright ------------------------------ 2.68 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.90 MiB/5.31 MiB
ruff ------------------------------ 4.75 MiB/11.02 MiB
duckdb ------------------------------ 4.82 MiB/19.27 MiB
playwright ------------------------------ 3.40 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.93 MiB/5.31 MiB
ruff ------------------------------ 5.58 MiB/11.02 MiB
duckdb ------------------------------ 5.64 MiB/19.27 MiB
playwright ------------------------------ 4.20 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.96 MiB/5.31 MiB
ruff ------------------------------ 6.40 MiB/11.02 MiB
duckdb ------------------------------ 6.44 MiB/19.27 MiB
playwright ------------------------------ 4.98 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 2.00 MiB/5.31 MiB
ruff ------------------------------ 7.03 MiB/11.02 MiB
duckdb ------------------------------ 7.09 MiB/19.27 MiB
playwright ------------------------------ 5.61 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 2.03 MiB/5.31 MiB
ruff ------------------------------ 7.67 MiB/11.02 MiB
duckdb ------------------------------ 7.70 MiB/19.27 MiB
playwright ------------------------------ 6.20 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 2.07 MiB/5.31 MiB
ruff ------------------------------ 8.36 MiB/11.02 MiB
duckdb ------------------------------ 8.42 MiB/19.27 MiB
playwright ------------------------------ 6.91 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 2.09 MiB/5.31 MiB
ruff ------------------------------ 9.16 MiB/11.02 MiB
duckdb ------------------------------ 9.22 MiB/19.27 MiB
playwright ------------------------------ 7.68 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 2.12 MiB/5.31 MiB
ruff ------------------------------ 9.99 MiB/11.02 MiB
duckdb ------------------------------ 10.03 MiB/19.27 MiB
playwright ------------------------------ 8.49 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.15 MiB/5.31 MiB
ruff ------------------------------ 10.83 MiB/11.02 MiB
duckdb ------------------------------ 10.87 MiB/19.27 MiB
playwright ------------------------------ 9.34 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.15 MiB/5.31 MiB
duckdb ------------------------------ 11.11 MiB/19.27 MiB
playwright ------------------------------ 9.58 MiB/43.05 MiB
Built scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.17 MiB/5.31 MiB
duckdb ------------------------------ 11.51 MiB/19.27 MiB
playwright ------------------------------ 9.99 MiB/43.05 MiB
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.17 MiB/5.31 MiB
duckdb ------------------------------ 11.79 MiB/19.27 MiB
playwright ------------------------------ 10.22 MiB/43.05 MiB
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.18 MiB/5.31 MiB
duckdb ------------------------------ 13.06 MiB/19.27 MiB
playwright ------------------------------ 11.53 MiB/43.05 MiB
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.20 MiB/5.31 MiB
duckdb ------------------------------ 14.33 MiB/19.27 MiB
playwright ------------------------------ 12.79 MiB/43.05 MiB
⠧ Preparing packages... (30/33)
pyright ------------------------------ 2.22 MiB/5.31 MiB
duckdb ------------------------------ 15.53 MiB/19.27 MiB
playwright ------------------------------ 13.97 MiB/43.05 MiB
⠧ Preparing packages... (30/33)
pyright ------------------------------ 2.23 MiB/5.31 MiB
duckdb ------------------------------ 16.73 MiB/19.27 MiB
playwright ------------------------------ 15.19 MiB/43.05 MiB
⠧ Preparing packages... (30/33)
pyright ------------------------------ 2.25 MiB/5.31 MiB
duckdb ------------------------------ 18.00 MiB/19.27 MiB
playwright ------------------------------ 16.43 MiB/43.05 MiB
⠧ Preparing packages... (30/33)
pyright ------------------------------ 2.26 MiB/5.31 MiB
duckdb ------------------------------ 19.19 MiB/19.27 MiB
playwright ------------------------------ 17.63 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.34 MiB/5.31 MiB
playwright ------------------------------ 19.38 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.34 MiB/5.31 MiB
playwright ------------------------------ 19.63 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.40 MiB/5.31 MiB
playwright ------------------------------ 22.03 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.42 MiB/5.31 MiB
playwright ------------------------------ 24.57 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.45 MiB/5.31 MiB
playwright ------------------------------ 27.09 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.47 MiB/5.31 MiB
playwright ------------------------------ 29.60 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.50 MiB/5.31 MiB
playwright ------------------------------ 32.25 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.53 MiB/5.31 MiB
playwright ------------------------------ 34.62 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.56 MiB/5.31 MiB
playwright ------------------------------ 36.67 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.59 MiB/5.31 MiB
playwright ------------------------------ 38.86 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.62 MiB/5.31 MiB
playwright ------------------------------ 40.87 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.72 MiB/5.31 MiB
playwright ------------------------------ 41.38 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.78 MiB/5.31 MiB
playwright ------------------------------ 42.48 MiB/43.05 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 2.79 MiB/5.31 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 2.90 MiB/5.31 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 3.06 MiB/5.31 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 3.19 MiB/5.31 MiB
⠸ Preparing packages... (32/33)
pyright ------------------------------ 3.29 MiB/5.31 MiB
⠸ Preparing packages... (32/33)
pyright ------------------------------ 3.47 MiB/5.31 MiB
⠸ Preparing packages... (32/33)
pyright ------------------------------ 3.62 MiB/5.31 MiB
⠸ Preparing packages... (32/33)
pyright ------------------------------ 3.81 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.12 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.29 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.47 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.59 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
Prepared 33 packages in 2.56s
░░░░░░░░░░░░░░░░░░░░ [0/0] Installing wheels...
░░░░░░░░░░░░░░░░░░░░ [0/33] Installing wheels...
░░░░░░░░░░░░░░░░░░░░ [0/33] six==1.17.0
░░░░░░░░░░░░░░░░░░░░ [1/33] six==1.17.0
░░░░░░░░░░░░░░░░░░░░ [1/33] text-unidecode==1.3
█░░░░░░░░░░░░░░░░░░░ [2/33] text-unidecode==1.3
█░░░░░░░░░░░░░░░░░░░ [2/33] click==8.2.0
█░░░░░░░░░░░░░░░░░░░ [3/33] click==8.2.0
█░░░░░░░░░░░░░░░░░░░ [3/33] typing-extensions==4.13.2
██░░░░░░░░░░░░░░░░░░ [4/33] typing-extensions==4.13.2
██░░░░░░░░░░░░░░░░░░ [4/33] urllib3==2.4.0
███░░░░░░░░░░░░░░░░░ [5/33] urllib3==2.4.0
███░░░░░░░░░░░░░░░░░ [5/33] pyee==13.0.0
███░░░░░░░░░░░░░░░░░ [6/33] pyee==13.0.0
███░░░░░░░░░░░░░░░░░ [6/33] execnet==2.1.1
████░░░░░░░░░░░░░░░░ [7/33] execnet==2.1.1
████░░░░░░░░░░░░░░░░ [7/33] markupsafe==3.0.2
████░░░░░░░░░░░░░░░░ [8/33] markupsafe==3.0.2
████░░░░░░░░░░░░░░░░ [8/33] iniconfig==2.1.0
█████░░░░░░░░░░░░░░░ [9/33] iniconfig==2.1.0
███████████████████░ [32/33] pyright==1.1.400
████████████████████ [33/33] pyright==1.1.400
Installed 33 packages in 115ms
+ blinker==1.9.0
+ certifi==2025.4.26
+ charset-normalizer==3.4.2
+ click==8.2.0
+ duckdb==1.2.2
+ execnet==2.1.1
+ flask==3.1.1
+ greenlet==3.2.2
+ idna==3.10
+ iniconfig==2.1.0
+ itsdangerous==2.2.0
+ jinja2==3.1.6
+ markupsafe==3.0.2
+ nodeenv==1.9.1
+ packaging==25.0
+ playwright==1.52.0
+ pluggy==1.6.0
+ pyee==13.0.0
+ pyright==1.1.400
+ pytest==8.3.5
+ pytest-base-url==2.1.0
+ pytest-playwright==0.7.0
+ pytest-xdist==3.6.1
+ python-dateutil==2.9.0.post0
+ python-slugify==8.0.4
+ requests==2.32.3
+ ruff==0.11.10
+ scubaduck==0.1.0 (from file:///workspace/scubaduck)
+ six==1.17.0
+ text-unidecode==1.3
+ typing-extensions==4.13.2
+ urllib3==2.4.0
+ werkzeug==3.1.3
++ source .venv/bin/activate
+++ '[' -z '' ']'
+++ '[' -n x ']'
+++ SCRIPT_PATH=.venv/bin/activate
+++ '[' .venv/bin/activate = /tmp/McG5ie-setup_script.sh ']'
+++ deactivate nondestructive
+++ unset -f pydoc
+++ '[' -z '' ']'
+++ '[' -z '' ']'
+++ hash -r
+++ '[' -z '' ']'
+++ unset VIRTUAL_ENV
+++ unset VIRTUAL_ENV_PROMPT
+++ '[' '!' nondestructive = nondestructive ']'
+++ VIRTUAL_ENV=/workspace/scubaduck/.venv
+++ '[' linux-gnu = cygwin ']'
+++ '[' linux-gnu = msys ']'
+++ export VIRTUAL_ENV
+++ '[' -z '' ']'
+++ unset SCRIPT_PATH
+++ _OLD_VIRTUAL_PATH=/root/.cargo/bin:/root/.rbenv/shims:/root/.rbenv/bin:/root/.rbenv/shims:/root/.local/share/swiftly/bin:/root/.bun/bin:/root/.nvm/versions/node/v22.15.1/bin:/root/.pyenv/shims:3441PYENV_ROOT/shims:/root/.pyenv/bin:/usr/local/go/bin:/root/go/bin:/root/.rbenv/bin:/root/.rbenv/shims:/root/.bun/bin:/root/.local/bin:/root/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ PATH=/workspace/scubaduck/.venv/bin:/root/.cargo/bin:/root/.rbenv/shims:/root/.rbenv/bin:/root/.rbenv/shims:/root/.local/share/swiftly/bin:/root/.bun/bin:/root/.nvm/versions/node/v22.15.1/bin:/root/.pyenv/shims:3441PYENV_ROOT/shims:/root/.pyenv/bin:/usr/local/go/bin:/root/go/bin:/root/.rbenv/bin:/root/.rbenv/shims:/root/.bun/bin:/root/.local/bin:/root/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export PATH
+++ '[' xscubaduck '!=' x ']'
+++ VIRTUAL_ENV_PROMPT='(scubaduck) '
+++ export VIRTUAL_ENV_PROMPT
+++ '[' -z '' ']'
+++ '[' -z '' ']'
+++ _OLD_VIRTUAL_PS1=
+++ PS1='(scubaduck) '
+++ export PS1
+++ alias pydoc
+++ true
+++ hash -r
++ playwright install chromium
Downloading Chromium 136.0.7103.25 (playwright build v1169) from https://cdn.playwright.dev/dbazure/download/playwright/builds/chromium/1169/chromium-linux.zip
167.7 MiB [] 0% 0.0s167.7 MiB [] 0% 33.2s167.7 MiB [] 0% 33.7s167.7 MiB [] 0% 23.5s167.7 MiB [] 0% 16.5s167.7 MiB [] 0% 9.6s167.7 MiB [] 1% 7.8s167.7 MiB [] 1% 7.2s167.7 MiB [] 2% 5.9s167.7 MiB [] 3% 4.6s167.7 MiB [] 3% 4.8s167.7 MiB [] 4% 4.9s167.7 MiB [] 4% 4.4s167.7 MiB [] 5% 4.1s167.7 MiB [] 6% 4.0s167.7 MiB [] 7% 3.5s167.7 MiB [] 8% 3.2s167.7 MiB [] 9% 3.0s167.7 MiB [] 10% 2.9s167.7 MiB [] 11% 2.7s167.7 MiB [] 12% 2.4s167.7 MiB [] 14% 2.2s167.7 MiB [] 15% 2.3s167.7 MiB [] 16% 2.2s167.7 MiB [] 17% 2.1s167.7 MiB [] 18% 2.1s167.7 MiB [] 19% 2.1s167.7 MiB [] 20% 2.0s167.7 MiB [] 21% 2.0s167.7 MiB [] 22% 1.9s167.7 MiB [] 24% 1.8s167.7 MiB [] 25% 1.8s167.7 MiB [] 26% 1.7s167.7 MiB [] 27% 1.7s167.7 MiB [] 29% 1.6s167.7 MiB [] 30% 1.5s167.7 MiB [] 31% 1.5s167.7 MiB [] 33% 1.4s167.7 MiB [] 34% 1.4s167.7 MiB [] 35% 1.3s167.7 MiB [] 37% 1.3s167.7 MiB [] 39% 1.2s167.7 MiB [] 41% 1.1s167.7 MiB [] 42% 1.1s167.7 MiB [] 44% 1.0s167.7 MiB [] 45% 1.0s167.7 MiB [] 46% 1.0s167.7 MiB [] 48% 0.9s167.7 MiB [] 49% 0.9s167.7 MiB [] 50% 0.9s167.7 MiB [] 52% 0.9s167.7 MiB [] 53% 0.8s167.7 MiB [] 54% 0.8s167.7 MiB [] 55% 0.8s167.7 MiB [] 56% 0.8s167.7 MiB [] 57% 0.8s167.7 MiB [] 58% 0.7s167.7 MiB [] 60% 0.7s167.7 MiB [] 62% 0.7s167.7 MiB [] 63% 0.6s167.7 MiB [] 65% 0.6s167.7 MiB [] 67% 0.5s167.7 MiB [] 69% 0.5s167.7 MiB [] 70% 0.5s167.7 MiB [] 71% 0.5s167.7 MiB [] 73% 0.4s167.7 MiB [] 75% 0.4s167.7 MiB [] 76% 0.4s167.7 MiB [] 78% 0.3s167.7 MiB [] 80% 0.3s167.7 MiB [] 81% 0.3s167.7 MiB [] 83% 0.3s167.7 MiB [] 84% 0.2s167.7 MiB [] 85% 0.2s167.7 MiB [] 87% 0.2s167.7 MiB [] 89% 0.2s167.7 MiB [] 90% 0.2s167.7 MiB [] 91% 0.1s167.7 MiB [] 93% 0.1s167.7 MiB [] 94% 0.1s167.7 MiB [] 96% 0.1s167.7 MiB [] 97% 0.0s167.7 MiB [] 99% 0.0s167.7 MiB [] 100% 0.0s
Chromium 136.0.7103.25 (playwright build v1169) downloaded to /root/.cache/ms-playwright/chromium-1169
Downloading FFMPEG playwright build v1011 from https://cdn.playwright.dev/dbazure/download/playwright/builds/ffmpeg/1011/ffmpeg-linux.zip
2.3 MiB [] 0% 0.0s2.3 MiB [] 2% 0.6s2.3 MiB [] 6% 0.4s2.3 MiB [] 15% 0.3s2.3 MiB [] 30% 0.1s2.3 MiB [] 64% 0.0s2.3 MiB [] 88% 0.0s2.3 MiB [] 94% 0.0s2.3 MiB [] 97% 0.0s2.3 MiB [] 100% 0.0s
FFMPEG playwright build v1011 downloaded to /root/.cache/ms-playwright/ffmpeg-1011
Downloading Chromium Headless Shell 136.0.7103.25 (playwright build v1169) from https://cdn.playwright.dev/dbazure/download/playwright/builds/chromium/1169/chromium-headless-shell-linux.zip
101.4 MiB [] 0% 0.0s101.4 MiB [] 0% 26.6s101.4 MiB [] 0% 21.9s101.4 MiB [] 0% 16.7s101.4 MiB [] 0% 9.0s101.4 MiB [] 2% 4.1s101.4 MiB [] 4% 2.5s101.4 MiB [] 6% 1.9s101.4 MiB [] 7% 1.8s101.4 MiB [] 9% 1.5s101.4 MiB [] 10% 1.4s101.4 MiB [] 11% 1.4s101.4 MiB [] 15% 1.2s101.4 MiB [] 17% 1.1s101.4 MiB [] 20% 0.9s101.4 MiB [] 23% 0.9s101.4 MiB [] 25% 0.8s101.4 MiB [] 28% 0.7s101.4 MiB [] 32% 0.6s101.4 MiB [] 34% 0.6s101.4 MiB [] 37% 0.6s101.4 MiB [] 40% 0.5s101.4 MiB [] 43% 0.5s101.4 MiB [] 45% 0.5s101.4 MiB [] 48% 0.5s101.4 MiB [] 49% 0.5s101.4 MiB [] 50% 0.5s101.4 MiB [] 53% 0.4s101.4 MiB [] 56% 0.4s101.4 MiB [] 57% 0.4s101.4 MiB [] 61% 0.4s101.4 MiB [] 63% 0.3s101.4 MiB [] 65% 0.3s101.4 MiB [] 67% 0.3s101.4 MiB [] 69% 0.3s101.4 MiB [] 72% 0.2s101.4 MiB [] 74% 0.2s101.4 MiB [] 76% 0.2s101.4 MiB [] 79% 0.2s101.4 MiB [] 81% 0.2s101.4 MiB [] 83% 0.1s101.4 MiB [] 86% 0.1s101.4 MiB [] 89% 0.1s101.4 MiB [] 91% 0.1s101.4 MiB [] 93% 0.1s101.4 MiB [] 95% 0.0s101.4 MiB [] 99% 0.0s101.4 MiB [] 100% 0.0s
Chromium Headless Shell 136.0.7103.25 (playwright build v1169) downloaded to /root/.cache/ms-playwright/chromium_headless_shell-1169
++ echo 'source .venv/bin/activate'
I just checked the AGENTS.md in the repo root. Let's see what it says.
bash: .venv/bin/activate: No such file or directory
root@79a0f51f0ce9:/workspace# ls
scubaduck
root@79a0f51f0ce9:/workspace# cd scubaduck
root@79a0f51f0ce9:/workspace/scubaduck# ls
AGENTS.md codex_setup.sh scubaduck tests
README.md pyproject.toml stubs uv.lock
root@79a0f51f0ce9:/workspace/scubaduck# cat AGENTS.md
- Use "source .venv/bin/activate" to activate the virtual environment before
running any commands
- ONLY use non-interactive commands like cat, sed, apply_patch to do edits.
Do NOT use interactive editors.
- Do NOT attempt to install packages. Only the packages specified in
pyproject.toml are available. You cannot add new packages. If you
desperately want another package, make a note of it in the final PR
description.
- Use conventional commits to format PR title
- There are no nested AGENTS.md files, this is the only agents file
- When using Playwright, ONLY use chromium browser. This browser is already
installed.
- Use "ruff check" to check lint, "ruff format" to autoformat files and
"pyright" to typecheck.
- When writing the PR description, include the original prompt supplied by the
user.
- When you add functionality to the server, add server tests to
tests/test_server.py. When you add features to the frontend, add frontend
tests to tests/test_web.py
root@79a0f51f0ce9:/workspace/scubaduck# ls -R | head
.:
AGENTS.md
README.md
codex_setup.sh
pyproject.toml
scubaduck
stubs
tests
uv.lock
I’ll check the pyproject file to see which packages are included.
root@79a0f51f0ce9:/workspace/scubaduck# cat pyproject.toml
[project]
name = "scubaduck"
version = "0.1.0"
description = "Scuba on DuckDB"
readme = "README.md"
requires-python = ">=3.12"
license = {text = "MIT"}
dependencies = [
"duckdb",
"flask",
"python-dateutil>=2.9.0.post0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.pytest.ini_options]
addopts = "-n auto --tb=native"
[tool.pyright]
# Pyright configuration with strict settings
include = ["scubaduck", "tests"]
exclude = ["**/__pycache__", "dist"]
stubPath = "stubs"
venvPath = "."
venv = ".venv"
reportMissingImports = true
reportMissingTypeStubs = true
pythonVersion = "3.12"
pythonPlatform = "All"
typeCheckingMode = "strict"
reportUnknownMemberType = true
reportUnknownParameterType = true
reportUnknownVariableType = true
reportUnknownArgumentType = true
reportPrivateImportUsage = true
reportUntypedFunctionDecorator = true
reportFunctionMemberAccess = true
reportIncompatibleMethodOverride = true
[tool.ruff]
target-version = "py312"
[tool.uv]
dev-dependencies = [
"pytest>=8.3.5",
"ruff>=0.11.2",
"pytest-xdist>=3.6.1",
"playwright>=1.52.0",
"pyright>=1.1.350",
"pytest-playwright>=0.7.0",
]
root@79a0f51f0ce9:/workspace/scubaduck# ls tests
conftest.py test_server.py test_web.py
I’ll open the test_web.py file to review its content.
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '1,160p' tests/test_web.py
from __future__ import annotations
from typing import Any
def select_value(page: Any, selector: str, value: str) -> None:
page.evaluate(
"arg => setSelectValue(arg.sel, arg.val)",
{"sel": selector, "val": value},
)
def run_query(
page: Any,
url: str,
*,
start: str | None = None,
end: str | None = None,
order_by: str | None = None,
order_dir: str | None = "ASC",
limit: int | None = None,
group_by: list[str] | None = None,
aggregate: str | None = None,
) -> dict[str, Any]:
page.goto(url)
page.wait_for_selector("#order_by option", state="attached")
page.wait_for_selector("#order_dir", state="attached")
page.wait_for_function("window.lastResults !== undefined")
if start is not None:
page.fill("#start", start)
if end is not None:
page.fill("#end", end)
if order_by is not None:
select_value(page, "#order_by", order_by)
if order_dir is not None and order_dir == "DESC":
page.click("#order_dir")
if limit is not None:
page.fill("#limit", str(limit))
if group_by is not None:
select_value(page, "#graph_type", "table")
page.evaluate(
"g => { groupBy.chips = g; groupBy.renderChips(); }",
group_by,
)
if aggregate is not None:
select_value(page, "#graph_type", "table")
select_value(page, "#aggregate", aggregate)
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
return page.evaluate("window.lastResults")
def test_range_filters(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-02 00:00:00",
end="2024-01-02 04:00:00",
order_by="timestamp",
limit=100,
)
assert len(data["rows"]) == 2
from dateutil import parser
timestamps = [parser.parse(row[0]).replace(tzinfo=None) for row in data["row
s"]]
assert timestamps == [
parser.parse("2024-01-02 00:00:00"),
parser.parse("2024-01-02 03:00:00"),
]
def test_order_by(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="value",
order_dir="DESC",
limit=100,
)
values = [row[2] for row in data["rows"]]
assert values == sorted(values, reverse=True)
def test_limit(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="timestamp",
limit=2,
)
assert len(data["rows"]) == 2
def test_simple_filter(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
filter_el = page.query_selector("#filters .filter:last-child")
assert filter_el
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": filter_el, "val": "user"},
)
val_input = filter_el.query_selector(".f-val")
val_input.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
data = page.evaluate("window.lastResults")
assert len(data["rows"]) == 2
assert all(row[3] == "alice" for row in data["rows"])
def test_default_filter_and_layout(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
count = page.evaluate("document.querySelectorAll('#filters .filter').length"
)
assert count == 1
last_is_button = page.evaluate(
"document.querySelector('#filters').lastElementChild.id === 'add_filter'
"
)
assert last_is_button
position = page.evaluate(
"getComputedStyle(document.querySelector('#filters .filter button.remove
')).position"
)
assert position == "static"
def test_header_and_tabs(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
header = page.text_content("#header")
assert "sample.csv" in header
assert "events" in header
assert page.is_visible("#settings")
assert page.is_hidden("#columns")
page.click("text=Columns")
assert page.is_visible("#columns")
cols = [c.strip() for c in page.locator("#column_groups li").all_inner_texts
()]
assert "timestamp" in cols
assert "event" in cols
page.click("text=View Settings")
assert page.is_visible("#settings")
btn_color = page.evaluate(
"getComputedStyle(document.querySelector('#dive')).backgroundColor"
)
assert "rgb(0, 128, 0)" == btn_color
sidebar_overflow = page.evaluate(
"getComputedStyle(document.querySelector('#sidebar')).overflowY"
)
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '160,320p' tests/test_web.py
)
view_overflow = page.evaluate(
"getComputedStyle(document.querySelector('#view')).overflowY"
)
assert sidebar_overflow == "auto"
assert view_overflow == "auto"
def test_graph_type_table_fields(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "table")
assert page.is_visible("#group_by_field")
assert page.is_visible("#aggregate_field")
assert page.is_visible("#show_hits_field")
page.click("text=Columns")
assert not page.is_visible("text=Strings:")
def test_help_and_alignment(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
titles = page.evaluate(
"Array.from(document.querySelectorAll('#settings .help')).map(e => e.tit
le)"
)
assert any("start/end of the time range" in t for t in titles)
text_align = page.evaluate(
"getComputedStyle(document.querySelector('#settings label')).textAlign"
)
assert text_align == "right"
def test_table_sorting(page: Any, server_url: str) -> None:
run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="timestamp",
order_dir="ASC",
limit=100,
)
# header alignment
align = page.evaluate(
"getComputedStyle(document.querySelector('#results th')).textAlign"
)
assert align == "right"
header = page.locator("#results th").nth(3)
def values() -> list[str]:
return page.locator("#results td:nth-child(4)").all_inner_texts()
orig_rows = values()
assert orig_rows == ["alice", "bob", "alice", "charlie"]
first_sql = page.evaluate("window.lastResults.sql")
header.click()
assert values() == sorted(orig_rows)
assert header.inner_text().endswith("▲")
color = page.evaluate(
"getComputedStyle(document.querySelector('#results th:nth-child(4)')).co
lor"
)
assert "0, 0, 255" in color
assert page.evaluate("window.lastResults.sql") == first_sql
header.click()
assert values() == sorted(orig_rows, reverse=True)
assert header.inner_text().endswith("▼")
header.click()
assert values() == orig_rows
assert header.inner_text() == "user"
color = page.evaluate(
"getComputedStyle(document.querySelector('#results th:nth-child(4)')).co
lor"
)
assert "0, 0, 255" not in color
def test_relative_dropdown(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
btn = page.query_selector('[data-target="start-select"]')
assert btn
btn.click()
page.click("#start-select div:text('-3 hours')")
assert page.input_value("#start") == "-3 hours"
def test_end_dropdown_now(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click('[data-target="end-select"]')
page.click("#end-select div:text('now')")
assert page.input_value("#end") == "now"
def test_invalid_time_error_shown(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="nonsense",
end="now",
order_by="timestamp",
)
assert "error" in data
msg = page.text_content("#view")
assert "nonsense" in msg
def test_query_error_shown(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="timestamp",
group_by=["user"],
aggregate="Avg",
)
assert "error" in data
msg = page.text_content("#view")
assert "Aggregate avg" in msg
def test_column_toggle_and_selection(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.wait_for_selector("#column_groups input", state="attached")
count = page.evaluate(
"document.querySelectorAll('#column_groups input:checked').length"
)
assert count == 4
page.click("#columns_none")
count = page.evaluate(
"document.querySelectorAll('#column_groups input:checked').length"
)
assert count == 0
page.click("#columns_all")
count = page.evaluate(
"document.querySelectorAll('#column_groups input:checked').length"
)
assert count == 4
page.uncheck("#column_groups input[value='value']")
page.click("text=View Settings")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-02 00:00:00")
select_value(page, "#order_by", "timestamp")
page.fill("#limit", "10")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
data = page.evaluate("window.lastResults")
assert len(data["rows"][0]) == 3
headers = page.locator("#results th").all_inner_texts()
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '320,640p' tests/test_web.py
headers = page.locator("#results th").all_inner_texts()
assert "value" not in headers
def test_columns_links_alignment(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.wait_for_selector("#column_groups input", state="attached")
tag = page.evaluate("document.getElementById('columns_all').tagName")
assert tag == "A"
align = page.evaluate(
"getComputedStyle(document.querySelector('#column_actions')).textAlign"
)
assert align == "right"
def test_column_group_links(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.wait_for_selector("#column_groups a", state="attached")
tag = page.evaluate("document.querySelector('#column_groups .col-group a').t
agName")
assert tag == "A"
def test_column_group_links_float_right(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.wait_for_selector("#column_groups .col-group .links", state="attached")
float_val = page.evaluate(
"getComputedStyle(document.querySelector('#column_groups .col-group .lin
ks')).float"
)
assert float_val == "right"
def test_chip_dropdown_navigation(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.wait_for_selector("#filters .filter:last-child .chip-dropdown div")
page.keyboard.type("ali")
page.wait_for_selector("text=alice")
page.keyboard.press("ArrowDown")
page.keyboard.press("Enter")
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips == ["ali"]
page.click("#filters .filter:last-child .chip .x")
page.wait_for_selector(".chip", state="detached")
def test_chip_copy_and_paste(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.evaluate(
"Object.defineProperty(navigator, 'clipboard', {value:{ _data: '', write
Text(t){ this._data = t; }, readText(){ return Promise.resolve(this._data); } }}
)"
)
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
page.keyboard.type("bob")
page.keyboard.press("Enter")
f.query_selector(".chip-copy").click()
assert page.evaluate("navigator.clipboard._data") == "alice,bob"
page.evaluate(
"var f=document.querySelector('#filters .filter:last-child'); f.chips=[]
; f.querySelectorAll('.chip').forEach(c=>c.remove())"
)
page.wait_for_selector("#filters .chip", state="detached")
inp.click()
page.evaluate(
"var dt=new DataTransfer(); dt.setData('text/plain','alice,bob'); var e=
new ClipboardEvent('paste',{clipboardData:dt}); document.querySelector('#filters
.filter:last-child .f-val').dispatchEvent(e);"
)
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips[:2] == ["alice", "bob"]
page.evaluate(
"var f=document.querySelector('#filters .filter:last-child'); f.chips=[]
; f.querySelectorAll('.chip').forEach(c=>c.remove())"
)
page.wait_for_selector("#filters .chip", state="detached")
inp.click()
page.evaluate(
"var dt=new DataTransfer(); dt.setData('text/plain','alice,bob'); var e=
new ClipboardEvent('paste',{clipboardData:dt}); Object.defineProperty(e,'shiftKe
y',{value:true}); document.querySelector('#filters .filter:last-child .f-val').d
ispatchEvent(e);"
)
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips[-1] == "alice,bob"
...
page.wait_for_selector("#order_by option", state="attached")
page.wait_for_function("window.lastResults !== undefined")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-02 00:00:00")
page.fill("#limit", "1")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
first_url = page.url
first_rows = page.evaluate("window.lastResults.rows.length")
page.fill("#limit", "2")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
second_url = page.url
second_rows = page.evaluate("window.lastResults.rows.length")
assert second_rows != first_rows
assert first_url != second_url
page.go_back()
page.wait_for_function("window.lastResults !== undefined")
assert page.url == first_url
assert page.evaluate("window.lastResults.rows.length") == first_rows
def test_load_from_url(page: Any, server_url: str) -> None:
url = (
f"{server_url}?start=2024-01-01%2000:00:00&end=2024-01-02%2000:00:00"
"&order_by=timestamp&limit=2"
)
page.goto(url)
page.wait_for_selector("#order_by option", state="attached")
page.wait_for_function("window.lastResults !== undefined")
assert page.input_value("#start") == "2024-01-01 00:00:00"
assert page.input_value("#end") == "2024-01-02 00:00:00"
assert page.input_value("#limit") == "2"
assert page.evaluate("window.lastResults.rows.length") == 2
def test_empty_data_message(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2025-01-01 00:00:00",
end="2025-01-02 00:00:00",
order_by="timestamp",
limit=100,
)
assert data["rows"] == []
msg = page.text_content("#view")
assert "Empty data provided to table" in msg
def test_group_by_chip_from_url(page: Any, server_url: str) -> None:
url = f"{server_url}?graph_type=table&group_by=user&order_by=user&limit=10"
page.goto(url)
page.wait_for_selector("#group_by_field .chip", state="attached")
chips = page.evaluate(
"Array.from(document.querySelectorAll('#group_by_field .chip')).map(c =>
c.firstChild.textContent)"
)
assert chips == ["user"]
def test_group_by_autocomplete(page: Any, server_url: str) -> None:
page.goto(f"{server_url}?graph_type=table")
page.wait_for_selector("#group_by_field", state="visible")
inp = page.query_selector("#group_by_field .f-val")
assert inp
inp.click()
page.keyboard.type("us")
page.wait_for_selector("#group_by_field .chip-dropdown div")
options = page.locator("#group_by_field .chip-dropdown div").all_inner_texts
()
assert "user" in options
def test_group_by_copy_icon(page: Any, server_url: str) -> None:
page.goto(f"{server_url}?graph_type=table")
page.wait_for_selector("#group_by_field", state="visible")
icon = page.text_content("#group_by_field .chip-copy")
assert icon == "⎘"
def test_group_by_input_no_border(page: Any, server_url: str) -> None:
page.goto(f"{server_url}?graph_type=table")
page.wait_for_selector("#group_by_field", state="visible")
border = page.evaluate(
"getComputedStyle(document.querySelector('#group_by_field .f-val')).bord
erStyle"
)
assert border == "none"
def test_table_group_by_query(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="timestamp",
limit=100,
group_by=["user"],
aggregate="Count",
)
assert "error" not in data
assert len(data["rows"]) == 3
def test_table_avg_no_group_by(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
aggregate="Avg",
)
assert len(data["rows"]) == 1
row = data["rows"][0]
assert row[0] == 4
from dateutil import parser
ts = parser.parse(row[1]).replace(tzinfo=None)
assert ts == parser.parse("2024-01-01 13:00:00")
assert row[2] == 25
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '640,960p' tests/test_web.py
The tests go up to line 638, but there's nothing after 640. Opening test_server.py now.
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '1,160p' tests/test_server.py
from __future__ import annotations
import json
from pathlib import Path
import duckdb
from scubaduck import server
import pytest
def test_basic_query() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-02 00:00:00",
"order_by": "timestamp",
"order_dir": "ASC",
"limit": 10,
"columns": ["timestamp", "event", "value", "user"],
"filters": [],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert data
rows = data["rows"]
# We expect first three rows (until 2024-01-02 00:00:00)
assert len(rows) == 3
assert rows[0][1] == "login"
assert rows[1][1] == "logout"
def test_filter_multi_token() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-02 03:00:00",
"order_by": "timestamp",
"limit": 10,
"columns": ["timestamp", "event", "value", "user"],
"filters": [{"column": "user", "op": "=", "value": ["alice", "charlie"]}
],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert data
rows = data["rows"]
# Should only return rows for alice and charlie
assert len(rows) == 3
assert rows[0][3] == "alice"
assert rows[-1][3] == "charlie"
def test_empty_filter_is_noop() -> None:
app = server.app
client = app.test_client()
base_payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"order_by": "timestamp",
"limit": 100,
"columns": ["timestamp", "event", "value", "user"],
}
no_filter = {**base_payload, "filters": []}
empty_filter = {
**base_payload,
"filters": [{"column": "user", "op": "=", "value": None}],
}
rv1 = client.post(
"/api/query", data=json.dumps(no_filter), content_type="application/json
"
)
rv2 = client.post(
"/api/query", data=json.dumps(empty_filter), content_type="application/j
son"
)
rows1 = rv1.get_json()["rows"]
rows2 = rv2.get_json()["rows"]
assert rows1 == rows2
def test_select_columns() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"order_by": "timestamp",
"limit": 10,
"columns": ["timestamp", "user"],
"filters": [],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert data
rows = data["rows"]
assert len(rows[0]) == 2
assert rows[0][1] == "alice"
def test_string_filter_ops() -> None:
app = server.app
client = app.test_client()
base = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"order_by": "timestamp",
"limit": 100,
"columns": ["timestamp", "event", "value", "user"],
}
contains = {
**base,
"filters": [{"column": "user", "op": "contains", "value": "ali"}],
}
rv = client.post(
"/api/query", data=json.dumps(contains), content_type="application/json"
)
rows = rv.get_json()["rows"]
assert all("ali" in r[3] for r in rows)
regex = {
**base,
"filters": [{"column": "user", "op": "~", "value": "^a.*"}],
}
rv = client.post(
"/api/query", data=json.dumps(regex), content_type="application/json"
)
rows = rv.get_json()["rows"]
assert all(r[3].startswith("a") for r in rows)
assert len(rows) == 2
not_empty = {**base, "filters": [{"column": "user", "op": "!empty"}]}
rv = client.post(
"/api/query", data=json.dumps(not_empty), content_type="application/json
"
)
assert len(rv.get_json()["rows"]) == 4
def _make_payload() -> dict[str, object]:
return {
"start": "2024-01-01 00:00:00",
"end": "2024-01-02 00:00:00",
"order_by": "timestamp",
"order_dir": "ASC",
"limit": 10,
"columns": ["timestamp", "event", "value", "user"],
"filters": [],
}
def test_database_types(tmp_path: Path) -> None:
csv_file = tmp_path / "events.csv"
csv_file.write_text(Path("scubaduck/sample.csv").read_text())
import sqlite3
conn = sqlite3.connect(sqlite_file)
conn.execute(
"CREATE TABLE events (timestamp TEXT, event TEXT, value INTEGER, user TE
XT)"
)
with open(csv_file) as f:
next(f)
for line in f:
ts, ev, val, user = line.strip().split(",")
conn.execute(
"INSERT INTO events VALUES (?, ?, ?, ?)", (ts, ev, int(val), use
r)
)
conn.commit()
conn.close() # pyright: ignore[reportUnknownMemberType, reportAttributeAcce
ssIssue]
duckdb_file = tmp_path / "events.duckdb"
con = duckdb.connect(duckdb_file)
con.execute(
f"CREATE TABLE events AS SELECT * FROM read_csv_auto('{csv_file.as_posix
()}')"
)
con.close() # pyright: ignore[reportUnknownMemberType, reportAttributeAcces
sIssue]
for db in (csv_file, sqlite_file, duckdb_file):
app = server.create_app(db)
client = app.test_client()
payload = _make_payload()
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/js
on"
)
rows = rv.get_json()["rows"]
assert len(rows) == 3
def test_group_by_table() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"graph_type": "table",
"order_by": "user",
"limit": 10,
"columns": ["value"],
"group_by": ["user"],
"aggregate": "Sum",
"show_hits": True,
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
rows = rv.get_json()["rows"]
assert rows[0][0] == "alice"
assert rows[0][1] == 2
assert rows[0][2] == 40
def test_relative_time_query(monkeypatch: pytest.MonkeyPatch) -> None:
app = server.app
client = app.test_client()
from datetime import datetime
fixed_now = datetime(2024, 1, 2, 4, 0, 0)
class FixedDateTime(datetime):
@classmethod
def now(cls, tz=None): # type: ignore[override]
return fixed_now if tz is None else fixed_now.astimezone(tz)
monkeypatch.setattr(server, "datetime", FixedDateTime)
payload = {
"start": "-1 hour",
"end": "now",
"order_by": "timestamp",
"limit": 100,
"columns": ["timestamp", "event", "value", "user"],
"filters": [],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert rv.status_code == 200
assert len(data["rows"]) == 1
assert data["rows"][0][3] == "charlie"
def test_invalid_time_error() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "nonsense",
"end": "now",
"order_by": "timestamp",
"limit": 10,
"columns": ["timestamp"],
"filters": [],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert rv.status_code == 400
assert "error" in data
def test_query_error_returns_sql_and_traceback() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"columns": ["event"],
"group_by": ["user"],
"aggregate": "avg",
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert rv.status_code == 400
assert "error" in data
def test_table_unknown_column_error() -> None:
app = server.app
client = app.test_client()
payload = {
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"graph_type": "table",
"order_by": "timestamp",
"limit": 100,
"columns": ["user", "Hits", "value"],
"group_by": ["user"],
"aggregate": "Count",
"show_hits": True,
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert rv.status_code == 400
assert "Unknown column" in data["error"]
def test_samples_view_rejects_group_by() -> None:
app = server.app
client = app.test_client()
payload = {
"graph_type": "samples",
"group_by": ["user"],
"columns": ["timestamp"],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
I'll take a look at the README to see if there are any instructions for tests.
I really like Scuba (Meta's internal real-time database system). The distributed
, real-time database part of Scuba is quite difficult (and expensive) to replica
te, but I also really like Scuba's UI for doing queries, and I have found myself
wishing that I have access to it even for "small" databases, e.g., I have a sql
ite dataset I want to explore.
Pivotal ideas:
* Time series by default. In the dedicated "time series" view, there are many fe
atures specifically oriented towards working towards tables that represent event
s that occurred over time: the start, end, compare, aggregate and granularity fi
elds all specially privilege the timestamp field. In fact, you can't log events
to Scuba's backing data store without a timestamp, they always come with one. (S
cuba also supports other views that don't presuppose a time series, but the time
series is the most beloved and well used view.) This is in contrast to typical
software which tries to generalize to arbitrary data first, with time series bei
ng added on later.
* It's all about exploration. Scuba is predicated on the idea that you don't kno
w what you're looking for, that you are going to spend time tweaking queries and
changing filters/grouping as part of an investigation to figure out why a syste
m behaves the way it is. So the filters/comparisons/groupings you want to edit a
re always visible on the left sidebar, with the expectation that you're going to
tweak the query to look at something else. Similarly, all the parameters of you
r query get saved into your URL, so your browser history can double up as a quer
y history / you can easily share a query with someone else. This is contrast to
typical software which is often oriented to making pretty dashboards and reports
. (This function is important too, but it's not what I want in exploration mode!
)
* You can fix data problems in the query editor. It's pretty common to have mess
ed up and ended up with a database that doesn't have exactly the columns you nee
d, or some columns that are corrupted in some way. Scuba has pretty robust suppo
rt for defining custom columns with arbitrary SQL functions, grouping over them
as if they were native functions, and doing so with minimal runtime cost (Scuba
aims to turn around your query in milliseconds!) Having to go and run a huge dat
a pipeline to fix your data is a big impediment to exploration; quick and easy c
ustom columns means you can patch over problems when you're investigating and fi
x them for real later.
We're going to build a exploratory data analysis tool like Scuba for time series
database (i.e., a database with a mandatory timestamp representing the time an
event occurred). We'll use DuckDB as the underlying SQL engine served from a Py
thon server, and render the GUI/results as a webpage with vanilla HTML and JS. W
e'll use choices.js to support token inputs. We define a token input to mean a
text input element where as you type a dropdown displays with valid values, and
if you select one or press enter, the selection turns into a token/chip that can
only be deleted as one unit.
To start, we are going to support one views: samples. The samples view only all
ows you to view individual samples from the database, subject to a filter. Our m
ain UI concept is that there is a left sidebar that is the query editor, and the
right side that shows the view. The sidebar is always visible and defaults to
the query parameters of the current view. After you make changes to the query,
clicking the "Dive" button updates the view. The URL of the page encodes all of
the values of the query (and gets updated when you Dive), so the browser's back
button lets you view previous queries.
The query editor's job is to generate a SQL query, which then is applied on the
database, and then the result visualized according to the view.
Here are the settings you can apply to the query. The help text should show up w
hen you mouse over the field name:
* Start/End - Help text: "Sets the start/end of the time range to query. Can be
any kind of datetime string. For example: 'April 23, 2014' or 'yesterday'." The
UI for this selector supports both relative selections (now, -1 hour, -3 hours,
-12 hours, -1 day, -3 days, -1 week, -1 fortnight, -30 days, -90 days) as well a
s specifying an absolute date. The way this field is rendered is there is a fre
e form text box, a drop down arrow (for the relative selectors), and then a cale
ndar button (for date selection).
* Order By - Help text: "Choose a column to sort results by." There is an ASC/D
ESC toggle next to it.
* Limit - Help text: "Choose the maximum number of results to show in the chart
after any aggregations have been applied. For example, a limit of 10 will show
no more than 10 rows for a table, etc."
* Filters - You can create as many filters as you want. You can either write a f
ilter using a UI or manual SQL. In the UI, filter consists of a column name, a r
elation (e.g., =, !=, <, >) and then a text field. The text field is a token inp
ut. It accepts multiple tokens for = relation, in which case we match using an O
R for all options.
There is also a "Columns" tab which lets you view all fields in the table, organ
ized by their type. You can also define derived columns, by specifying a column
name and SQL expression. Derived columns can be used for all parts of the UI, in
cluding filters/group by/etc. Columns have checkboxes indicating if we should SE
LECT them or not. Each selected column shows up in the graph. There is an All/N
one link which can be used to select/deselect all checkboxes.
The query UI constructs a SQL query that intuitively has this form:
```
SELECT column, column, ...,
FROM table
WHERE time >= min-timestamp
AND time <= max-timestamp
[AND condition ...]
ORDER BY aggregate(column)
LIMIT number
```
You should write tests for the server backend, demonstrating that at specific qu
ery values we get back the correct rows of data.
The README is lengthy, so I’m skipping ahead to check the test-running instructions.
root@79a0f51f0ce9:/workspace/scubaduck# grep -n "tests" -n README.md
38:You should write tests for the server backend, demonstrating that at specific
query values we get back the correct rows of data.
The README has general info, while the scubaduck folder might contain specific code.
root@79a0f51f0ce9:/workspace/scubaduck# ls scubaduck
__init__.py sample.csv server.py static
root@79a0f51f0ce9:/workspace/scubaduck# ls scubaduck/static
index.html
root@79a0f51f0ce9:/workspace/scubaduck# cat scubaduck/static/index.html | head -
n 40
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ScubaDuck</title>
<style>
body { margin: 0; font-family: sans-serif; height: 100vh; display: flex; fle
x-direction: column; }
#header { padding: 10px; font-weight: bold; border-bottom: 1px solid #ccc; }
#content { flex: 1; display: flex; height: calc(100vh - 42px); overflow: hid
den; }
#sidebar { width: 450px; padding: 10px; border-right: 3px solid #ccc; overfl
ow-y: auto; display: flex; flex-direction: column; box-sizing: border-box; }
#sidebar-resizer { width: 5px; cursor: col-resize; background: #ccc; }
#view { flex: 1; padding: 10px; overflow-y: auto; overflow-x: auto; }
.field { display: flex; align-items: center; margin-bottom: 10px; }
.field label { width: 80px; text-align: right; margin-right: 5px; }
.help { margin-left: 4px; cursor: help; }
.rel-btn { margin-left: 4px; }
#tabs { display: flex; align-items: center; margin-bottom: 10px; }
#tabs .tab { margin-right: 5px; background: none; border: 1px solid #ccc; pa
dding: 4px 8px; cursor: pointer; width: 120px; text-align: center; box-sizing: b
order-box; }
#tabs .tab.active { background: #eee; font-weight: bold; }
#dive { margin-left: auto; background: green; color: white; border: none; pa
dding: 5px 10px; cursor: pointer; }
.tab-content { display: none; }
.tab-content.active { display: block; }
#filter_list { display: flex; flex-direction: column; }
#filters .filter {
border: 1px solid #ccc;
padding: 5px;
margin-bottom: 5px;
position: relative;
display: flex;
flex-direction: column;
}
#filters .filter-row { display: flex; margin-bottom: 5px; }
#filters .filter-row .f-col { flex: 1; }
#filters .filter-row .f-op {
margin-left: 5px;
width: fit-content;
flex: 0 0 auto;
}
.chip-input input {
border: none;
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '40,160p' scubaduck/static/index.
html
border: none;
flex: 1;
min-width: 60px;
margin: 2px;
outline: none;
}
.chip-box { position: relative; }
.chip-input { display: flex; flex-wrap: wrap; border: 1px solid #ccc; paddin
g: 2px; min-height: 24px; }
.chip { background: #eee; border: 1px solid #999; padding: 2px 4px; margin:
2px; border-radius: 3px; display: flex; align-items: center; }
.chip .x { margin-left: 4px; cursor: pointer; }
.chip-copy { margin-left: 4px; cursor: pointer; background: none; border: no
ne; }
.chip-dropdown { position: absolute; left: 0; right: 0; top: 100%; backgroun
d: white; border: 1px solid #ccc; max-height: 120px; overflow-y: auto; z-index:
10; display: none; }
.chip-dropdown div { padding: 2px 4px; cursor: pointer; }
.chip-dropdown div.highlight { background: #bde4ff; }
.rel-box { position: relative; display: flex; }
.rel-dropdown { position: absolute; left: 0; right: 0; top: 100%; background
: white; border: 1px solid #ccc; z-index: 10; display: none; }
.rel-dropdown div { padding: 2px 4px; cursor: pointer; }
.rel-dropdown div:hover { background: #bde4ff; }
.dropdown { position: relative; display: inline-block; }
.dropdown-display {
border: 1px solid #ccc;
padding: 2px 18px 2px 4px;
cursor: pointer;
min-width: 80px;
position: relative;
}
.dropdown-display::after {
content: '\25BC';
position: absolute;
right: 4px;
pointer-events: none;
}
.dropdown-menu { position: absolute; left: 0; right: 0; top: 100%; backgroun
d: white; border: 1px solid #ccc; z-index: 10; max-height: 160px; overflow-y: au
to; display: none; }
.dropdown-menu input { width: 100%; box-sizing: border-box; padding: 2px 4px
; border: none; border-bottom: 1px solid #ccc; }
.dropdown-menu div { padding: 2px 4px; cursor: pointer; }
.dropdown-menu div.selected { background: #bde4ff; }
.dropdown-menu .option:hover { background: #eee; }
.dropdown-menu input::placeholder { color: #999; }
#filters .filter button.remove {
margin-left: 5px;
width: 20px;
flex: 0 0 auto;
padding: 0;
text-align: center;
line-height: 1;
}
#filters h4 { margin: 0 0 5px 0; }
table { border-collapse: collapse; min-width: 100%; }
th, td { border: 1px solid #ccc; padding: 4px; box-sizing: border-box; }
th { text-align: left; cursor: pointer; position: relative; }
th.sorted { color: blue; }
tr:nth-child(even) td { background: #f9f9f9; }
tr.selected td { background: #bde4ff !important; }
tr:hover:not(.selected) td { background: #eee; }
#column_actions {
text-align: right;
margin-bottom: 5px;
}
#column_actions a {
margin-left: 5px;
}
.col-group-header {
overflow: hidden;
}
.col-group-header .links {
float: right;
}
.col-group-header .links a {
margin-left: 5px;
}
/* Column resizer removed */
</style>
</head>
<body>
<div id="header">sample.csv - events <select id="graph_type"><option value="sa
mples">Samples</option><option value="table">Table</option></select></div>
<div id="content">
<div id="sidebar">
<div id="tabs">
<button class="tab active" data-tab="settings">View Settings</button>
<button class="tab" data-tab="columns">Columns</button>
<button id="dive" onclick="dive()">Dive</button>
</div>
<div id="settings" class="tab-content active">
<div class="field">
<label>Start<span class="help" title="Sets the start/end of the time r
ange to query. Can be any kind of datetime string. For example: 'April 23, 2014'
or 'yesterday'.">[?]</span></label>
<div class="rel-box">
<input id="start" type="text" />
<button type="button" class="rel-btn" data-target="start-select">	
660;</button>
<div id="start-select" class="rel-dropdown" data-input="start">
<div data-value="-1 hour">-1 hour</div>
<div data-value="-3 hours">-3 hours</div>
<div data-value="-12 hours">-12 hours</div>
<div data-value="-1 day">-1 day</div>
<div data-value="-3 days">-3 days</div>
<div data-value="-1 week">-1 week</div>
<div data-value="-1 fortnight">-1 fortnight</div>
<div data-value="-30 days">-30 days</div>
<div data-value="-90 days">-90 days</div>
</div>
</div>
</div>
<div class="field">
<label>End<span class="help" title="Sets the start/end of the time ran
ge to query. Can be any kind of datetime string. For example: 'April 23, 2014' o
r 'yesterday'.">[?]</span></label>
<div class="rel-box">
<input id="end" type="text" />
<button type="button" class="rel-btn" data-target="end-select">φ
0;</button>
<div id="end-select" class="rel-dropdown" data-input="end">
<div data-value="now">now</div>
<div data-value="-1 hour">-1 hour</div>
<div data-value="-3 hours">-3 hours</div>
<div data-value="-12 hours">-12 hours</div>
<div data-value="-1 day">-1 day</div>
<div data-value="-3 days">-3 days</div>
<div data-value="-1 week">-1 week</div>
<div data-value="-1 fortnight">-1 fortnight</div>
<div data-value="-30 days">-30 days</div>
<div data-value="-90 days">-90 days</div>
</div>
</div>
</div>
<div class="field">
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '160,320p' scubaduck/static/index
.html
<div class="field">
<label>Order By<span class="help" title="Choose a column to sort resul
ts by.">[?]</span></label>
<select id="order_by"></select>
<button id="order_dir" type="button">ASC \u25B2</button>
</div>
<div class="field">
<label>Limit<span class="help" title="Choose the maximum number of res
ults to show in the chart after any aggregations have been applied. For example,
a limit of 10 will show no more than 10 rows for a table, etc.">[?]</span></lab
el>
<input id="limit" type="number" value="100" />
</div>
<div id="group_by_field" class="field" style="display:none;">
<label>Group By</label>
<div class="chip-box">
<div class="chip-input">
<input id="group_by" class="f-val" type="text">
<button type="button" class="chip-copy">⎘</button>
</div>
<div class="chip-dropdown"></div>
</div>
</div>
<div id="aggregate_field" class="field" style="display:none;">
<label>Aggregate</label>
<select id="aggregate">
<option>Avg</option>
<option>Count</option>
<option>Sum</option>
<option>Min</option>
<option>Max</option>
<option>Count Distinct</option>
<option>p5</option>
<option>p25</option>
<option>p50</option>
<option>p70</option>
<option>p75</option>
<option>p90</option>
<option>p95</option>
<option>p99</option>
<option>p99.9</option>
<option>p99.99</option>
</select>
</div>
<div id="show_hits_field" class="field" style="display:none;">
<label>Show Hits</label>
<input id="show_hits" type="checkbox" checked>
</div>
<div id="filters">
<h4>Filters<span class="help" title="You can create as many filters as
you want. You can either write a filter using a UI or manual SQL. In the UI, fi
lter consists of a column name, a relation (e.g., =, !=, <, >) and then a text f
ield. The text field is a token input. It accepts multiple tokens for = relation
, in which case we match using an OR for all options.">[?]</span></h4>
<div id="filter_list"></div>
<button id="add_filter" type="button" onclick="addFilter()">Add Filter
</button>
</div>
<div id="query_info" style="margin-top:10px;"></div>
</div>
<div id="columns" class="tab-content">
<div id="column_actions">
<a id="columns_all" href="#">All</a>
<a id="columns_none" href="#">None</a>
</div>
<div id="column_groups"></div>
</div>
</div>
<div id="sidebar-resizer"></div>
<div id="view">
<table id="results"></table>
</div>
</div>
<script>
const allColumns = [];
const columnTypes = {};
const stringColumns = [];
const integerColumns = [];
const timeColumns = [];
let selectedColumns = [];
let displayType = 'samples';
let groupBy = {chips: [], addChip: () => {}, renderChips: () => {}};
function initDropdown(select) {
const wrapper = document.createElement('div');
wrapper.className = 'dropdown';
select.parentNode.insertBefore(wrapper, select);
wrapper.appendChild(select);
select.style.display = 'none';
const disp = document.createElement('div');
disp.className = 'dropdown-display';
function updateDisplay() {
const opt = select.options[select.selectedIndex];
disp.textContent = opt ? opt.textContent : '';
}
updateDisplay();
wrapper.appendChild(disp);
const menu = document.createElement('div');
menu.className = 'dropdown-menu';
const search = document.createElement('input');
search.placeholder = 'Search';
menu.appendChild(search);
const list = document.createElement('div');
menu.appendChild(list);
wrapper.appendChild(menu);
function close() {
menu.style.display = 'none';
}
function open() {
renderOptions();
menu.style.display = 'block';
search.focus();
}
disp.addEventListener('click', () => {
if (menu.style.display === 'block') {
close();
} else {
open();
}
});
document.addEventListener('click', e => {
if (!wrapper.contains(e.target)) {
close();
}
});
function renderOptions() {
const q = search.value.toLowerCase();
list.innerHTML = '';
Array.from(select.options).forEach(o => {
if (!o.textContent.toLowerCase().includes(q)) return;
const div = document.createElement('div');
div.className = 'option';
if (q) {
const text = o.textContent;
const idx = text.toLowerCase().indexOf(q);
if (idx !== -1) {
div.innerHTML =
text.slice(0, idx) +
'<u>' +
text.slice(idx, idx + q.length) +
'</u>' +
text.slice(idx + q.length);
} else {
div.textContent = text;
}
} else {
div.textContent = o.textContent;
}
if (o.value === select.value) div.classList.add('selected');
div.addEventListener('mousedown', evt => {
evt.preventDefault();
select.value = o.value;
select.dispatchEvent(new Event('change'));
updateDisplay();
close();
});
list.appendChild(div);
});
}
search.addEventListener('input', renderOptions);
select.addEventListener('change', updateDisplay);
}
// Sidebar resizing
const sidebar = document.getElementById('sidebar');
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '320,640p' scubaduck/static/index
.html
const sidebar = document.getElementById('sidebar');
const sidebarResizer = document.getElementById('sidebar-resizer');
let sidebarWidth = parseInt(localStorage.getItem('sidebarWidth') || 450, 10);
sidebar.style.width = sidebarWidth + 'px';
let sidebarResize = false;
function startSidebarDrag(e) {
e.preventDefault();
sidebarResize = true;
document.addEventListener('mousemove', onSidebarDrag);
document.addEventListener('mouseup', stopSidebarDrag);
}
function onSidebarDrag(e) {
if (!sidebarResize) return;
sidebarWidth = Math.max(200, e.clientX - sidebar.getBoundingClientRect().left)
;
sidebar.style.width = sidebarWidth + 'px';
}
function stopSidebarDrag() {
document.removeEventListener('mousemove', onSidebarDrag);
document.removeEventListener('mouseup', stopSidebarDrag);
sidebarResize = false;
localStorage.setItem('sidebarWidth', sidebarWidth);
}
sidebarResizer.addEventListener('mousedown', startSidebarDrag);
let orderDir = 'ASC';
const orderDirBtn = document.getElementById('order_dir');
const graphTypeSel = document.getElementById('graph_type');
function updateOrderDirButton() {
orderDirBtn.textContent = orderDir + (orderDir === 'ASC' ? ' \u25B2' : ' \u25B
C');
}
function updateDisplayTypeUI() {
const show = graphTypeSel.value === 'table';
document.getElementById('group_by_field').style.display = show ? 'flex' : 'non
e';
document.getElementById('aggregate_field').style.display = show ? 'flex' : 'no
ne';
document.getElementById('show_hits_field').style.display = show ? 'flex' : 'no
ne';
document.querySelectorAll('#column_groups .col-group').forEach(g => {
if (g.querySelector('.col-group-header').textContent.startsWith('Strings'))
{
g.style.display = show ? 'none' : '';
}
});
displayType = graphTypeSel.value;
}
orderDirBtn.addEventListener('click', () => {
orderDir = orderDir === 'ASC' ? 'DESC' : 'ASC';
updateOrderDirButton();
});
updateOrderDirButton();
graphTypeSel.addEventListener('change', updateDisplayTypeUI);
fetch('/api/columns').then(r => r.json()).then(cols => {
const orderSelect = document.getElementById('order_by');
const groupsEl = document.getElementById('column_groups');
const groups = {
time: {name: 'Time', cols: [], ul: null},
integer: {name: 'Integers', cols: [], ul: null},
string: {name: 'Strings', cols: [], ul: null}
};
cols.forEach(c => {
const t = c.type.toUpperCase();
columnTypes[c.name] = c.type;
allColumns.push(c.name);
let g = 'string';
if (t.includes('INT')) g = 'integer';
if (t.includes('TIMESTAMP')) g = 'time';
groups[g].cols.push(c.name);
if (g !== 'string') {
const o = document.createElement('option');
o.value = c.name;
o.textContent = c.name;
orderSelect.appendChild(o);
}
});
Object.keys(groups).forEach(key => {
const g = groups[key];
const div = document.createElement('div');
div.className = 'col-group';
const header = document.createElement('div');
header.className = 'col-group-header';
header.appendChild(document.createTextNode(g.name + ': '));
const links = document.createElement('span');
links.className = 'links';
const allBtn = document.createElement('a');
allBtn.href = '#';
allBtn.textContent = 'All';
const noneBtn = document.createElement('a');
noneBtn.href = '#';
noneBtn.textContent = 'None';
links.appendChild(allBtn);
links.appendChild(noneBtn);
header.appendChild(links);
div.appendChild(header);
const ul = document.createElement('ul');
g.ul = ul;
g.cols.forEach(name => {
const li = document.createElement('li');
const label = document.createElement('label');
const cb = document.createElement('input');
cb.type = 'checkbox';
cb.value = name;
cb.checked = true;
cb.addEventListener('change', updateSelectedColumns);
label.appendChild(cb);
label.appendChild(document.createTextNode(' ' + name));
li.appendChild(label);
ul.appendChild(li);
});
allBtn.addEventListener('click', e => {
e.preventDefault();
ul.querySelectorAll('input').forEach(cb => (cb.checked = true));
updateSelectedColumns();
});
noneBtn.addEventListener('click', e => {
e.preventDefault();
ul.querySelectorAll('input').forEach(cb => (cb.checked = false));
updateSelectedColumns();
});
div.appendChild(ul);
...
}
function isTimeColumn(name) {
const t = (columnTypes[name] || '').toUpperCase();
return t.includes('TIMESTAMP');
}
function initChipInput(filter, fetchOptions) {
const input = filter.querySelector('.f-val');
const chipsEl = filter.querySelector('.chip-input');
const dropdown = filter.querySelector('.chip-dropdown');
const copyBtn = filter.querySelector('.chip-copy');
const chips = [];
filter.chips = chips;
filter.renderChips = renderChips;
filter.addChip = addChip;
let highlight = 0;
chipsEl.addEventListener('click', () => {
input.focus();
});
function renderChips() {
chipsEl.querySelectorAll('.chip').forEach(c => c.remove());
chips.forEach((v, i) => {
const span = document.createElement('span');
span.className = 'chip';
span.textContent = v;
const x = document.createElement('span');
x.className = 'x';
x.textContent = '✖';
x.addEventListener('click', () => {
chips.splice(i, 1);
renderChips();
});
span.appendChild(x);
chipsEl.insertBefore(span, input);
});
}
function hideDropdown() {
dropdown.style.display = 'none';
}
function showDropdown() {
dropdown.style.display = 'block';
}
function updateHighlight() {
Array.from(dropdown.children).forEach((c, i) => {
c.classList.toggle('highlight', i === highlight);
});
}
function addChip(val) {
if (!val) return;
chips.push(val);
input.value = '';
renderChips();
}
copyBtn.addEventListener('click', () => {
navigator.clipboard && navigator.clipboard.writeText(chips.join(','));
});
input.addEventListener('paste', e => {
e.preventDefault();
const text = e.clipboardData.getData('text');
if (e.shiftKey) {
addChip(text.trim());
} else {
text.split(',').forEach(t => addChip(t.trim()));
}
hideDropdown();
});
input.addEventListener('keydown', e => {
if (e.key === 'ArrowDown') {
if (dropdown.style.display !== 'none') {
highlight = Math.min(highlight + 1, dropdown.children.length - 1);
updateHighlight();
}
e.preventDefault();
} else if (e.key === 'ArrowUp') {
if (dropdown.style.display !== 'none') {
highlight = Math.max(highlight - 1, 0);
updateHighlight();
}
e.preventDefault();
} else if (e.key === 'Backspace' && input.value === '') {
if (chips.length > 0) {
chips.pop();
renderChips();
}
hideDropdown();
} else if (e.key === 'Enter') {
if (dropdown.style.display !== 'none' && dropdown.children.length > 0) {
const val = dropdown.children[highlight].dataset.value;
if (val !== input.value.trim()) {
addChip(val);
} else {
addChip(input.value.trim());
}
} else {
addChip(input.value.trim());
}
hideDropdown();
e.preventDefault();
}
});
function renderDropdown(vals) {
dropdown.innerHTML = '';
const typed = input.value.trim();
if (typed) {
vals.splice(1, 0, typed);
}
vals.forEach((v, i) => {
const d = document.createElement('div');
d.textContent = v;
d.dataset.value = v;
d.addEventListener('mouseover', () => {
highlight = i;
updateHighlight();
I'll focus on relevant parts, like CSS styles for filters and their layout adjustments.
root@79a0f51f0ce9:/workspace/scubaduck# grep -n "filter-row" -n scubaduck/static
/index.html
32: #filters .filter-row { display: flex; margin-bottom: 5px; }
33: #filters .filter-row .f-col { flex: 1; }
34: #filters .filter-row .f-op {
682: <div class="filter-row">
I'm reviewing or opening about 680 lines of code right now.
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '680,720p' scubaduck/static/index
.html
container.className = 'filter';
container.innerHTML = `
<div class="filter-row">
<select class="f-col"></select>
<select class="f-op"></select>
<button type="button" class="remove" onclick="this.closest('.filter').remo
ve()">✖</button>
</div>
<div class="chip-box">
<div class="chip-input">
<input class="f-val" type="text">
<button type="button" class="chip-copy">⎘</button>
</div>
<div class="chip-dropdown"></div>
</div>
`;
const colSel = container.querySelector('.f-col');
colSel.innerHTML = allColumns.map(c => `<option value="${c}">${c}</option>`).j
oin('');
initDropdown(colSel);
function populateOps() {
const opSel = container.querySelector('.f-op');
const col = colSel.value;
const ops = isStringColumn(col)
? [
['=', '='],
['!=', '!='],
['~', 'matches regex'],
['!~', 'not matches regex'],
['contains', 'contains'],
['!contains', 'not contains'],
['empty', 'empty'],
['!empty', 'not empty'],
['LIKE', 'like'],
]
: [
['=', '='],
['!=', '!='],
['<', '<'],
['>', '>'],
];
opSel.innerHTML = ops.map(o => `<option value="${o[0]}">${o[1]}</option>`).j
oin('');
root@79a0f51f0ce9:/workspace/scubaduck# sed -n '720,760p' scubaduck/static/index
.html
opSel.innerHTML = ops.map(o => `<option value="${o[0]}">${o[1]}</option>`).j
oin('');
updateInputVis();
}
function updateInputVis() {
const op = container.querySelector('.f-op').value;
const box = container.querySelector('.chip-box');
box.style.display = op === 'empty' || op === '!empty' ? 'none' : 'block';
}
colSel.addEventListener('change', populateOps);
container.querySelector('.f-op').addEventListener('change', updateInputVis);
populateOps();
document.getElementById('filter_list').appendChild(container);
initChipInput(container, (typed, el) => {
const colSel = el.querySelector('.f-col');
if (!colSel) return [];
const col = colSel.value;
if (!isStringColumn(col)) return [];
return fetch(`/api/samples?column=${encodeURIComponent(col)}&q=${encodeURICo
mponent(typed)}`)
.then(r => r.json());
});
}
let lastQueryTime = 0;
let queryStart = 0;
function dive(push=true) {
const payload = collectParams();
if (push) {
history.pushState(payload, '', paramsToSearch(payload));
}
const view = document.getElementById('view');
view.innerHTML = '<p>Loading...</p>';
window.lastResults = undefined;
queryStart = performance.now();
fetch('/api/query', {method:'POST', headers:{'Content-Type':'application/json'
}, body:JSON.stringify(payload)})
.then(async r => {
const data = await r.json();
if (!r.ok) throw data;
return data;
I need to create a test to verify if the "X" button remains flush right. The layout might have changed due to the custom dropdown implementation, so I'll check the CSS and DOM after rendering. Specifically, I’ll investigate how the wrapper for the <select>
impacts the width and behavior of the filter column element. Looking into the CSS for .dropdown
might help clarify the issue.
I see the dropdown wrapper isn't being styled because it lacks the .f-col
class. I’ll check if adding .f-col
to the wrapper could fix the issue.
The user just wants a test verifying the "X" button is flush right. I'll check similar tests.
root@79a0f51f0ce9:/workspace/scubaduck# grep -n "getComputedStyle" -n tests/test
_web.py | head
130: "getComputedStyle(document.querySelector('#filters .filter button.re
move')).position"
154: "getComputedStyle(document.querySelector('#dive')).backgroundColor"
159: "getComputedStyle(document.querySelector('#sidebar')).overflowY"
162: "getComputedStyle(document.querySelector('#view')).overflowY"
188: "getComputedStyle(document.querySelector('#settings label')).textAli
gn"
205: "getComputedStyle(document.querySelector('#results th')).textAlign"
223: "getComputedStyle(document.querySelector('#results th:nth-child(4)')
).color"
236: "getComputedStyle(document.querySelector('#results th:nth-child(4)')
).color"
332: "getComputedStyle(document.querySelector('#column_actions')).textAli
gn"
352: "getComputedStyle(document.querySelector('#column_groups .col-group
.links')).float"
I'm scrolling back to check tests around line 120 involving field layout.
def test_default_filter_and_layout(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
count = page.evaluate("document.querySelectorAll('#filters .filter').length"
)
assert count == 1
last_is_button = page.evaluate(
"document.querySelector('#filters').lastElementChild.id === 'add_filter'
"
)
assert last_is_button
position = page.evaluate(
"getComputedStyle(document.querySelector('#filters .filter button.remove
')).position"
)
assert position == "static"
def test_header_and_tabs(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
header = page.text_content("#header")
assert "sample.csv" in header
assert "events" in header
assert page.is_visible("#settings")
assert page.is_hidden("#columns")
page.click("text=Columns")
assert page.is_visible("#columns")
cols = [c.strip() for c in page.locator("#column_groups li").all_inner_texts
()]
assert "timestamp" in cols
assert "event" in cols
page.click("text=View Settings")
I’ll create a test to ensure the X button is aligned with the right side using boundingRect.
root@79a0f51f0ce9:/workspace/scubaduck# grep -n "BoundingClientRect" -n tests/te
st_web.py
Maybe it's about checking CSS properties like width or alignment; I'll search for "evaluate bounding".
root@79a0f51f0ce9:/workspace/scubaduck# grep -n "clientRect" -n tests/test_web.p
y
I’m looking for tests that verify width or float behavior.
root@79a0f51f0ce9:/workspace/scubaduck# grep -n "offset" -n tests/test_web.py
I need to check the CSS to evaluate width and related styles.
I’ll check ‘server.py’ to implement the new test for the remove button alignment.
import re
from datetime import datetime, timedelta, timezone
import time
from pathlib import Path
import sqlite3
import traceback
import duckdb
from dateutil import parser as dtparser
from flask import Flask, jsonify, request, send_from_directory
@dataclass
class Filter:
column: str
op: str
value: str | int | float | list[str] | None
@dataclass
class QueryParams:
start: str | None = None
end: str | None = None
order_by: str | None = None
order_dir: str = "ASC"
limit: int | None = None
columns: list[str] = field(default_factory=lambda: [])
filters: list[Filter] = field(default_factory=lambda: [])
derived_columns: dict[str, str] = field(default_factory=lambda: {})
graph_type: str = "samples"
group_by: list[str] = field(default_factory=lambda: [])
aggregate: str | None = None
show_hits: bool = False
def _load_database(path: Path) -> duckdb.DuckDBPyConnection:
ext = path.suffix.lower()
if ext == ".csv":
con = duckdb.connect()
con.execute(
f"CREATE TABLE events AS SELECT * FROM read_csv_auto('{path.as_posix
()}')"
)
elif ext in {".db", ".sqlite"}:
con = duckdb.connect()
sconn = sqlite3.connect(path)
info = sconn.execute("PRAGMA table_info(events)").fetchall()
col_defs = ", ".join(f"{r[1]} {r[2]}" for r in info)
con.execute(f"CREATE TABLE events ({col_defs})")
placeholders = ",".join("?" for _ in info)
for row in sconn.execute("SELECT * FROM events"):
con.execute(f"INSERT INTO events VALUES ({placeholders})", row)
sconn.close()
else:
con = duckdb.connect(path)
return con
_REL_RE = re.compile(
r"([+-]?\d+(?:\.\d*)?)\s*(hour|hours|day|days|week|weeks|fortnight|fortnight
s)",
re.IGNORECASE,
)
def parse_time(val: str | None) -> str | None:
"""Parse an absolute or relative time string into ``YYYY-MM-DD HH:MM:SS``.""
"
if val is None or val == "":
return None
s = val.strip()
if s.lower() == "now":
dt = datetime.now(timezone.utc)
return dt.replace(microsecond=0).strftime("%Y-%m-%d %H:%M:%S")
m = _REL_RE.fullmatch(s)
if m:
qty = float(m.group(1))
unit = m.group(2).lower()
delta: timedelta
if unit.startswith("hour"):
delta = timedelta(hours=qty)
elif unit.startswith("day"):
delta = timedelta(days=qty)
elif unit.startswith("week"):
delta = timedelta(weeks=qty)
elif unit.startswith("fortnight"):
delta = timedelta(weeks=2 * qty)
else: # pragma: no cover - defensive
raise ValueError(f"Unsupported unit: {unit}")
dt = datetime.now(timezone.utc) + delta
return dt.replace(microsecond=0).strftime("%Y-%m-%d %H:%M:%S")
dt = dtparser.parse(s)
return dt.replace(microsecond=0, tzinfo=None).strftime("%Y-%m-%d %H:%M:%S")
def build_query(params: QueryParams, column_types: Dict[str, str] | None = None)
-> str:
select_parts: list[str] = []
has_agg = bool(params.group_by) or params.aggregate is not None
if has_agg:
select_parts.extend(params.group_by)
agg = (params.aggregate or "avg").lower()
def agg_expr(col: str) -> str:
if agg.startswith("p"):
quant = float(agg[1:]) / 100
return f"quantile({col}, {quant})"
if agg == "count distinct":
return f"count(DISTINCT {col})"
if agg == "avg" and column_types is not None:
ctype = column_types.get(col, "").upper()
if "TIMESTAMP" in ctype or "DATE" in ctype or "TIME" in ctype:
return (
"TIMESTAMP 'epoch' + INTERVAL '1 second' * "
f"CAST(avg(epoch({col})) AS BIGINT)"
)
I only need to add a test to the front-end. Let's check tests/conftest.py.
from __future__ import annotations
import threading
from collections.abc import Iterator
import pytest
from werkzeug.serving import make_server
from scubaduck.server import app
@pytest.fixture()
def server_url() -> Iterator[str]:
httpd = make_server("127.0.0.1", 0, app)
port = httpd.server_port
thread = threading.Thread(target=httpd.serve_forever)
thread.start()
try:
yield f"http://127.0.0.1:{port}"
finally:
httpd.shutdown()
thread.join()
I need to check Node.js and Playwright setup before running tests and verifying layouts.
I'll run a ruff check since Playwright seems to be already installed, no networking needed.
root@79a0f51f0ce9:/workspace/scubaduck# source .venv/bin/activate
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff check
All checks passed!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff format --check
6 files already formatted
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pyright
0 errors, 0 warnings, 0 informations
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
............................................ [100%]
44 passed in 7.79s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll add a test to verify the filter layout and check the bounding difference.
> from scubaduck.server import app
> import threading
> from werkzeug.serving import make_server
>
> httpd=make_server('127.0.0.1',0,app)
> port=httpd.server_port
> thread=threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> import requests
> resp=requests.get(f'http://127.0.0.1:{port}')
> print(len(resp.text))
> httpd.shutdown();thread.join()
> PY
I can try internal requests, since they might work despite external access being blocked.
127.0.0.1 - - [21/May/2025 02:48:31] "GET / HTTP/1.1" 200 -
36408
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'm setting up the test steps, confirming the default filter with JS search for "addFilter()".
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "addFilter" -n scuba
duck/static/index.html
207: <button id="add_filter" type="button" onclick="addFilter()">Add Fi
lter</button>
456: addFilter();
678:function addFilter() {
845: addFilter();
858: addFilter();
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
The test will check bounding rectangles, but first let's compute the margin difference with Playwright.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# python - <<'PY'
> from scubaduck.server import app
> from werkzeug.serving import make_server
> import threading
> from playwright.sync_api import sync_playwright
>
> httpd = make_server('127.0.0.1', 0, app)
> port = httpd.server_port
> thread = threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> with sync_playwright() as p:
> browser = p.chromium.launch()
> page = browser.new_page()
> page.goto(f'http://127.0.0.1:{port}')
> page.wait_for_selector('#order_by option')
> diff = page.evaluate("() => { const b=document.querySelector('#filters .fi
lter'); const x=b.querySelector('button.remove'); return b.getBoundingClientRect
().right - x.getBoundingClientRect().right; }")
> print('diff', diff)
> browser.close()
> httpd.shutdown();thread.join()
> PY
127.0.0.1 - - [21/May/2025 02:48:41] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:48:41] "GET /api/columns HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:48:41] "POST /api/query HTTP/1.1" 200 -
^CTraceback (most recent call last):
File "<stdin>", line 15, in <module>
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/sync_
api/_generated.py", line 8187, in wait_for_selector
self._sync(
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_sync_base.py", line 113, in _sync
self._dispatcher_fiber.switch()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/sync_
api/_context_manager.py", line 56, in greenlet_main
self._loop.run_until_complete(self._connection.run_as_sync())
File "/usr/lib/python3.12/asyncio/base_events.py", line 674, in run_until_comp
lete
self.run_forever()
File "/usr/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/lib/python3.12/asyncio/base_events.py", line 1949, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/selectors.py", line 468, in select
fd_event_list = self._selector.poll(timeout, max_ev)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
The script may have hung because the HTTP server wasn’t closed properly—let’s test again with more control.
python - <<'PY'
from scubaduck.server import app
from werkzeug.serving import make_server
import threading
from playwright.sync_api import sync_playwright
httpd = make_server('127.0.0.1', 0, app)
port = httpd.server_port
thread = threading.Thread(target=httpd.serve_forever)
thread.start()
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(f'http://127.0.0.1:{port}')
page.wait_for_selector('#order_by option', state='attached')
diff = page.evaluate("() => { const f=document.querySelector('#filters .filt
er'); const x=f.querySelector('button.remove'); const bb=f.getBoundingClientRect
(); const xb=x.getBoundingClientRect(); return [bb.right, xb.right]; }")
print(diff)
browser.close()
httpd.shutdown(); thread.join()
PY
The script might be stuck, so I'll try sending a newline to unblock.
^CException ignored in: <module 'threading' from '/usr/lib/python3.12/threading.
py'>
Traceback (most recent call last):
File "/usr/lib/python3.12/threading.py", line 1622, in _shutdown
lock.acquire()
KeyboardInterrupt:
Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or br
owser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has
been closed
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll run the script with a print statement at the start to check for differences.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# python - <<'PY'
> from scubaduck.server import app
> from werkzeug.serving import make_server
> import threading
> from playwright.sync_api import sync_playwright
>
> httpd = make_server('127.0.0.1', 0, app)
> port = httpd.server_port
> thread = threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> with sync_playwright() as p:
> browser = p.chromium.launch()
> page = browser.new_page()
> page.goto(f'http://127.0.0.1:{port}')
> page.wait_for_selector('#order_by option', state='attached')
> diff = page.evaluate('''() => {
> const f=document.querySelector("#filters .filter");
> const box=f.getBoundingClientRect();
> const x=f.querySelector("button.remove").getBoundingClientRect();
> return {filterRight: box.right, xRight: x.right, diff: box.right-x.rig
ht};
> }''')
> print(diff)
> browser.close()
> httpd.shutdown(); thread.join()
> PY
127.0.0.1 - - [21/May/2025 02:49:13] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:49:13] "GET /api/columns HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:49:13] "POST /api/query HTTP/1.1" 200 -
{'filterRight': 437, 'xRight': 194.3125, 'diff': 242.6875}
The user asked for a test but didn't mention a fix; the code needs updating.
The user asked only for the test, but the code will likely require a fix.
The wrapper needs a display of flex
and flex: 1
to stretch the column.
I’ll update JS to transfer 'f-col' class and ensure proper flex styling to the wrapper.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '296,372p' scubaduck/
static/index.html
'</u>' +
text.slice(idx + q.length);
} else {
div.textContent = text;
}
} else {
div.textContent = o.textContent;
}
if (o.value === select.value) div.classList.add('selected');
div.addEventListener('mousedown', evt => {
evt.preventDefault();
select.value = o.value;
select.dispatchEvent(new Event('change'));
updateDisplay();
close();
});
list.appendChild(div);
});
}
search.addEventListener('input', renderOptions);
select.addEventListener('change', updateDisplay);
}
// Sidebar resizing
const sidebar = document.getElementById('sidebar');
const sidebarResizer = document.getElementById('sidebar-resizer');
let sidebarWidth = parseInt(localStorage.getItem('sidebarWidth') || 450, 10);
sidebar.style.width = sidebarWidth + 'px';
let sidebarResize = false;
function startSidebarDrag(e) {
e.preventDefault();
sidebarResize = true;
document.addEventListener('mousemove', onSidebarDrag);
document.addEventListener('mouseup', stopSidebarDrag);
}
function onSidebarDrag(e) {
if (!sidebarResize) return;
sidebarWidth = Math.max(200, e.clientX - sidebar.getBoundingClientRect().left)
;
sidebar.style.width = sidebarWidth + 'px';
}
function stopSidebarDrag() {
document.removeEventListener('mousemove', onSidebarDrag);
document.removeEventListener('mouseup', stopSidebarDrag);
sidebarResize = false;
localStorage.setItem('sidebarWidth', sidebarWidth);
}
sidebarResizer.addEventListener('mousedown', startSidebarDrag);
let orderDir = 'ASC';
const orderDirBtn = document.getElementById('order_dir');
const graphTypeSel = document.getElementById('graph_type');
function updateOrderDirButton() {
orderDirBtn.textContent = orderDir + (orderDir === 'ASC' ? ' \u25B2' : ' \u25B
C');
}
function updateDisplayTypeUI() {
const show = graphTypeSel.value === 'table';
document.getElementById('group_by_field').style.display = show ? 'flex' : 'non
e';
document.getElementById('aggregate_field').style.display = show ? 'flex' : 'no
ne';
document.getElementById('show_hits_field').style.display = show ? 'flex' : 'no
ne';
document.querySelectorAll('#column_groups .col-group').forEach(g => {
if (g.querySelector('.col-group-header').textContent.startsWith('Strings'))
{
g.style.display = show ? 'none' : '';
}
});
displayType = graphTypeSel.value;
}
orderDirBtn.addEventListener('click', () => {
orderDir = orderDir === 'ASC' ? 'DESC' : 'ASC';
updateOrderDirButton();
});
updateOrderDirButton();
graphTypeSel.addEventListener('change', updateDisplayTypeUI);
fetch('/api/columns').then(r => r.json()).then(cols => {
const orderSelect = document.getElementById('order_by');
const groupsEl = document.getElementById('column_groups');
const groups = {
time: {name: 'Time', cols: [], ul: null},
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I didn't check the start of initDropdown earlier, so I'll look for that now.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "initDropdown" -n sc
ubaduck/static/index.html
234:function initDropdown(select) {
453: initDropdown(orderSelect);
454: initDropdown(document.getElementById('aggregate'));
697: initDropdown(colSel);
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '234,284p' scubaduck/
static/index.html
function initDropdown(select) {
const wrapper = document.createElement('div');
wrapper.className = 'dropdown';
select.parentNode.insertBefore(wrapper, select);
wrapper.appendChild(select);
select.style.display = 'none';
const disp = document.createElement('div');
disp.className = 'dropdown-display';
function updateDisplay() {
const opt = select.options[select.selectedIndex];
disp.textContent = opt ? opt.textContent : '';
}
updateDisplay();
wrapper.appendChild(disp);
const menu = document.createElement('div');
menu.className = 'dropdown-menu';
const search = document.createElement('input');
search.placeholder = 'Search';
menu.appendChild(search);
const list = document.createElement('div');
menu.appendChild(list);
wrapper.appendChild(menu);
function close() {
menu.style.display = 'none';
}
function open() {
renderOptions();
menu.style.display = 'block';
search.focus();
}
disp.addEventListener('click', () => {
if (menu.style.display === 'block') {
close();
} else {
open();
}
});
document.addEventListener('click', e => {
if (!wrapper.contains(e.target)) {
close();
}
});
function renderOptions() {
const q = search.value.toLowerCase();
list.innerHTML = '';
Array.from(select.options).forEach(o => {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll patch the function, then adjust index.html to align with the changes.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> function initDropdown(select) {
> const wrapper = document.createElement('div');
> - wrapper.className = 'dropdown';
> + wrapper.className = 'dropdown';
> + if (select.classList.contains('f-col')) {
> + wrapper.classList.add('f-col');
> + }
> select.parentNode.insertBefore(wrapper, select);
> wrapper.appendChild(select);
> select.style.display = 'none';
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll test adjusting .dropdown.f-col
styles to account for potential conflicts with inline-block
.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# python - <<'PY'
> from bs4 import BeautifulSoup
> html="<div style='display:flex;width:300px'><div class='f-col dropdown' style=
'display:inline-block'>X</div><div style='width:50px'>Y</div></div>"
> print(BeautifulSoup(html, 'html.parser').prettify())
> PY
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'bs4'
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Since external packages aren't allowed, I'll check the layout with Playwright for width calculations.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# python - <<'PY'
> from scubaduck.server import app
> from werkzeug.serving import make_server
> import threading
> from playwright.sync_api import sync_playwright
>
> httpd = make_server('127.0.0.1', 0, app)
> port = httpd.server_port
> thread = threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> with sync_playwright() as p:
> browser = p.chromium.launch()
> page = browser.new_page()
> page.goto(f'http://127.0.0.1:{port}')
> page.wait_for_selector('#order_by option', state='attached')
> diff = page.evaluate('''() => {
> const f=document.querySelector('#filters .filter');
> const box=f.getBoundingClientRect();
> const x=f.querySelector('button.remove').getBoundingClientRect();
> return {filterRight: box.right, xRight: x.right, diff: box.right - x.r
ight};
> }''')
> console.log = print
> print(diff)
> browser.close()
> httpd.shutdown(); thread.join()
> PY
127.0.0.1 - - [21/May/2025 02:49:41] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:49:42] "GET /api/columns HTTP/1.1" 200 -
[2025-05-21 02:49:42,034] ERROR in app: Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
127.0.0.1 - - [21/May/2025 02:49:42] "POST /api/query HTTP/1.1" 500 -
Traceback (most recent call last):
File "<stdin>", line 22, in <module>
NameError: name 'console' is not defined
The error came from uninitialized 'console', incorrect query params, and missing filter columns. Let's fix it.
python - <<'PY'
from scubaduck.server import app
from werkzeug.serving import make_server
import threading
from playwright.sync_api import sync_playwright
httpd = make_server('127.0.0.1', 0, app)
port = httpd.server_port
thread = threading.Thread(target=httpd.serve_forever)
thread.start()
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(f'http://127.0.0.1:{port}')
page.wait_for_selector('#order_by option', state='attached')
diff = page.evaluate('''() => {
const f=document.querySelector('#filters .filter');
const box=f.getBoundingClientRect();
const x=f.querySelector('button.remove').getBoundingClientRect();
return box.right - x.right;
}''')
print('diff', diff)
browser.close()
httpd.shutdown(); thread.join()
PY
^CException ignored in: <module 'threading' from '/usr/lib/python3.12/threading.
py'>
Traceback (most recent call last):
File "/usr/lib/python3.12/threading.py", line 1622, in _shutdown
lock.acquire()
KeyboardInterrupt:
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I think the script failed due to a handshake. Let's add prints for confirmation.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# python - <<'PY'
> from scubaduck.server import app
> from werkzeug.serving import make_server
> import threading
> from playwright.sync_api import sync_playwright
>
> httpd = make_server('127.0.0.1', 0, app)
> port = httpd.server_port
> thread = threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> with sync_playwright() as p:
> browser = p.chromium.launch()
> page = browser.new_page()
> page.goto(f'http://127.0.0.1:{port}')
> page.wait_for_selector('#order_by option', state='attached')
> diff = page.evaluate('''() => { const f=document.querySelector('#filters .
filter'); const box=f.getBoundingClientRect(); const x=f.querySelector('button.r
emove').getBoundingClientRect(); return {box:box.right,x:x.right,diff:box.right-
x.right}; }''')
> print('diff', diff)
> browser.close()
> httpd.shutdown(); thread.join()
> PY
127.0.0.1 - - [21/May/2025 02:50:04] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:50:04] "GET /api/columns HTTP/1.1" 200 -
[2025-05-21 02:50:04,178] ERROR in app: Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
127.0.0.1 - - [21/May/2025 02:50:04] "POST /api/query HTTP/1.1" 500 -
diff {'box': 437, 'x': 431, 'diff': 6}
The 6px difference might be caused by the container padding. Let's focus on the inner border.
I'll measure the difference relative to .filter-row
since it has no padding.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# python - <<'PY'
> from scubaduck.server import app
> from werkzeug.serving import make_server
> import threading
> from playwright.sync_api import sync_playwright
>
> httpd = make_server('127.0.0.1', 0, app)
> port = httpd.server_port
> thread = threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> with sync_playwright() as p:
> browser = p.chromium.launch()
> page = browser.new_page()
> page.goto(f'http://127.0.0.1:{port}')
> page.wait_for_selector('#order_by option', state='attached')
> diff = page.evaluate('''() => {
> const row=document.querySelector('#filters .filter-row');
> const r=row.getBoundingClientRect();
> const x=row.querySelector('button.remove').getBoundingClientRect();
> return {rowRight:r.right, xRight:x.right, diff:r.right-x.right};
> }''')
> print(diff)
> browser.close()
> httpd.shutdown();thread.join()
> PY
127.0.0.1 - - [21/May/2025 02:50:12] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:50:12] "GET /api/columns HTTP/1.1" 200 -
[2025-05-21 02:50:12,449] ERROR in app: Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
127.0.0.1 - - [21/May/2025 02:50:12] "POST /api/query HTTP/1.1" 500 -
{'rowRight': 431, 'xRight': 431, 'diff': 0}
I'll update initDropdown
to remove the class from select
after adding f-col
to wrapper
.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - if (select.classList.contains('f-col')) {
> - wrapper.classList.add('f-col');
> - }
> + if (select.classList.contains('f-col')) {
> + wrapper.classList.add('f-col');
> + select.classList.remove('f-col');
> + }
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll add the test after test_default_filter_and_layout
, checking button alignment.
_web.py
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
filter_el = page.query_selector("#filters .filter:last-child")
assert filter_el
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": filter_el, "val": "user"},
)
val_input = filter_el.query_selector(".f-val")
val_input.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
data = page.evaluate("window.lastResults")
assert len(data["rows"]) == 2
assert all(row[3] == "alice" for row in data["rows"])
def test_default_filter_and_layout(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
count = page.evaluate("document.querySelectorAll('#filters .filter').length"
)
assert count == 1
last_is_button = page.evaluate(
"document.querySelector('#filters').lastElementChild.id === 'add_filter'
"
)
assert last_is_button
position = page.evaluate(
"getComputedStyle(document.querySelector('#filters .filter button.remove
')).position"
)
assert position == "static"
def test_header_and_tabs(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
header = page.text_content("#header")
assert "sample.csv" in header
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll add the test after test_default_filter_and_layout
and proceed with a patch.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "test_default_filter
_and_layout" -n -n tests/test_web.py
120:def test_default_filter_and_layout(page: Any, server_url: str) -> None:
_web.py
def test_default_filter_and_layout(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
count = page.evaluate("document.querySelectorAll('#filters .filter').length"
)
assert count == 1
last_is_button = page.evaluate(
"document.querySelector('#filters').lastElementChild.id === 'add_filter'
"
)
assert last_is_button
position = page.evaluate(
"getComputedStyle(document.querySelector('#filters .filter button.remove
')).position"
)
assert position == "static"
def test_header_and_tabs(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
header = page.text_content("#header")
assert "sample.csv" in header
assert "events" in header
assert page.is_visible("#settings")
assert page.is_hidden("#columns")
page.click("text=Columns")
assert page.is_visible("#columns")
cols = [c.strip() for c in page.locator("#column_groups li").all_inner_texts
()]
assert "timestamp" in cols
assert "event" in cols
page.click("text=View Settings")
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll add the new test after default_filter_and_layout
, before header_and_tabs
.
> *** Begin Patch
> *** Update File: tests/test_web.py
> @@
> def test_default_filter_and_layout(page: Any, server_url: str) -> None:
> @@
> position = page.evaluate(
> "getComputedStyle(document.querySelector('#filters .filter button.rem
ove')).position"
> )
> assert position == "static"
> +
> +
> +def test_filter_remove_alignment(page: Any, server_url: str) -> None:
> + page.goto(server_url)
> + page.wait_for_selector("#order_by option", state="attached")
> + diff = page.evaluate(
> + "() => { const r=document.querySelector('#filters .filter-row').getBo
undingClientRect(); const x=document.querySelector('#filters .filter-row button.
remove').getBoundingClientRect(); return Math.abs(r.right - x.right); }"
> + )
> + assert diff <= 1
> *** End Patch
> PATCH
Success. Updated the following files:
M tests/test_web.py
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff format scubaduck/static
/index.html tests/test_web.py
error: Failed to parse scubaduck/static/index.html:1:1: Expected a statement
1 file left unchanged
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Ruff only works on Python, so I'll run it for tests/test_web.py.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff format tests/test_web.p
y
1 file left unchanged
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Time for a quick ruff check to see if everything looks good.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff check
All checks passed!
0 errors, 0 warnings, 0 informations
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
...............FF..
Two tests are failing. I'll wait a bit longer to view more details.
...............FF..FFF.....FF....F.FF.F..FF^C
Tests didn't finish due to errors; I'll try running them with -x
for more details.
...............FF..FFF.....FF....F.FF.F..FF^Cpytest tests/test_web.py::test_filt
er_remove_alignment -vv
...
^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 242, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 92, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 68, in thread_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 95, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 70, in unraisable_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 846, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 829, in _runtest_for
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/capture.
py", line 898, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/skipping
.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 174, in pytest_runtest_call
item.runtest()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 477, in test_table_enhance
ments
border = page.evaluate(
^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/sync_
api/_generated.py", line 8536, in evaluate
self._sync(
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_page.py", line 468, in evaluate
return await self._main_frame.evaluate(expression, arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_frame.py", line 278, in evaluate
await self._channel.send(
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.evaluate: TypeError: Failed to execute 'get
ComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
at eval (eval at evaluate (:313:29), <anonymous>:1:1)
at eval (<anonymous>)
at UtilityScript.evaluate (<anonymous>:313:29)
at UtilityScript.<anonymous> (<anonymous>:1:44)
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:50:38] "GET / HT
TP/1.1" 200 -
...
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 628, in test_table_group_b
y_query
assert "error" not in data
^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'Error' is not iterable
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:50:40] "GET / HT
TP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:50:40] "GET /api
/columns HTTP/1.1" 200 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:50:40] "POST /ap
i/query HTTP/1.1" 500 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:50:40] "POST /ap
i/query HTTP/1.1" 500 -
=========================== short test summary info ============================
FAILED tests/test_web.py::test_limit[chromium] - TypeError: 'Error' object is no
t subscriptable
FAILED tests/test_web.py::test_range_filters[chromium] - TypeError: 'Error' obje
ct is not subscriptable
FAILED tests/test_web.py::test_table_sorting[chromium] - playwright._impl._error
s.Error: Page.evaluate: TypeError: Failed to execute...
FAILED tests/test_web.py::test_order_by[chromium] - TypeError: 'Error' object is
not subscriptable
FAILED tests/test_web.py::test_simple_filter[chromium] - TypeError: 'Error' obje
ct is not subscriptable
FAILED tests/test_web.py::test_query_error_shown[chromium] - TypeError: argument
of type 'Error' is not iterable
FAILED tests/test_web.py::test_column_toggle_and_selection[chromium] - TypeError
: 'Error' object is not subscriptable
FAILED tests/test_web.py::test_table_enhancements[chromium] - playwright._impl._
errors.Error: Page.evaluate: TypeError: Failed to execute...
FAILED tests/test_web.py::test_url_query_persistence[chromium] - playwright._imp
l._errors.Error: Page.evaluate: TypeError: Cannot read prope...
FAILED tests/test_web.py::test_load_from_url[chromium] - playwright._impl._error
s.Error: Page.evaluate: TypeError: Cannot read prope...
FAILED tests/test_web.py::test_empty_data_message[chromium] - TypeError: 'Error'
object is not subscriptable
FAILED tests/test_web.py::test_table_avg_no_group_by[chromium] - TypeError: 'Err
or' object is not subscriptable
FAILED tests/test_web.py::test_table_group_by_query[chromium] - TypeError: argum
ent of type 'Error' is not iterable
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.12/threading.py:359: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
13 failed, 30 passed in 18.77s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_filter_remove_alignment -vv
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
initialized: 5/5 workers
Tests failed due to a server error, possibly from a filter issue after modifying the layout.
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_filter_remove_alignment[chromium]
[gw0] [100%] PASSED tests/test_web.py::test_filter_remove_alignment[chromium]
============================== 1 passed in 2.01s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_filter_remove_alignment -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_filter_remove_alignment[chromium]
[gw0] PASSED tests/test_web.py::test_filter_remove_alignment[chromium]
============================== 1 passed in 1.91s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
The test passed individually, but a server error caused previous failures. I'll retry all tests.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
..............FF...FFF...F..F....F.FF.F..FF^C
Looks like the tests hang due to previous failures. I'll investigate with pytest
.
..............FF...FFF...F..F....F.FF.F..FF^Cpytest tests/test_web.py::test_limi
t -vv -s
...
^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 242, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 92, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 68, in thread_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 95, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 70, in unraisable_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 846, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 829, in _runtest_for
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/capture.
py", line 898, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/skipping
.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 174, in pytest_runtest_call
item.runtest()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 477, in test_table_enhance
ments
border = page.evaluate(
^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/sync_
api/_generated.py", line 8536, in evaluate
self._sync(
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_page.py", line 468, in evaluate
return await self._main_frame.evaluate(expression, arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_frame.py", line 278, in evaluate
await self._channel.send(
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.evaluate: TypeError: Failed to execute 'get
ComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
at eval (eval at evaluate (:313:29), <anonymous>:1:1)
at eval (<anonymous>)
at UtilityScript.evaluate (<anonymous>:313:29)
at UtilityScript.<anonymous> (<anonymous>:1:44)
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:07] "GET / HT
TP/1.1" 200 -
...
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 628, in test_table_group_b
y_query
assert "error" not in data
^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'Error' is not iterable
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:09] "GET / HT
TP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:09] "GET /api
/columns HTTP/1.1" 200 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:09] "POST /ap
i/query HTTP/1.1" 500 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:09] "POST /ap
i/query HTTP/1.1" 500 -
=========================== short test summary info ============================
FAILED tests/test_web.py::test_range_filters[chromium] - TypeError: 'Error' obje
ct is not subscriptable
FAILED tests/test_web.py::test_limit[chromium] - TypeError: 'Error' object is no
t subscriptable
FAILED tests/test_web.py::test_table_sorting[chromium] - playwright._impl._error
s.Error: Page.evaluate: TypeError: Failed to execute...
FAILED tests/test_web.py::test_order_by[chromium] - TypeError: 'Error' object is
not subscriptable
FAILED tests/test_web.py::test_simple_filter[chromium] - TypeError: 'Error' obje
ct is not subscriptable
FAILED tests/test_web.py::test_query_error_shown[chromium] - TypeError: argument
of type 'Error' is not iterable
FAILED tests/test_web.py::test_column_toggle_and_selection[chromium] - TypeError
: 'Error' object is not subscriptable
FAILED tests/test_web.py::test_table_enhancements[chromium] - playwright._impl._
errors.Error: Page.evaluate: TypeError: Failed to execute...
FAILED tests/test_web.py::test_url_query_persistence[chromium] - playwright._imp
l._errors.Error: Page.evaluate: TypeError: Cannot read prope...
FAILED tests/test_web.py::test_load_from_url[chromium] - playwright._impl._error
s.Error: Page.evaluate: TypeError: Cannot read prope...
FAILED tests/test_web.py::test_empty_data_message[chromium] - TypeError: 'Error'
object is not subscriptable
FAILED tests/test_web.py::test_table_avg_no_group_by[chromium] - TypeError: 'Err
or' object is not subscriptable
FAILED tests/test_web.py::test_table_group_by_query[chromium] - TypeError: argum
ent of type 'Error' is not iterable
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.12/threading.py:359: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
13 failed, 30 passed in 21.23s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_limit -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
initialized: 5/5 workers
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_limit[chromium]
[gw0] FAILED tests/test_web.py::test_limit[chromium]
=================================== FAILURES ===================================
_____________________________ test_limit[chromium] _____________________________
[gw0] linux -- Python 3.12.3 /workspace/scubaduck/.venv/bin/python
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 341, in from_call
result: TResult | None = func()
^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 242, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 92, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 68, in thread_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 95, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 70, in unraisable_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 846, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 829, in _runtest_for
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/capture.
py", line 898, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/skipping
.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 174, in pytest_runtest_call
item.runtest()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 96, in test_limit
assert len(data["rows"]) == 2
~~~~^^^^^^^^
TypeError: 'Error' object is not subscriptable
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:25] "GET / HT
TP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:25] "GET /api
/columns HTTP/1.1" 200 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:25] "POST /ap
i/query HTTP/1.1" 500 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:26] "POST /ap
i/query HTTP/1.1" 500 -
=========================== short test summary info ============================
FAILED tests/test_web.py::test_limit[chromium] - TypeError: 'Error' object is no
t subscriptable
============================== 1 failed in 2.07s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Looks like the KeyError
happens due to a missing 'column' property in the filter.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "collectParams" -n s
cubaduck/static/index.html
752: const payload = collectParams();
775:function collectParams() {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '775,850p' scubaduck/
static/index.html
function collectParams() {
updateSelectedColumns();
const payload = {
start: document.getElementById('start').value,
end: document.getElementById('end').value,
order_by: document.getElementById('order_by').value,
order_dir: orderDir,
limit: parseInt(document.getElementById('limit').value, 10),
columns: selectedColumns.filter(c => c !== 'Hits'),
graph_type: graphTypeSel.value,
filters: Array.from(document.querySelectorAll('#filters .filter')).map(f =>
{
const chips = f.chips || [];
const op = f.querySelector('.f-op').value;
let value = null;
if (op !== 'empty' && op !== '!empty') {
value = chips.length === 0 ? null : (chips.length === 1 ? chips[0] : chi
ps);
}
return {column: f.querySelector('.f-col').value, op, value};
})
};
if (graphTypeSel.value === 'table') {
payload.group_by = groupBy.chips || [];
payload.aggregate = document.getElementById('aggregate').value;
payload.show_hits = document.getElementById('show_hits').checked;
}
return payload;
}
function paramsToSearch(params) {
const sp = new URLSearchParams();
if (params.start) sp.set('start', params.start);
if (params.end) sp.set('end', params.end);
if (params.order_by) sp.set('order_by', params.order_by);
if (params.order_dir) sp.set('order_dir', params.order_dir);
if (params.limit !== null && params.limit !== undefined) sp.set('limit', param
s.limit);
if (params.columns && params.columns.length) sp.set('columns', params.columns.
join(','));
if (params.filters && params.filters.length) sp.set('filters', JSON.stringify(
params.filters));
if (params.graph_type) sp.set('graph_type', params.graph_type);
if (params.graph_type === 'table') {
if (params.group_by && params.group_by.length) sp.set('group_by', params.gro
up_by.join(','));
if (params.aggregate) sp.set('aggregate', params.aggregate);
if (params.show_hits) sp.set('show_hits', '1');
}
const qs = sp.toString();
return qs ? '?' + qs : '';
}
function applyParams(params) {
document.getElementById('start').value = params.start || '';
document.getElementById('end').value = params.end || '';
if (params.order_by) {
document.getElementById('order_by').value = params.order_by;
}
orderDir = params.order_dir || 'ASC';
updateOrderDirButton();
if (params.limit !== undefined && params.limit !== null) {
document.getElementById('limit').value = params.limit;
}
graphTypeSel.value = params.graph_type || 'samples';
updateDisplayTypeUI();
if (params.group_by) {
groupBy.chips.splice(0, groupBy.chips.length, ...params.group_by);
groupBy.renderChips();
}
if (params.aggregate) document.getElementById('aggregate').value = params.aggr
egate;
document.getElementById('show_hits').checked = params.show_hits ?? true;
document.querySelectorAll('#column_groups input').forEach(cb => {
cb.checked = !params.columns || params.columns.includes(cb.value);
});
updateSelectedColumns();
const list = document.getElementById('filter_list');
list.innerHTML = '';
if (params.filters && params.filters.length) {
params.filters.forEach(f => {
addFilter();
const el = list.lastElementChild;
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '850,940p' scubaduck/
static/index.html
const el = list.lastElementChild;
el.querySelector('.f-col').value = f.column;
el.querySelector('.f-col').dispatchEvent(new Event('change'));
el.querySelector('.f-op').value = f.op;
el.querySelector('.f-op').dispatchEvent(new Event('change'));
if (f.value !== null && f.op !== 'empty' && f.op !== '!empty') {
const values = Array.isArray(f.value) ? f.value : [f.value];
values.forEach(v => el.addChip(v));
el.renderChips();
}
});
} else {
addFilter();
}
}
function parseSearch() {
const sp = new URLSearchParams(window.location.search);
const params = {};
if (sp.has('start')) params.start = sp.get('start');
if (sp.has('end')) params.end = sp.get('end');
if (sp.has('order_by')) params.order_by = sp.get('order_by');
if (sp.has('order_dir')) params.order_dir = sp.get('order_dir');
if (sp.has('limit')) params.limit = parseInt(sp.get('limit'), 10);
if (sp.has('columns')) params.columns = sp.get('columns').split(',').filter(c
=> c);
if (sp.has('filters')) {
try { params.filters = JSON.parse(sp.get('filters')); } catch(e) { params.fi
lters = []; }
}
if (sp.has('graph_type')) params.graph_type = sp.get('graph_type');
if (sp.has('group_by')) params.group_by = sp.get('group_by').split(',').filter
(c => c);
if (sp.has('aggregate')) params.aggregate = sp.get('aggregate');
if (sp.has('show_hits')) params.show_hits = sp.get('show_hits') === '1';
return params;
}
function initFromUrl() {
const params = parseSearch();
history.replaceState(params, '', paramsToSearch(params));
applyParams(params);
dive(false);
}
window.addEventListener('popstate', e => {
const params = e.state || parseSearch();
applyParams(params);
dive(false);
});
let originalRows = [];
let sortState = {index: null, dir: null};
function renderTable(rows) {
const table = document.getElementById('results');
table.innerHTML = '';
if (rows.length === 0) return;
let hitsIndex = selectedColumns.indexOf('Hits');
let totalHits = 0;
if (hitsIndex !== -1) {
totalHits = rows.reduce((s, r) => s + Number(r[hitsIndex]), 0);
}
const header = document.createElement('tr');
selectedColumns.forEach((col, i) => {
const th = document.createElement('th');
th.textContent = col;
th.dataset.index = i;
th.addEventListener('click', handleSort);
if (sortState.index === i) {
th.classList.add('sorted');
th.textContent = col + (sortState.dir === 'desc' ? ' \u25BC' : ' \u25B2');
}
if (!isStringColumn(col)) th.style.textAlign = 'right';
header.appendChild(th);
});
table.appendChild(header);
rows.forEach(row => {
const tr = document.createElement('tr');
tr.addEventListener('click', () => {
tr.classList.toggle('selected');
});
row.forEach((v, i) => {
const col = selectedColumns[i];
const td = document.createElement('td');
if (isTimeColumn(col)) {
const d = new Date(v);
td.textContent = d.toLocaleString('en-US', {
weekday: 'short',
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll modify collectParams
to search for the select inside the wrapper, keeping styles.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "wrapper.classList.a
dd('f-col')" -n scubaduck/static/index.html
238: wrapper.classList.add('f-col');
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '234,246p' scubaduck/
static/index.html
function initDropdown(select) {
const wrapper = document.createElement('div');
wrapper.className = 'dropdown';
if (select.classList.contains('f-col')) {
wrapper.classList.add('f-col');
select.classList.remove('f-col');
}
select.parentNode.insertBefore(wrapper, select);
wrapper.appendChild(select);
select.style.display = 'none';
const disp = document.createElement('div');
disp.className = 'dropdown-display';
function updateDisplay() {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll remove select.classList.remove('f-col')
from the code.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - if (select.classList.contains('f-col')) {
> - wrapper.classList.add('f-col');
> - select.classList.remove('f-col');
> - }
> + if (select.classList.contains('f-col')) {
> + wrapper.classList.add('f-col');
> + }
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff format tests/test_web.p
y
1 file left unchanged
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff check
All checks passed!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pyright
0 errors, 0 warnings, 0 informations
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_limit -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_limit[chromium]
[gw0] FAILED tests/test_web.py::test_limit[chromium]
=================================== FAILURES ===================================
_____________________________ test_limit[chromium] _____________________________
[gw0] linux -- Python 3.12.3 /workspace/scubaduck/.venv/bin/python
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 341, in from_call
result: TResult | None = func()
^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 242, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 92, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 68, in thread_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 95, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 70, in unraisable_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 846, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 829, in _runtest_for
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/capture.
py", line 898, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/skipping
.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 174, in pytest_runtest_call
item.runtest()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 96, in test_limit
assert len(data["rows"]) == 2
~~~~^^^^^^^^
TypeError: 'Error' object is not subscriptable
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:51] "GET / HT
TP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:51] "GET /api
/columns HTTP/1.1" 200 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:51] "POST /ap
i/query HTTP/1.1" 500 -
ERROR scubaduck.server:app.py:875 Exception on /api/query [POST]
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 1511, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 919, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/flask/app.py", l
ine 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) #
type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/scubaduck/server.py", line 260, in query
params.filters.append(Filter(f["column"], f["op"], f.get("value")))
~^^^^^^^^^^
KeyError: 'column'
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:51:51] "POST /ap
i/query HTTP/1.1" 500 -
=========================== short test summary info ============================
FAILED tests/test_web.py::test_limit[chromium] - TypeError: 'Error' object is no
t subscriptable
============================== 1 failed in 2.28s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
The .f-col
class is applied to both the wrapper and select. I'll adjust the query.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '790,824p' scubaduck/
static/index.html
}
return {column: f.querySelector('.f-col').value, op, value};
})
};
if (graphTypeSel.value === 'table') {
payload.group_by = groupBy.chips || [];
payload.aggregate = document.getElementById('aggregate').value;
payload.show_hits = document.getElementById('show_hits').checked;
}
return payload;
}
function paramsToSearch(params) {
const sp = new URLSearchParams();
if (params.start) sp.set('start', params.start);
if (params.end) sp.set('end', params.end);
if (params.order_by) sp.set('order_by', params.order_by);
if (params.order_dir) sp.set('order_dir', params.order_dir);
if (params.limit !== null && params.limit !== undefined) sp.set('limit', param
s.limit);
if (params.columns && params.columns.length) sp.set('columns', params.columns.
join(','));
if (params.filters && params.filters.length) sp.set('filters', JSON.stringify(
params.filters));
if (params.graph_type) sp.set('graph_type', params.graph_type);
if (params.graph_type === 'table') {
if (params.group_by && params.group_by.length) sp.set('group_by', params.gro
up_by.join(','));
if (params.aggregate) sp.set('aggregate', params.aggregate);
if (params.show_hits) sp.set('show_hits', '1');
}
const qs = sp.toString();
return qs ? '?' + qs : '';
}
function applyParams(params) {
document.getElementById('start').value = params.start || '';
document.getElementById('end').value = params.end || '';
if (params.order_by) {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - return {column: f.querySelector('.f-col').value, op, value};
> + const colSel = f.querySelector('.f-col select') || f.querySelector('.f-
col');
> + return {column: colSel.value, op, value};
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll start by searching for where to patch applyParams.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "el.querySelector('.
f-col').value" -n scubaduck/static/index.html
851: el.querySelector('.f-col').value = f.column;
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '846,862p' scubaduck/
static/index.html
list.innerHTML = '';
if (params.filters && params.filters.length) {
params.filters.forEach(f => {
addFilter();
const el = list.lastElementChild;
el.querySelector('.f-col').value = f.column;
el.querySelector('.f-col').dispatchEvent(new Event('change'));
el.querySelector('.f-op').value = f.op;
el.querySelector('.f-op').dispatchEvent(new Event('change'));
if (f.value !== null && f.op !== 'empty' && f.op !== '!empty') {
const values = Array.isArray(f.value) ? f.value : [f.value];
values.forEach(v => el.addChip(v));
el.renderChips();
}
});
} else {
addFilter();
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - el.querySelector('.f-col').value = f.column;
> - el.querySelector('.f-col').dispatchEvent(new Event('change'));
> + const colSel = el.querySelector('.f-col select') || el.querySelector('.
f-col');
> + colSel.value = f.column;
> + colSel.dispatchEvent(new Event('change'));
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll go ahead and re-run ruff to check for any issues.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff check
All checks passed!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pyright
0 errors, 0 warnings, 0 informations
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll rerun the test that failed previously to see what happens now.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_limit -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_limit[chromium]
[gw0] PASSED tests/test_web.py::test_limit[chromium]
============================== 1 passed in 2.20s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Now, I'll run all tests to double-check everything works as expected.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
......................F...................... [100%]
=================================== FAILURES ===================================
_________________________ test_simple_filter[chromium] _________________________
[gw0] linux -- Python 3.12.3 /workspace/scubaduck/.venv/bin/python
Traceback (most recent call last):
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 341, in from_call
result: TResult | None = func()
^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 242, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 92, in pytest_runtest_call
yield from thread_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/threadex
ception.py", line 68, in thread_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 95, in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/unraisab
leexception.py", line 70, in unraisable_exception_runtest_hook
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 846, in pytest_runtest_call
yield from self._runtest_for(item, "call")
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/logging.
py", line 829, in _runtest_for
yield
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/capture.
py", line 898, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 139, in _multicall
teardown.throw(exception)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/skipping
.py", line 257, in pytest_runtest_call
return (yield)
^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/runner.p
y", line 174, in pytest_runtest_call
item.runtest()
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 1627, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_hooks.py
", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_manager.
py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 167, in _multicall
raise exception
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/pluggy/_callers.
py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/_pytest/python.p
y", line 159, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/tests/test_web.py", line 116, in test_simple_filter
assert len(data["rows"]) == 2
~~~~^^^^^^^^
KeyError: 'rows'
----------------------------- Captured stdout call -----------------------------
Query failed:
SELECT timestamp, event, value, user FROM events WHERE timestamp = 'alice' ORDER
BY timestamp ASC LIMIT 100
Traceback (most recent call last):
File "/workspace/scubaduck/scubaduck/server.py", line 333, in query
rows = con.execute(sql).fetchall()
^^^^^^^^^^^^^^^^
duckdb.duckdb.ConversionException: Conversion Error: invalid timestamp field for
mat: "alice", expected format is (YYYY-MM-DD HH:MM:SS[.US][±HH:MM| ZONE])
LINE 1: ... timestamp, event, value, user FROM events WHERE timestamp = 'alice'
ORDER BY timestamp ASC LIMIT 100
^
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET / HT
TP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/columns HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "POST /ap
i/query HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/samples?column=user&q= HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/samples?column=user&q=a HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/samples?column=user&q=al HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/samples?column=user&q=ali HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/samples?column=user&q=alic HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "GET /api
/samples?column=user&q=alice HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:52:19] "POST /ap
i/query HTTP/1.1" 400 -
=========================== short test summary info ============================
FAILED tests/test_web.py::test_simple_filter[chromium] - KeyError: 'rows'
1 failed, 44 passed in 7.24s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
It looks like only test_simple_filter failed. I'll investigate it further.
web.py
def test_order_by(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="value",
order_dir="DESC",
limit=100,
)
values = [row[2] for row in data["rows"]]
assert values == sorted(values, reverse=True)
def test_limit(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-03 00:00:00",
order_by="timestamp",
limit=2,
)
assert len(data["rows"]) == 2
def test_simple_filter(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
filter_el = page.query_selector("#filters .filter:last-child")
assert filter_el
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": filter_el, "val": "user"},
)
val_input = filter_el.query_selector(".f-val")
val_input.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
data = page.evaluate("window.lastResults")
assert len(data["rows"]) == 2
assert all(row[3] == "alice" for row in data["rows"])
def test_default_filter_and_layout(page: Any, server_url: str) -> None:
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll look for the definition of setSelectValue in the HTML. Let's confirm its contents.
scubaduck/static/index.html
1027:function setSelectValue(selector, value) {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '1024,1040p' scubaduc
k/static/index.html
document.getElementById('query_info').textContent = '';
}
function setSelectValue(selector, value) {
const el = typeof selector === 'string' ? document.querySelector(selector) : s
elector;
if (el) {
el.value = value;
el.dispatchEvent(new Event('change'));
}
}
</script>
</body>
</html>
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
The test needs an update since the wrapper no longer matches the expected select element.
tests/test_web.py
8: "arg => setSelectValue(arg.sel, arg.val)",
106: "arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
373: "arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
401: "arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
445: "arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I need to figure out the line ranges for the other changes.
_web.py
float_val = page.evaluate(
"getComputedStyle(document.querySelector('#column_groups .col-group .lin
ks')).float"
)
assert float_val == "right"
def test_chip_dropdown_navigation(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.wait_for_selector("#filters .filter:last-child .chip-dropdown div")
page.keyboard.type("ali")
page.wait_for_selector("text=alice")
page.keyboard.press("ArrowDown")
page.keyboard.press("Enter")
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips == ["ali"]
page.click("#filters .filter:last-child .chip .x")
page.wait_for_selector(".chip", state="detached")
def test_chip_copy_and_paste(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.evaluate(
"Object.defineProperty(navigator, 'clipboard', {value:{ _data: '', write
Text(t){ this._data = t; }, readText(){ return Promise.resolve(this._data); } }}
)"
)
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
page.keyboard.type("bob")
page.keyboard.press("Enter")
f.query_selector(".chip-copy").click()
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll adjust setSelectValue to support elements with wrappers or selects and update index.html.
k/static/index.html
document.getElementById('query_info').textContent = '';
}
function setSelectValue(selector, value) {
const el = typeof selector === 'string' ? document.querySelector(selector) : s
elector;
if (el) {
el.value = value;
el.dispatchEvent(new Event('change'));
}
}
</script>
</body>
</html>
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> function setSelectValue(selector, value) {
> const el = typeof selector === 'string' ? document.querySelector(selector)
: selector;
> - if (el) {
> - el.value = value;
> - el.dispatchEvent(new Event('change'));
> - }
> + if (el) {
> + const select = el.tagName === 'SELECT' ? el : el.querySelector('select');
> + if (select) {
> + select.value = value;
> + select.dispatchEvent(new Event('change'));
> + }
> + }
> }
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff check
All checks passed!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pyright
0 errors, 0 warnings, 0 informations
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_simple_filter -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_simple_filter[chromium]
[gw0] PASSED tests/test_web.py::test_simple_filter[chromium]
============================== 1 passed in 2.30s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Time to go ahead and execute the complete test suite one more time!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
.........................................^C
It seemed done, but I interrupted it. Let's run pytest -q
again.
.........................................^Cpytest -q
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.12/threading.py:359: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
41 passed in 24.21s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
.........................................^C
The tests seem to be taking too long, so I'll use pytest -q | tail -n 20
.
.........................................^Cpytest -q > /tmp/pytestlog.txt && tai
l -n 20 /tmp/pytestlog.txt
The command didn't execute, likely due to improper truncation. I'll try it again.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.12/threading.py:359: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
41 passed in 28.54s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q > /tmp/pytestlog.t
xt && tail -n 20 /tmp/pytestlog.txt
pytest -q > /tmp/pytestlog.txt && tail -n 20 /tmp/pytestlog.txt
I see "41 passed" after pytest run. Maybe tests were interrupted—checking log file now.
cat /tmp/pytestlog.txt
^Cls -l /tmp
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ls -l /tmp
total 4228
drwx------ 2 root root 4096 May 19 16:25 TemporaryDirectory.qfVg9o
drwxr-xr-x 2 root root 4096 May 21 02:46 hsperfdata_root
drwxr-xr-x 3 root root 4096 May 19 16:18 node-compile-cache
drwx------ 5 root root 4096 May 21 02:53 pytest-of-root
-rw-r--r-- 1 root root 307 May 21 02:53 pytestlog.txt
-rw-r--r-- 1 root root 1006235 May 13 04:04 python-build.20250513040323.163.log
-rw-r--r-- 1 root root 1098296 May 13 04:05 python-build.20250513040414.13507.lo
g
-rw-r--r-- 1 root root 837387 May 13 04:05 python-build.20250513040505.28157.lo
g
-rw-r--r-- 1 root root 850121 May 13 04:06 python-build.20250513040549.41224.lo
g
-rw-r--r-- 1 root root 184027 May 19 16:21 ruby-build.20250519161941.598.log
-rw-r--r-- 1 root root 184893 May 19 16:23 ruby-build.20250519162125.12706.log
-rw-r--r-- 1 root root 128751 May 19 16:25 ruby-build.20250519162321.25072.log
-rwxrwxrwx 1 root root 0 May 21 02:46 uv-4aacf18a150bb7d6.lock
drwxr-xr-x 3 root root 4096 May 19 16:25 v8-compile-cache-0
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ls -l /tmp
total 4228
drwx------ 2 root root 4096 May 19 16:25 TemporaryDirectory.qfVg9o
drwxr-xr-x 2 root root 4096 May 21 02:46 hsperfdata_root
drwxr-xr-x 3 root root 4096 May 19 16:18 node-compile-cache
drwx------ 5 root root 4096 May 21 02:53 pytest-of-root
-rw-r--r-- 1 root root 307 May 21 02:53 pytestlog.txt
-rw-r--r-- 1 root root 1006235 May 13 04:04 python-build.20250513040323.163.log
-rw-r--r-- 1 root root 1098296 May 13 04:05 python-build.20250513040414.13507.lo
g
-rw-r--r-- 1 root root 837387 May 13 04:05 python-build.20250513040505.28157.lo
g
-rw-r--r-- 1 root root 850121 May 13 04:06 python-build.20250513040549.41224.lo
g
-rw-r--r-- 1 root root 184027 May 19 16:21 ruby-build.20250519161941.598.log
-rw-r--r-- 1 root root 184893 May 19 16:23 ruby-build.20250519162125.12706.log
-rw-r--r-- 1 root root 128751 May 19 16:25 ruby-build.20250519162321.25072.log
-rwxrwxrwx 1 root root 0 May 21 02:46 uv-4aacf18a150bb7d6.lock
drwxr-xr-x 3 root root 4096 May 19 16:25 v8-compile-cache-0
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I see a /tmp/pytestlog.txt file that's 307 bytes. I'll take a look.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# cat /tmp/pytestlog.txt
bringing up nodes...
bringing up nodes...
.........................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/lib/python3.12/threading.py:359: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
41 passed in 13.47s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
It looks like the test run was interrupted. I'll try running pytest
again without interruption.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q > /tmp/pytestlog.t
xt
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll review the log to understand the command’s outcome.
t
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_frame.py", line 323, in wait_for_selector
await self._channel.send("waitForSelector", locals_to_params(locals()))
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Page.wait_for_selector: Timeout 30000ms e
xceeded.
Call log:
- waiting for locator("#filters .filter:last-child .chip-dropdown div") to be
visible
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:54:06] "GET / HT
TP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:54:06] "GET /api
/columns HTTP/1.1" 200 -
INFO werkzeug:_internal.py:97 127.0.0.1 - - [21/May/2025 02:54:06] "POST /ap
i/query HTTP/1.1" 200 -
=========================== short test summary info ============================
FAILED tests/test_web.py::test_chip_dropdown_hides_on_outside_click[chromium]
FAILED tests/test_web.py::test_chip_dropdown_navigation[chromium] - playwrigh...
2 failed, 43 passed in 36.02s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
There are two failing tests, including one for dropdown hiding on outside click.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "chip_dropdown" -n t
ests/test_web.py
366:def test_chip_dropdown_navigation(page: Any, server_url: str) -> None:
438:def test_chip_dropdown_hides_on_outside_click(page: Any, server_url: str) ->
None:
_web.py
"var dt=new DataTransfer(); dt.setData('text/plain','alice,bob'); var e=
new ClipboardEvent('paste',{clipboardData:dt}); Object.defineProperty(e,'shiftKe
y',{value:true}); document.querySelector('#filters .filter:last-child .f-val').d
ispatchEvent(e);"
)
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips[-1] == "alice,bob"
def test_chip_dropdown_hides_on_outside_click(page: Any, server_url: str) -> Non
e:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.wait_for_selector("#filters .filter:last-child .chip-dropdown div")
page.click("#header")
page.wait_for_selector("#filters .filter:last-child .chip-dropdown", state="
hidden")
def test_chip_input_no_outline(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
inp = page.query_selector("#filters .filter:last-child .f-val")
assert inp
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll test the chip dropdown navigation functionality now. Let's see how it performs!
page.click("text=Columns")
page.wait_for_selector("#column_groups .col-group .links", state="attached")
float_val = page.evaluate(
"getComputedStyle(document.querySelector('#column_groups .col-group .lin
ks')).float"
)
assert float_val == "right"
def test_chip_dropdown_navigation(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.wait_for_selector("#filters .filter:last-child .chip-dropdown div")
page.keyboard.type("ali")
page.wait_for_selector("text=alice")
page.keyboard.press("ArrowDown")
page.keyboard.press("Enter")
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips == ["ali"]
page.click("#filters .filter:last-child .chip .x")
page.wait_for_selector(".chip", state="detached")
def test_chip_copy_and_paste(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.evaluate(
"Object.defineProperty(navigator, 'clipboard', {value:{ _data: '', write
Text(t){ this._data = t; }, readText(){ return Promise.resolve(this._data); } }}
)"
)
page.click("text=Add Filter")
f = page.query_selector("#filters .filter:last-child")
assert f
page.evaluate(
"arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val)",
{"el": f, "val": "user"},
)
inp = f.query_selector(".f-val")
inp.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
page.keyboard.type("bob")
page.keyboard.press("Enter")
f.query_selector(".chip-copy").click()
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
The dropdown isn't appearing after modifying setSelectValue. I’ll manually test and replicate it.
> from scubaduck.server import app
> from werkzeug.serving import make_server
> import threading
> from playwright.sync_api import sync_playwright
>
> httpd=make_server('127.0.0.1',0,app)
> port=httpd.server_port
> thread=threading.Thread(target=httpd.serve_forever)
> thread.start()
>
> with sync_playwright() as p:
> page = p.chromium.launch().new_page()
> page.goto(f'http://127.0.0.1:{port}')
> page.wait_for_selector('#order_by option')
> page.click('text=Add Filter')
> f = page.query_selector('#filters .filter:last-child')
> page.evaluate("arg => setSelectValue(arg.el.querySelector('.f-col'), arg.v
al)", {"el": f, "val": "user"})
> page.query_selector('#filters .filter:last-child .f-val').click()
> try:
> page.wait_for_selector('#filters .filter:last-child .chip-dropdown div
', timeout=3000)
> print('dropdown visible')
> except Exception as e:
> print('error', e)
> print('dropdown display', page.query_selector('#filters .filter:last-child
.chip-dropdown').evaluate('el => el.style.display'))
>
> p.chromium.launch().close
> PY
127.0.0.1 - - [21/May/2025 02:54:52] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:54:52] "GET /api/columns HTTP/1.1" 200 -
127.0.0.1 - - [21/May/2025 02:54:52] "POST /api/query HTTP/1.1" 200 -
Traceback (most recent call last):
File "<stdin>", line 14, in <module>
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/sync_
api/_generated.py", line 8187, in wait_for_selector
self._sync(
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_page.py", line 425, in wait_for_selector
return await self._main_frame.wait_for_selector(**locals_to_params(locals())
)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_frame.py", line 323, in wait_for_selector
await self._channel.send("waitForSelector", locals_to_params(locals()))
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/scubaduck/.venv/lib/python3.12/site-packages/playwright/_impl
/_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Page.wait_for_selector: Timeout 30000ms e
xceeded.
Call log:
- waiting for locator("#order_by option") to be visible
63 × locator resolved to 2 elements. Proceeding with the first one: <option
value="timestamp">timestamp</option>
The script failed from a timeout on '#order_by option'. I'll retry with a shorter script.
python - <<'PY'
from scubaduck.server import app
from werkzeug.serving import make_server
import threading
from playwright.sync_api import sync_playwright
httpd = make_server('127.0.0.1',0,app)
port=httpd.server_port
thread=threading.Thread(target=httpd.serve_forever); thread.start()
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(f'http://127.0.0.1:{port}')
page.wait_for_selector('#order_by option')
page.click('text=Add Filter')
f = page.query_selector('#filters .filter:last-child')
page.evaluate("arg => setSelectValue(arg.el.querySelector('.f-col'), arg.val
)", {"el": f, "val": "user"})
inp = f.query_selector('.f-val')
inp.click()
try:
page.wait_for_selector('#filters .filter:last-child .chip-dropdown div',
timeout=3000)
print('dropdown visible, display', f.query_selector('.chip-dropdown').ev
aluate('e => e.style.display'))
except Exception as e:
print('timeout', e)
print('display style', f.query_selector('.chip-dropdown').evaluate('e =>
e.style.display'))
browser.close()
httpd.shutdown(); thread.join()
PY
^CException ignored in: <module 'threading' from '/usr/lib/python3.12/threading.
py'>
Traceback (most recent call last):
File "/usr/lib/python3.12/threading.py", line 1622, in _shutdown
lock.acquire()
KeyboardInterrupt:
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'm thinking the issue may be related to how events are triggered on the wrapper vs. select.
It seems the dropdown isn't showing because the test waits for it before typing.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "showDropdown" -n sc
ubaduck/static/index.html
564: function showDropdown() {
655: showDropdown();
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '560,670p' scubaduck/
static/index.html
function hideDropdown() {
dropdown.style.display = 'none';
}
function showDropdown() {
dropdown.style.display = 'block';
}
function updateHighlight() {
Array.from(dropdown.children).forEach((c, i) => {
c.classList.toggle('highlight', i === highlight);
});
}
function addChip(val) {
if (!val) return;
chips.push(val);
input.value = '';
renderChips();
}
copyBtn.addEventListener('click', () => {
navigator.clipboard && navigator.clipboard.writeText(chips.join(','));
});
input.addEventListener('paste', e => {
e.preventDefault();
const text = e.clipboardData.getData('text');
if (e.shiftKey) {
addChip(text.trim());
} else {
text.split(',').forEach(t => addChip(t.trim()));
}
hideDropdown();
});
input.addEventListener('keydown', e => {
if (e.key === 'ArrowDown') {
if (dropdown.style.display !== 'none') {
highlight = Math.min(highlight + 1, dropdown.children.length - 1);
updateHighlight();
}
e.preventDefault();
} else if (e.key === 'ArrowUp') {
if (dropdown.style.display !== 'none') {
highlight = Math.max(highlight - 1, 0);
updateHighlight();
}
e.preventDefault();
} else if (e.key === 'Backspace' && input.value === '') {
if (chips.length > 0) {
chips.pop();
renderChips();
}
hideDropdown();
} else if (e.key === 'Enter') {
if (dropdown.style.display !== 'none' && dropdown.children.length > 0) {
const val = dropdown.children[highlight].dataset.value;
if (val !== input.value.trim()) {
addChip(val);
} else {
addChip(input.value.trim());
}
} else {
addChip(input.value.trim());
}
hideDropdown();
e.preventDefault();
}
});
function renderDropdown(vals) {
dropdown.innerHTML = '';
const typed = input.value.trim();
if (typed) {
vals.splice(1, 0, typed);
}
vals.forEach((v, i) => {
const d = document.createElement('div');
d.textContent = v;
d.dataset.value = v;
d.addEventListener('mouseover', () => {
highlight = i;
updateHighlight();
});
d.addEventListener('mousedown', evt => {
evt.preventDefault();
addChip(v);
hideDropdown();
});
dropdown.appendChild(d);
});
if (vals.length) {
highlight = 0;
updateHighlight();
showDropdown();
} else {
hideDropdown();
}
}
function loadOptions() {
if (!fetchOptions) {
dropdown.innerHTML = '';
return;
}
Promise.resolve(fetchOptions(input.value, filter)).then(values => {
renderDropdown(Array.isArray(values) ? values : []);
});
}
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '670,740p' scubaduck/
static/index.html
input.addEventListener('focus', loadOptions);
input.addEventListener('input', loadOptions);
document.addEventListener('click', evt => {
if (!filter.contains(evt.target)) {
hideDropdown();
}
});
}
function addFilter() {
const container = document.createElement('div');
container.className = 'filter';
container.innerHTML = `
<div class="filter-row">
<select class="f-col"></select>
<select class="f-op"></select>
<button type="button" class="remove" onclick="this.closest('.filter').remo
ve()">✖</button>
</div>
<div class="chip-box">
<div class="chip-input">
<input class="f-val" type="text">
<button type="button" class="chip-copy">⎘</button>
</div>
<div class="chip-dropdown"></div>
</div>
`;
const colSel = container.querySelector('.f-col');
colSel.innerHTML = allColumns.map(c => `<option value="${c}">${c}</option>`).j
oin('');
initDropdown(colSel);
function populateOps() {
const opSel = container.querySelector('.f-op');
const col = colSel.value;
const ops = isStringColumn(col)
? [
['=', '='],
['!=', '!='],
['~', 'matches regex'],
['!~', 'not matches regex'],
['contains', 'contains'],
['!contains', 'not contains'],
['empty', 'empty'],
['!empty', 'not empty'],
['LIKE', 'like'],
]
: [
['=', '='],
['!=', '!='],
['<', '<'],
['>', '>'],
];
opSel.innerHTML = ops.map(o => `<option value="${o[0]}">${o[1]}</option>`).j
oin('');
updateInputVis();
}
function updateInputVis() {
const op = container.querySelector('.f-op').value;
const box = container.querySelector('.chip-box');
box.style.display = op === 'empty' || op === '!empty' ? 'none' : 'block';
}
colSel.addEventListener('change', populateOps);
container.querySelector('.f-op').addEventListener('change', updateInputVis);
populateOps();
document.getElementById('filter_list').appendChild(container);
initChipInput(container, (typed, el) => {
const colSel = el.querySelector('.f-col');
if (!colSel) return [];
const col = colSel.value;
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '740,812p' scubaduck/
static/index.html
const col = colSel.value;
if (!isStringColumn(col)) return [];
return fetch(`/api/samples?column=${encodeURIComponent(col)}&q=${encodeURICo
mponent(typed)}`)
.then(r => r.json());
});
}
let lastQueryTime = 0;
let queryStart = 0;
function dive(push=true) {
const payload = collectParams();
if (push) {
history.pushState(payload, '', paramsToSearch(payload));
}
const view = document.getElementById('view');
view.innerHTML = '<p>Loading...</p>';
window.lastResults = undefined;
queryStart = performance.now();
fetch('/api/query', {method:'POST', headers:{'Content-Type':'application/json'
}, body:JSON.stringify(payload)})
.then(async r => {
const data = await r.json();
if (!r.ok) throw data;
return data;
})
.then(data => {
lastQueryTime = Math.round(performance.now() - queryStart);
showResults(data);
})
.catch(err => {
showError(err);
});
}
function collectParams() {
updateSelectedColumns();
const payload = {
start: document.getElementById('start').value,
end: document.getElementById('end').value,
order_by: document.getElementById('order_by').value,
order_dir: orderDir,
limit: parseInt(document.getElementById('limit').value, 10),
columns: selectedColumns.filter(c => c !== 'Hits'),
graph_type: graphTypeSel.value,
filters: Array.from(document.querySelectorAll('#filters .filter')).map(f =>
{
const chips = f.chips || [];
const op = f.querySelector('.f-op').value;
let value = null;
if (op !== 'empty' && op !== '!empty') {
value = chips.length === 0 ? null : (chips.length === 1 ? chips[0] : chi
ps);
}
const colSel = f.querySelector('.f-col select') || f.querySelector('.f-col
');
return {column: colSel.value, op, value};
})
};
if (graphTypeSel.value === 'table') {
payload.group_by = groupBy.chips || [];
payload.aggregate = document.getElementById('aggregate').value;
payload.show_hits = document.getElementById('show_hits').checked;
}
return payload;
}
function paramsToSearch(params) {
const sp = new URLSearchParams();
if (params.start) sp.set('start', params.start);
if (params.end) sp.set('end', params.end);
if (params.order_by) sp.set('order_by', params.order_by);
if (params.order_dir) sp.set('order_dir', params.order_dir);
if (params.limit !== null && params.limit !== undefined) sp.set('limit', param
s.limit);
if (params.columns && params.columns.length) sp.set('columns', params.columns.
join(','));
if (params.filters && params.filters.length) sp.set('filters', JSON.stringify(
params.filters));
if (params.graph_type) sp.set('graph_type', params.graph_type);
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
The issue is with colSel being the wrapper, not a select element. I'll update to fix.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "initChipInput(conta
iner" -n scubaduck/static/index.html
737: initChipInput(container, (typed, el) => {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# sed -n '736,758p' scubaduck/
static/index.html
document.getElementById('filter_list').appendChild(container);
initChipInput(container, (typed, el) => {
const colSel = el.querySelector('.f-col');
if (!colSel) return [];
const col = colSel.value;
if (!isStringColumn(col)) return [];
return fetch(`/api/samples?column=${encodeURIComponent(col)}&q=${encodeURICo
mponent(typed)}`)
.then(r => r.json());
});
}
let lastQueryTime = 0;
let queryStart = 0;
function dive(push=true) {
const payload = collectParams();
if (push) {
history.pushState(payload, '', paramsToSearch(payload));
}
const view = document.getElementById('view');
view.innerHTML = '<p>Loading...</p>';
window.lastResults = undefined;
queryStart = performance.now();
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - initChipInput(container, (typed, el) => {
> - const colSel = el.querySelector('.f-col');
> - if (!colSel) return [];
> - const col = colSel.value;
> + initChipInput(container, (typed, el) => {
> + const colEl = el.querySelector('.f-col select') || el.querySelector('.f-c
ol');
> + if (!colEl) return [];
> + const col = colEl.value;
> if (!isStringColumn(col)) return [];
> return fetch(`/api/samples?column=${encodeURIComponent(col)}&q=${encodeUR
IComponent(typed)}`)
> .then(r => r.json());
> });
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# ruff check
All checks passed!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pyright
0 errors, 0 warnings, 0 informations
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll try running each failing test by itself to isolate the issue.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_chip_dropdown_navigation -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_chip_dropdown_navigation[chromium]
[gw0] PASSED tests/test_web.py::test_chip_dropdown_navigation[chromium]
============================== 1 passed in 2.21s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest tests/test_web.py::te
st_chip_dropdown_hides_on_outside_click -vv -s
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.6.0 -- /workspace/scubad
uck/.venv/bin/python
cachedir: .pytest_cache
rootdir: /workspace/scubaduck
configfile: pyproject.toml
plugins: base-url-2.1.0, xdist-3.6.1, playwright-0.7.0
5 workers [1 item]
scheduling tests via LoadScheduling
tests/test_web.py::test_chip_dropdown_hides_on_outside_click[chromium]
[gw0] PASSED tests/test_web.py::test_chip_dropdown_hides_on_outside_click[chromi
um]
============================== 1 passed in 2.23s ===============================
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# pytest -q
bringing up nodes...
............................................. [100%]
45 passed in 7.33s
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
All tests passed successfully, so it's time to commit the updates.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# git status --short
M scubaduck/static/index.html
M tests/test_web.py
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Two files were modified. Time to commit these updates!
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# git add scubaduck/static/ind
ex.html tests/test_web.py
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# git commit -m "test: verify
filter remove button alignment" && git status --short
[work fd3c8f5] test: verify filter remove button alignment
2 files changed, 25 insertions(+), 8 deletions(-)
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Let me see the current status to decide the next step.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# git status --short
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ll include lines showing where the new test was added in tests/test_web.py.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba tests/test_web.py | s
ed -n '120,145p'
120 def test_default_filter_and_layout(page: Any, server_url: str) -> None:
121 page.goto(server_url)
122 page.wait_for_selector("#order_by option", state="attached")
123 count = page.evaluate("document.querySelectorAll('#filters .filter')
.length")
124 assert count == 1
125 last_is_button = page.evaluate(
126 "document.querySelector('#filters').lastElementChild.id === 'add
_filter'"
127 )
128 assert last_is_button
129 position = page.evaluate(
130 "getComputedStyle(document.querySelector('#filters .filter butto
n.remove')).position"
131 )
132 assert position == "static"
133
134
135 def test_filter_remove_alignment(page: Any, server_url: str) -> None:
136 page.goto(server_url)
137 page.wait_for_selector("#order_by option", state="attached")
138 diff = page.evaluate(
139 "() => { const r=document.querySelector('#filters .filter-row').
getBoundingClientRect(); const x=document.querySelector('#filters .filter-row bu
tton.remove').getBoundingClientRect(); return Math.abs(r.right - x.right); }"
140 )
141 assert diff <= 1
142
143
144 def test_header_and_tabs(page: Any, server_url: str) -> None:
145 page.goto(server_url)
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'm focusing on test lines 135-141 and modifying index.html around initDropdown.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# grep -n "initDropdown" -n sc
ubaduck/static/index.html | head
234:function initDropdown(select) {
456: initDropdown(orderSelect);
457: initDropdown(document.getElementById('aggregate'));
700: initDropdown(colSel);
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '234,251p'
234 function initDropdown(select) {
235 const wrapper = document.createElement('div');
236 wrapper.className = 'dropdown';
237 if (select.classList.contains('f-col')) {
238 wrapper.classList.add('f-col');
239 }
240 select.parentNode.insertBefore(wrapper, select);
241 wrapper.appendChild(select);
242 select.style.display = 'none';
243 const disp = document.createElement('div');
244 disp.className = 'dropdown-display';
245 function updateDisplay() {
246 const opt = select.options[select.selectedIndex];
247 disp.textContent = opt ? opt.textContent : '';
248 }
249 updateDisplay();
250 wrapper.appendChild(disp);
251 const menu = document.createElement('div');
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
Making another patch for lines related to setSelectValue.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '748,767p'
748 let queryStart = 0;
749
750 function dive(push=true) {
751 const payload = collectParams();
752 if (push) {
753 history.pushState(payload, '', paramsToSearch(payload));
754 }
755 const view = document.getElementById('view');
756 view.innerHTML = '<p>Loading...</p>';
757 window.lastResults = undefined;
758 queryStart = performance.now();
759 fetch('/api/query', {method:'POST', headers:{'Content-Type':'applicati
on/json'}, body:JSON.stringify(payload)})
760 .then(async r => {
761 const data = await r.json();
762 if (!r.ok) throw data;
763 return data;
764 })
765 .then(data => {
766 lastQueryTime = Math.round(performance.now() - queryStart);
767 showResults(data);
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll find the line ranges for where the new function setSelectValue was added.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | grep -n "setSelectValue" -n
1027: 1027 function setSelectValue(selector, value) {
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '1026,1035p'
1026
1027 function setSelectValue(selector, value) {
1028 const el = typeof selector === 'string' ? document.querySelector(selec
tor) : selector;
1029 if (el) {
1030 const select = el.tagName === 'SELECT' ? el : el.querySelector('sele
ct');
1031 if (select) {
1032 select.value = value;
1033 select.dispatchEvent(new Event('change'));
1034 }
1035 }
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'm going to patch lines around collectParams, specifically near line 797.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '786,804p'
786 const op = f.querySelector('.f-op').value;
787 let value = null;
788 if (op !== 'empty' && op !== '!empty') {
789 value = chips.length === 0 ? null : (chips.length === 1 ? chips[
0] : chips);
790 }
791 const colSel = f.querySelector('.f-col select') || f.querySelector
('.f-col');
792 return {column: colSel.value, op, value};
793 })
794 };
795 if (graphTypeSel.value === 'table') {
796 payload.group_by = groupBy.chips || [];
797 payload.aggregate = document.getElementById('aggregate').value;
798 payload.show_hits = document.getElementById('show_hits').checked;
799 }
800 return payload;
801 }
802
803 function paramsToSearch(params) {
804 const sp = new URLSearchParams();
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I'll track down the line ranges for the initChipInput changes.
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '732,748p'
732
733 colSel.addEventListener('change', populateOps);
734 container.querySelector('.f-op').addEventListener('change', updateInpu
tVis);
735 populateOps();
736 document.getElementById('filter_list').appendChild(container);
737 initChipInput(container, (typed, el) => {
738 const colEl = el.querySelector('.f-col select') || el.querySelector(
'.f-col');
739 if (!colEl) return [];
740 const col = colEl.value;
741 if (!isStringColumn(col)) return [];
742 return fetch(`/api/samples?column=${encodeURIComponent(col)}&q=${enc
odeURIComponent(typed)}`)
743 .then(r => r.json());
744 });
745 }
746
747 let lastQueryTime = 0;
748 let queryStart = 0;
(scubaduck) root@79a0f51f0ce9:/workspace/scubaduck#
I’ve got the code lines ready, now I’ll create the PR for the changes!