cadrumo.application.provisioning_browser module¶
Provisioning of the Playwright Chromium build Cadrumo’s browser automation drives.
The installed playwright package pins exact browser revisions in its bundled
browsers.json manifest, and launches only those revisions. The probe here
therefore reads that manifest and checks the revision-exact cache directories
and their completion markers, so a stale build left by an earlier Playwright
version never reads as installed. It is a filesystem read: the Playwright driver
can hang inside the CLI process, so nothing here launches it.
install_playwright_browser() is the explicit acquisition step behind
aeat config provision browser. It is idempotent and runs the vendor
installer only through the injected runner, which the outbound browser-runtime
adapter supplies. A missing build is refused with a recovery action naming that
command rather than surfacing Playwright’s raw launch error.
- BROWSER_PROVISION_ACTION_ID¶
Catalogue action whose target command provisions the browser.
- PLAYWRIGHT_BROWSER_INSTALL_TIMEOUT_S¶
Two archives of roughly two hundred megabytes each over an operator’s connection.
- BrowserInstallerRunner¶
Runs the vendor browser install within a timeout and returns its exit code.
- class BrowserBuild(**data)[source]¶
Bases:
BaseModelOne revision-pinned browser build the installed Playwright launches.
- Parameters:
data (Any)
- name: str¶
- revision: str¶
- playwright_browsers_root(cache_root=None, *, env=None)[source]¶
Return the directory Playwright installs browser binaries into.
Uses an explicit
cache_rootwhen supplied, otherwise honoursPLAYWRIGHT_BROWSERS_PATHthen falls back to the per-OS default cache. The cache is vendor-owned: Cadrumo reads it and lets the vendor installer write it, and it is intentionally not a Cadrumo storage setting.envis injectable so the override precedence is testable without mutating the process environment.
- required_browser_builds(manifest_path=None)[source]¶
Return the Chromium builds the installed Playwright pins, or
Nonewhen unreadable.A manifest entry carrying per-host revision overrides is treated as unreadable rather than guessed, because the host key it is selected by is Playwright’s own internal classification.
- Return type:
tuple[BrowserBuild,...] |None- Parameters:
manifest_path (Path | None)
- browser_not_provisioned_verdict(facts)[source]¶
Return the refusal for a missing browser build, recovered by the provisioning command.
- probe_playwright_browser(cache_root=None, *, manifest_path=None)[source]¶
Report whether every Chromium build the installed Playwright launches is present.
Missing builds are refused with the provisioning action. An unreadable manifest (Playwright absent or its layout unrecognised) is refused without a recovery action, because installing a browser cannot repair it.
- Return type:
- Parameters:
- class BrowserInstallOutcome(**data)[source]¶
Bases:
ProvisioningOutcomeThe result of a browser provisioning request, including one that needed no download.
- Parameters:
data (Any)
- installed: bool¶
- already_installed: bool¶
- installer_exit_code: int | None¶
- install_playwright_browser(*, run, probe=<function probe_playwright_browser>)[source]¶
Download the pinned Chromium builds when any is missing, then confirm them.
Idempotent: when the probe already reports every build installed, nothing runs. Success is decided by re-probing the cache, never by the installer’s exit code alone.
- Return type:
- Returns:
A
BrowserInstallOutcome. Never raises for installer failure.- Parameters:
probe (Callable[[], DependencyStatus])