Task ID: task_e_682f2fd27ab48323973a9be5c0c473fb
pytest ------------------------------ 77.52 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 16.00 KiB/5.31 MiB
ruff ------------------------------ 223.44 KiB/11.02 MiB
duckdb ------------------------------ 176.00 KiB/19.27 MiB
playwright ------------------------------ 32.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
pyee ------------------------------ 15.36 KiB/15.36 KiB
execnet ------------------------------ 30.88 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
requests ------------------------------ 46.88 KiB/63.41 KiB
packaging ------------------------------ 48.00 KiB/64.91 KiB
text-unidecode ------------------------------ 76.32 KiB/76.32 KiB
click ------------------------------ 96.00 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 80.00 KiB/125.66 KiB
jinja2 ------------------------------ 96.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 127.12 KiB/145.08 KiB
certifi ------------------------------ 155.88 KiB/155.88 KiB
werkzeug ------------------------------ 79.67 KiB/219.24 KiB
python-dateutil ------------------------------ 48.00 KiB/224.50 KiB
pytest ------------------------------ 93.52 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 16.00 KiB/5.31 MiB
ruff ------------------------------ 239.44 KiB/11.02 MiB
duckdb ------------------------------ 192.00 KiB/19.27 MiB
playwright ------------------------------ 32.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 30.88 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
requests ------------------------------ 46.88 KiB/63.41 KiB
packaging ------------------------------ 48.00 KiB/64.91 KiB
text-unidecode ------------------------------ 76.32 KiB/76.32 KiB
click ------------------------------ 96.00 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 80.00 KiB/125.66 KiB
jinja2 ------------------------------ 96.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 127.12 KiB/145.08 KiB
certifi ------------------------------ 155.88 KiB/155.88 KiB
werkzeug ------------------------------ 79.67 KiB/219.24 KiB
python-dateutil ------------------------------ 61.79 KiB/224.50 KiB
pytest ------------------------------ 93.52 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 16.00 KiB/5.31 MiB
ruff ------------------------------ 239.44 KiB/11.02 MiB
duckdb ------------------------------ 192.00 KiB/19.27 MiB
playwright ------------------------------ 32.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 30.88 KiB/39.66 KiB
pytest-xdist ------------------------------ 45.03 KiB/45.03 KiB
requests ------------------------------ 46.88 KiB/63.41 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
text-unidecode ------------------------------ 76.32 KiB/76.32 KiB
click ------------------------------ 99.76 KiB/99.76 KiB
flask ------------------------------ 64.00 KiB/100.88 KiB
urllib3 ------------------------------ 80.00 KiB/125.66 KiB
jinja2 ------------------------------ 96.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 127.12 KiB/145.08 KiB
werkzeug ------------------------------ 95.67 KiB/219.24 KiB
python-dateutil ------------------------------ 61.79 KiB/224.50 KiB
pytest ------------------------------ 109.52 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 16.00 KiB/5.31 MiB
ruff ------------------------------ 255.44 KiB/11.02 MiB
duckdb ------------------------------ 208.00 KiB/19.27 MiB
playwright ------------------------------ 32.00 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 ------------------------------ 46.88 KiB/63.41 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
text-unidecode ------------------------------ 76.32 KiB/76.32 KiB
click ------------------------------ 99.76 KiB/99.76 KiB
flask ------------------------------ 80.00 KiB/100.88 KiB
urllib3 ------------------------------ 80.00 KiB/125.66 KiB
jinja2 ------------------------------ 96.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 143.12 KiB/145.08 KiB
werkzeug ------------------------------ 95.67 KiB/219.24 KiB
python-dateutil ------------------------------ 77.79 KiB/224.50 KiB
pytest ------------------------------ 109.52 KiB/335.58 KiB
greenlet ------------------------------ 48.00 KiB/589.71 KiB
pyright ------------------------------ 16.00 KiB/5.31 MiB
ruff ------------------------------ 287.44 KiB/11.02 MiB
duckdb ------------------------------ 249.81 KiB/19.27 MiB
playwright ------------------------------ 32.00 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
text-unidecode ------------------------------ 76.32 KiB/76.32 KiB
flask ------------------------------ 80.00 KiB/100.88 KiB
urllib3 ------------------------------ 80.00 KiB/125.66 KiB
jinja2 ------------------------------ 96.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 143.12 KiB/145.08 KiB
werkzeug ------------------------------ 95.67 KiB/219.24 KiB
python-dateutil ------------------------------ 125.79 KiB/224.50 KiB
pytest ------------------------------ 125.52 KiB/335.58 KiB
greenlet ------------------------------ 62.64 KiB/589.71 KiB
pyright ------------------------------ 32.00 KiB/5.31 MiB
ruff ------------------------------ 335.44 KiB/11.02 MiB
duckdb ------------------------------ 281.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 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
flask ------------------------------ 80.00 KiB/100.88 KiB
urllib3 ------------------------------ 80.00 KiB/125.66 KiB
jinja2 ------------------------------ 112.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 143.12 KiB/145.08 KiB
werkzeug ------------------------------ 95.67 KiB/219.24 KiB
python-dateutil ------------------------------ 141.79 KiB/224.50 KiB
pytest ------------------------------ 125.52 KiB/335.58 KiB
greenlet ------------------------------ 62.64 KiB/589.71 KiB
pyright ------------------------------ 48.00 KiB/5.31 MiB
ruff ------------------------------ 351.44 KiB/11.02 MiB
duckdb ------------------------------ 297.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
requests ------------------------------ 63.41 KiB/63.41 KiB
packaging ------------------------------ 64.91 KiB/64.91 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 96.00 KiB/125.66 KiB
jinja2 ------------------------------ 128.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 143.12 KiB/145.08 KiB
werkzeug ------------------------------ 111.67 KiB/219.24 KiB
python-dateutil ------------------------------ 221.79 KiB/224.50 KiB
pytest ------------------------------ 157.52 KiB/335.58 KiB
greenlet ------------------------------ 142.64 KiB/589.71 KiB
pyright ------------------------------ 142.99 KiB/5.31 MiB
ruff ------------------------------ 447.44 KiB/11.02 MiB
duckdb ------------------------------ 393.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
requests ------------------------------ 63.41 KiB/63.41 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 96.00 KiB/125.66 KiB
jinja2 ------------------------------ 128.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 143.12 KiB/145.08 KiB
werkzeug ------------------------------ 111.67 KiB/219.24 KiB
python-dateutil ------------------------------ 221.79 KiB/224.50 KiB
pytest ------------------------------ 157.52 KiB/335.58 KiB
greenlet ------------------------------ 142.64 KiB/589.71 KiB
pyright ------------------------------ 142.99 KiB/5.31 MiB
ruff ------------------------------ 447.44 KiB/11.02 MiB
duckdb ------------------------------ 393.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
execnet ------------------------------ 39.66 KiB/39.66 KiB
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 96.00 KiB/125.66 KiB
jinja2 ------------------------------ 128.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 145.08 KiB/145.08 KiB
werkzeug ------------------------------ 111.67 KiB/219.24 KiB
python-dateutil ------------------------------ 221.79 KiB/224.50 KiB
pytest ------------------------------ 173.52 KiB/335.58 KiB
greenlet ------------------------------ 174.64 KiB/589.71 KiB
pyright ------------------------------ 174.99 KiB/5.31 MiB
ruff ------------------------------ 479.44 KiB/11.02 MiB
duckdb ------------------------------ 425.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 96.00 KiB/125.66 KiB
jinja2 ------------------------------ 128.00 KiB/131.74 KiB
charset-normalizer ------------------------------ 145.08 KiB/145.08 KiB
werkzeug ------------------------------ 111.67 KiB/219.24 KiB
python-dateutil ------------------------------ 221.79 KiB/224.50 KiB
pytest ------------------------------ 173.52 KiB/335.58 KiB
greenlet ------------------------------ 190.64 KiB/589.71 KiB
pyright ------------------------------ 190.99 KiB/5.31 MiB
ruff ------------------------------ 495.44 KiB/11.02 MiB
duckdb ------------------------------ 441.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
flask ------------------------------ 96.00 KiB/100.88 KiB
urllib3 ------------------------------ 96.00 KiB/125.66 KiB
jinja2 ------------------------------ 128.00 KiB/131.74 KiB
werkzeug ------------------------------ 127.67 KiB/219.24 KiB
python-dateutil ------------------------------ 221.79 KiB/224.50 KiB
pytest ------------------------------ 189.52 KiB/335.58 KiB
greenlet ------------------------------ 190.64 KiB/589.71 KiB
pyright ------------------------------ 190.99 KiB/5.31 MiB
ruff ------------------------------ 495.44 KiB/11.02 MiB
duckdb ------------------------------ 457.81 KiB/19.27 MiB
playwright ------------------------------ 48.00 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
flask ------------------------------ 100.88 KiB/100.88 KiB
urllib3 ------------------------------ 112.00 KiB/125.66 KiB
jinja2 ------------------------------ 131.74 KiB/131.74 KiB
werkzeug ------------------------------ 127.67 KiB/219.24 KiB
pytest ------------------------------ 189.52 KiB/335.58 KiB
greenlet ------------------------------ 302.64 KiB/589.71 KiB
pyright ------------------------------ 302.99 KiB/5.31 MiB
ruff ------------------------------ 607.44 KiB/11.02 MiB
duckdb ------------------------------ 553.81 KiB/19.27 MiB
playwright ------------------------------ 63.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
flask ------------------------------ 100.88 KiB/100.88 KiB
urllib3 ------------------------------ 112.00 KiB/125.66 KiB
werkzeug ------------------------------ 127.67 KiB/219.24 KiB
pytest ------------------------------ 189.52 KiB/335.58 KiB
greenlet ------------------------------ 302.64 KiB/589.71 KiB
pyright ------------------------------ 302.99 KiB/5.31 MiB
ruff ------------------------------ 607.44 KiB/11.02 MiB
duckdb ------------------------------ 553.81 KiB/19.27 MiB
playwright ------------------------------ 63.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
urllib3 ------------------------------ 112.00 KiB/125.66 KiB
werkzeug ------------------------------ 127.67 KiB/219.24 KiB
pytest ------------------------------ 189.52 KiB/335.58 KiB
greenlet ------------------------------ 318.64 KiB/589.71 KiB
pyright ------------------------------ 318.99 KiB/5.31 MiB
ruff ------------------------------ 623.44 KiB/11.02 MiB
duckdb ------------------------------ 569.81 KiB/19.27 MiB
playwright ------------------------------ 63.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠹ Preparing packages... (0/33)
urllib3 ------------------------------ 112.00 KiB/125.66 KiB
werkzeug ------------------------------ 127.67 KiB/219.24 KiB
pytest ------------------------------ 189.52 KiB/335.58 KiB
greenlet ------------------------------ 334.64 KiB/589.71 KiB
pyright ------------------------------ 318.99 KiB/5.31 MiB
ruff ------------------------------ 623.44 KiB/11.02 MiB
duckdb ------------------------------ 569.81 KiB/19.27 MiB
playwright ------------------------------ 63.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
werkzeug ------------------------------ 143.67 KiB/219.24 KiB
pytest ------------------------------ 221.52 KiB/335.58 KiB
greenlet ------------------------------ 462.64 KiB/589.71 KiB
pyright ------------------------------ 542.99 KiB/5.31 MiB
ruff ------------------------------ 863.44 KiB/11.02 MiB
duckdb ------------------------------ 809.81 KiB/19.27 MiB
playwright ------------------------------ 95.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
werkzeug ------------------------------ 175.67 KiB/219.24 KiB
pytest ------------------------------ 269.52 KiB/335.58 KiB
greenlet ------------------------------ 478.64 KiB/589.71 KiB
pyright ------------------------------ 862.99 KiB/5.31 MiB
ruff ------------------------------ 1.15 MiB/11.02 MiB
duckdb ------------------------------ 1.07 MiB/19.27 MiB
playwright ------------------------------ 111.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
pytest ------------------------------ 333.52 KiB/335.58 KiB
greenlet ------------------------------ 494.64 KiB/589.71 KiB
pyright ------------------------------ 1.17 MiB/5.31 MiB
ruff ------------------------------ 1.48 MiB/11.02 MiB
duckdb ------------------------------ 1.41 MiB/19.27 MiB
playwright ------------------------------ 319.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
pytest ------------------------------ 333.52 KiB/335.58 KiB
greenlet ------------------------------ 494.64 KiB/589.71 KiB
pyright ------------------------------ 1.31 MiB/5.31 MiB
ruff ------------------------------ 1.62 MiB/11.02 MiB
duckdb ------------------------------ 1.53 MiB/19.27 MiB
playwright ------------------------------ 479.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
greenlet ------------------------------ 510.64 KiB/589.71 KiB
pyright ------------------------------ 1.34 MiB/5.31 MiB
ruff ------------------------------ 1.79 MiB/11.02 MiB
duckdb ------------------------------ 1.70 MiB/19.27 MiB
playwright ------------------------------ 639.51 KiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
greenlet ------------------------------ 558.64 KiB/589.71 KiB
pyright ------------------------------ 1.76 MiB/5.31 MiB
ruff ------------------------------ 2.23 MiB/11.02 MiB
duckdb ------------------------------ 2.15 MiB/19.27 MiB
playwright ------------------------------ 1.07 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
pyright ------------------------------ 1.81 MiB/5.31 MiB
ruff ------------------------------ 2.97 MiB/11.02 MiB
duckdb ------------------------------ 2.86 MiB/19.27 MiB
playwright ------------------------------ 1.82 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠸ Preparing packages... (23/33)
pyright ------------------------------ 1.81 MiB/5.31 MiB
ruff ------------------------------ 3.00 MiB/11.02 MiB
duckdb ------------------------------ 2.90 MiB/19.27 MiB
playwright ------------------------------ 1.87 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.83 MiB/5.31 MiB
ruff ------------------------------ 3.69 MiB/11.02 MiB
duckdb ------------------------------ 3.56 MiB/19.27 MiB
playwright ------------------------------ 2.54 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.86 MiB/5.31 MiB
ruff ------------------------------ 4.36 MiB/11.02 MiB
duckdb ------------------------------ 4.27 MiB/19.27 MiB
playwright ------------------------------ 3.24 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.90 MiB/5.31 MiB
ruff ------------------------------ 5.14 MiB/11.02 MiB
duckdb ------------------------------ 5.02 MiB/19.27 MiB
playwright ------------------------------ 3.97 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠼ Preparing packages... (28/33)
pyright ------------------------------ 1.94 MiB/5.31 MiB
ruff ------------------------------ 5.94 MiB/11.02 MiB
duckdb ------------------------------ 5.83 MiB/19.27 MiB
playwright ------------------------------ 4.78 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 1.97 MiB/5.31 MiB
ruff ------------------------------ 6.76 MiB/11.02 MiB
duckdb ------------------------------ 6.62 MiB/19.27 MiB
playwright ------------------------------ 5.56 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 1.98 MiB/5.31 MiB
ruff ------------------------------ 7.50 MiB/11.02 MiB
duckdb ------------------------------ 7.40 MiB/19.27 MiB
playwright ------------------------------ 6.28 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 2.03 MiB/5.31 MiB
ruff ------------------------------ 8.14 MiB/11.02 MiB
duckdb ------------------------------ 8.03 MiB/19.27 MiB
playwright ------------------------------ 6.89 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠴ Preparing packages... (28/33)
pyright ------------------------------ 2.06 MiB/5.31 MiB
ruff ------------------------------ 8.89 MiB/11.02 MiB
duckdb ------------------------------ 8.78 MiB/19.27 MiB
playwright ------------------------------ 7.64 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.09 MiB/5.31 MiB
ruff ------------------------------ 9.59 MiB/11.02 MiB
duckdb ------------------------------ 9.46 MiB/19.27 MiB
playwright ------------------------------ 8.32 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.12 MiB/5.31 MiB
ruff ------------------------------ 10.30 MiB/11.02 MiB
duckdb ------------------------------ 10.17 MiB/19.27 MiB
playwright ------------------------------ 9.02 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.14 MiB/5.31 MiB
duckdb ------------------------------ 10.95 MiB/19.27 MiB
playwright ------------------------------ 9.76 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.14 MiB/5.31 MiB
duckdb ------------------------------ 11.01 MiB/19.27 MiB
playwright ------------------------------ 9.84 MiB/43.05 MiB
Building scubaduck @ file:///workspace/scubaduck
⠦ Preparing packages... (28/33)
pyright ------------------------------ 2.17 MiB/5.31 MiB
duckdb ------------------------------ 12.10 MiB/19.27 MiB
playwright ------------------------------ 10.92 MiB/43.05 MiB
Built scubaduck @ file:///workspace/scubaduck
⠧ Preparing packages... (29/33)
pyright ------------------------------ 2.17 MiB/5.31 MiB
duckdb ------------------------------ 12.12 MiB/19.27 MiB
playwright ------------------------------ 10.94 MiB/43.05 MiB
⠧ Preparing packages... (29/33)
pyright ------------------------------ 2.17 MiB/5.31 MiB
duckdb ------------------------------ 13.18 MiB/19.27 MiB
playwright ------------------------------ 11.97 MiB/43.05 MiB
⠧ Preparing packages... (29/33)
pyright ------------------------------ 2.19 MiB/5.31 MiB
duckdb ------------------------------ 14.34 MiB/19.27 MiB
playwright ------------------------------ 13.08 MiB/43.05 MiB
⠧ Preparing packages... (29/33)
pyright ------------------------------ 2.20 MiB/5.31 MiB
duckdb ------------------------------ 15.60 MiB/19.27 MiB
playwright ------------------------------ 14.31 MiB/43.05 MiB
⠧ Preparing packages... (29/33)
pyright ------------------------------ 2.23 MiB/5.31 MiB
duckdb ------------------------------ 16.78 MiB/19.27 MiB
playwright ------------------------------ 15.48 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.25 MiB/5.31 MiB
duckdb ------------------------------ 17.97 MiB/19.27 MiB
playwright ------------------------------ 16.63 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.25 MiB/5.31 MiB
duckdb ------------------------------ 19.07 MiB/19.27 MiB
playwright ------------------------------ 17.72 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.31 MiB/5.31 MiB
playwright ------------------------------ 19.54 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.31 MiB/5.31 MiB
playwright ------------------------------ 19.60 MiB/43.05 MiB
⠇ Preparing packages... (30/33)
pyright ------------------------------ 2.38 MiB/5.31 MiB
playwright ------------------------------ 21.73 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.41 MiB/5.31 MiB
playwright ------------------------------ 24.13 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.44 MiB/5.31 MiB
playwright ------------------------------ 26.54 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.46 MiB/5.31 MiB
playwright ------------------------------ 29.16 MiB/43.05 MiB
⠋ Preparing packages... (31/33)
pyright ------------------------------ 2.52 MiB/5.31 MiB
playwright ------------------------------ 31.11 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.60 MiB/5.31 MiB
playwright ------------------------------ 32.61 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.64 MiB/5.31 MiB
playwright ------------------------------ 33.65 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.72 MiB/5.31 MiB
playwright ------------------------------ 34.84 MiB/43.05 MiB
⠙ Preparing packages... (31/33)
pyright ------------------------------ 2.78 MiB/5.31 MiB
playwright ------------------------------ 35.94 MiB/43.05 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 2.86 MiB/5.31 MiB
playwright ------------------------------ 36.99 MiB/43.05 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 2.97 MiB/5.31 MiB
playwright ------------------------------ 38.17 MiB/43.05 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 3.05 MiB/5.31 MiB
playwright ------------------------------ 39.02 MiB/43.05 MiB
⠹ Preparing packages... (31/33)
pyright ------------------------------ 3.15 MiB/5.31 MiB
playwright ------------------------------ 39.74 MiB/43.05 MiB
⠸ Preparing packages... (31/33)
pyright ------------------------------ 3.23 MiB/5.31 MiB
playwright ------------------------------ 40.75 MiB/43.05 MiB
⠸ Preparing packages... (31/33)
pyright ------------------------------ 3.31 MiB/5.31 MiB
playwright ------------------------------ 41.28 MiB/43.05 MiB
⠸ Preparing packages... (31/33)
pyright ------------------------------ 3.42 MiB/5.31 MiB
playwright ------------------------------ 42.11 MiB/43.05 MiB
⠸ Preparing packages... (31/33)
pyright ------------------------------ 3.47 MiB/5.31 MiB
⠸ Preparing packages... (31/33)
pyright ------------------------------ 3.51 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 3.76 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.01 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.33 MiB/5.31 MiB
⠼ Preparing packages... (32/33)
pyright ------------------------------ 4.50 MiB/5.31 MiB
⠴ Preparing packages... (32/33)
Prepared 33 packages in 2.64s
░░░░░░░░░░░░░░░░░░░░ [0/0] Installing wheels...
░░░░░░░░░░░░░░░░░░░░ [0/33] Installing wheels...
░░░░░░░░░░░░░░░░░░░░ [0/33] markupsafe==3.0.2
░░░░░░░░░░░░░░░░░░░░ [1/33] markupsafe==3.0.2
░░░░░░░░░░░░░░░░░░░░ [1/33] pytest-xdist==3.6.1
█░░░░░░░░░░░░░░░░░░░ [2/33] pytest-xdist==3.6.1
█░░░░░░░░░░░░░░░░░░░ [2/33] pyee==13.0.0
█░░░░░░░░░░░░░░░░░░░ [3/33] pyee==13.0.0
█░░░░░░░░░░░░░░░░░░░ [3/33] six==1.17.0
██░░░░░░░░░░░░░░░░░░ [4/33] six==1.17.0
██░░░░░░░░░░░░░░░░░░ [4/33] packaging==25.0
███░░░░░░░░░░░░░░░░░ [5/33] packaging==25.0
███░░░░░░░░░░░░░░░░░ [5/33] certifi==2025.4.26
███░░░░░░░░░░░░░░░░░ [6/33] certifi==2025.4.26
███░░░░░░░░░░░░░░░░░ [6/33] idna==3.10
████░░░░░░░░░░░░░░░░ [7/33] idna==3.10
████░░░░░░░░░░░░░░░░ [7/33] blinker==1.9.0
████░░░░░░░░░░░░░░░░ [8/33] blinker==1.9.0
████░░░░░░░░░░░░░░░░ [8/33] requests==2.32.3
█████░░░░░░░░░░░░░░░ [9/33] requests==2.32.3
███████████████████░ [32/33] pyright==1.1.400
████████████████████ [33/33] pyright==1.1.400
Installed 33 packages in 111ms
+ 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/iuoHnC-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
++ python -c 'import os; import duckdb; con = duckdb.connect(); con.execute(f"SET http_proxy = '\''{os.getenv("HTTP_PROXY")}'\''"); con.execute("INSTALL '\''sqlite'\'';")'
++ 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% 14.2s167.7 MiB [] 0% 36.2s167.7 MiB [] 0% 20.1s167.7 MiB [] 0% 16.4s167.7 MiB [] 0% 8.6s167.7 MiB [] 1% 6.0s167.7 MiB [] 1% 5.3s167.7 MiB [] 2% 5.4s167.7 MiB [] 2% 4.6s167.7 MiB [] 4% 3.5s167.7 MiB [] 5% 3.1s167.7 MiB [] 5% 3.0s167.7 MiB [] 6% 2.8s167.7 MiB [] 8% 2.4s167.7 MiB [] 9% 2.2s167.7 MiB [] 10% 2.2s167.7 MiB [] 11% 2.0s167.7 MiB [] 13% 1.7s167.7 MiB [] 15% 1.7s167.7 MiB [] 16% 1.6s167.7 MiB [] 18% 1.5s167.7 MiB [] 20% 1.4s167.7 MiB [] 21% 1.4s167.7 MiB [] 22% 1.4s167.7 MiB [] 23% 1.3s167.7 MiB [] 25% 1.3s167.7 MiB [] 27% 1.2s167.7 MiB [] 30% 1.1s167.7 MiB [] 31% 1.1s167.7 MiB [] 33% 1.0s167.7 MiB [] 34% 1.0s167.7 MiB [] 36% 1.0s167.7 MiB [] 37% 0.9s167.7 MiB [] 39% 0.9s167.7 MiB [] 40% 0.9s167.7 MiB [] 41% 0.9s167.7 MiB [] 42% 0.8s167.7 MiB [] 44% 0.8s167.7 MiB [] 45% 0.8s167.7 MiB [] 46% 0.8s167.7 MiB [] 48% 0.7s167.7 MiB [] 49% 0.7s167.7 MiB [] 50% 0.7s167.7 MiB [] 52% 0.7s167.7 MiB [] 53% 0.7s167.7 MiB [] 55% 0.6s167.7 MiB [] 56% 0.6s167.7 MiB [] 58% 0.6s167.7 MiB [] 60% 0.5s167.7 MiB [] 61% 0.5s167.7 MiB [] 63% 0.5s167.7 MiB [] 65% 0.5s167.7 MiB [] 66% 0.5s167.7 MiB [] 67% 0.5s167.7 MiB [] 68% 0.4s167.7 MiB [] 70% 0.4s167.7 MiB [] 71% 0.4s167.7 MiB [] 72% 0.4s167.7 MiB [] 73% 0.4s167.7 MiB [] 74% 0.4s167.7 MiB [] 75% 0.4s167.7 MiB [] 76% 0.4s167.7 MiB [] 77% 0.3s167.7 MiB [] 78% 0.3s167.7 MiB [] 79% 0.3s167.7 MiB [] 80% 0.3s167.7 MiB [] 82% 0.3s167.7 MiB [] 83% 0.3s167.7 MiB [] 84% 0.2s167.7 MiB [] 86% 0.2s167.7 MiB [] 87% 0.2s167.7 MiB [] 88% 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 [] 98% 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 [] 3% 0.5s2.3 MiB [] 7% 0.4s2.3 MiB [] 17% 0.3s2.3 MiB [] 46% 0.1s2.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% 18.0s101.4 MiB [] 0% 18.2s101.4 MiB [] 0% 12.3s101.4 MiB [] 0% 7.6s101.4 MiB [] 1% 4.5s101.4 MiB [] 2% 3.2s101.4 MiB [] 4% 2.6s101.4 MiB [] 6% 1.9s101.4 MiB [] 8% 1.5s101.4 MiB [] 10% 1.5s101.4 MiB [] 12% 1.4s101.4 MiB [] 15% 1.2s101.4 MiB [] 16% 1.2s101.4 MiB [] 17% 1.2s101.4 MiB [] 20% 1.1s101.4 MiB [] 22% 1.0s101.4 MiB [] 23% 1.0s101.4 MiB [] 26% 0.9s101.4 MiB [] 28% 0.8s101.4 MiB [] 31% 0.8s101.4 MiB [] 33% 0.7s101.4 MiB [] 36% 0.7s101.4 MiB [] 37% 0.7s101.4 MiB [] 39% 0.6s101.4 MiB [] 41% 0.6s101.4 MiB [] 45% 0.5s101.4 MiB [] 47% 0.5s101.4 MiB [] 51% 0.4s101.4 MiB [] 54% 0.4s101.4 MiB [] 58% 0.4s101.4 MiB [] 62% 0.3s101.4 MiB [] 65% 0.3s101.4 MiB [] 68% 0.3s101.4 MiB [] 71% 0.2s101.4 MiB [] 75% 0.2s101.4 MiB [] 78% 0.2s101.4 MiB [] 82% 0.1s101.4 MiB [] 86% 0.1s101.4 MiB [] 90% 0.1s101.4 MiB [] 94% 0.0s101.4 MiB [] 98% 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'
ls
bash: .venv/bin/activate: No such file or directory
root@1d8096239718:/workspace# ls
scubaduck
root@1d8096239718:/workspace# cd scubaduck
root@1d8096239718:/workspace/scubaduck# ls
AGENTS.md codex_setup.sh scubaduck tests
README.md pyproject.toml stubs uv.lock
root@1d8096239718:/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@1d8096239718:/workspace/scubaduck# ls
AGENTS.md codex_setup.sh scubaduck tests
README.md pyproject.toml stubs uv.lock
root@1d8096239718:/workspace/scubaduck# ls scubaduck
__init__.py sample.csv server.py static
root@1d8096239718:/workspace/scubaduck# ls scubaduck/static
index.html js
root@1d8096239718:/workspace/scubaduck# ls scubaduck/static/js
chip_input.js timeseries_chart.js
...
</div>
</div>
<div id="sidebar-resizer"></div>
<div id="view">
<table id="results"></table>
</div>
</div>
<script src="/js/chip_input.js"></script>
<script src="/js/timeseries_chart.js"></script>
<script>
const allColumns = [];
const baseColumns = [];
const columnTypes = {};
const stringColumns = [];
const baseStringColumns = [];
const integerColumns = [];
const baseIntegerColumns = [];
const timeColumns = [];
const baseTimeColumns = [];
const timeColumnOptions = [];
const baseTimeColumnOptions = [];
const derivedColumns = [];
let selectedColumns = [];
let displayType = 'samples';
let groupBy = {chips: [], addChip: () => {}, renderChips: () => {}};
let defaultTimeColumn = '';
function initDropdown(select) {
const wrapper = document.createElement('div');
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';
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');
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;
...
d = new Date(v);
} else {
const unit = document.getElementById('time_unit').value;
const factors = {s: 1000, ms: 1, us: 0.001, ns: 0.000001};
d = new Date(Number(v) * (factors[unit] || 1000));
}
td.textContent = d.toLocaleString('en-US', {
weekday: 'short',
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: true,
timeZoneName: 'short'
});
} else {
if (col === 'Hits') {
const pct = totalHits ? ((v / totalHits) * 100).toFixed(1) : '0';
td.textContent = `${formatNumber(v)} (${pct}%)`;
} else {
td.textContent = isStringColumn(col) ? v : formatNumber(v);
}
}
td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
tr.appendChild(td);
});
table.appendChild(tr);
});
// ensure table does not overflow unless necessary
const view = document.getElementById('view');
if (table.scrollWidth <= view.clientWidth) {
table.style.width = '100%';
}
}
function handleSort(e) {
const idx = parseInt(e.target.dataset.index, 10);
if (sortState.index !== idx) {
sortState.index = idx;
sortState.dir = 'asc';
} else if (sortState.dir === 'asc') {
sortState.dir = 'desc';
} else if (sortState.dir === 'desc') {
sortState.index = null;
sortState.dir = null;
} else {
sortState.dir = 'asc';
}
let rows = originalRows.slice();
if (sortState.index !== null) {
rows.sort((a, b) => {
const va = a[sortState.index];
const vb = b[sortState.index];
if (va === vb) return 0;
if (sortState.dir === 'desc') return va < vb ? 1 : -1;
return va > vb ? 1 : -1;
});
}
renderTable(rows);
}
function showResults(data) {
window.lastResults = data;
const view = document.getElementById('view');
if (graphTypeSel.value === 'timeseries') {
showTimeSeries(data);
} else {
if (data.rows.length === 0) {
view.innerHTML =
'<p id="empty-message">Empty data provided to table</p><table id="result
s"></table>';
} else {
view.innerHTML = '<table id="results"></table>';
}
originalRows = data.rows.slice();
sortState = {index: null, dir: null};
renderTable(originalRows);
}
const sqlEl = document.createElement('pre');
sqlEl.id = 'sql_query';
sqlEl.style.whiteSpace = 'pre-wrap';
sqlEl.style.marginTop = '10px';
sqlEl.textContent = data.sql;
view.appendChild(sqlEl);
document.getElementById('query_info').textContent =
`Your query took about ${lastQueryTime} ms`;
}
function showError(err) {
window.lastResults = err;
const view = document.getElementById('view');
let msg = '';
if (typeof err === 'string') {
msg = err;
} else if (err) {
msg = err.error || 'Error';
if (err.sql) {
msg += '\nSQL: ' + err.sql;
}
if (err.traceback) {
msg += '\n' + err.traceback;
}
}
view.innerHTML = `<pre id="error-message">${msg}</pre>`;
document.getElementById('query_info').textContent = '';
}
function setSelectValue(selector, value) {
const el = typeof selector === 'string' ? document.querySelector(selector) : s
elector;
if (el) {
const select = el.tagName === 'SELECT' ? el : el.querySelector('select');
if (select) {
select.value = value;
select.dispatchEvent(new Event('change'));
}
}
}
</script>
</body>
</html>
I see some truncated output above. I’ll open index.html earlier to investigate.
root@1d8096239718:/workspace/scubaduck# head -n 40 scubaduck/static/index.html
<!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;
}
#derived_columns .derived {
border: 1px solid #ccc;
padding: 5px;
margin-bottom: 5px;
display: flex;
flex-direction: column;
}
#derived_columns .derived-row {
display: flex;
I need to find some CSS rules for tables or numeric formatting.
root@1d8096239718:/workspace/scubaduck# grep -n "table" -n scubaduck/static/inde
x.html | head
114: table { border-collapse: collapse; min-width: 100%; }
191: <div id="header">sample.csv - <select id="table"></select> <select id="gra
ph_type"><option value="samples">Samples</option><option value="table">Table</op
tion><option value="timeseries">Time Series</option></select></div>
253: <label>Limit<span class="help" title="Choose the maximum number of
results to show in the chart after any aggregations have been applied. For exam
ple, a limit of 10 will show no more than 10 rows for a table, etc.">[?]</span><
/label>
348: <table id="results"></table>
491: const showTable = graphTypeSel.value === 'table';
526:function loadColumns(table) {
527: return fetch('/api/columns?table=' + encodeURIComponent(table)).then(r =>
r.json()).then(cols => {
670:fetch('/api/tables').then(r => r.json()).then(tables => {
671: tables.forEach(t => {
675: document.getElementById('table').appendChild(o);
I'll start by exploring the section near line 114.
root@1d8096239718:/workspace/scubaduck# sed -n '100,140p' scubaduck/static/index
.html
.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;
}
#ts-container {
display: flex;
}
#legend {
I'll check for columns containing numeric values or SI units.
root@1d8096239718:/workspace/scubaduck# grep -n "SI" -n scubaduck/static/index.h
tml
I'm searching for the "decimal" or "formatNumber" functions in the codebase.
root@1d8096239718:/workspace/scubaduck# grep -n "formatNumber" -n scubaduck/stat
ic/index.html
768:function formatNumber(val) {
1213: td.textContent = `${formatNumber(v)} (${pct}%)`;
1215: td.textContent = isStringColumn(col) ? v : formatNumber(v);
root@1d8096239718:/workspace/scubaduck# sed -n '760,780p' scubaduck/static/index
.html
const t = (columnTypes[name] || '').toUpperCase();
if (t.includes('TIMESTAMP') || t.includes('DATE') || t.includes('TIME')) retur
n true;
const sel = document.getElementById('time_column').value;
const xsel = document.getElementById('x_axis').value;
if (name === sel || name === xsel) return true;
return false;
}
function formatNumber(val) {
if (typeof val !== 'number') val = Number(val);
if (Number.isNaN(val)) return '';
if (val === 0) return '0';
const abs = Math.abs(val);
if (abs > 999.999) {
const units = [
{n: 1e12, s: 'T'},
{n: 1e9, s: 'B'},
{n: 1e6, s: 'M'},
{n: 1e3, s: 'K'},
];
for (const u of units) {
.html
for (const u of units) {
if (abs >= u.n) {
return (val / u.n).toFixed(2) + ' ' + u.s;
}
}
}
if (abs < 0.0005) return '0.000';
return val.toFixed(3);
}
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'],
I need to ensure number and suffix don't break in numeric table columns using CSS.
root@1d8096239718:/workspace/scubaduck# grep -n "function renderTable" -n scubad
uck/static/index.html
1142:function renderTable(rows) {
root@1d8096239718:/workspace/scubaduck# sed -n '1142,1220p' scubaduck/static/ind
ex.html
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');
let label = col;
if (
displayType === 'table' &&
col !== 'Hits' &&
!(groupBy.chips || []).includes(col)
) {
const agg = document.getElementById('aggregate').value.toLowerCase();
label += ` (${agg})`;
}
th.textContent = label;
th.dataset.index = i;
th.addEventListener('click', handleSort);
if (sortState.index === i) {
th.classList.add('sorted');
th.textContent =
label + (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', () => {
const wasSelected = tr.classList.contains('selected');
document
.querySelectorAll('#results tr.selected')
.forEach(el => el.classList.remove('selected'));
if (!wasSelected) {
tr.classList.add('selected');
}
});
row.forEach((v, i) => {
const col = selectedColumns[i];
const td = document.createElement('td');
if (isTimeColumn(col)) {
let d;
const t = (columnTypes[col] || '').toUpperCase();
if (t.includes('TIMESTAMP') || t.includes('DATE') || t.includes('TIME'))
{
d = new Date(v);
} else {
const unit = document.getElementById('time_unit').value;
const factors = {s: 1000, ms: 1, us: 0.001, ns: 0.000001};
d = new Date(Number(v) * (factors[unit] || 1000));
}
td.textContent = d.toLocaleString('en-US', {
weekday: 'short',
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: true,
timeZoneName: 'short'
});
} else {
if (col === 'Hits') {
const pct = totalHits ? ((v / totalHits) * 100).toFixed(1) : '0';
td.textContent = `${formatNumber(v)} (${pct}%)`;
} else {
td.textContent = isStringColumn(col) ? v : formatNumber(v);
}
}
td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
tr.appendChild(td);
});
ex.html
});
table.appendChild(tr);
});
// ensure table does not overflow unless necessary
const view = document.getElementById('view');
if (table.scrollWidth <= view.clientWidth) {
table.style.width = '100%';
}
}
function handleSort(e) {
const idx = parseInt(e.target.dataset.index, 10);
if (sortState.index !== idx) {
sortState.index = idx;
sortState.dir = 'asc';
} else if (sortState.dir === 'asc') {
sortState.dir = 'desc';
} else if (sortState.dir === 'desc') {
sortState.index = null;
sortState.dir = null;
} else {
sortState.dir = 'asc';
}
let rows = originalRows.slice();
if (sortState.index !== null) {
rows.sort((a, b) => {
const va = a[sortState.index];
const vb = b[sortState.index];
if (va === vb) return 0;
if (sortState.dir === 'desc') return va < vb ? 1 : -1;
return va > vb ? 1 : -1;
});
}
renderTable(rows);
}
function showResults(data) {
window.lastResults = data;
const view = document.getElementById('view');
if (graphTypeSel.value === 'timeseries') {
showTimeSeries(data);
} else {
if (data.rows.length === 0) {
view.innerHTML =
'<p id="empty-message">Empty data provided to table</p><table id="result
s"></table>';
} else {
view.innerHTML = '<table id="results"></table>';
}
originalRows = data.rows.slice();
sortState = {index: null, dir: null};
renderTable(originalRows);
}
const sqlEl = document.createElement('pre');
sqlEl.id = 'sql_query';
sqlEl.style.whiteSpace = 'pre-wrap';
sqlEl.style.marginTop = '10px';
sqlEl.textContent = data.sql;
view.appendChild(sqlEl);
document.getElementById('query_info').textContent =
`Your query took about ${lastQueryTime} ms`;
I need to add a "white-space: nowrap" style to the numeric column cells.
root@1d8096239718:/workspace/scubaduck# grep -n "td." -n scubaduck/static/index.
html
115: th, td { border: 1px solid #ccc; padding: 4px; box-sizing: border-box; }
118: tr:nth-child(even) td { background: #f9f9f9; }
119: tr.selected td { background: #bde4ff !important; }
120: tr:hover:not(.selected) td { background: #eee; }
1188: const td = document.createElement('td');
1199: td.textContent = d.toLocaleString('en-US', {
1213: td.textContent = `${formatNumber(v)} (${pct}%)`;
1215: td.textContent = isStringColumn(col) ? v : formatNumber(v);
1218: td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
1219: tr.appendChild(td);
I'll add the new 'num' or 'numeric' style in the <style> section and search existing CSS.
root@1d8096239718:/workspace/scubaduck# grep -n "numeric" -n scubaduck/static/in
dex.html
874: <option value="numeric">Numeric</option>
1202: day: 'numeric',
1203: year: 'numeric',
1204: hour: 'numeric',
1205: minute: 'numeric',
1206: second: 'numeric',
I’ll check if there are existing numeric classes by searching for 'className'.
root@1d8096239718:/workspace/scubaduck# grep -n "className" -n scubaduck/static/
index.html | head
373: wrapper.className = 'dropdown';
381: disp.className = 'dropdown-display';
389: menu.className = 'dropdown-menu';
427: div.className = 'option';
605: div.className = 'col-group';
607: header.className = 'col-group-header';
610: links.className = 'links';
793: container.className = 'filter';
868: container.className = 'derived';
I noticed a td
at line 1188, but it lacks a class attribute.
root@1d8096239718:/workspace/scubaduck# sed -n '1180,1220p' scubaduck/static/ind
ex.html
.querySelectorAll('#results tr.selected')
.forEach(el => el.classList.remove('selected'));
if (!wasSelected) {
tr.classList.add('selected');
}
});
row.forEach((v, i) => {
const col = selectedColumns[i];
const td = document.createElement('td');
if (isTimeColumn(col)) {
let d;
const t = (columnTypes[col] || '').toUpperCase();
if (t.includes('TIMESTAMP') || t.includes('DATE') || t.includes('TIME'))
{
d = new Date(v);
} else {
const unit = document.getElementById('time_unit').value;
const factors = {s: 1000, ms: 1, us: 0.001, ns: 0.000001};
d = new Date(Number(v) * (factors[unit] || 1000));
}
td.textContent = d.toLocaleString('en-US', {
weekday: 'short',
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: true,
timeZoneName: 'short'
});
} else {
if (col === 'Hits') {
const pct = totalHits ? ((v / totalHits) * 100).toFixed(1) : '0';
td.textContent = `${formatNumber(v)} (${pct}%)`;
} else {
td.textContent = isStringColumn(col) ? v : formatNumber(v);
}
}
td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
tr.appendChild(td);
});
I’ll apply td.className = 'num'
in numeric columns to handle formatting and prevent breaks. I'll check for existing CSS rules, particularly for .num
or .number
.
root@1d8096239718:/workspace/scubaduck# grep -n "\.num" -n scubaduck/static/inde
x.html
root@1d8096239718:/workspace/scubaduck# grep -n "number" -n scubaduck/static/ind
ex.html
253: <label>Limit<span class="help" title="Choose the maximum number of
results to show in the chart after any aggregations have been applied. For exam
ple, a limit of 10 will show no more than 10 rows for a table, etc.">[?]</span><
/label>
254: <input id="limit" type="number" value="100" />
769: if (typeof val !== 'number') val = Number(val);
I'll define a .numeric
class with white-space: nowrap
for the number units. Let’s find the CSS section.
root@1d8096239718:/workspace/scubaduck# sed -n '110,130p' scubaduck/static/index
.html
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;
}
root@1d8096239718:/workspace/scubaduck# sed -n '130,170p' scubaduck/static/index
.html
}
.col-group-header .links {
float: right;
}
.col-group-header .links a {
margin-left: 5px;
}
#ts-container {
display: flex;
}
#legend {
width: 150px;
flex: 0 0 150px;
margin-right: 10px;
overflow-y: auto;
}
.legend-group {
margin-bottom: 4px;
}
.legend-header {
font-weight: normal;
}
.legend-item {
display: flex;
justify-content: space-between;
padding-left: 8px;
}
.legend-value {
margin-left: 4px;
}
#chart-wrapper {
flex: 1;
}
.legend-item.highlight {
background: #ddd;
}
#legend .drill-links h4 {
margin: 10px 0 4px 0;
}
#legend .drill-links a {
display: block;
root@1d8096239718:/workspace/scubaduck# grep -n "nowrap" scubaduck/static/index.
html
I'll add .numeric { white-space: nowrap; }
in the CSS for numeric columns. I'll modify renderTable
to add the 'numeric' class only for numeric columns, excluding string and time columns. I'll check for 'Hits' and handle that specifically. Finally, I'll search for displayType to understand the table view.
root@1d8096239718:/workspace/scubaduck# grep -n "displayType" -n scubaduck/stati
c/index.html
367:let displayType = 'samples';
517: displayType = graphTypeSel.value;
1156: displayType === 'table' &&
I need to apply CSS for numeric cells in both table and samples view and make adjustments. I'll run ruff, pyright, and add a test to test_web.py
.
root@1d8096239718:/workspace/scubaduck# ls tests
conftest.py test_server.py test_web.py
{"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_time_column_dropdown(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#time_column option", state="attached")
options = page.locator("#time_column option").all_inner_texts()
assert "timestamp" in options
assert "value" in options
assert page.input_value("#time_column") == "timestamp"
def test_time_unit_dropdown(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#time_unit", state="attached")
opts = page.locator("#time_unit option").all_inner_texts()
assert "ms" in opts
assert page.input_value("#time_unit") == "s"
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_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').getBound
ingClientRect(); const x=document.querySelector('#filters .filter-row button.rem
ove').getBoundingClientRect(); return Math.abs(r.right - x.right); }"
)
assert diff <= 1
I'm quickly paging to the bottom to locate the relevant content.
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"
)
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_graph_type_timeseries_fields(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
assert page.is_visible("#group_by_field")
assert page.is_visible("#aggregate_field")
assert page.is_visible("#x_axis_field")
assert page.is_visible("#granularity_field")
assert page.is_visible("#fill_field")
def test_timeseries_default_query(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
data = page.evaluate("window.lastResults")
assert "error" not in data
assert page.is_visible("#chart")
page.click("text=Columns")
assert not page.is_checked("#column_groups input[value='timestamp']")
def test_timeseries_single_bucket(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-01 00:00:00")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
path = page.get_attribute("#chart path", "d")
assert path is not None and "NaN" not in path
def test_timeseries_fill_options(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-02 03:00:00")
select_value(page, "#graph_type", "timeseries")
select_value(page, "#granularity", "1 hour")
select_value(page, "#fill", "0")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
path_zero = page.get_attribute("#chart path", "d")
assert path_zero is not None and path_zero.count("L") > 20
select_value(page, "#fill", "connect")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
path_conn = page.get_attribute("#chart path", "d")
assert path_conn is not None and path_conn.count("M") == 1
select_value(page, "#fill", "blank")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
path_blank = page.get_attribute("#chart path", "d")
assert path_blank is not None and path_blank.count("M") > 1
def test_timeseries_hover_highlight(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart path", state="attached")
path_el = page.query_selector("#chart path")
assert path_el
page.evaluate(
"el => el.dispatchEvent(new MouseEvent('mouseenter', {bubbles: true}))",
path_el,
)
width = page.evaluate(
"getComputedStyle(document.querySelector('#chart path')).strokeWidth"
)
assert "2.5" in width
color = page.evaluate(
"getComputedStyle(document.querySelector('#legend .legend-item')).backgr
oundColor"
)
assert "221, 221, 221" in color
def test_timeseries_crosshair(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart path", state="attached")
page.eval_on_selector(
"#chart",
"el => { const r = el.getBoundingClientRect(); el.dispatchEvent(new Mous
eEvent('mousemove', {clientX: r.left + r.width/2, clientY: r.top + r.height/2, b
ubbles: true})); }",
)
line_display = page.evaluate(
"document.getElementById('crosshair_line').style.display"
)
assert line_display != "none"
count = page.eval_on_selector_all("#crosshair_dots circle", "els => els.leng
th")
assert count > 0
page.eval_on_selector(
"#chart",
"el => el.dispatchEvent(new MouseEvent('mouseleave', {bubbles: true}))",
)
line_display = page.evaluate(
"document.getElementById('crosshair_line').style.display"
Let me keep scrolling to capture everything I need.
"#chart",
"el => { const r = el.getBoundingClientRect(); el.dispatchEvent(new Mous
eEvent('mousemove', {clientX: r.left + r.width/2, clientY: r.top + r.height/2, b
ubbles: true})); }",
)
page.eval_on_selector(
"#chart",
"el => { const r = el.getBoundingClientRect(); el.dispatchEvent(new Mous
eEvent('click', {clientX: r.left + r.width/2, clientY: r.top + r.height/2, bubbl
es: true})); }",
)
line_display = page.evaluate(
"document.getElementById('crosshair_line').style.display"
)
assert line_display != "none"
pos1 = page.evaluate("document.getElementById('crosshair_line').getAttribute
('x1')")
page.eval_on_selector(
"#chart",
"el => { const r = el.getBoundingClientRect(); el.dispatchEvent(new Mous
eEvent('mousemove', {clientX: r.left + r.width/4, clientY: r.top + r.height/2, b
ubbles: true})); }",
)
pos2 = page.evaluate("document.getElementById('crosshair_line').getAttribute
('x1')")
assert pos1 == pos2
page.eval_on_selector(
"#chart",
"el => el.dispatchEvent(new MouseEvent('mouseleave', {bubbles: true}))",
)
line_display = page.evaluate(
"document.getElementById('crosshair_line').style.display"
)
assert line_display != "none"
page.eval_on_selector(
"#chart",
"el => { const r = el.getBoundingClientRect(); el.dispatchEvent(new Mous
eEvent('click', {clientX: r.left + r.width/2, clientY: r.top + r.height/2, bubbl
es: true})); }",
)
line_display = page.evaluate(
"document.getElementById('crosshair_line').style.display"
)
assert line_display == "none"
def test_timeseries_auto_timezone(browser: Any, server_url: str) -> None:
context = browser.new_context(timezone_id="America/New_York")
page = context.new_page()
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
path = page.get_attribute("#chart path", "d")
context.close()
assert path is not None
coords = [float(p.split(" ")[1]) for p in path.replace("M", "L").split("L")[
1:]]
assert max(coords) > min(coords)
def test_timeseries_multi_series(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.click("text=Columns")
page.click("text=Add Derived")
expr = page.query_selector("#derived_list .derived textarea")
assert expr
name_inp = page.query_selector("#derived_list .derived .d-name")
assert name_inp
name_inp.fill("value_2")
expr.fill("value * 2")
page.click("text=View Settings")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-03 00:00:00")
select_value(page, "#granularity", "1 hour")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
count = page.eval_on_selector_all("#chart path", "els => els.length")
assert count == 2
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"]
...
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()
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")
inp.click()
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);"
)
I'll open sample.csv to understand its columns and identify the numeric ones for testing.
root@1d8096239718:/workspace/scubaduck# head scubaduck/sample.csv
timestamp,event,value,user
2024-01-01 00:00:00,login,10,alice
2024-01-01 01:00:00,logout,20,bob
2024-01-02 00:00:00,login,30,alice
2024-01-02 03:00:00,login,40,charlie
I'm checking the value column to ensure proper SI formatting for large numbers and the query structure.
import duckdb
from scubaduck import server
import pytest
def test_basic_query() -> None:
app = server.app
client = app.test_client()
payload = {
"table": "events",
"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_js_served() -> None:
app = server.app
client = app.test_client()
rv = client.get("/js/chip_input.js")
assert rv.status_code == 200
assert b"initChipInput" in rv.data
def test_filter_multi_token() -> None:
app = server.app
client = app.test_client()
payload = {
"table": "events",
"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 = {
"table": "events",
"start": "2024-01-01 00:00:00",
"end": "2024-01-03 00:00:00",
"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 = {
"table": "events",
"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 {
"table": "events",
"start": "2024-01-01 00:00:00",
I'm checking the code around _make_payload to understand it better.
"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())
sqlite_file = tmp_path / "events.sqlite"
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_sqlite_longvarchar(tmp_path: Path) -> None:
sqlite_file = tmp_path / "events.sqlite"
import sqlite3
conn = sqlite3.connect(sqlite_file)
conn.execute(
"CREATE TABLE events (timestamp TEXT, url LONGVARCHAR, title VARCHAR(10)
)"
)
conn.execute(
"INSERT INTO events VALUES ('2024-01-01 00:00:00', 'https://a.com', 'Hom
e')"
)
conn.commit()
conn.close() # pyright: ignore[reportUnknownMemberType, reportAttributeAcce
ssIssue]
app = server.create_app(sqlite_file)
client = app.test_client()
payload = {
"table": "events",
"start": "2024-01-01 00:00:00",
"end": "2024-01-01 01:00:00",
"order_by": "timestamp",
"columns": ["timestamp", "url", "title"],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert rv.status_code == 200
assert data["rows"][0][1] == "https://a.com"
def test_sqlite_bigint(tmp_path: Path) -> None:
sqlite_file = tmp_path / "big.sqlite"
import sqlite3
conn = sqlite3.connect(sqlite_file)
conn.execute("CREATE TABLE events (timestamp TEXT, value INTEGER)")
big_value = 13385262862605259
conn.execute(
"INSERT INTO events VALUES ('2024-01-01 00:00:00', ?)",
(big_value,),
)
conn.commit()
conn.close() # pyright: ignore[reportUnknownMemberType, reportAttributeAcce
ssIssue]
app = server.create_app(sqlite_file)
client = app.test_client()
payload = {
"table": "events",
"order_by": "timestamp",
"columns": ["timestamp", "value"],
}
rv = client.post(
"/api/query", data=json.dumps(payload), content_type="application/json"
)
data = rv.get_json()
assert rv.status_code == 200
assert data["rows"][0][1] == big_value
def test_integer_time_column(tmp_path: Path) -> None:
csv_file = tmp_path / "events.csv"
csv_file.write_text("created,event\n1704067200,login\n1704070800,logout\n")
app = server.create_app(csv_file)
client = app.test_client()
payload = {
"table": "events",
"start": "2024-01-01 00:00:00",
"end": "2024-01-01 01:00:00",
"order_by": "created",
"columns": ["created", "event"],
"time_column": "created",
}
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"]) == 2
def test_integer_time_unit_ms(tmp_path: Path) -> None:
csv_file = tmp_path / "events.csv"
csv_file.write_text("created,event\n1704067200000,login\n1704070800000,logou
t\n")
app = server.create_app(csv_file)
client = app.test_client()
payload = {
"table": "events",
"start": "2024-01-01 00:00:00",
"end": "2024-01-01 01:00:00",
"order_by": "created",
"columns": ["created", "event"],
"time_column": "created",
"time_unit": "ms",
}
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"]) == 2
def test_integer_time_unit_us_default_start_end(tmp_path: Path) -> None:
csv_file = tmp_path / "events.csv"
csv_file.write_text(
"created,event\n1704067200000000,login\n1704070800000000,logout\n"
)
app = server.create_app(csv_file)
client = app.test_client()
payload = {
"table": "events",
I'm on the lookout for existing tests that verify CSS properties for numeric cells.
root@1d8096239718:/workspace/scubaduck# grep -n "whiteSpace" -n tests/test_web.p
y
I need to locate where getComputedStyle is used in the code.
root@1d8096239718:/workspace/scubaduck# grep -n "whiteSpace" -n tests/test_web.p
y
_web.py | head -n 20
147: "getComputedStyle(document.querySelector('#filters .filter button.re
move')).position"
180: "getComputedStyle(document.querySelector('#dive')).backgroundColor"
185: "getComputedStyle(document.querySelector('#sidebar')).overflowY"
188: "getComputedStyle(document.querySelector('#view')).overflowY"
288: "getComputedStyle(document.querySelector('#chart path')).strokeWidth
"
292: "getComputedStyle(document.querySelector('#legend .legend-item')).ba
ckgroundColor"
418: "getComputedStyle(document.querySelector('#settings label')).textAli
gn"
435: "getComputedStyle(document.querySelector('#results th')).textAlign"
453: "getComputedStyle(document.querySelector('#results th:nth-child(4)')
).color"
466: "getComputedStyle(document.querySelector('#results th:nth-child(4)')
).color"
561: "getComputedStyle(document.querySelector('#column_actions')).textAli
gn"
581: "getComputedStyle(document.querySelector('#column_groups .col-group
.links')).float"
684: "getComputedStyle(document.querySelector('#filters .filter:last-chil
d .f-val')).outlineStyle"
709: "getComputedStyle(document.querySelector('#filters .filter:last-chil
d .chip-dropdown')).display"
738: "getComputedStyle(document.querySelector('#filters .filter:last-chil
d .chip-dropdown')).display"
766: "getComputedStyle(document.querySelector('#filters .filter:last-chil
d .chip-dropdown')).display"
813: "getComputedStyle(document.querySelector('#filters .filter:last-chil
d .chip-dropdown')).display"
855: "getComputedStyle(document.querySelector('#results td')).borderStyle
"
860: "getComputedStyle(document.querySelector('#results tr:nth-child(2) t
d')).backgroundColor"
863: "getComputedStyle(document.querySelector('#results tr:nth-child(3) t
d')).backgroundColor"
I'll scroll around line 810 to check what's there.
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.keyboard.type("alice")
page.keyboard.press("Enter")
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips == ["alice"]
inp.click()
page.keyboard.type("alice")
page.keyboard.press("Enter")
chips = page.evaluate(
"Array.from(document.querySelectorAll('#filters .filter:last-child .chip
')).map(c => c.firstChild.textContent)"
)
assert chips == []
def test_table_enhancements(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",
limit=10,
)
border = page.evaluate(
"getComputedStyle(document.querySelector('#results td')).borderStyle"
)
assert border == "solid"
color1 = page.evaluate(
"getComputedStyle(document.querySelector('#results tr:nth-child(2) td'))
.backgroundColor"
)
color2 = page.evaluate(
"getComputedStyle(document.querySelector('#results tr:nth-child(3) td'))
.backgroundColor"
)
assert color1 != color2
page.hover("#results tr:nth-child(2)")
hover_color = page.evaluate(
"getComputedStyle(document.querySelector('#results tr:nth-child(2) td'))
.backgroundColor"
)
assert hover_color != color1
page.click("#results tr:nth-child(2)")
selected_color = page.evaluate(
"getComputedStyle(document.querySelector('#results tr:nth-child(2) td'))
.backgroundColor"
)
assert "189, 228, 255" in selected_color
overflow = page.evaluate(
"var v=document.getElementById('view'); v.scrollWidth > v.clientWidth"
)
assert not overflow
def test_table_single_selection(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",
limit=10,
)
page.click("#results tr:nth-child(2)")
page.click("#results tr:nth-child(3)")
count = page.evaluate("document.querySelectorAll('#results tr.selected').len
gth")
assert count == 1
is_third = page.evaluate(
"document.querySelector('#results tr:nth-child(3)').classList.contains('
selected')"
)
def test_timestamp_rendering(page: Any, server_url: str) -> None:
run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-02 00:00:00",
order_by="timestamp",
limit=1,
)
cell = page.text_content("#results td")
assert cell != "Invalid Date"
valid = page.evaluate("v => !isNaN(Date.parse(v))", cell)
assert valid
def test_url_query_persistence(page: Any, server_url: str) -> None:
page.goto(server_url)
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"] == []
I need to scroll down a bit more to reach the very end.
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")
I'm getting closer to the end of the section. Just a bit more!
def test_table_headers_show_aggregate(page: Any, server_url: str) -> None:
run_query(
page,
server_url,
aggregate="Avg",
)
headers = page.locator("#results th").all_inner_texts()
assert "Hits" in headers
assert "timestamp (avg)" in headers
assert "value (avg)" in headers
def test_format_number_function(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
vals = page.evaluate(
"() => [formatNumber(815210), formatNumber(999.999), formatNumber(0.0004
), formatNumber(0)]"
)
assert vals == ["815.21 K", "999.999", "0.000", "0"]
def test_derived_column_query(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.click("text=Add Derived")
expr = page.query_selector("#derived_list .derived textarea")
assert expr
expr.fill("value * 2")
page.click("text=View Settings")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-03 00:00:00")
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 data["rows"][0][-1] == 20
def test_derived_column_remove(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.click("text=Add Derived")
assert page.query_selector("#derived_list .derived button.remove")
page.click("#derived_list .derived button.remove")
count = page.evaluate("document.querySelectorAll('#derived_list .derived').l
ength")
assert count == 0
def test_sql_query_display(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-02 00:00:00",
order_by="timestamp",
limit=10,
)
sql = data["sql"]
displayed = page.text_content("#sql_query")
assert displayed is not None
assert displayed.strip() == sql
def test_timeseries_resize(page: Any, server_url: str) -> None:
I'll search for tests related to "table_enhancements" and verify the CSS property next.
root@1d8096239718:/workspace/scubaduck# grep -n "table_headers_show_aggregate" -
n tests/test_web.py
1044:def test_table_headers_show_aggregate(page: Any, server_url: str) -> None:
page,
server_url,
aggregate="Avg",
)
headers = page.locator("#results th").all_inner_texts()
assert "Hits" in headers
assert "timestamp (avg)" in headers
assert "value (avg)" in headers
def test_format_number_function(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
vals = page.evaluate(
"() => [formatNumber(815210), formatNumber(999.999), formatNumber(0.0004
), formatNumber(0)]"
)
assert vals == ["815.21 K", "999.999", "0.000", "0"]
def test_derived_column_query(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.click("text=Add Derived")
expr = page.query_selector("#derived_list .derived textarea")
assert expr
expr.fill("value * 2")
page.click("text=View Settings")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-03 00:00:00")
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")
def test_derived_column_remove(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
page.click("text=Add Derived")
assert page.query_selector("#derived_list .derived button.remove")
page.click("#derived_list .derived button.remove")
count = page.evaluate("document.querySelectorAll('#derived_list .derived').l
ength")
assert count == 0
def test_sql_query_display(page: Any, server_url: str) -> None:
data = run_query(
page,
server_url,
start="2024-01-01 00:00:00",
end="2024-01-02 00:00:00",
order_by="timestamp",
limit=10,
)
sql = data["sql"]
displayed = page.text_content("#sql_query")
assert displayed is not None
assert displayed.strip() == sql
def test_timeseries_resize(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart path", state="attached")
def chart_info() -> dict[str, float]:
return page.evaluate(
"() => {const p=document.querySelector('#chart path'); const nums=p.
getAttribute('d').match(/[-0-9.]+/g).map(parseFloat); return {width: parseFloat(
document.getElementById('chart').getAttribute('width')), last: nums[nums.length-
2]};}"
)
before = chart_info()
legend_width = page.evaluate(
"parseFloat(getComputedStyle(document.getElementById('legend')).width)"
)
assert page.evaluate(
"() => document.getElementById('legend').getBoundingClientRect().right <
= document.getElementById('chart').getBoundingClientRect().left"
)
page.evaluate("document.getElementById('sidebar').style.width='200px'")
page.wait_for_function(
"width => document.getElementById('chart').getAttribute('width') != widt
h",
arg=before["width"],
)
after = chart_info()
legend_width_after = page.evaluate(
"parseFloat(getComputedStyle(document.getElementById('legend')).width)"
)
assert after["width"] > before["width"]
assert after["last"] > before["last"]
assert legend_width_after == legend_width
def test_timeseries_no_overflow(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
The test_web file is large, but I'll look at the bottom to add a new test.
def test_timeseries_legend_values(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("g => { groupBy.chips = g; groupBy.renderChips(); }", ["user"]
)
select_value(page, "#aggregate", "Avg")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
headers = page.evaluate(
"() => Array.from(document.querySelectorAll('#legend .legend-header')).m
ap(e => e.textContent)"
)
assert any(h.startswith("alice") for h in headers)
page.wait_for_selector("#chart path", state="attached")
page.eval_on_selector(
"#chart",
"el => { const r=el.getBoundingClientRect(); el.dispatchEvent(new MouseE
vent('mousemove', {clientX:r.left+r.width/2, clientY:r.top+r.height/2, bubbles:t
rue})); }",
)
value = page.evaluate("document.querySelector('#legend .legend-value').textC
ontent")
assert value != ""
def test_timeseries_group_links(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-02 03:00:00")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
assert page.text_content("#legend .drill-links h4") == "Group by"
page.click("#legend .drill-links a:text('user')")
page.wait_for_function("window.lastResults !== undefined")
chips = page.evaluate("groupBy.chips")
assert chips == ["user"]
assert page.text_content("#legend .drill-links h4") == "Drill up"
assert page.is_visible("#legend .drill-links a:text('Aggregate')")
I'm paging down to capture additional details.
th")
assert count > 2
def test_timeseries_y_axis_labels(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart text.y-tick-label", state="attached")
count = page.eval_on_selector_all("#chart text.y-tick-label", "els => els.le
ngth")
grid_count = page.eval_on_selector_all("#chart line.grid", "els => els.lengt
h")
assert count > 0 and count == grid_count
def test_timeseries_interval_offset(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-03 12:00:00")
select_value(page, "#granularity", "1 hour")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart text.tick-label", state="attached")
labels = page.eval_on_selector_all(
"#chart text.tick-label", "els => els.map(e => e.textContent)"
)
assert labels
assert all(lbl != "00:00" for lbl in labels)
times = [lbl for lbl in labels if ":" in lbl]
assert times
for t in times:
h = int(t.split(":")[0])
assert h % 4 == 0
def test_timeseries_legend_values(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("g => { groupBy.chips = g; groupBy.renderChips(); }", ["user"]
)
select_value(page, "#aggregate", "Avg")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
headers = page.evaluate(
"() => Array.from(document.querySelectorAll('#legend .legend-header')).m
ap(e => e.textContent)"
)
assert any(h.startswith("alice") for h in headers)
page.wait_for_selector("#chart path", state="attached")
page.eval_on_selector(
"#chart",
"el => { const r=el.getBoundingClientRect(); el.dispatchEvent(new MouseE
vent('mousemove', {clientX:r.left+r.width/2, clientY:r.top+r.height/2, bubbles:t
rue})); }",
)
value = page.evaluate("document.querySelector('#legend .legend-value').textC
ontent")
assert value != ""
def test_timeseries_group_links(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-02 03:00:00")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
assert page.text_content("#legend .drill-links h4") == "Group by"
page.click("#legend .drill-links a:text('user')")
page.wait_for_function("window.lastResults !== undefined")
chips = page.evaluate("groupBy.chips")
assert chips == ["user"]
assert page.text_content("#legend .drill-links h4") == "Drill up"
assert page.is_visible("#legend .drill-links a:text('Aggregate')")
I need to check if more tests are needed, adding them after test_format_number_function.
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
assert page.text_content("#legend .drill-links h4") == "Group by"
page.click("#legend .drill-links a:text('user')")
page.wait_for_function("window.lastResults !== undefined")
chips = page.evaluate("groupBy.chips")
assert chips == ["user"]
assert page.text_content("#legend .drill-links h4") == "Drill up"
assert page.is_visible("#legend .drill-links a:text('Aggregate')")
I’ll check lines 1100 to 1160 to verify the file’s closure.
end="2024-01-02 00:00:00",
order_by="timestamp",
limit=10,
)
sql = data["sql"]
displayed = page.text_content("#sql_query")
assert displayed is not None
assert displayed.strip() == sql
def test_timeseries_resize(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart path", state="attached")
def chart_info() -> dict[str, float]:
return page.evaluate(
"() => {const p=document.querySelector('#chart path'); const nums=p.
getAttribute('d').match(/[-0-9.]+/g).map(parseFloat); return {width: parseFloat(
document.getElementById('chart').getAttribute('width')), last: nums[nums.length-
2]};}"
)
before = chart_info()
legend_width = page.evaluate(
"parseFloat(getComputedStyle(document.getElementById('legend')).width)"
)
assert page.evaluate(
"() => document.getElementById('legend').getBoundingClientRect().right <
= document.getElementById('chart').getBoundingClientRect().left"
)
page.evaluate("document.getElementById('sidebar').style.width='200px'")
page.wait_for_function(
"width => document.getElementById('chart').getAttribute('width') != widt
h",
arg=before["width"],
)
after = chart_info()
legend_width_after = page.evaluate(
"parseFloat(getComputedStyle(document.getElementById('legend')).width)"
)
assert after["width"] > before["width"]
assert after["last"] > before["last"]
assert legend_width_after == legend_width
def test_timeseries_no_overflow(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
overflow = page.evaluate(
"var v=document.getElementById('view'); v.scrollWidth > v.clientWidth"
)
assert not overflow
def test_timeseries_axis_ticks(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart text.tick-label", state="attached")
count = page.eval_on_selector_all("#chart text.tick-label", "els => els.leng
th")
assert count > 2
def test_timeseries_y_axis_labels(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart text.y-tick-label", state="attached")
count = page.eval_on_selector_all("#chart text.y-tick-label", "els => els.le
ngth")
grid_count = page.eval_on_selector_all("#chart line.grid", "els => els.lengt
h")
assert count > 0 and count == grid_count
def test_timeseries_interval_offset(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-03 12:00:00")
select_value(page, "#granularity", "1 hour")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
page.wait_for_selector("#chart text.tick-label", state="attached")
labels = page.eval_on_selector_all(
"#chart text.tick-label", "els => els.map(e => e.textContent)"
)
assert labels
assert all(lbl != "00:00" for lbl in labels)
times = [lbl for lbl in labels if ":" in lbl]
assert times
for t in times:
h = int(t.split(":")[0])
assert h % 4 == 0
def test_timeseries_legend_values(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.evaluate("g => { groupBy.chips = g; groupBy.renderChips(); }", ["user"]
)
select_value(page, "#aggregate", "Avg")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
headers = page.evaluate(
"() => Array.from(document.querySelectorAll('#legend .legend-header')).m
ap(e => e.textContent)"
)
assert any(h.startswith("alice") for h in headers)
page.wait_for_selector("#chart path", state="attached")
page.eval_on_selector(
I'll reveal more lines, from 1220 to 1280, to gather everything needed.
page.eval_on_selector(
"#chart",
"el => { const r=el.getBoundingClientRect(); el.dispatchEvent(new MouseE
vent('mousemove', {clientX:r.left+r.width/2, clientY:r.top+r.height/2, bubbles:t
rue})); }",
)
value = page.evaluate("document.querySelector('#legend .legend-value').textC
ontent")
assert value != ""
def test_timeseries_group_links(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#graph_type", state="attached")
select_value(page, "#graph_type", "timeseries")
page.fill("#start", "2024-01-01 00:00:00")
page.fill("#end", "2024-01-02 03:00:00")
page.evaluate("window.lastResults = undefined")
page.click("text=Dive")
page.wait_for_function("window.lastResults !== undefined")
assert page.text_content("#legend .drill-links h4") == "Group by"
page.click("#legend .drill-links a:text('user')")
page.wait_for_function("window.lastResults !== undefined")
chips = page.evaluate("groupBy.chips")
assert chips == ["user"]
assert page.text_content("#legend .drill-links h4") == "Drill up"
assert page.is_visible("#legend .drill-links a:text('Aggregate')")
I’ll add the new test after test_format_number_function
, checking lines 1060-1100 first.
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
def test_table_headers_show_aggregate(page: Any, server_url: str) -> None:
run_query(
page,
server_url,
aggregate="Avg",
)
headers = page.locator("#results th").all_inner_texts()
assert "Hits" in headers
assert "timestamp (avg)" in headers
assert "value (avg)" in headers
def test_format_number_function(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
vals = page.evaluate(
"() => [formatNumber(815210), formatNumber(999.999), formatNumber(0.0004
), formatNumber(0)]"
)
assert vals == ["815.21 K", "999.999", "0.000", "0"]
def test_derived_column_query(page: Any, server_url: str) -> None:
I'll add a test_numeric_cells_no_break
to check 'nowrap' on numeric columns from #results
.
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",
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",
I'll inspect index.html for the default selected columns by searching for selectedColumns
.
tatic/index.html
366:let selectedColumns = [];
733: selectedColumns = groupBy.chips.slice();
734: if (document.getElementById('show_hits').checked) selectedColumns.push('
Hits');
736: if (!selectedColumns.includes(c)) selectedColumns.push(c);
739: if (dc.include && !selectedColumns.includes(dc.name)) selectedColumns.
push(dc.name);
742: selectedColumns = base.slice();
744: if (dc.include) selectedColumns.push(dc.name);
978: columns: selectedColumns.filter(c =>
1146: let hitsIndex = selectedColumns.indexOf('Hits');
1152: selectedColumns.forEach((col, i) => {
1187: const col = selectedColumns[i];
root@1d8096239718:/workspace/scubaduck# sed -n '720,760p' scubaduck/static/index
.html
document.querySelectorAll('.rel-dropdown').forEach(dd => {
if (!dd.parentElement.contains(e.target)) dd.style.display = 'none';
});
});
function updateSelectedColumns() {
const base = allColumns.filter(name => {
const cb = document.querySelector(`#column_groups input[value="${name}"]`);
if (!cb || !cb.checked) return false;
if (graphTypeSel.value === 'table' && isStringColumn(name)) return false;
return true;
});
if (graphTypeSel.value === 'table' || graphTypeSel.value === 'timeseries') {
selectedColumns = groupBy.chips.slice();
if (document.getElementById('show_hits').checked) selectedColumns.push('Hits
');
base.forEach(c => {
if (!selectedColumns.includes(c)) selectedColumns.push(c);
});
derivedColumns.forEach(dc => {
if (dc.include && !selectedColumns.includes(dc.name)) selectedColumns.push
(dc.name);
});
} else {
selectedColumns = base.slice();
derivedColumns.forEach(dc => {
if (dc.include) selectedColumns.push(dc.name);
});
}
}
function isStringColumn(name) {
const t = (columnTypes[name] || '').toUpperCase();
return t.includes('CHAR') || t.includes('STRING') || t.includes('VARCHAR');
}
function isIntegerColumn(name) {
const t = (columnTypes[name] || '').toUpperCase();
return t.includes('INT');
}
function isTimeColumn(name) {
const t = (columnTypes[name] || '').toUpperCase();
I’ll look for the loadColumns
function to understand how base columns are fetched.
root@1d8096239718:/workspace/scubaduck# grep -n "loadColumns" -n scubaduck/stati
c/index.html
526:function loadColumns(table) {
679: loadColumns(table).then(() => {
686: loadColumns(document.getElementById('table').value).then(() => {
root@1d8096239718:/workspace/scubaduck# sed -n '526,690p' scubaduck/static/index
.html
function loadColumns(table) {
return fetch('/api/columns?table=' + encodeURIComponent(table)).then(r => r.js
on()).then(cols => {
const orderSelect = document.getElementById('order_by');
const xAxisSelect = document.getElementById('x_axis');
const groupsEl = document.getElementById('column_groups');
const timeColumnSelect = document.getElementById('time_column');
orderSelect.innerHTML = '';
xAxisSelect.innerHTML = '';
timeColumnSelect.innerHTML = '';
groupsEl.innerHTML = '';
allColumns.length = 0;
stringColumns.length = 0;
integerColumns.length = 0;
timeColumns.length = 0;
timeColumnOptions.length = 0;
baseColumns.length = 0;
baseStringColumns.length = 0;
baseIntegerColumns.length = 0;
baseTimeColumns.length = 0;
baseTimeColumnOptions.length = 0;
for (const k in columnTypes) delete columnTypes[k];
const groups = {
time: {name: 'Time', cols: [], ul: null},
integer: {name: 'Integers', cols: [], ul: null},
string: {name: 'Strings', cols: [], ul: null},
};
const heur = ['timestamp','created','created_at','event_time','time','date',
'occurred','happened','logged'];
let guess = null;
cols.forEach(c => {
const t = c.type.toUpperCase();
columnTypes[c.name] = c.type;
allColumns.push(c.name);
baseColumns.push(c.name);
let g = 'string';
const isNumeric = t.includes('INT') || t.includes('DECIMAL') || t.includes
('NUMERIC') || t.includes('REAL') || t.includes('DOUBLE') || t.includes('FLOAT')
|| t.includes('HUGEINT');
const isTimeType = t.includes('TIMESTAMP') || t.includes('DATE') || t.incl
udes('TIME');
if (isNumeric || isTimeType) {
timeColumnOptions.push(c.name);
baseTimeColumnOptions.push(c.name);
if (!guess && heur.some(h => c.name.toLowerCase().includes(h))) guess =
c.name;
}
if (isTimeType) {
g = 'time';
timeColumns.push(c.name);
baseTimeColumns.push(c.name);
} else if (isNumeric) {
g = 'integer';
}
if (g === 'string') {
stringColumns.push(c.name);
baseStringColumns.push(c.name);
} else if (g === 'integer') {
integerColumns.push(c.name);
baseIntegerColumns.push(c.name);
}
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);
}
});
timeColumns.forEach(name => {
const o = document.createElement('option');
o.value = name;
o.textContent = name;
xAxisSelect.appendChild(o);
});
timeColumnOptions.forEach(name => {
const o = document.createElement('option');
o.value = name;
o.textContent = name;
timeColumnSelect.appendChild(o);
});
defaultTimeColumn = guess || timeColumnOptions[0] || '';
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);
groupsEl.appendChild(div);
});
document.getElementById('columns_all').addEventListener('click', e => {
e.preventDefault();
groupsEl.querySelectorAll('input').forEach(cb => (cb.checked = true));
updateSelectedColumns();
});
document.getElementById('columns_none').addEventListener('click', e => {
e.preventDefault();
groupsEl.querySelectorAll('input').forEach(cb => (cb.checked = false));
updateSelectedColumns();
});
updateSelectedColumns();
groupBy = document.getElementById('group_by').closest('.field');
initChipInput(groupBy, typed =>
allColumns.filter(c => c.toLowerCase().includes(typed.toLowerCase()))
);
initDropdown(orderSelect);
initDropdown(document.getElementById('aggregate'));
});
}
let columnsInitialized = false;
fetch('/api/tables').then(r => r.json()).then(tables => {
tables.forEach(t => {
const o = document.createElement('option');
o.value = t;
o.textContent = t;
document.getElementById('table').appendChild(o);
});
const table = parseSearch().table || tables[0];
document.getElementById('table').value = table;
loadColumns(table).then(() => {
updateDisplayTypeUI();
addFilter();
initFromUrl();
columnsInitialized = true;
});
document.getElementById('table').addEventListener('change', () => {
loadColumns(document.getElementById('table').value).then(() => {
if (columnsInitialized) {
applyParams(parseSearch());
}
});
I’m adding a test to check if numeric cells have the correct white-space property.
root@1d8096239718:/workspace/scubaduck# git status --short
root@1d8096239718:/workspace/scubaduck# source .venv/bin/activate
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll update the index.html file to reflect the required changes.
(scubaduck) root@1d8096239718:/workspace/scubaduck# sed -n '110,130p' scubaduck/
static/index.html
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;
}
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll add a td.numeric
style after the current table styles using sed.
(scubaduck) root@1d8096239718:/workspace/scubaduck# grep -n "td {" -n scubaduck/
static/index.html
115: th, td { border: 1px solid #ccc; padding: 4px; box-sizing: border-box; }
118: tr:nth-child(even) td { background: #f9f9f9; }
119: tr.selected td { background: #bde4ff !important; }
120: tr:hover:not(.selected) td { background: #eee; }
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll apply a patch starting after line 115. Let’s implement that.
(scubaduck) root@1d8096239718:/workspace/scubaduck# sed -n '114,122p' scubaduck/
static/index.html
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;
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll add a new line right after the border definitions.
(scubaduck) root@1d8096239718:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - th, td { border: 1px solid #ccc; padding: 4px; box-sizing: border-box; }
> + th, td { border: 1px solid #ccc; padding: 4px; box-sizing: border-box; }
> + td.numeric { white-space: nowrap; }
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'm updating the JS to assign the 'numeric' class to numeric cells in renderTable.
(scubaduck) root@1d8096239718:/workspace/scubaduck# grep -n "td.style.textAlign"
-n scubaduck/static/index.html
1219: td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll modify the code to add a 'numeric' class for non-string, non-time columns.
(scubaduck) root@1d8096239718:/workspace/scubaduck# sed -n '1186,1221p' scubaduc
k/static/index.html
});
row.forEach((v, i) => {
const col = selectedColumns[i];
const td = document.createElement('td');
if (isTimeColumn(col)) {
let d;
const t = (columnTypes[col] || '').toUpperCase();
if (t.includes('TIMESTAMP') || t.includes('DATE') || t.includes('TIME'))
{
d = new Date(v);
} else {
const unit = document.getElementById('time_unit').value;
const factors = {s: 1000, ms: 1, us: 0.001, ns: 0.000001};
d = new Date(Number(v) * (factors[unit] || 1000));
}
td.textContent = d.toLocaleString('en-US', {
weekday: 'short',
month: 'short',
day: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: true,
timeZoneName: 'short'
});
} else {
if (col === 'Hits') {
const pct = totalHits ? ((v / totalHits) * 100).toFixed(1) : '0';
td.textContent = `${formatNumber(v)} (${pct}%)`;
} else {
td.textContent = isStringColumn(col) ? v : formatNumber(v);
}
}
td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
tr.appendChild(td);
});
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll add a check to apply the 'numeric' class to non-string and non-time columns.
(scubaduck) root@1d8096239718:/workspace/scubaduck# apply_patch<<'PATCH'
> *** Begin Patch
> *** Update File: scubaduck/static/index.html
> @@
> - td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
> + if (!isStringColumn(col) && !isTimeColumn(col)) {
> + td.classList.add('numeric');
> + }
> + td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
> tr.appendChild(td);
> });
> *** End Patch
> PATCH
Success. Updated the following files:
M scubaduck/static/index.html
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll add a test after test_format_number_function
and open the patch for editing.
(scubaduck) root@1d8096239718:/workspace/scubaduck# grep -n "test_format_number_
function" -n tests/test_web.py
1056:def test_format_number_function(page: Any, server_url: str) -> None:
(scubaduck) root@1d8096239718:/workspace/scubaduck# sed -n '1056,1068p' tests/te
st_web.py
def test_format_number_function(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
vals = page.evaluate(
"() => [formatNumber(815210), formatNumber(999.999), formatNumber(0.0004
), formatNumber(0)]"
)
assert vals == ["815.21 K", "999.999", "0.000", "0"]
def test_derived_column_query(page: Any, server_url: str) -> None:
page.goto(server_url)
page.wait_for_selector("#order_by option", state="attached")
page.click("text=Columns")
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll insert the new test right before test_derived_column_query
and patch it.
> *** Begin Patch
> *** Update File: tests/test_web.py
> @@
> def test_format_number_function(page: Any, server_url: str) -> None:
> @@
> assert vals == ["815.21 K", "999.999", "0.000", "0"]
> +
> +
> +def test_numeric_cell_nowrap(page: Any, server_url: str) -> None:
> + run_query(page, server_url, limit=10)
> + whitespace = page.evaluate(
> + "getComputedStyle(document.querySelector('#results td:nth-child(3)'))
.whiteSpace"
> + )
> + assert whitespace == "nowrap"
> *** End Patch
> PATCH
Success. Updated the following files:
M tests/test_web.py
(scubaduck) root@1d8096239718:/workspace/scubaduck# grep -n "nowrap" -n tests/te
st_web.py
1065:def test_numeric_cell_nowrap(page: Any, server_url: str) -> None:
1070: assert whitespace == "nowrap"
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll run ruff format and check the formatting of the code.
(scubaduck) root@1d8096239718:/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@1d8096239718:/workspace/scubaduck#
Ruff can't parse HTML, so I'll just run it on Python files in the root.
(scubaduck) root@1d8096239718:/workspace/scubaduck# ruff format
6 files left unchanged
All checks passed!
(scubaduck) root@1d8096239718:/workspace/scubaduck# pyright
0 errors, 0 warnings, 0 informations
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll start by running the tests to ensure everything works as expected.
(scubaduck) root@1d8096239718:/workspace/scubaduck# pytest -q
bringing up nodes...
........................................................................ [ 77%]
..................... [100%]
93 passed in 15.65s
(scubaduck) root@1d8096239718:/workspace/scubaduck#
All tests are passing. Time to check the git status now.
(scubaduck) root@1d8096239718:/workspace/scubaduck# git status --short
M scubaduck/static/index.html
M tests/test_web.py
(scubaduck) root@1d8096239718:/workspace/scubaduck#
Time to go ahead and commit my updates.
(scubaduck) root@1d8096239718:/workspace/scubaduck# git add scubaduck/static/ind
ex.html tests/test_web.py
(scubaduck) root@1d8096239718:/workspace/scubaduck# git commit -m "feat(web): pr
event si suffix wrap" && git status --short
[work 77b6ccf] feat(web): prevent si suffix wrap
2 files changed, 12 insertions(+)
(scubaduck) root@1d8096239718:/workspace/scubaduck# git status --short
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll gather citation lines from index.html and tests, then locate their line numbers.
(scubaduck) root@1d8096239718:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '114,125p'
114 table { border-collapse: collapse; min-width: 100%; }
115 th, td { border: 1px solid #ccc; padding: 4px; box-sizing: border-bo
x; }
116 td.numeric { white-space: nowrap; }
117 th { text-align: left; cursor: pointer; position: relative; }
118 th.sorted { color: blue; }
119 tr:nth-child(even) td { background: #f9f9f9; }
120 tr.selected td { background: #bde4ff !important; }
121 tr:hover:not(.selected) td { background: #eee; }
122 #column_actions {
123 text-align: right;
124 margin-bottom: 5px;
125 }
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I'll grab the lines around 1186 for the JS changes.
(scubaduck) root@1d8096239718:/workspace/scubaduck# nl -ba scubaduck/static/inde
x.html | sed -n '1218,1230p'
1218 }
1219 if (!isStringColumn(col) && !isTimeColumn(col)) {
1220 td.classList.add('numeric');
1221 }
1222 td.style.textAlign = isStringColumn(col) ? 'left' : 'right';
1223 tr.appendChild(td);
1224 });
1225 table.appendChild(tr);
1226 });
1227 // ensure table does not overflow unless necessary
1228 const view = document.getElementById('view');
1229 if (table.scrollWidth <= view.clientWidth) {
1230 table.style.width = '100%';
(scubaduck) root@1d8096239718:/workspace/scubaduck#
I’m working on implementing the necessary lines to add the test cases.
(scubaduck) root@1d8096239718:/workspace/scubaduck# nl -ba tests/test_web.py | s
ed -n '1056,1072p'
1056 def test_format_number_function(page: Any, server_url: str) -> None:
1057 page.goto(server_url)
1058 page.wait_for_selector("#order_by option", state="attached")
1059 vals = page.evaluate(
1060 "() => [formatNumber(815210), formatNumber(999.999), formatNumbe
r(0.0004), formatNumber(0)]"
1061 )
1062 assert vals == ["815.21 K", "999.999", "0.000", "0"]
1063
1064
1065 def test_numeric_cell_nowrap(page: Any, server_url: str) -> None:
1066 run_query(page, server_url, limit=10)
1067 whitespace = page.evaluate(
1068 "getComputedStyle(document.querySelector('#results td:nth-child(
3)')).whiteSpace"
1069 )
1070 assert whitespace == "nowrap"
1071
1072
(scubaduck) root@1d8096239718:/workspace/scubaduck#
Time to draft the PR with references to those specific lines. I'll get started!