Skip to content

fix(gui): print one line on start, trust OS certs, wait on locks - #182

Open
autoidm-jon wants to merge 6 commits into
mainfrom
fix/gui-quiet-start
Open

autoidm-jon wants to merge 6 commits into
mainfrom
fix/gui-quiet-start

Conversation

@autoidm-jon

Copy link
Copy Markdown
Contributor

pdt gui now prints one line with its address, and logs everything else to .pdt/gui.log. Every pdt download (DuckDB, the gcloud SDK, pwsh, Docker tools, price APIs) trusts the operating system's certificate store through truststore, so a company TLS proxy works. The GUI database opens transactions as IMMEDIATE, so the server and the worker wait for each other instead of failing with "database is locked", and the worker retries a lock quietly.

Fixes #180

@github-actions

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • pyproject.toml changes a dependency or build setting
  • src/pdt/deploy_common.py is shared by every provider
  • pyproject.toml and uv.lock add the new dependency truststore to [project.dependencies], and it is added to every provider script header (deploy_aws.py drops certifi), so TLS trust moves from Python's CA file to the OS store everywhere
  • src/pdt/deploy_common.py ecb_xml and fetch_json now pass download.CONTEXT, changing certificate verification for the shared price and API fetches of all four providers at once
  • removes user-facing output: gui_cli.open_browser's 'Opened ...' line, the 'starting pdt gui' status, and duckdb_wasm's download progress (size_text deleted); worker and server errors now go only to .pdt/gui.log

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/38310978526

@github-actions

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • pyproject.toml changes a dependency or build setting
  • src/pdt/cli.py is the command line
  • src/pdt/deploy_common.py is shared by every provider
  • src/pdt/utils/email_auth.py is public API that deployed apps import
  • src/pdt/utils/send_email.py is public API that deployed apps import
  • src/pdt/utils/send_email_graph.py is public API that deployed apps import
  • src/pdt/utils/web.py is public API that deployed apps import
  • pyproject.toml adds the new runtime dependency truststore to [project.dependencies], and every provider script header gains it (deploy_aws.py swaps certifi for it)
  • src/pdt/utils/web.py gains public functions trust_os_certificates/os_ssl_context/os_requests_session now used by utils/send_email.py, send_email_graph.py and email_auth.py, changing TLS behaviour for deployed apps
  • src/pdt/cli.py:main monkey-patches ssl.SSLContext process-wide and sets UV_SYSTEM_CERTS=1 for child uv runs; deploy_aws.py had to reorder imports before boto3 to avoid RecursionError

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/38410530374

@cursor

cursor Bot commented Oct 16, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@github-actions

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • pyproject.toml changes a dependency or build setting
  • src/pdt/cli.py is the command line
  • src/pdt/deploy_common.py is shared by every provider
  • src/pdt/utils/email_auth.py is public API that deployed apps import
  • src/pdt/utils/send_email.py is public API that deployed apps import
  • src/pdt/utils/send_email_graph.py is public API that deployed apps import
  • src/pdt/utils/web.py is public API that deployed apps import
  • agree with floor: pyproject.toml adds the truststore dependency and src/pdt/utils/web.py gains public API (trust_os_certificates, os_ssl_context, os_requests_session) that deployed apps and every provider script import
  • credential and TLS handling changes across public API: send_email.py and send_email_graph.py replace ssl.create_default_context with the OS store, and email_auth.py passes a custom requests session into msal and google-auth token refresh
  • deploy_common.LIFECYCLE_MODULES now copies utils/log.py and utils/web.py into /opt/pdt-lifecycle, changing the build context and image contents for every provider
  • src/pdt/deploy_aws.py drops certifi from its PEP 723 header while still doing import certifi (line 53) and certifi.where() (line 594), and nothing left in that header depends on certifi, so the AWS deploy script may fail at import

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/38892821448

@github-actions

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • pyproject.toml changes a dependency or build setting
  • src/pdt/cli.py is the command line
  • src/pdt/deploy_common.py is shared by every provider
  • src/pdt/utils/email_auth.py is public API that deployed apps import
  • src/pdt/utils/send_email.py is public API that deployed apps import
  • src/pdt/utils/send_email_graph.py is public API that deployed apps import
  • src/pdt/utils/web.py is public API that deployed apps import
  • pyproject.toml adds truststore as a new core dependency, and cli.py:main injects it into ssl for every pdt process plus sets UV_SYSTEM_CERTS=1
  • src/pdt/utils/web.py gains os_ssl_context and os_requests_session, public API that deployed apps import, and send_email.py, send_email_graph.py, email_auth.py now route TLS through them
  • deploy_common.LIFECYCLE_MODULES now also copies utils/log.py and utils/web.py into every provider's build context, changing what each generated image ships

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/39025641017

@autoidm-jon

autoidm-jon commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Goal: pdt gui starts with a single address line, trusts the certificates that the computer trusts, and no longer fails when two processes write the SQLite file together.

# Severity Disposition Finding Action
1 should-fix Declined src/pdt/cli.py:840: at an interactive terminal, main's watch.watched adds the "Get help with pdt gui at https://autoidm.com/discord" line after the busy-port error, so the user sees two lines. No change. Main adds this help line after every failed command (#245), including "pdt gui did not start". Removing it for one error changes main's behavior. The owner decides whether a handled pdt gui error skips it.

Conflict resolutions after the rebase onto main:

  • src/pdt/gui_cli.py: the foreground prints the PR's one address line; --background keeps main's live "starting" wait line; wait_up takes the PR's project argument.
  • src/pdt/duckdb_wasm.py: the PR's version. The download runs in a background thread of the gui server, so main's wait line around it has no terminal to show on.
  • src/pdt/deploy_common.py: fetch_once keeps main's open_url parameter (the Azure reader) and uses the process-wide OS certificate store; LIFECYCLE_MODULES holds main's alert_message.py and teams.py plus the PR's utils/log.py and utils/web.py; main's import signal stays.
  • src/pdt/cli.py: main split main() into run() inside the error watcher, so the certificate setup moved to the start of run(), still skipped during tab completion.
  • src/pdt/utils/email_auth.py and tests/conftest.py: kept both sides.

Checks that passed:

  • uv run --group dev ruff check
  • uv run pytest -q: 2567 passed, 2 skipped

@autoidm-jon

autoidm-jon commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Goal: pdt gui starts with a single address line, trusts the certificates that the computer trusts, and no longer fails when two processes write the SQLite file together.

Reviewer: Cursor gpt-5.6-luna-high (the review of the conflict resolutions is in the earlier comment; this comment covers one CI fix after it).

# Severity Disposition Finding Action
1 blocker fixed The rebased head failed test (windows-latest, 3.12): tests/test_tls.py read source files with the default Windows encoding, and a file from main now holds characters that cp1252 cannot decode (UnicodeDecodeError: 'charmap' codec can't decode byte 0x90). The head before the rebase passed. tests/test_tls.py reads each file as UTF-8. The fix is folded into the commit that owns the test.

Checks that passed:

  • uv run pytest -q: 2560 passed, 9 skipped
  • uv run --group dev ruff check: all checks passed

@autoidm-jon

autoidm-jon commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Goal: pdt gui starts with a single address line, trusts the certificates that the computer trusts, and no longer fails when two processes write the SQLite file together.

# Severity Disposition Finding Action
1 low removed duckdb_wasm.py: the comments on FETCH and failure restate the names and the "" default. Deleted both
2 low removed duckdb_wasm.py: the docstrings of fetch_in_background and fetch restate their bodies. Deleted both
3 low removed duckdb_wasm.py: the noqa: BLE001 text says an error "must not stop the server". fetch runs in a daemon thread, so an uncaught error does not stop the server. Kept the bare # noqa: BLE001
4 low removed gui/settings.py: the comment above LOGGING restates the file handler config. Deleted
5 low removed gui/worker.py: the comment in the except restates the locked check and the "trying again" log line. Deleted
6 low removed gui_cli.py: the comment on LOG_LIMIT restates the trim line in start. Deleted
7 low removed gui_cli.py: the is_up docstring restates the comparison with the project path. Deleted
8 low removed utils/web.py: a sentence in the trust_os_certificates docstring explained which libraries use ssl.SSLContext. That is truststore documentation. Deleted the sentence
9 low removed tests/test_gui_cli.py: the other_server docstring restates the fixture. Deleted
10 low removed tests/test_tls.py: the comment above PROCESS_SCRIPTS restates the name, and its second half ("the modules that only they import") does not match the set. Deleted
11 info kept cli.py, run_windows_task.py: UV_SYSTEM_CERTS comments. uv uses its own certificate file unless this is set, so a company TLS proxy blocks package downloads. None
12 info kept duckdb_wasm.py: the comment above the cleanup loop says why partial files exist. None
13 info kept gui/settings.py: the DEFERRED / IMMEDIATE comment states SQLite locking behavior. None
14 info kept gui/views.py: the read-order comment and the project_path docstring give reasons that the code does not show. None
15 info kept gui_cli.py: the SO_REUSEADDR comment states the platform difference. None
16 info kept lifecycle.py, run_powershell.py: "Here and not at import" comments give the boto3 import-order reason. None
17 info kept utils/web.py: the public API docstrings (proxy roots, botocore RecursionError, app-process use). None
18 info kept duckdb_wasm.py, gui_cli.py, gui_server.py: the module docstring updates describe the new behavior. None
19 info kept tests/conftest.py, tests/test_gui.py, tests/test_tls.py: the comments and docstrings that give a test's reason (process-wide SSL state, the DEFERRED lock order, the 250-character window, the boto3-first app). None

Checks passed on dd7c3b5a: uv run --group dev ruff check (all checks passed); uv run pytest -q (2567 passed, 2 skipped).

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • pyproject.toml changes a dependency or build setting
  • src/pdt/cli.py is the command line
  • src/pdt/deploy_common.py is shared by every provider
  • src/pdt/utils/email_auth.py is public API that deployed apps import
  • src/pdt/utils/send_email.py is public API that deployed apps import
  • src/pdt/utils/send_email_graph.py is public API that deployed apps import
  • src/pdt/utils/web.py is public API that deployed apps import
  • pyproject.toml adds a new core dependency truststore, and each provider script header (deploy_aws/azure/google_cloud/windows, lifecycle.py, run_powershell.py) gains it too
  • src/pdt/utils/web.py adds three public functions used by deployed apps via send_email.py, send_email_graph.py, and email_auth.py — TLS trust and credential-session handling, which is public API
  • deploy_common.LIFECYCLE_MODULES now ships utils/log.py and utils/web.py into every generated image, and cli.py sets UV_SYSTEM_CERTS for every child process; deploy_aws.py:594 still calls certifi.where() after certifi left its script header

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/41847620266

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pdt gui prints a Django note, a certificate error, and a database-locked traceback on Windows

1 participant