ci: the control side of every A/B oracle is the published set, as a user installs it
Engine candidate 5 (run 46208549074): ab_oracle, ab_network and ab_host were all red on a BROKEN
CONTROL. The published engine (labelled firefox-68, a tag written in the harness, when firefox-70
was the last published) was launched by the CANDIDATE's core, which no longer declares
zoom.stealth.screen.popup_position, and the engine refuses a launch whose declarations its core does
not emit (rule 7). A pairing no user has.
The control is now the set a user gets: the last invisible-playwright on the index, the
invisible-core it pins exactly, the engine that core's seal pins, in a venv of their own.
- ci/py-lock/published.txt: the set as a hash lock (every file of the two versions, the requirements
each declares); scripts/ci_published_set.py makes it (resolve), compares it with the index (check),
installs it offline over the gate's lock from the run's wheelhouse (install) and verifies what the
venv imports (verify); fetch/tag run BY the set's python: its own core fetches its own engine.
- .github/workflows/published-set.yml: daily and on a pull request that touches the lock, red when
the committed lock is not the index's last release.
- ci_ab_oracle, ci_ab_host, ci_ab_network: the published side runs in the set's python
(INVPW_PUBLISHED_PYTHON) with an environment that carries nothing of the candidate's job
(PYTHONPATH, VIRTUAL_ENV, its seal, its pin switches); the candidate side is unchanged. No tag is
written in a harness file: the label and the file names (dump-<N>.json, ...) come from the seal of
the set. A candidate without a set is refused, never run against its own core.
- ci_poison_host: the by-product files are named for the tag of the set as well.
- tests/test_ci_published_set.py (36, in wrapper.unit.all.linux and .windows): the defect on fake
cores and a fake engine that refuses as rule 7 (red on the old harness with that refusal), the
three seams, the lock on known-bad inputs, the resolver on synthetic index documents, the install
commands, no tag written in a harness file.
Red on the old harness: the defect test fails with "stealth: zoom.stealth.screen.popup_position is
not declared by the core candidate-core (rule 7)" on the scripts of df491f2e. The regression
registry of the wrapper is not on this base: its row follows with the registry.
This commit is contained in:
1 parent
df491f2e67
commit
0b23228eb8
16 files changed
+1117
-139
No files matched your search
@@ -0,0 +1,44 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# published-set.yml - the control side of the A/B oracles is the last PUBLISHED SET, and this keeps its lock equal to the index.
|
||||
#
|
||||
# An A/B oracle holds a candidate against the engine published before it, and that engine is launched by the core it was built for (it refuses a launch whose
|
||||
# declarations that core does not emit). So the control is a set: the last `invisible-playwright` on the index, the `invisible-core` it pins exactly, and the engine
|
||||
# that core's seal pins, in a venv of their own, installed by hash (ci-03): ci/py-lock/published.txt, made by scripts/ci_published_set.py. Nothing in it is chosen
|
||||
# by hand; a new release is the new baseline.
|
||||
#
|
||||
# The lock is a committed file so that a run installs it offline (the wheelhouse of the run holds the files it names). What can go stale is the lock, the day a
|
||||
# release is published: this reads the index (the JSON of the two packages, nothing is installed or run) and is RED when the committed lock is not the index's last
|
||||
# release. The fix is one command, `python scripts/ci_published_set.py resolve --write`, in the pull request that records the release.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: published-set
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "41 5 * * *"
|
||||
pull_request:
|
||||
paths:
|
||||
- ci/py-lock/published.txt
|
||||
- scripts/ci_published_set.py
|
||||
- .github/workflows/published-set.yml
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
lock-is-the-index:
|
||||
name: the committed published set is the index's last release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Check out the lock and the script
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 (v4.4.0)
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 (v5.6.0)
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: The lock against the index (reads the index, installs nothing)
|
||||
run: python scripts/ci_published_set.py check
|
||||
@@ -0,0 +1,9 @@
|
||||
# The PUBLISHED SET, the control side of the A/B oracles (scripts/ci_published_set.py): the last published invisible-playwright and the invisible-core it pins (its seal pins the engine). Written by `python scripts/ci_published_set.py resolve --write`; .github/workflows/published-set.yml keeps it equal to the index.
|
||||
# wrapper-requires: greenlet<4.0.0,>=3.1.1 | psutil>=5.9 | pyee<14,>=13
|
||||
# core-requires: maxminddb>=2.2 | platformdirs>=4 | psutil>=5.9 | requests[socks]>=2.31 | tzdata>=2024.1
|
||||
invisible-core==70.83.0 \
|
||||
--hash=sha256:1dff040e41f5aba5aa07e086328ca436291fddbd31514d1bc9a9dbfc4ba7fb6a \
|
||||
--hash=sha256:f7144262686adf54a4a1c85a8d17f76b31dc4ddcfbd6636d777c5c39963d3293
|
||||
invisible-playwright==0.60.0 \
|
||||
--hash=sha256:00509578944ff0d742761d4d5f19fcde21b7657197fa24ab0718e076ebdf9aa6 \
|
||||
--hash=sha256:7285f5756ad2031087d12f339c2e89b76bdb953449c9151c0edc11a58d96d9c6
|
||||
@@ -15,8 +15,8 @@
|
||||
{"id": "wrapper.e2e.stock_twin", "giro": "G2", "os": ["linux", "windows"], "min_tests": 20, "exact": true, "tests": ["tests/test_a_drag_from_the_top_into_a_frame_of_another_site_e2e.py", "tests/test_a_select_dropdown_opens_at_its_element_e2e.py", "tests/test_a_tooltip_opens_at_the_pointer_e2e.py", "tests/test_intersection_and_lazy_loading_in_a_frame_of_another_site_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The twins of the browser's own popups and of the frame's reads. Two references, one browser at a time, the reference first and ours second, and the verdict is 'the same as the reference' (tests/_stock_twin.py, tests/_retail_reference.py). The select dropdown (4 scales) and the tooltip (4 scales) are measured from chrome scope, against RETAIL Firefox 159 driven by Marionette alone, headed (the leg sets INVPW_RETAIL_FIREFOX to its firefox.exe). The real drag from the top into a frame of another site (4 scales), what the IntersectionObserver of a scrolled frame of another site reads (8 steps, 4 scales) and when a lazy frame is requested (4 distances, 4 scales) are measured against Playwright's own Firefox (stock_firefox), headed, driven by the stock Playwright client. 20 = 4 + 4 + 4 + 4 + 4. Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The files are in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
|
||||
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
|
||||
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4116, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_windows_job_keeps_a_dump_of_a_crashing_python.py", "tests/test_every_wire_method_isLine truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4128, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_pytest_process_clears_the_gp_fault_error_box_on_windows.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_Line truncated
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4152, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_windows_job_keeps_a_dump_of_a_crashing_python.py"Line truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4164, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_pytest_process_clears_the_gp_fault_error_box_on_windows.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_aLine truncated
|
||||
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode).", "core_dumps": "invpw-cores"},
|
||||
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 447, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_screenshot_honours_its_scale_e2e.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_throuLine truncated
|
||||
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 414, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapLine truncated
|
||||
@@ -26,8 +26,8 @@
|
||||
{"id": "wrapper.e2e.suite.windows.3", "giro": "G2", "os": ["windows"], "min_tests": 276, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_drag_motion.py", "tests/test_element_screenshot_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_first_launch_from_a_new_path.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_post_data_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screencast.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_input_files_payloads.py", "tests/test_set_offline_e2e.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_external_texture_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "Part 3 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.4", "giro": "G2", "os": ["windows"], "min_tests": 293, "exact": true, "tests": ["tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_popup_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_injected_node_surface.py", "tests/test_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_e2e.py", "tests/test_juggler_connection.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_oop_frame_element.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_scroll_into_view.py", "tests/test_shadow_trusted_input.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_page_e2e.py", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 4 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 609 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.control_a", "giro": "G2", "os": ["windows"], "min_tests": 20, "exact": true, "tests": ["tests/test_control_a_selects_all_in_a_field_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "The keyboard shortcut Control+A selects all in a field (5 ways to press it x an input and a textarea, in-process and served to the stock client), alone on its own Windows runner (windows-latest), as e2e.yml runs it on the published engine: the Windows keyboard of a real user is what it needs. The same file is in one of wrapper.e2e.suite.windows.1..4 and in wrapper.e2e.suite.linux.1.", "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.ab_oracle", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_oracle_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Same seed, same bytes: the engine published as firefox-68 against the candidate, on one machine, with the same core and wrapper, after the control: the published engine against ITSELF (the A/A; a difference is a broken control, exit 2, and the A/B is not run). On a pull request (no candidate: INVPW_BINARY_PATH is the published engine, no INVISIBLE_SEAL_FILE) the A/A is the whole test, on the first two seeds of the candidate set (all five when the pull request changes a file of this oracle: the step of e2e.yml that runs scripts/ci_ab_pr_seeds.py exports AB_ORACLE_PR_SEEDS), and saves both dumps and the diff under $AB_ORACLE_OUT or $RUNNER_TEMP/invpw-evidence/ab-oracle. scripts/ci_ab_oracle.py runs the host gate's dump (scripts/ci_host_gate.py dump: the persona seeds of ci/persona-seeds.json, each at its own DPR with nothing pinned, the whole page of scripts/host_gate; the `candidate` set of 5 seeds that reach every webgl renderer and every DPR, or with AB_ORACLE_SEED_SET=final and AB_ORACLE_SHARD=i/n the 20 seeds that reach every value of every dimension split over n jobs) twice, once with the firefox-68 binary (the release's seal.json, then the core's own download.ensure_binary under that seal: the archive's sha256 is checked against the seal) and once with the candidate binary of the leg under its own seal, and compares every leaf of every visit: the only differences allowed are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys; anything else is red with the leaf, the two values and the seed; fewer leaves than the host gate's reference holds (16439 per visit; a DPR the reference does not record is held to the least of those it does) is red. The files (dump-68.json, dump-68-again.json, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) are the artifact ab-oracle-<os> of the leg. 1 = the one test; the comparator's own cases (51, the A/A's among them) are in tests/test_ab_oracle.py, the persona seeds' (15) in tests/test_persona_cover.py, in the rows of the whole unit suite. Needs the engine's binary (INVPW_BINARY_PATH) and, for the A/B, the candidate's seal (INVISIBLE_SEAL_FILE) and the network (the release assets of firefox-68). The engine of the candidate must accept the core of the leg and the 68 engine must accept it too: a core that declares something the published engine refuses is a red of this suite, not of the engine.", "timeout_minutes": 50, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"], "artifact": "ab-oracle"},
|
||||
{"id": "wrapper.e2e.ab_network", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_network_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Network A/B oracle: the P4 journey, HTTPS h1/h2 (ClientHello, h2 frames, header order), HTTP/3 (transport parameters, H3 SETTINGS), WebRTC through the coherent SOCKS5 lab gateway, DNS through the fake DoH, and an idle launch; transcripts compared leaf by leaf, direct connections red on either side. A/A first (the published engine twice: a difference is a broken control; ci/ab-network-volatile.json holds the leaves the A/A proved volatile, and may only shrink), then the published engine against the candidate. Without a candidate (a PR's e2e) the A/A alone, on the first seed (all five when the pull request changes a file of this oracle: AB_NETWORK_PR_SEEDS), in jobs of its own in e2e.yml on Linux and on Windows (the shared e2e jobs leave this file out).", "timeout_minutes": 75, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]},
|
||||
{"id": "wrapper.e2e.ab_host", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_host_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Host A/B oracle: the whole TRACE of a closed run, from the launch to the exit of the browser, after the same journey. Compared: the processes by kind (the parent, -contentproc type, sandboxingKind, isForBrowser, the helpers by what they ran) with their count, except for the kinds of type tab whose count follows the idle time (only their presence counts), and the host paths the tree touched, judged by one rule (red if and only if a path is in all the measured launches of one engine and in no launch of the other, the long launches included; every other path that differs is listed in not-judged.json, not judged); what is ours (the package, the profile and temp dirs of the launch, the run cache, its own shared memory) leaves the comparison as a class. Linux: strace of the whole tree. Windows: the process-creation audit (event 4688, with the command line) and an ETW file trace of Kernel-File, which need an administrator. It has jobs of its own in e2e.yml on Linux and on Windows (a measurement shares the machine with no other browser), and its footprints keep the lifecycle of the tree (who started and ended when, how) and how the close ended. Each engine run starts with a discarded warm-up launch whose trace is kept and listed apart (what only the warm-up did, with the process that did it); only the tree of the launch is compared (a Windows service's paths are counted by process name and left out), and a path or a kind that differs names the processes to blame. A/A first, then the published engine against the candidate; the one declared difference (Linux glxtest, gone on the 69) is in ci/ab-host-expected.json, applied by kind, a list that may only shrink. There is no list of noise. Without a candidate (a PR e2e) the A/A alone, on the first two seeds (all five when the pull request changes a file of this oracle: AB_HOST_PR_SEEDS).", "runner_image": {"windows": "windows-2022"}, "timeout_minutes": 50, "core_dumps": "cores", "stock_firefox": ["windows"], "location_service": ["windows"], "extra_steps": ["keep_oracle_files"]},
|
||||
{"id": "wrapper.e2e.ab_oracle", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_oracle_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Same seed, same bytes: the engine of the published set (the last published engine, with its own core and wrapper) against the candidate (with core_ref and wrapper_ref), on one machine, after the control: the published engine against ITSELF (the A/A; a difference is a broken control, exit 2, and the A/B is not run). On a pull request (no candidate: INVPW_BINARY_PATH is the published engine, no INVISIBLE_SEAL_FILE) the A/A is the whole test, on the first two seeds of the candidate set (all five when the pull request changes a file of this oracle: the step of e2e.yml that runs scripts/ci_ab_pr_seeds.py exports AB_ORACLE_PR_SEEDS), and saves both dumps and the diff under $AB_ORACLE_OUT or $RUNNER_TEMP/invpw-evidence/ab-oracle. scripts/ci_ab_oracle.py runs the host gate's dump (scripts/ci_host_gate.py dump: the persona seeds of ci/persona-seeds.json, each at its own DPR with nothing pinned, the whole page of scripts/host_gate; the `candidate` set of 5 seeds that reach every webgl renderer and every DPR, or with AB_ORACLE_SEED_SET=final and AB_ORACLE_SHARD=i/n the 20 seeds that reach every value of every dimension split over n jobs) twice, once with the published engine (fetched by the published set's own core under its own seal, which checks the archive's sha256, and dumped in that set's venv) and once with the candidate binary of the leg under its own seal, and compares every leaf of every visit: the only differences allowed are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys; anything else is red with the leaf, the two values and the seed; fewer leaves than the host gate's reference holds (16439 per visit; a DPR the reference does not record is held to the least of those it does) is red. The files (dump-<N>.json, dump-<N>-again.json for the tag of the published set, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) are the artifact ab-oracle-<os> of the leg. 1 = the one test; the comparator's own cases (51, the A/A's among them) are in tests/test_ab_oracle.py, the persona seeds' (15) in tests/test_persona_cover.py, in the rows of the whole unit suite. Needs the engine's binary (INVPW_BINARY_PATH) and, for the A/B, the candidate's seal (INVISIBLE_SEAL_FILE) and the network (the release assets of the published engine, and INVPW_PUBLISHED_PYTHON). Each engine runs with the core it was built for: a core that declares less than the published engine requires is no longer a red of this suite (it was: engine candidate 5, every A/B a broken control). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "timeout_minutes": 50, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"], "artifact": "ab-oracle"},
|
||||
{"id": "wrapper.e2e.ab_network", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_network_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Network A/B oracle: the P4 journey, HTTPS h1/h2 (ClientHello, h2 frames, header order), HTTP/3 (transport parameters, H3 SETTINGS), WebRTC through the coherent SOCKS5 lab gateway, DNS through the fake DoH, and an idle launch; transcripts compared leaf by leaf, direct connections red on either side. A/A first (the published engine twice: a difference is a broken control; ci/ab-network-volatile.json holds the leaves the A/A proved volatile, and may only shrink), then the published engine against the candidate. Without a candidate (a PR's e2e) the A/A alone, on the first seed (all five when the pull request changes a file of this oracle: AB_NETWORK_PR_SEEDS), in jobs of its own in e2e.yml on Linux and on Windows (the shared e2e jobs leave this file out). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "timeout_minutes": 75, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]},
|
||||
{"id": "wrapper.e2e.ab_host", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_host_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Host A/B oracle: the whole TRACE of a closed run, from the launch to the exit of the browser, after the same journey. Compared: the processes by kind (the parent, -contentproc type, sandboxingKind, isForBrowser, the helpers by what they ran) with their count, except for the kinds of type tab whose count follows the idle time (only their presence counts), and the host paths the tree touched, judged by one rule (red if and only if a path is in all the measured launches of one engine and in no launch of the other, the long launches included; every other path that differs is listed in not-judged.json, not judged); what is ours (the package, the profile and temp dirs of the launch, the run cache, its own shared memory) leaves the comparison as a class. Linux: strace of the whole tree. Windows: the process-creation audit (event 4688, with the command line) and an ETW file trace of Kernel-File, which need an administrator. It has jobs of its own in e2e.yml on Linux and on Windows (a measurement shares the machine with no other browser), and its footprints keep the lifecycle of the tree (who started and ended when, how) and how the close ended. Each engine run starts with a discarded warm-up launch whose trace is kept and listed apart (what only the warm-up did, with the process that did it); only the tree of the launch is compared (a Windows service's paths are counted by process name and left out), and a path or a kind that differs names the processes to blame. A/A first, then the published engine against the candidate; the one declared difference (Linux glxtest, gone on the 69) is in ci/ab-host-expected.json, applied by kind, a list that may only shrink. There is no list of noise. Without a candidate (a PR e2e) the A/A alone, on the first two seeds (all five when the pull request changes a file of this oracle: AB_HOST_PR_SEEDS). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "runner_image": {"windows": "windows-2022"}, "timeout_minutes": 50, "core_dumps": "cores", "stock_firefox": ["windows"], "location_service": ["windows"], "extra_steps": ["keep_oracle_files"]},
|
||||
{"id": "wrapper.e2e.ab_host_crash", "giro": "G2", "os": ["linux"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_host_crash_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "A signal sent to the parent of the browser with os.kill, the core the kernel writes and gdb reads, and the signal line of strace exist on Linux only: Windows has no counterpart of this test. What a Windows launch that did not end with 0 leaves (the `.extra` files and the minidump names, read from the crash folders) is held by the unit tests of the recorder with fake launches, and by every Windows leg of the three oracles, which are red on any parent that does not end with 0.", "note": "The recorder of the host oracle, tested on a launch that dies on purpose: scripts/ci_ab_host.py crash-probe launches the engine once under the oracle's stand-in (strace of the tree, cores enabled, a crash watcher), sends SIGSEGV to the browser's parent with os.kill and closes it as the oracle closes its launches; the test passes when the oracle reports RED (exit 1, `FAIL the parent process exited with code ...: seed N, launch crash`) and the artifact (RUNNER_TEMP/invpw-evidence/ab-host-crash) holds the signal line of the strace log (strace-signals.txt, strace-tail.txt), the core run through gdb (gdb-core.*.txt: `thread apply all bt`, the MOZ_CRASH reason, `info sharedlibrary`), the build ids and what the collectors did not find (said.txt). It fails when the oracle says green for a launch that died, when the evidence is missing and when the probe did not run; the red of the probe does not make the job red. It runs in the job of the host oracle on Linux (e2e-host: strace, gdb and elfutils installed, kernel.core_pattern pointed at INVPW_CORE_DIR), after the A/A, and is left out of the shared e2e job (OWN_JOB_FILES).", "timeout_minutes": 35, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]}
|
||||
]
|
||||
+14
-15
@@ -2706,17 +2706,14 @@ def staged_engine(binary: str, base=None):
|
||||
shutil.rmtree(dest, ignore_errors=True)
|
||||
|
||||
|
||||
def run_subprocess(binary: str, seal: Path | None, leg: str, out: Path, label: str, seeds: list, crash_with: str | None = None) -> int:
|
||||
def run_subprocess(binary: str, seal: Path | None, leg: str, out: Path, label: str, seeds: list, crash_with: str | None = None, python: str | None = None) -> int:
|
||||
"""`run` in a process of its own, with a cache folder and a temp root of its own: they are the run's, so what the engine does in them is `ours`
|
||||
(the cache of the bundle's fonts, the profile and the temp dirs of the launch) and the rest of the machine is the host's.
|
||||
|
||||
`crash_with` (a signal name) makes the run the recorder's own test: one launch, whose parent is sent that signal (`crash-probe`)."""
|
||||
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
|
||||
if seal:
|
||||
env["INVISIBLE_SEAL_FILE"] = str(seal)
|
||||
for name in ("MOZ_LOG", "MOZ_LOG_FILE"):
|
||||
env.pop(name, None)
|
||||
cmd = [sys.executable, "-u", str(Path(__file__).resolve()), "run", binary, "--leg", leg, "--out", str(out), "--label", label,
|
||||
`crash_with` (a signal name) makes the run the recorder's own test: one launch, whose parent is sent that signal (`crash-probe`). `python` is the published set's
|
||||
(scripts/ci_published_set.py): the control side runs in the venv that holds the published core and wrapper, never in the candidate's."""
|
||||
env = oracle.process_env(seal, python)
|
||||
cmd = [python or sys.executable, "-u", str(Path(__file__).resolve()), "run", binary, "--leg", leg, "--out", str(out), "--label", label,
|
||||
"--seeds", ",".join(str(s) for s in seeds)]
|
||||
if crash_with:
|
||||
cmd += ["--crash-with", crash_with]
|
||||
@@ -2844,18 +2841,18 @@ def ab(candidate: str | None, candidate_seal: Path | None, leg: str, out: Path,
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
work = Path(tempfile.mkdtemp(prefix="ab-host-fetch-"))
|
||||
try:
|
||||
binary, seal = published or oracle.fetch_published(engine_tag, work)
|
||||
runs = [(engine_tag, "footprint-%s.json" % engine_tag.rsplit("-", 1)[-1], binary, seal),
|
||||
(engine_tag + " again", "footprint-%s-again.json" % engine_tag.rsplit("-", 1)[-1], binary, seal)]
|
||||
binary, seal, python = oracle.split_published(published or oracle.fetch_published(engine_tag, work))
|
||||
runs = [(engine_tag, "footprint-%s.json" % engine_tag.rsplit("-", 1)[-1], binary, seal, python),
|
||||
(engine_tag + " again", "footprint-%s-again.json" % engine_tag.rsplit("-", 1)[-1], binary, seal, python)]
|
||||
if candidate:
|
||||
runs.append((oracle.CANDIDATE, "footprint-candidate.json", candidate, candidate_seal))
|
||||
runs.append((oracle.CANDIDATE, "footprint-candidate.json", candidate, candidate_seal, None))
|
||||
failed = []
|
||||
for label, name, exe, seal_file in runs:
|
||||
for label, name, exe, seal_file, side_python in runs:
|
||||
print("=== footprint with %s: %s (run from %s)" % (label, exe, stage_dir()))
|
||||
sys.stdout.flush()
|
||||
try:
|
||||
with staged_engine(exe) as staged:
|
||||
rc = run_subprocess(staged, Path(seal_file) if seal_file else None, leg, out / name, label, seeds)
|
||||
rc = run_subprocess(staged, Path(seal_file) if seal_file else None, leg, out / name, label, seeds, **({"python": side_python} if side_python else {}))
|
||||
except OSError as e:
|
||||
print("the engine of %s could not be staged: %s" % (label, e))
|
||||
rc = 125
|
||||
@@ -2921,7 +2918,7 @@ def main(argv=None) -> int:
|
||||
x.add_argument("--candidate-seal", type=Path, default=os.environ.get("INVISIBLE_SEAL_FILE"))
|
||||
x.add_argument("--leg", required=True)
|
||||
x.add_argument("--out", type=Path, required=True)
|
||||
x.add_argument("--engine-tag", default=oracle.ENGINE_TAG)
|
||||
x.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
|
||||
x.add_argument("--seeds", default=None)
|
||||
x.add_argument("--published-binary", type=Path, help="use this binary for the published engine instead of fetching it")
|
||||
x.add_argument("--published-seal", type=Path, help="its seal (default: the environment's)")
|
||||
@@ -2947,6 +2944,8 @@ def main(argv=None) -> int:
|
||||
return 3
|
||||
return crash_probe(args.binary, args.leg, args.out, args.seed if args.seed is not None else default_seeds()[0])
|
||||
seeds = [int(s) for s in args.seeds.split(",")] if args.seeds else default_seeds()
|
||||
if args.cmd == "ab":
|
||||
args.engine_tag = args.engine_tag or oracle.default_tag()
|
||||
if args.cmd == "run":
|
||||
if sys.platform.startswith("linux") and not shutil.which("strace"):
|
||||
print("needs strace (apt install strace): without it the processes and the files of the run are not seen")
|
||||
|
||||
+32
-21
@@ -96,7 +96,6 @@ VOLATILE_FILE = ROOT / "ci" / "ab-network-volatile.json"
|
||||
SEEDS_FILE = ROOT / "ci" / "persona-seeds.json"
|
||||
#: The seeds the A/B oracle of the page uses today (scripts/ci_host_gate.py: SEEDS), when ci/persona-seeds.json has no "candidate" key.
|
||||
FALLBACK_SEEDS = (11, 12, 13)
|
||||
ENGINE_TAG = "firefox-68"
|
||||
CANDIDATE = "candidate"
|
||||
#: The most times the engine sends one STUN request (a transmit and its retransmissions) before it gives the transaction up: the pref
|
||||
#: ``media.peerconnection.ice.stun_client_maximum_transmits`` (modules/libpref/init/all.js), 7. The first RTO is 100 ms and doubles, so how
|
||||
@@ -2026,9 +2025,15 @@ def judge(report: Dict[str, Any], control: bool) -> int:
|
||||
return 2 if control else 1
|
||||
|
||||
|
||||
def engine_env(seal: Optional[str]) -> Dict[str, str]:
|
||||
"""The environment of a process that runs one engine: its seal, no autofix, no pin check, no browser logging."""
|
||||
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
|
||||
def engine_env(seal: Optional[str], python: Optional[str] = None) -> Dict[str, str]:
|
||||
"""The environment of a process that runs one engine: its seal, no autofix, no pin check, no browser logging. With `python` (the published set's venv,
|
||||
scripts/ci_published_set.py) it is the set's: nothing of the candidate's job that makes it import another core or run another seal, and the pin check stays on."""
|
||||
if python:
|
||||
from ci_published_set import clean_env
|
||||
|
||||
env = clean_env({"INVISIBLE_CORE_AUTOFIX": "off"})
|
||||
else:
|
||||
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
|
||||
if seal:
|
||||
env["INVISIBLE_SEAL_FILE"] = str(seal)
|
||||
for name in ("MOZ_LOG", "MOZ_LOG_FILE"):
|
||||
@@ -2036,11 +2041,12 @@ def engine_env(seal: Optional[str]) -> Dict[str, str]:
|
||||
return env
|
||||
|
||||
|
||||
def run_engine(binary: str, seal: Optional[str], label: str, seeds: Tuple[int, ...], out: Path) -> int:
|
||||
"""``run`` in a process of its own: the seal a process runs under is read at import, so each engine gets its own."""
|
||||
env = engine_env(seal)
|
||||
def run_engine(binary: str, seal: Optional[str], label: str, seeds: Tuple[int, ...], out: Path, python: Optional[str] = None) -> int:
|
||||
"""``run`` in a process of its own: the seal a process runs under is read at import, so each engine gets its own. `python` is the published set's: the control
|
||||
side runs in the venv that holds the published core and wrapper, never in the candidate's."""
|
||||
env = engine_env(seal, python)
|
||||
env[crash.CRASH_DIR_ENV] = str(Path(out).parent / (Path(out).stem + ".crash")) # footprint-68.json -> transcript-68.crash/: what a launch that did not end with 0 left
|
||||
command = [sys.executable, "-u", str(Path(__file__).resolve()), "run", "--binary", binary, "--label", label, "--seeds", ",".join(map(str, seeds)), "--out", str(out)]
|
||||
command = [python or sys.executable, "-u", str(Path(__file__).resolve()), "run", "--binary", binary, "--label", label, "--seeds", ",".join(map(str, seeds)), "--out", str(out)]
|
||||
print("=== run %s: %s (seal %s)" % (label, binary, seal or "the one this process has"))
|
||||
sys.stdout.flush()
|
||||
from ci_ab_oracle import own_cache_env
|
||||
@@ -2161,10 +2167,10 @@ HUNT_BASE_S = 600
|
||||
HUNT_PER_REPETITION_S = 120
|
||||
|
||||
|
||||
def hunt_engine(binary: str, seal: Optional[str], label: str, seed: int, n: int, out_dir: Path) -> int:
|
||||
def hunt_engine(binary: str, seal: Optional[str], label: str, seed: int, n: int, out_dir: Path, python: Optional[str] = None) -> int:
|
||||
"""``hunt_run`` in a process of its own, as ``run_engine`` runs ``run``: each engine its own seal and its own cache."""
|
||||
env = engine_env(seal)
|
||||
command = [sys.executable, "-u", str(Path(__file__).resolve()), "hunt-run", "--binary", binary, "--label", label, "--seed", str(seed), "--n", str(n), "--out", str(out_dir)]
|
||||
env = engine_env(seal, python)
|
||||
command = [python or sys.executable, "-u", str(Path(__file__).resolve()), "hunt-run", "--binary", binary, "--label", label, "--seed", str(seed), "--n", str(n), "--out", str(out_dir)]
|
||||
print("=== hunt %s: %s (seal %s), %d repetitions of the WebRTC walk of seed %d" % (label, binary, seal or "the one this process has", n, seed))
|
||||
sys.stdout.flush()
|
||||
from ci_ab_oracle import own_cache_env
|
||||
@@ -2176,14 +2182,15 @@ def hunt_engine(binary: str, seal: Optional[str], label: str, seed: int, n: int,
|
||||
return 124
|
||||
|
||||
|
||||
def published_engine(args: argparse.Namespace, work: Path) -> Tuple[str, Optional[str]]:
|
||||
"""The published engine of an ``ab``: the binary the caller gave, or the one the release holds, with its seal."""
|
||||
def published_engine(args: argparse.Namespace, work: Path) -> Tuple[str, Optional[str], Optional[str]]:
|
||||
"""The published engine of an ``ab``: the binary the caller gave (run as this process is), or the one the published set fetches with its own core (its seal and its
|
||||
python: the control side runs in that venv)."""
|
||||
if args.published_binary:
|
||||
return str(args.published_binary), (str(args.published_seal) if args.published_seal else None)
|
||||
return str(args.published_binary), (str(args.published_seal) if args.published_seal else None), None
|
||||
import ci_ab_oracle as oracle
|
||||
|
||||
binary, seal = oracle.fetch_published(args.engine_tag, work)
|
||||
return binary, str(seal)
|
||||
binary, seal, python = oracle.split_published(oracle.fetch_published(args.engine_tag, work))
|
||||
return binary, (str(seal) if seal else None), python
|
||||
|
||||
|
||||
def cmd_hunt(args: argparse.Namespace, spec: str) -> int:
|
||||
@@ -2198,9 +2205,9 @@ def cmd_hunt(args: argparse.Namespace, spec: str) -> int:
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
work = Path(tempfile.mkdtemp(prefix="ab-network-"))
|
||||
try:
|
||||
binary, seal = published_engine(args, work)
|
||||
binary, seal, python = published_engine(args, work)
|
||||
for label in (args.engine_tag, args.engine_tag + "-again"):
|
||||
code = hunt_engine(binary, seal, label, seed, n, out)
|
||||
code = hunt_engine(binary, seal, label, seed, n, out, **({"python": python} if python else {}))
|
||||
if code != 0:
|
||||
print("hunt %s ended with %s" % (label, code))
|
||||
summary = hunt_summary(read_hunt_records(out))
|
||||
@@ -2224,6 +2231,10 @@ def compare_files(a: Path, b: Path, out: Optional[Path], floor: int, volatile_pa
|
||||
|
||||
|
||||
def cmd_ab(args: argparse.Namespace) -> int:
|
||||
if args.engine_tag is None:
|
||||
from ci_ab_oracle import default_tag
|
||||
|
||||
args.engine_tag = default_tag()
|
||||
spec = os.environ.get(HUNT_ENV)
|
||||
if spec:
|
||||
return cmd_hunt(args, spec)
|
||||
@@ -2238,12 +2249,12 @@ def cmd_ab(args: argparse.Namespace) -> int:
|
||||
return 2
|
||||
work = Path(tempfile.mkdtemp(prefix="ab-network-"))
|
||||
try:
|
||||
binary, seal = published_engine(args, work)
|
||||
binary, seal, python = published_engine(args, work)
|
||||
tag = args.engine_tag.rsplit("-", 1)[-1]
|
||||
first, again = out / ("transcript-%s.json" % tag), out / ("transcript-%s-again.json" % tag)
|
||||
problems = []
|
||||
for path, label in ((first, args.engine_tag), (again, args.engine_tag + "-again")):
|
||||
if run_engine(binary, seal, label, seeds, path) != 0 or not path.is_file():
|
||||
if run_engine(binary, seal, label, seeds, path, **({"python": python} if python else {})) != 0 or not path.is_file():
|
||||
problems.append("the run %s did not produce a transcript" % label)
|
||||
if problems:
|
||||
print("\n".join("FAIL " + p for p in problems))
|
||||
@@ -2296,7 +2307,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
a.add_argument("--candidate-seal", default=os.environ.get("INVISIBLE_SEAL_FILE"))
|
||||
a.add_argument("--published-binary", type=Path, default=None, help="use this binary as the published engine instead of fetching it")
|
||||
a.add_argument("--published-seal", type=Path, default=None)
|
||||
a.add_argument("--engine-tag", default=ENGINE_TAG)
|
||||
a.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
|
||||
a.add_argument("--seeds", default=None)
|
||||
a.add_argument("--floor", type=int, default=0)
|
||||
a.add_argument("--volatile", type=Path, default=VOLATILE_FILE)
|
||||
|
||||
+99
-61
@@ -3,17 +3,19 @@
|
||||
|
||||
A page reads the same values from two engines that differ only by the work of one
|
||||
release. This runs the host gate's dump (scripts/ci_host_gate.py dump: the page in
|
||||
scripts/host_gate, whole APIs) twice on the SAME machine, with the same core and the same
|
||||
wrapper, over the persona seeds (ci/persona-seeds.json, computed by scripts/persona_cover.py
|
||||
scripts/host_gate, whole APIs) twice on the SAME machine, each engine with ITS OWN core and wrapper
|
||||
(the published engine with the published set, the candidate with core_ref and wrapper_ref), over the persona seeds (ci/persona-seeds.json, computed by scripts/persona_cover.py
|
||||
from the prefs the core emits: the `candidate` set, 5 seeds that reach every webgl renderer
|
||||
and every DPR, or the `final` set, 20 seeds that reach every value of every dimension). Each
|
||||
seed runs at its OWN DPR (nothing is pinned):
|
||||
|
||||
1. with the published engine (firefox-68 by default): its seal and its archive are
|
||||
downloaded the way the core downloads an engine (the release's seal.json, then
|
||||
invisible_core.download.ensure_binary under that seal, which checks the sha256 of
|
||||
the archive against the seal and the engine against the seal);
|
||||
2. with the candidate binary the gate already holds, under its own seal.
|
||||
1. with the published engine: the one the PUBLISHED SET carries (scripts/ci_published_set.py:
|
||||
the last wrapper on the index, the core it pins, the engine that core's seal pins). The
|
||||
set's venv fetches its own engine the way a user's core does (ensure_binary under its
|
||||
own seal, which checks the sha256 of the archive and the engine against the seal) and
|
||||
the dump runs in that venv: the engine is launched by the core it was built for;
|
||||
2. with the candidate binary the gate already holds, under its own seal, in the venv of
|
||||
the job (core_ref, wrapper_ref).
|
||||
|
||||
The dump also reads what the host gate's retail comparison leaves alone, the ab. leaves (ci_host_gate.is_ab): ab.poison on every seed (zone, language, colour scheme, a
|
||||
canary font and the audio context, which scripts/ci_poison_host.py holds to the declared identity on a poisoned host) and, on seeds 0 and 63, the extra visit of every realm and
|
||||
@@ -28,7 +30,7 @@ visit compares fewer leaves than MIN_LEAVES says: a page that dumped less than t
|
||||
own reference would pass anything.
|
||||
|
||||
python ci_ab_oracle.py run <candidate-firefox> --candidate-seal gate.seal.json \\
|
||||
--leg linux-x86_64 --out ab-oracle [--engine-tag firefox-68] [--seed-set candidate|final] [--shard i/n]
|
||||
--leg linux-x86_64 --out ab-oracle [--engine-tag <the set's tag>] [--seed-set candidate|final] [--shard i/n]
|
||||
python ci_ab_oracle.py run --published-binary <firefox> --leg linux-x86_64 --out ab-oracle --limit 2 (the A/A alone)
|
||||
python ci_ab_oracle.py compare ab-oracle [--a-a] [--seed-set ...] [--shard i/n] (again, from the dumps)
|
||||
|
||||
@@ -83,11 +85,15 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
import ci_crash_evidence as crash # noqa: E402
|
||||
import ci_host_gate as gate # noqa: E402
|
||||
import ci_published_set as published_set # noqa: E402
|
||||
import persona_cover as personas # noqa: E402
|
||||
|
||||
FORMAT = "ab-oracle/1"
|
||||
#: The engine the candidate is held to: the last one published.
|
||||
ENGINE_TAG = "firefox-68"
|
||||
#: The control side is the PUBLISHED SET (scripts/ci_published_set.py): the wrapper the index published last, the core that wrapper pins, and the engine that core's seal pins, in a venv
|
||||
#: of their own. The variable names that venv's python; the job sets it (or the oracle's test makes the venv from the run's wheelhouse). No tag is written in this file: the engine the
|
||||
#: candidate is held to is the one the set carries, so a new release is the new baseline.
|
||||
PUBLISHED_PYTHON_ENV = "INVPW_PUBLISHED_PYTHON"
|
||||
SET_SCRIPT = Path(__file__).resolve().parent / "ci_published_set.py"
|
||||
CANDIDATE = "candidate"
|
||||
#: What the host gate's own reference holds per visit (non-diag leaves at each DPR, today).
|
||||
#: A visit that compares fewer leaves than this is red. Moves by hand with the reference
|
||||
@@ -327,35 +333,68 @@ def print_report(report: dict, published: str, other: str = CANDIDATE, title: st
|
||||
# -
|
||||
# The run: two dumps, one per engine, as subprocesses (the seal a process runs under is read at import).
|
||||
|
||||
def fetch_published(tag: str, work: Path) -> tuple:
|
||||
"""(binary, seal path) of the published engine `tag`, fetched the way the core fetches an engine."""
|
||||
os.environ.setdefault("INVISIBLE_CORE_AUTOFIX", "off")
|
||||
os.environ.setdefault("INVISIBLE_CORE_PIN", "allow")
|
||||
from invisible_core import download
|
||||
from invisible_core.constants import RELEASE_URL_TEMPLATE
|
||||
from invisible_core.seal import load_seal
|
||||
def published_python() -> str:
|
||||
"""The python of the published set's venv (INVPW_PUBLISHED_PYTHON). RuntimeError when there is none: a candidate held to a control that is not the published set is
|
||||
the broken control this file used to run (the candidate's core with the published engine, which refuses a launch whose declarations that core does not emit)."""
|
||||
python = os.environ.get(PUBLISHED_PYTHON_ENV)
|
||||
if not python or not Path(python).is_file():
|
||||
raise RuntimeError("%s names no python (%r): the control side of an A/B is the PUBLISHED SET in a venv of its own (scripts/ci_published_set.py install --house <the "
|
||||
"run's wheelhouse> --venv <dir>, then export the python it prints), never the core and the wrapper of the candidate" % (PUBLISHED_PYTHON_ENV, python))
|
||||
return python
|
||||
|
||||
owner, repo = download._parse_owner_repo(RELEASE_URL_TEMPLATE)
|
||||
seal_path = work / ("seal-%s.json" % tag)
|
||||
sources = download.release_asset_urls(owner, repo, tag, "seal.json",
|
||||
RELEASE_URL_TEMPLATE.format(tag=tag, asset="seal.json"))
|
||||
download._download_file(sources, seal_path)
|
||||
seal = load_seal(seal_path)
|
||||
if seal.tag != tag or seal.is_local:
|
||||
raise SystemExit("the seal of the release %s says tag %r (local: %s)" % (tag, seal.tag, seal.is_local))
|
||||
print("published engine %s: %s" % (tag, seal.describe()))
|
||||
|
||||
def set_command(python: str, *argv: str) -> list:
|
||||
"""`python scripts/ci_published_set.py <argv>`, run BY the set's python: stdlib and its own invisible_core."""
|
||||
return [python, str(SET_SCRIPT)] + list(argv)
|
||||
|
||||
|
||||
def default_tag() -> str:
|
||||
"""The tag of the engine the control side runs: the one the seal of the published set's core names; without a set (a pull request, whose engine IS the published one and
|
||||
runs under the core the wrapper pins) the seal of the core of this process."""
|
||||
python = os.environ.get(PUBLISHED_PYTHON_ENV)
|
||||
if python and Path(python).is_file():
|
||||
done = subprocess.run(set_command(python, "tag"), capture_output=True, text=True, env=published_set.clean_env(), timeout=120)
|
||||
if done.returncode != 0:
|
||||
raise RuntimeError("the published set's core names no seal tag: %s" % (done.stderr or done.stdout)[-600:])
|
||||
return done.stdout.strip().splitlines()[-1]
|
||||
from invisible_core.seal import active_seal
|
||||
|
||||
return active_seal().tag
|
||||
|
||||
|
||||
def fetch_published(tag: str | None, work: Path) -> tuple:
|
||||
"""(binary, None, python) of the published set: the engine its own core fetches under its own seal, and the python that is its venv's. `tag`, when given, is held
|
||||
to the seal of the set (a label that names another engine than the one the set carries is a wrong control, said here)."""
|
||||
python = published_python()
|
||||
done = subprocess.run(set_command(python, "fetch", "--work", str(work)), capture_output=True, text=True, env=published_set.clean_env(), timeout=DUMP_TIMEOUT_S)
|
||||
if done.returncode != 0:
|
||||
raise RuntimeError("the published set could not fetch its engine (exit %s): %s" % (done.returncode, (done.stderr or done.stdout)[-800:]))
|
||||
fetched = json.loads(done.stdout.strip().splitlines()[-1])
|
||||
if tag and fetched["tag"] != tag:
|
||||
raise RuntimeError("the control is labelled %s but the published set carries %s" % (tag, fetched["tag"]))
|
||||
print("published engine %s: %s (core and wrapper of the published set, %s)" % (fetched["tag"], fetched["describe"], python))
|
||||
sys.stdout.flush()
|
||||
# the engine store of this fetch only: the dumps that follow run under the environment they were given
|
||||
before = os.environ.get(download.ENGINE_DIR_ENV)
|
||||
os.environ[download.ENGINE_DIR_ENV] = str(work / "engines")
|
||||
try:
|
||||
binary = download.ensure_binary(seal=seal)
|
||||
finally:
|
||||
if before is None:
|
||||
os.environ.pop(download.ENGINE_DIR_ENV, None)
|
||||
else:
|
||||
os.environ[download.ENGINE_DIR_ENV] = before
|
||||
return str(binary), seal_path
|
||||
return fetched["binary"], None, python
|
||||
|
||||
|
||||
def process_env(seal, python: str | None = None) -> dict:
|
||||
"""The environment of a process that runs ONE engine: no autofix, no browser logging, and the seal of that engine. With `python` (the published set's venv) the process is the
|
||||
set's: nothing of the candidate's job that could make it import another core or run another seal reaches it, and the core's pin check stays ON (a set whose wrapper and
|
||||
core do not agree is refused, as it is on a user's machine). Without it (the candidate, or a pull request's published engine) it is as it always was."""
|
||||
if python:
|
||||
env = published_set.clean_env({"INVISIBLE_CORE_AUTOFIX": "off"})
|
||||
else:
|
||||
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
|
||||
if seal: # None: the engine runs under the seal of the core it is launched with (the published set's, a pull request's published engine)
|
||||
env["INVISIBLE_SEAL_FILE"] = str(seal)
|
||||
for name in ("MOZ_LOG", "MOZ_LOG_FILE"): # the e2e legs log the engine; a run is as the host gate's
|
||||
env.pop(name, None)
|
||||
return env
|
||||
|
||||
|
||||
def split_published(published: tuple) -> tuple:
|
||||
"""(binary, seal, python or None) of a `published` tuple: two items (a binary given, run in this process's environment) or three (the published set)."""
|
||||
return (published[0], published[1], published[2] if len(published) > 2 else None)
|
||||
|
||||
|
||||
def own_cache_env(env: dict, folder: str, platform: str | None = None) -> dict:
|
||||
@@ -381,27 +420,24 @@ def own_cache_env(env: dict, folder: str, platform: str | None = None) -> dict:
|
||||
return out
|
||||
|
||||
|
||||
def dump_with_exits(name: str, exe: str, seal_file, leg: str, visits, target: Path, out: Path) -> tuple:
|
||||
def dump_with_exits(name: str, exe: str, seal_file, leg: str, visits, target: Path, out: Path, python: str | None = None) -> tuple:
|
||||
"""The dump of one engine run as `run_dump` makes it, with the folder where its probe writes how each browser ended (`<out>/crash/<name>`, named to the dump process by
|
||||
AB_CRASH_DIR): `(rc or "timeout", the red lines of the launches that did not end with 0, or that nobody saw)`. A dump process whose probe wrote nothing is red: an oracle
|
||||
that does not see how its browsers end does not see them."""
|
||||
crash_dir = out / "crash" / name
|
||||
try:
|
||||
with crash.environment(**{crash.CRASH_DIR_ENV: crash_dir}):
|
||||
rc = run_dump(exe, Path(seal_file) if seal_file else None, leg, target, visits)
|
||||
rc = run_dump(exe, Path(seal_file) if seal_file else None, leg, target, visits, **({"python": python} if python else {}))
|
||||
except subprocess.TimeoutExpired:
|
||||
rc = "timeout"
|
||||
return rc, crash.exits_of_run(crash_dir, name, windows=leg.startswith("win"), needed=(rc == 0))
|
||||
|
||||
|
||||
def run_dump(binary: str, seal: Path | None, leg: str, out: Path, visits: list | None = None) -> int:
|
||||
"""The host gate's dump of `visits` ([(dpr, seed)], each seed at its own DPR) as a subprocess; None is the host gate's own grid."""
|
||||
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
|
||||
if seal is not None: # None: the engine runs under the seal of the core it is launched with (a pull request's published engine)
|
||||
env["INVISIBLE_SEAL_FILE"] = str(seal)
|
||||
for name in ("MOZ_LOG", "MOZ_LOG_FILE"): # the e2e legs log the engine; a dump runs as the host gate's does
|
||||
env.pop(name, None)
|
||||
cmd = [sys.executable, str(Path(gate.__file__)), "dump", binary, "--leg", leg, "--out", str(out)]
|
||||
def run_dump(binary: str, seal: Path | None, leg: str, out: Path, visits: list | None = None, python: str | None = None) -> int:
|
||||
"""The host gate's dump of `visits` ([(dpr, seed)], each seed at its own DPR) as a subprocess; None is the host gate's own grid. `python` is the published set's: the
|
||||
dump of the control side runs in the venv that holds the published core and wrapper, never in the candidate's."""
|
||||
env = process_env(seal, python)
|
||||
cmd = [python or sys.executable, str(Path(gate.__file__)), "dump", binary, "--leg", leg, "--out", str(out)]
|
||||
if visits is not None:
|
||||
if relaunch_visits(visits):
|
||||
cmd += ["--relaunch-seed", str(RELAUNCH_SEED)]
|
||||
@@ -419,13 +455,13 @@ def run(candidate: str, candidate_seal: Path, leg: str, out: Path, engine_tag: s
|
||||
started = time.time()
|
||||
problems, dumps = [], {}
|
||||
try:
|
||||
binary, seal = published or fetch_published(engine_tag, work)
|
||||
for name, exe, seal_file in ((engine_tag, binary, seal), (CANDIDATE, candidate, candidate_seal)):
|
||||
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
|
||||
for name, exe, seal_file, side_python in ((engine_tag, binary, seal, python), (CANDIDATE, candidate, candidate_seal, None)):
|
||||
target = work / name
|
||||
print("=== dump with %s: %s (seal %s), seeds %s"
|
||||
% (name, exe, seal_file, " ".join("%d@%s" % (seed, dpr) for dpr, seed in visits)))
|
||||
sys.stdout.flush()
|
||||
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out)
|
||||
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out, side_python)
|
||||
if rc != 0:
|
||||
problems.append("the dump with %s ended with %s" % (name, rc))
|
||||
problems += exits
|
||||
@@ -454,13 +490,13 @@ def again_name(engine_tag: str) -> str:
|
||||
return dump_name(engine_tag)[:-len(".json")] + "-again.json"
|
||||
|
||||
|
||||
def _dump_visits(name: str, exe: str, seal_file, leg: str, visits: list, work: Path, out: Path, file_name: str) -> tuple:
|
||||
def _dump_visits(name: str, exe: str, seal_file, leg: str, visits: list, work: Path, out: Path, file_name: str, python: str | None = None) -> tuple:
|
||||
"""One engine's dump of `visits`: ({(dpr, seed): items}, problems); the packed dump is written to out/file_name."""
|
||||
target = work / name
|
||||
print("=== dump with %s: %s (seal %s), seeds %s"
|
||||
% (name, exe, seal_file or "of the core", " ".join("%d@%s" % (seed, dpr) for dpr, seed in visits)))
|
||||
sys.stdout.flush()
|
||||
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out)
|
||||
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out, python)
|
||||
problems = ([] if rc == 0 else ["the dump with %s ended with %s" % (name, rc)]) + exits
|
||||
dumped = read_visits(target) if target.is_dir() else {}
|
||||
write_json(out / file_name, pack(name, dumped))
|
||||
@@ -472,7 +508,8 @@ def run_ab(leg: str, out: Path, engine_tag: str, published: tuple | None = None,
|
||||
"""The A/A (the published engine twice), then, with a candidate, the A/B against the first dump. 0 green, 1 a finding,
|
||||
2 a broken control (the A/A differs, or a dump of it did not run: the A/B is not run) .
|
||||
|
||||
`published` is (binary, seal or None); without it the engine is fetched the way the core fetches one."""
|
||||
`published` is (binary, seal or None) of a binary the caller gave, run in this process's environment, or (binary, None, python) of the published set; without it the
|
||||
set the job made (INVPW_PUBLISHED_PYTHON) fetches its own engine."""
|
||||
visits = select_visits() if visits is None else visits
|
||||
expected = tuple(visits)
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
@@ -482,9 +519,9 @@ def run_ab(leg: str, out: Path, engine_tag: str, published: tuple | None = None,
|
||||
asked = ["%d@%s" % (seed, dpr) for dpr, seed in visits]
|
||||
try:
|
||||
try:
|
||||
binary, seal = published or fetch_published(engine_tag, work)
|
||||
first, p1 = _dump_visits(engine_tag, binary, seal, leg, visits, work, out, dump_name(engine_tag))
|
||||
again, p2 = _dump_visits(engine_tag + "-again", binary, seal, leg, visits, work, out, again_name(engine_tag))
|
||||
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
|
||||
first, p1 = _dump_visits(engine_tag, binary, seal, leg, visits, work, out, dump_name(engine_tag), **({"python": python} if python else {}))
|
||||
again, p2 = _dump_visits(engine_tag + "-again", binary, seal, leg, visits, work, out, again_name(engine_tag), **({"python": python} if python else {}))
|
||||
problems = p1 + p2
|
||||
except SystemExit:
|
||||
raise
|
||||
@@ -521,8 +558,8 @@ def run_clean(leg: str, out: Path, engine_tag: str, visits: list, published: tup
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
work = Path(tempfile.mkdtemp(prefix="ab-oracle-clean-"))
|
||||
try:
|
||||
binary, seal = published or fetch_published(engine_tag, work)
|
||||
_, problems = _dump_visits(engine_tag + "-clean", binary, seal, leg, visits, work, out, clean_name(engine_tag))
|
||||
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
|
||||
_, problems = _dump_visits(engine_tag + "-clean", binary, seal, leg, visits, work, out, clean_name(engine_tag), **({"python": python} if python else {}))
|
||||
except SystemExit:
|
||||
raise
|
||||
except Exception as e: # noqa: BLE001 - said, not raised: this is a by-product
|
||||
@@ -568,7 +605,7 @@ def main(argv=None) -> int:
|
||||
help="the candidate's seal (default: INVISIBLE_SEAL_FILE)")
|
||||
r.add_argument("--leg", required=True)
|
||||
r.add_argument("--out", type=Path, required=True)
|
||||
r.add_argument("--engine-tag", default=ENGINE_TAG)
|
||||
r.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
|
||||
r.add_argument("--seed-set", choices=SEED_SETS, default=SEED_SET,
|
||||
help="the persona seeds to visit (ci/persona-seeds.json), each at its own DPR")
|
||||
r.add_argument("--shard", help="i/n: every n-th seed of the set from the i-th (the final set over n jobs)")
|
||||
@@ -580,13 +617,13 @@ def main(argv=None) -> int:
|
||||
k = sub.add_parser("clean", help="the published engine's dump on this (clean) machine, for the poisoned run's by-product")
|
||||
k.add_argument("--leg", required=True)
|
||||
k.add_argument("--out", type=Path, required=True)
|
||||
k.add_argument("--engine-tag", default=ENGINE_TAG)
|
||||
k.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
|
||||
k.add_argument("--seed-set", choices=SEED_SETS, default=SEED_SET)
|
||||
k.add_argument("--shard")
|
||||
k.add_argument("--limit", type=int)
|
||||
c = sub.add_parser("compare")
|
||||
c.add_argument("directory", type=Path)
|
||||
c.add_argument("--engine-tag", default=ENGINE_TAG)
|
||||
c.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
|
||||
c.add_argument("--seed-set", choices=SEED_SETS, default=SEED_SET)
|
||||
c.add_argument("--shard")
|
||||
c.add_argument("--limit", type=int)
|
||||
@@ -598,6 +635,7 @@ def main(argv=None) -> int:
|
||||
sys.stdout.reconfigure(newline="\n") # the line goes to $GITHUB_OUTPUT: a carriage return would be part of the value
|
||||
print("touched=%s" % ("true" if touched(pr.changed_files(args.base)) else "false"))
|
||||
return 0
|
||||
args.engine_tag = args.engine_tag or default_tag()
|
||||
if args.cmd == "clean":
|
||||
return run_clean(args.leg, args.out, args.engine_tag, select_visits(args.seed_set, args.shard, limit=args.limit))
|
||||
if args.cmd == "compare":
|
||||
|
||||
@@ -248,8 +248,15 @@ def dump_findings(dump: dict, wants: Callable = declared) -> list:
|
||||
# the same seeds. Every leaf that differs is a host dependency the published engine ALREADY has: not a failure of the candidate and never red,
|
||||
# a finding, kept in a file of its own and summarised in the job's summary.
|
||||
|
||||
CLEAN_FILE = "poison-clean-68.json"
|
||||
DEPENDENCE_FILE = "poison-host-dependence-68.json"
|
||||
def clean_file(engine_tag: str) -> str:
|
||||
"""poison-clean-70.json for firefox-70: the published engine's dump on the clean runner (ci_ab_oracle.clean_name). The tag is the one the published set carries."""
|
||||
return "poison-clean-%s.json" % engine_tag.rsplit("-", 1)[-1]
|
||||
|
||||
|
||||
def dependence_file(engine_tag: str) -> str:
|
||||
return "poison-host-dependence-%s.json" % engine_tag.rsplit("-", 1)[-1]
|
||||
|
||||
|
||||
DEPENDENCE_FORMAT = "poison-host-dependence/1"
|
||||
CLIP = 300
|
||||
|
||||
@@ -305,14 +312,17 @@ def dependence_markdown(report: dict | None) -> str:
|
||||
return "\n".join(lines + [""])
|
||||
|
||||
|
||||
def write_dependence(out: Path, summary: Path | None = None) -> dict | None:
|
||||
"""Write DEPENDENCE_FILE in `out` from CLEAN_FILE and dump-68.json there, and the markdown to `summary` (the job's $GITHUB_STEP_SUMMARY).
|
||||
Returns the report, or None when there is no clean dump. Never a verdict."""
|
||||
clean, poisoned = out / CLEAN_FILE, out / "dump-68.json"
|
||||
def write_dependence(out: Path, summary: Path | None = None, engine_tag: str | None = None) -> dict | None:
|
||||
"""Write the dependence file in `out` from the clean dump and the published engine's dump there (named for `engine_tag`, by default the tag the published set carries),
|
||||
and the markdown to `summary` (the job's $GITHUB_STEP_SUMMARY). Returns the report, or None when there is no clean dump. Never a verdict."""
|
||||
import ci_ab_oracle as oracle
|
||||
|
||||
engine_tag = engine_tag or oracle.default_tag()
|
||||
clean, poisoned = out / clean_file(engine_tag), out / oracle.dump_name(engine_tag)
|
||||
report = None
|
||||
if clean.is_file() and poisoned.is_file():
|
||||
report = host_dependence(json.loads(clean.read_text(encoding="utf-8")), json.loads(poisoned.read_text(encoding="utf-8")))
|
||||
(out / DEPENDENCE_FILE).write_text(json.dumps(report, sort_keys=True, ensure_ascii=False), encoding="utf-8")
|
||||
(out / dependence_file(engine_tag)).write_text(json.dumps(report, sort_keys=True, ensure_ascii=False), encoding="utf-8")
|
||||
text = dependence_markdown(report)
|
||||
if summary:
|
||||
with open(summary, "a", encoding="utf-8", newline="\n") as f:
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
#!/usr/bin/env python3
|
||||
"""The PUBLISHED SET: the control side of every A/B oracle, exactly as a user installs it.
|
||||
|
||||
An A/B oracle holds a candidate against the engine published before it. That engine is not a binary alone: it is launched by the core that declares the prefs it
|
||||
requires (the engine refuses a launch whose declarations are not the ones it was built for), and that core is the one the published wrapper pins. So the control
|
||||
side is a SET, and nothing in it is chosen by hand: the last published `invisible-playwright` on PyPI pins its core exactly, and that core's seal pins its engine.
|
||||
|
||||
ci/py-lock/published.txt the set as a lock (ci-03): the wrapper and the core it pins, each at an exact version with the sha256 of EVERY file of that
|
||||
version on the index, and the requirements each declares (the headers), which the gate's own lock must satisfy.
|
||||
python scripts/ci_published_set.py resolve [--write] reads PyPI (the only command that does), prints the lock, or writes it
|
||||
python scripts/ci_published_set.py check PyPI's last release against the committed lock: red when they differ (.github/workflows/published-set.yml)
|
||||
python scripts/ci_published_set.py install --house DIR --venv DIR [--lock FILE]
|
||||
OFFLINE and hash-checked: a venv of its own with the gate's third-party lock (DIR/lock.txt), then the two wheels of the set by their hashes
|
||||
(`--no-deps`, from DIR: the wheelhouse of the run, whose job downloaded the files this lock names). Prints the venv's python.
|
||||
python scripts/ci_published_set.py verify --python PY what that python imports is the lock's set, from its own venv and from nowhere else
|
||||
python scripts/ci_published_set.py fetch --work DIR (run BY the set's python) fetches the engine the way a user's core does: its own seal
|
||||
python scripts/ci_published_set.py tag (run BY the set's python) the tag its seal names
|
||||
|
||||
Exit codes: 0 green, 1 red (a finding), 2 the command could not run.
|
||||
|
||||
The candidate's side is untouched: its core is core_ref's, its wrapper is wrapper_ref's, its engine is the candidate.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
LOCK_PATH = ROOT / "ci" / "py-lock" / "published.txt"
|
||||
GATE_LOCK_PATH = ROOT / "ci" / "py-lock" / "gate.txt"
|
||||
|
||||
WRAPPER = "invisible-playwright"
|
||||
CORE = "invisible-core"
|
||||
INDEX = "https://pypi.org/pypi"
|
||||
|
||||
HASH_RE = re.compile(r"^--hash=sha256:([0-9a-f]{64})$")
|
||||
PIN_RE = re.compile(r"^([A-Za-z0-9][A-Za-z0-9._-]*)==([0-9][A-Za-z0-9.!+_-]*)$")
|
||||
HEADER = ("The PUBLISHED SET, the control side of the A/B oracles (scripts/ci_published_set.py): the last published invisible-playwright and the invisible-core it pins "
|
||||
"(its seal pins the engine). Written by `python scripts/ci_published_set.py resolve --write`; .github/workflows/published-set.yml keeps it equal to the index.")
|
||||
|
||||
#: What a process of the published set must not inherit from the candidate's job: anything that makes its python import another wrapper or another core, or run
|
||||
#: another engine's seal. The set is what its venv holds, as it is on a user's machine.
|
||||
SET_LEAKS = ("PYTHONPATH", "PYTHONHOME", "PYTHONSTARTUP", "PYTHONUSERBASE", "VIRTUAL_ENV", "INVISIBLE_SEAL_FILE", "INVISIBLE_CORE_PIN", "INVISIBLE_CORE_AUTOFIX",
|
||||
"INVISIBLE_PLAYWRIGHT_ENGINE_DIR")
|
||||
|
||||
|
||||
def norm(name: str) -> str:
|
||||
return re.sub(r"[-_.]+", "-", name).lower()
|
||||
|
||||
|
||||
# -
|
||||
# The lock: text <-> parts (pure, no network)
|
||||
|
||||
def _release_parts(release: dict, name: str) -> tuple:
|
||||
"""(version, [sha256 of every file], [requirements without extras]) of a PyPI release document (`/pypi/<name>/<version>/json`)."""
|
||||
info = release.get("info") or {}
|
||||
if norm(info.get("name") or "") != norm(name):
|
||||
raise ValueError("the document is of %r, not %s" % (info.get("name"), name))
|
||||
files = [f for f in release.get("urls") or [] if not f.get("yanked")]
|
||||
hashes = sorted({(f.get("digests") or {}).get("sha256", "") for f in files})
|
||||
if not files or not all(re.fullmatch(r"[0-9a-f]{64}", h) for h in hashes):
|
||||
raise ValueError("%s %s has no file with a sha256 on the index" % (name, info.get("version")))
|
||||
if not any(f.get("packagetype") == "bdist_wheel" for f in files):
|
||||
raise ValueError("%s %s has no wheel on the index" % (name, info.get("version")))
|
||||
requires = [r for r in (info.get("requires_dist") or []) if "extra ==" not in r]
|
||||
return info["version"], hashes, requires
|
||||
|
||||
|
||||
def core_pin_of(requires: list) -> str:
|
||||
"""The version of `invisible-core==X` among the requirements of the wrapper; ValueError when there is not exactly one exact pin."""
|
||||
pins = []
|
||||
for r in requires:
|
||||
m = re.fullmatch(r"\s*invisible[-_.]core\s*==\s*([0-9][A-Za-z0-9.!+_-]*)\s*(?:;.*)?", r)
|
||||
if m:
|
||||
pins.append(m.group(1))
|
||||
if len(pins) != 1:
|
||||
raise ValueError("the published wrapper does not pin invisible-core exactly once with `==` (it declares %s)" % (requires or "nothing"))
|
||||
return pins[0]
|
||||
|
||||
|
||||
def lock_text(wrapper_release: dict, core_release: dict) -> str:
|
||||
version, hashes, requires = _release_parts(wrapper_release, WRAPPER)
|
||||
core_version, core_hashes, core_requires = _release_parts(core_release, CORE)
|
||||
pin = core_pin_of(requires)
|
||||
if pin != core_version:
|
||||
raise ValueError("%s %s pins invisible-core==%s but the core document is of %s" % (WRAPPER, version, pin, core_version))
|
||||
others = [r for r in requires if not re.match(r"\s*invisible[-_.]core\b", r, re.I)]
|
||||
out = ["# " + HEADER,
|
||||
"# wrapper-requires: " + " | ".join(sorted(others)),
|
||||
"# core-requires: " + " | ".join(sorted(core_requires))]
|
||||
for name, v, hs in ((CORE, core_version, core_hashes), (WRAPPER, version, hashes)):
|
||||
out.append("%s==%s \\" % (name, v))
|
||||
out.append(" \\\n".join(" --hash=sha256:" + h for h in hs))
|
||||
return "\n".join(out) + "\n"
|
||||
|
||||
|
||||
def parse_lock(text: str) -> dict:
|
||||
"""{"wrapper": (version, hashes), "core": (version, hashes), "wrapper_requires": [...], "core_requires": [...]}; ValueError names what is wrong.
|
||||
Every entry is `name==version` with at least one sha256: no range, no URL, no entry without a hash."""
|
||||
meta, entries, current = {}, {}, None
|
||||
joined = text.replace("\\\n", " ")
|
||||
for raw in joined.splitlines():
|
||||
line = raw.strip()
|
||||
if not line:
|
||||
continue
|
||||
m = re.match(r"^#\s*(wrapper-requires|core-requires):\s*(.*)$", line)
|
||||
if m:
|
||||
meta[m.group(1)] = [r.strip() for r in m.group(2).split(" | ") if r.strip()]
|
||||
continue
|
||||
if line.startswith("#"):
|
||||
continue
|
||||
parts = line.split()
|
||||
pin = PIN_RE.match(parts[0])
|
||||
if not pin:
|
||||
raise ValueError("a line that is not `name==version --hash=sha256:...`: %r" % line[:80])
|
||||
hashes = []
|
||||
for p in parts[1:]:
|
||||
h = HASH_RE.match(p)
|
||||
if not h:
|
||||
raise ValueError("%s: %r is not a --hash=sha256:<64 hex>" % (parts[0], p[:40]))
|
||||
hashes.append(h.group(1))
|
||||
if not hashes:
|
||||
raise ValueError("%s has no hash: an entry without a hash is an unchecked install" % parts[0])
|
||||
current = norm(pin.group(1))
|
||||
if current in entries:
|
||||
raise ValueError("%s is listed twice" % current)
|
||||
entries[current] = (pin.group(2), sorted(hashes))
|
||||
if sorted(entries) != sorted([CORE, WRAPPER]):
|
||||
raise ValueError("the lock holds %s, it must hold exactly %s and %s" % (sorted(entries), CORE, WRAPPER))
|
||||
for key in ("wrapper-requires", "core-requires"):
|
||||
if key not in meta:
|
||||
raise ValueError("the header line `# %s:` is missing" % key)
|
||||
return {"wrapper": entries[WRAPPER], "core": entries[CORE], "wrapper_requires": meta["wrapper-requires"], "core_requires": meta["core-requires"]}
|
||||
|
||||
|
||||
def locked_versions(gate_text: str) -> dict:
|
||||
"""{normalized name: version} of the pinned entries of a lock (ci/py-lock/gate.txt)."""
|
||||
out = {}
|
||||
for line in gate_text.replace("\\\n", " ").splitlines():
|
||||
m = PIN_RE.match(line.split()[0]) if line.strip() and not line.lstrip().startswith("#") else None
|
||||
if m:
|
||||
out[norm(re.sub(r"\[.*\]", "", m.group(1)))] = m.group(2)
|
||||
return out
|
||||
|
||||
|
||||
def problems_of_lock(parsed: dict, gate_text: str) -> list:
|
||||
"""What makes the set not installable, offline, over the gate's lock: the wrapper's pin of the core is not the core in the lock, or a requirement of either is
|
||||
not met by the third-party package the gate's lock holds (the venv of the set is the gate's lock plus these two wheels, `--no-deps`)."""
|
||||
from packaging.requirements import Requirement # the gate lock installs it (pytest needs it); resolve/check do not come here
|
||||
|
||||
problems = []
|
||||
try:
|
||||
pin = core_pin_of(parsed["wrapper_requires"] + ["%s==%s" % (CORE, parsed["core"][0])])
|
||||
if pin != parsed["core"][0]:
|
||||
problems.append("the lock names core %s" % parsed["core"][0])
|
||||
except ValueError as e:
|
||||
problems.append(str(e))
|
||||
held = locked_versions(gate_text)
|
||||
for owner, requires in (("the published wrapper", parsed["wrapper_requires"]), ("the published core", parsed["core_requires"])):
|
||||
for text in requires:
|
||||
req = Requirement(text)
|
||||
if req.marker is not None and not req.marker.evaluate({"extra": ""}):
|
||||
continue
|
||||
version = held.get(norm(req.name))
|
||||
if version is None:
|
||||
problems.append("%s requires %s: the gate's lock (ci/py-lock/gate.txt) does not hold it, so the set cannot be installed offline" % (owner, text))
|
||||
elif not req.specifier.contains(version, prereleases=True):
|
||||
problems.append("%s requires %s: the gate's lock holds %s==%s" % (owner, text, req.name, version))
|
||||
return problems
|
||||
|
||||
|
||||
# -
|
||||
# The index (the only network here)
|
||||
|
||||
def fetch_json(url: str) -> dict:
|
||||
request = urllib.request.Request(url, headers={"User-Agent": "ci-published-set"})
|
||||
with urllib.request.urlopen(request, timeout=60) as response: # noqa: S310 - the index of the package, https
|
||||
return json.loads(response.read().decode("utf-8"))
|
||||
|
||||
|
||||
def resolve(get=fetch_json) -> str:
|
||||
"""The lock of the last published set: PyPI's latest release of the wrapper, and the core that wrapper pins."""
|
||||
latest = get("%s/%s/json" % (INDEX, WRAPPER))
|
||||
version = (latest.get("info") or {}).get("version")
|
||||
if not version:
|
||||
raise ValueError("the index names no latest version of %s" % WRAPPER)
|
||||
wrapper = get("%s/%s/%s/json" % (INDEX, WRAPPER, version))
|
||||
pin = core_pin_of(_release_parts(wrapper, WRAPPER)[2])
|
||||
return lock_text(wrapper, get("%s/%s/%s/json" % (INDEX, CORE, pin)))
|
||||
|
||||
|
||||
def check(get=fetch_json, path: Path = LOCK_PATH) -> list:
|
||||
"""[] when the committed lock is the index's last release; else the lines that say how it differs (and how to fix it)."""
|
||||
committed = path.read_text(encoding="utf-8") if path.is_file() else ""
|
||||
try:
|
||||
wanted = resolve(get)
|
||||
except (ValueError, OSError) as e:
|
||||
return ["the index could not be read or is not what a release is: %s" % e]
|
||||
if committed == wanted:
|
||||
return []
|
||||
old = parse_lock(committed) if committed else None
|
||||
new = parse_lock(wanted)
|
||||
now = "%s %s + %s %s" % (WRAPPER, new["wrapper"][0], CORE, new["core"][0])
|
||||
was = "%s %s + %s %s" % (WRAPPER, old["wrapper"][0], CORE, old["core"][0]) if old else "nothing"
|
||||
return ["%s holds %s but the index's last release is %s. Fix: python scripts/ci_published_set.py resolve --write, and commit it. "
|
||||
"Rule: the control side of an A/B is the last published set" % (path.name, was, now)]
|
||||
|
||||
|
||||
# -
|
||||
# The venv of the set (offline) and what it must be
|
||||
|
||||
def venv_python(venv: Path) -> Path:
|
||||
return venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
|
||||
|
||||
|
||||
def clean_env(extra: dict | None = None) -> dict:
|
||||
env = {k: v for k, v in os.environ.items() if k not in SET_LEAKS}
|
||||
env.update(extra or {})
|
||||
return env
|
||||
|
||||
|
||||
def install(house: Path, venv: Path, lock: Path = LOCK_PATH, run=subprocess.run) -> Path:
|
||||
"""A venv of its own: the gate's third-party lock from the wheelhouse (`house/lock.txt`, the lock of the run), then the two wheels of the set by their hashes.
|
||||
Offline: `--no-index --find-links house`, `--require-hashes` on both; the two are installed `--no-deps` because the first step holds everything they need."""
|
||||
parse_lock(lock.read_text(encoding="utf-8")) # a lock that does not read is no install
|
||||
house_lock = house / "lock.txt"
|
||||
if not house_lock.is_file():
|
||||
raise FileNotFoundError("the wheelhouse %s has no lock.txt (the gate's lock): it is not a py-deps wheelhouse" % house)
|
||||
run([sys.executable, "-m", "venv", str(venv)], check=True)
|
||||
python = str(venv_python(venv))
|
||||
base = [python, "-m", "pip", "install", "--quiet", "--no-index", "--find-links", str(house), "--require-hashes"]
|
||||
run(base + ["-r", str(house_lock)], check=True, env=clean_env())
|
||||
run(base + ["--no-deps", "-r", str(lock)], check=True, env=clean_env())
|
||||
return venv_python(venv)
|
||||
|
||||
|
||||
IDENTITY_CODE = """
|
||||
import importlib.metadata as md, json, sys
|
||||
import invisible_core, invisible_playwright
|
||||
from invisible_core.seal import active_seal
|
||||
seal = active_seal()
|
||||
print(json.dumps({"prefix": sys.prefix, "core": md.version("invisible-core"), "core_version": invisible_core.__version__, "core_file": invisible_core.__file__,
|
||||
"wrapper": md.version("invisible-playwright"), "wrapper_file": invisible_playwright.__file__, "seal_tag": seal.tag, "seal_local": seal.is_local}))
|
||||
"""
|
||||
|
||||
|
||||
def identity(python: str, run=subprocess.run) -> dict:
|
||||
"""What `python` is when it imports the set: versions, files and the tag of the seal its core carries (read in isolated mode, with no variable of the job)."""
|
||||
done = run([python, "-I", "-c", IDENTITY_CODE], capture_output=True, text=True, env=clean_env(), timeout=120)
|
||||
if done.returncode != 0:
|
||||
raise RuntimeError("%s could not import the published set (exit %s): %s" % (python, done.returncode, (done.stderr or done.stdout)[-800:]))
|
||||
return json.loads(done.stdout.strip().splitlines()[-1])
|
||||
|
||||
|
||||
def verify(python: str, lock: Path = LOCK_PATH, run=subprocess.run) -> list:
|
||||
"""[] when `python` runs the lock's wrapper and the lock's core, both from its own prefix, under the seal its core was published with."""
|
||||
parsed = parse_lock(lock.read_text(encoding="utf-8"))
|
||||
ident = identity(python, run)
|
||||
problems = []
|
||||
if ident["wrapper"] != parsed["wrapper"][0] or not ident["wrapper_file"].startswith(ident["prefix"]):
|
||||
problems.append("the wrapper it runs is %s from %s, the set says %s from its own venv" % (ident["wrapper"], ident["wrapper_file"], parsed["wrapper"][0]))
|
||||
if ident["core"] != parsed["core"][0] or ident["core_version"] != parsed["core"][0] or not ident["core_file"].startswith(ident["prefix"]):
|
||||
problems.append("the core it runs is %s (reports %s) from %s, the set says %s from its own venv"
|
||||
% (ident["core"], ident["core_version"], ident["core_file"], parsed["core"][0]))
|
||||
if ident["seal_local"]:
|
||||
problems.append("its core runs under a local seal: a published core carries a release seal")
|
||||
return problems
|
||||
|
||||
|
||||
# -
|
||||
# What the set's own python does (the commands below are run BY it: they import the published core)
|
||||
|
||||
def fetch(work: Path) -> dict:
|
||||
"""The engine of the core this python has, fetched the way a user's core fetches it: its own seal, its own download, its own verification."""
|
||||
from invisible_core import download
|
||||
from invisible_core.seal import active_seal
|
||||
|
||||
work = Path(work)
|
||||
os.environ[download.ENGINE_DIR_ENV] = str(work / "engines")
|
||||
seal = active_seal()
|
||||
binary = download.ensure_binary()
|
||||
return {"binary": str(binary), "tag": seal.tag, "describe": seal.describe()}
|
||||
|
||||
|
||||
def main(argv=None) -> int:
|
||||
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
||||
sub = ap.add_subparsers(dest="cmd", required=True)
|
||||
r = sub.add_parser("resolve")
|
||||
r.add_argument("--write", action="store_true")
|
||||
sub.add_parser("check")
|
||||
i = sub.add_parser("install")
|
||||
i.add_argument("--house", type=Path, required=True)
|
||||
i.add_argument("--venv", type=Path, required=True)
|
||||
i.add_argument("--lock", type=Path, default=LOCK_PATH)
|
||||
v = sub.add_parser("verify")
|
||||
v.add_argument("--python", required=True)
|
||||
v.add_argument("--lock", type=Path, default=LOCK_PATH)
|
||||
f = sub.add_parser("fetch")
|
||||
f.add_argument("--work", type=Path, required=True)
|
||||
sub.add_parser("tag")
|
||||
args = ap.parse_args(argv)
|
||||
try:
|
||||
if args.cmd == "resolve":
|
||||
text = resolve()
|
||||
if args.write:
|
||||
LOCK_PATH.write_text(text, encoding="utf-8", newline="\n")
|
||||
print("wrote %s" % LOCK_PATH)
|
||||
else:
|
||||
sys.stdout.write(text)
|
||||
return 0
|
||||
if args.cmd == "check":
|
||||
problems = check()
|
||||
print("\n".join("FAIL " + p for p in problems) if problems else "OK the committed published set is the index's last release")
|
||||
return 1 if problems else 0
|
||||
if args.cmd == "install":
|
||||
python = install(args.house, args.venv, args.lock)
|
||||
problems = verify(str(python), args.lock)
|
||||
if problems:
|
||||
print("\n".join("FAIL " + p for p in problems))
|
||||
return 1
|
||||
print(python)
|
||||
return 0
|
||||
if args.cmd == "verify":
|
||||
problems = verify(args.python, args.lock)
|
||||
print("\n".join("FAIL " + p for p in problems) if problems else "OK")
|
||||
return 1 if problems else 0
|
||||
if args.cmd == "fetch":
|
||||
print(json.dumps(fetch(args.work)))
|
||||
return 0
|
||||
if args.cmd == "tag":
|
||||
from invisible_core.seal import active_seal
|
||||
|
||||
print(active_seal().tag)
|
||||
return 0
|
||||
except (ValueError, OSError, RuntimeError, subprocess.CalledProcessError) as e:
|
||||
print("ERROR %s: %s" % (type(e).__name__, e))
|
||||
return 2
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -18,8 +18,8 @@ Two modes, chosen by the environment as the gate chooses it:
|
||||
candidate set, or on all of them when the pull request changes a file of this oracle (AB_HOST_PR_SEEDS, exported by the step of e2e.yml that runs scripts/ci_ab_pr_seeds.py).
|
||||
This is the stability measurement: what the two traces do not agree on is a difference in diff-a-a.json, and red here says "what is compared is not stable". Nothing is
|
||||
excused: there is no list of noise.
|
||||
* a candidate (the gate's ab_oracle leg: INVPW_BINARY_PATH the candidate's binary, INVISIBLE_SEAL_FILE its seal): the A/A on the published firefox-68 (its seal and archive
|
||||
fetched the way the core fetches an engine) on every seed of the set, then the published engine against the candidate, with the declared differences of ci/ab-host-expected.json.
|
||||
* a candidate (the gate's ab_oracle leg: INVPW_BINARY_PATH the candidate's binary, INVISIBLE_SEAL_FILE its seal): the A/A on the engine of the PUBLISHED SET (INVPW_PUBLISHED_PYTHON: its own core and wrapper in a venv, its engine fetched the way its core
|
||||
fetches one) on every seed of the set, then the published engine against the candidate, with the declared differences of ci/ab-host-expected.json.
|
||||
|
||||
The launches run with a cache folder and a temp root of their own, so they leave nothing for the fontconfig test's cold launch and what the engine makes there is `ours`.
|
||||
|
||||
@@ -56,7 +56,8 @@ PR_SEEDS = 2
|
||||
def expected_footprints(candidate: bool, platform: str) -> list:
|
||||
"""The footprints a green run writes, sorted: the two runs of the published engine, the candidate's in the A/B, and on Windows the stock control's, which runs after a green
|
||||
A/A on every Windows run, a pull request included (run 45165805370: the control passed and the list without it was red)."""
|
||||
names = ["footprint-68-again.json", "footprint-68.json"] + (["footprint-candidate.json"] if candidate else [])
|
||||
number = host.oracle.default_tag().rsplit("-", 1)[-1] # the engine of the published set (a pull request: the engine of the core in use)
|
||||
names = ["footprint-%s-again.json" % number, "footprint-%s.json" % number] + (["footprint-candidate.json"] if candidate else [])
|
||||
return sorted(names + (["footprint-stock.json"] if platform == "win32" else []))
|
||||
|
||||
|
||||
|
||||
@@ -1778,7 +1778,7 @@ def test_each_engine_run_of_the_network_oracle_has_a_cache_folder_of_its_own_tha
|
||||
def _ab_args(tmp_path, *extra):
|
||||
empty = tmp_path / "volatile.json"
|
||||
empty.write_text(json.dumps({"format": ab.VOLATILE_FORMAT, "entries": []}), encoding="utf-8")
|
||||
return ["ab", "--out", str(tmp_path / "out"), "--published-binary", "published-ff", "--published-seal", "pub.seal.json", "--volatile", str(empty), "--seeds", "11,12", *extra]
|
||||
return ["ab", "--out", str(tmp_path / "out"), "--engine-tag", "firefox-68", "--published-binary", "published-ff", "--published-seal", "pub.seal.json", "--volatile", str(empty), "--seeds", "11,12", *extra]
|
||||
|
||||
|
||||
def test_the_a_a_first_then_the_candidate_and_a_broken_control_stops_the_a_b(tmp_path, monkeypatch, capsys):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The network A/B oracle on a runner: the same journey on the local lab with the published firefox-68 engine twice (the A/A, the control), and, with a candidate, against the candidate.
|
||||
"""The network A/B oracle on a runner: the same journey on the local lab with the engine of the published set twice (the A/A, the control), and, with a candidate, against the candidate.
|
||||
|
||||
scripts/ci_ab_network.py walks the P4 journey (17 steps), one HTTPS site (HTTP/1.1 and HTTP/2), one HTTP/3 site, one WebRTC page and two idle launches through a SOCKS5 gateway in coherent mode, with the fake DoH,
|
||||
a witness and the watcher of direct connections, and writes what the lab saw as a transcript: the hosts contacted in order, the DNS questions, the TLS ClientHello, the HTTP/2 frames, every request head in
|
||||
|
||||
@@ -464,7 +464,7 @@ def test_ab_with_the_hunt_variable_runs_only_the_walk_n_times_for_each_engine_of
|
||||
monkeypatch.setattr(ab, "run_engine", never)
|
||||
monkeypatch.setattr(ab, "compare_files", never)
|
||||
monkeypatch.setenv(ab.HUNT_ENV, "webrtc:4:3")
|
||||
assert ab.main(["ab", "--a-a", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox"]) == 0
|
||||
assert ab.main(["ab", "--a-a", "--engine-tag", "firefox-68", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox"]) == 0
|
||||
binary = str(Path("/e/firefox"))
|
||||
assert calls == [(binary, None, "firefox-68", 4, 3), (binary, None, "firefox-68-again", 4, 3)]
|
||||
hunt = tmp_path / "network" / "hunt"
|
||||
@@ -480,14 +480,14 @@ def test_ab_with_the_hunt_variable_runs_only_the_walk_n_times_for_each_engine_of
|
||||
def test_a_hunt_decides_nothing_even_when_an_engine_run_fails(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(ab, "hunt_engine", lambda *a, **k: 1)
|
||||
monkeypatch.setenv(ab.HUNT_ENV, "webrtc:4:2")
|
||||
assert ab.main(["ab", "--a-a", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox"]) == 0
|
||||
assert ab.main(["ab", "--a-a", "--engine-tag", "firefox-68", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox"]) == 0
|
||||
assert json.loads((tmp_path / "network" / "hunt" / "summary.json").read_text(encoding="utf-8"))["repetitions"] == []
|
||||
|
||||
|
||||
def test_a_hunt_variable_that_does_not_read_is_refused_and_runs_nothing(tmp_path, monkeypatch, capsys):
|
||||
monkeypatch.setattr(ab, "hunt_engine", lambda *a, **k: pytest.fail("a spec that does not read runs nothing"))
|
||||
monkeypatch.setenv(ab.HUNT_ENV, "webrtc:4")
|
||||
assert ab.main(["ab", "--a-a", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox"]) == 2
|
||||
assert ab.main(["ab", "--a-a", "--engine-tag", "firefox-68", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox"]) == 2
|
||||
assert "FAIL AB_NETWORK_HUNT" in capsys.readouterr().out
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ def test_without_the_hunt_variable_ab_is_the_a_a_it_was(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(ab, "hunt_engine", lambda *a, **k: pytest.fail("no hunt without the variable"))
|
||||
ran = []
|
||||
monkeypatch.setattr(ab, "run_engine", lambda binary, seal, label, seeds, out: ran.append(label) or 1)
|
||||
assert ab.main(["ab", "--a-a", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox", "--seeds", "4"]) == 2
|
||||
assert ab.main(["ab", "--a-a", "--engine-tag", "firefox-68", "--out", str(tmp_path / "network"), "--published-binary", "/e/firefox", "--seeds", "4"]) == 2
|
||||
assert ran == ["firefox-68", "firefox-68-again"], "the A/A runs the engine twice and says so when neither made a transcript: its own red, as before"
|
||||
|
||||
|
||||
|
||||
+10
-8
@@ -194,9 +194,9 @@ def test_the_floor_is_what_the_host_gate_s_own_reference_holds_today():
|
||||
assert ab.MIN_LEAVES[dpr] == len(ref), "the reference holds %d leaves at dpr %s: move MIN_LEAVES with it" % (len(ref), dpr)
|
||||
|
||||
|
||||
def test_the_published_engine_is_firefox_68_and_its_dump_is_named_for_it():
|
||||
assert ab.ENGINE_TAG == "firefox-68" and ab.dump_name("firefox-68") == "dump-68.json"
|
||||
assert ab.dump_name("firefox-69") == "dump-69.json"
|
||||
def test_the_published_engine_is_named_by_the_set_never_by_the_harness_and_its_dump_is_named_for_it():
|
||||
assert not hasattr(ab, "ENGINE_TAG"), "a tag written in the harness is a baseline that goes stale at the next release (firefox-68 was held as the control when firefox-70 was published)"
|
||||
assert ab.dump_name("firefox-68") == "dump-68.json" and ab.dump_name("firefox-70") == "dump-70.json"
|
||||
|
||||
|
||||
# --- the files --------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -238,7 +238,7 @@ def test_compare_from_the_files_writes_the_diff_and_exits_by_the_verdict(tmp_pat
|
||||
|
||||
|
||||
def _compare(directory, capsys):
|
||||
rc = ab.main(["compare", str(directory)])
|
||||
rc = ab.main(["compare", "--engine-tag", "firefox-68", str(directory)])
|
||||
capsys.readouterr()
|
||||
return rc, (directory / "diff.json").read_text(encoding="utf-8")
|
||||
|
||||
@@ -522,9 +522,9 @@ def test_the_a_a_compares_again_from_the_files(tmp_path, monkeypatch, capsys):
|
||||
full = {key: items(key[1]) for key in asked}
|
||||
ab.write_json(tmp_path / "dump-68.json", ab.pack("firefox-68", full))
|
||||
ab.write_json(tmp_path / ab.again_name("firefox-68"), ab.pack("firefox-68-again", full))
|
||||
assert ab.main(["compare", str(tmp_path), "--a-a", "--limit", "2"]) == 0
|
||||
assert ab.main(["compare", "--engine-tag", "firefox-68", str(tmp_path), "--a-a", "--limit", "2"]) == 0
|
||||
ab.write_json(tmp_path / ab.again_name("firefox-68"), ab.pack("firefox-68-again", _changed(full)))
|
||||
assert ab.main(["compare", str(tmp_path), "--a-a", "--limit", "2"]) == 2
|
||||
assert ab.main(["compare", "--engine-tag", "firefox-68", str(tmp_path), "--a-a", "--limit", "2"]) == 2
|
||||
|
||||
|
||||
def test_the_limit_takes_the_first_seeds_and_the_command_line_needs_a_candidate_or_a_published_engine(tmp_path):
|
||||
@@ -706,7 +706,9 @@ def test_the_host_e2e_expects_the_stock_footprint_on_windows_in_both_modes_and_n
|
||||
control that had passed. The four cases, so that the gate (the candidate mode) does not find a fifth."""
|
||||
import test_ab_host_e2e as host_e2e
|
||||
|
||||
a_a, a_b = ["footprint-68-again.json", "footprint-68.json"], ["footprint-68-again.json", "footprint-68.json", "footprint-candidate.json"]
|
||||
number = ab.default_tag().rsplit("-", 1)[-1] # the tag of the published set: the files are named for it, whichever release it is
|
||||
a_a = ["footprint-%s-again.json" % number, "footprint-%s.json" % number]
|
||||
a_b = a_a + ["footprint-candidate.json"]
|
||||
assert host_e2e.expected_footprints(False, "linux") == a_a
|
||||
assert host_e2e.expected_footprints(True, "linux") == a_b
|
||||
assert host_e2e.expected_footprints(False, "win32") == sorted(a_a + ["footprint-stock.json"])
|
||||
@@ -898,7 +900,7 @@ def test_a_candidate_set_visit_list_with_seed_0_expects_the_second_launch_of_it_
|
||||
assert ab.judge(full, lacking, [], expected=tuple(asked))["verdict"] == "red"
|
||||
ab.write_json(tmp_path / "dump-68.json", ab.pack("firefox-68", full))
|
||||
ab.write_json(tmp_path / "dump-candidate.json", ab.pack("candidate", lacking))
|
||||
assert ab.main(["compare", str(tmp_path), "--limit", "2"]) == 1
|
||||
assert ab.main(["compare", "--engine-tag", "firefox-68", str(tmp_path), "--limit", "2"]) == 1
|
||||
assert "second launch of dpr" in capsys.readouterr().out
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Same seed, same bytes: the published firefox-68 engine against itself (the control) and, with a candidate, against the candidate, on this machine.
|
||||
"""Same seed, same bytes: the published engine (the one of the published set) against itself (the control) and, with a candidate, against the candidate, on this machine.
|
||||
|
||||
scripts/ci_ab_oracle.py runs the host gate's dump (the page of scripts/host_gate, every API a page reads) over the persona seeds of ci/persona-seeds.json, each at its own
|
||||
DPR. Like the network and host oracles, it has two modes, told by whether there is a candidate:
|
||||
@@ -11,8 +11,8 @@ DPR. Like the network and host oracles, it has two modes, told by whether there
|
||||
(fetched the way the core fetches an engine: the release's seal.json and the archive checked against it) against the candidate. If the A/A is broken the A/B is not run. AB_ORACLE_SEED_SET=final and
|
||||
AB_ORACLE_SHARD=i/n run the 20 seeds that reach every value of every dimension, split over n jobs.
|
||||
|
||||
The only differences either comparison lets through are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys. The verdict is the pytest result; the files (dump-68.json,
|
||||
dump-68-again.json, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) and the log are the evidence.
|
||||
The only differences either comparison lets through are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys. The verdict is the pytest result; the files (dump-<N>.json for the tag of the published set,
|
||||
dump-<N>-again.json, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) and the log are the evidence.
|
||||
|
||||
Two more things the comparison cannot say are held here (`_check_ab_visit_and_poison`). The oracle's dumps carry the ab. leaves (scripts/ci_host_gate.py): the poison probe of the page on every
|
||||
seed and, on seeds 0 and 63, the extra visit of every realm and window a page can make; seed 63 must differ from seed 0 on at least AB_CONTROL_MIN of them (the count is in ab-control.json and the log).
|
||||
@@ -91,7 +91,7 @@ def _check_ab_visit_and_poison(out: Path, candidate: bool) -> None:
|
||||
any A/B), and seed 63 reads other values than seed 0 (the control of the ab leaves; the measured count goes to ab-control.json and the log).
|
||||
On a poisoned host (the gate's leg: AB_ORACLE_POISON=1) the poison is in force, the negative control of stock Firefox read it, and neither
|
||||
engine read any of it: its dumps hold the identity the core declares."""
|
||||
published = out / "dump-68.json"
|
||||
published = out / ab.dump_name(ab.default_tag())
|
||||
dumps = [("the published engine", published)] + ([("the candidate", out / "dump-candidate.json")] if candidate else [])
|
||||
problems = []
|
||||
for name, path in dumps:
|
||||
@@ -171,11 +171,12 @@ def test_the_published_engine_repeats_itself_and_the_candidate_gives_the_same_by
|
||||
assert sorted(control["relaunch"]) == sorted(ab.visit_name(*key) for key in ab.relaunch_visits(visits)), "seed 0 is launched twice on one profile, whichever shard has it"
|
||||
_check_what_every_launch_left(out, candidate)
|
||||
_check_ab_visit_and_poison(out, candidate)
|
||||
tag = ab.default_tag()
|
||||
names = sorted(p.name for p in out.glob("*.json") if not p.name.startswith("poison-"))
|
||||
if candidate:
|
||||
diff = json.loads((out / "diff.json").read_text(encoding="utf-8"))
|
||||
assert diff["verdict"] == "green" and diff["differences"] == [] and diff["problems"] == []
|
||||
assert len(diff["visits"]) >= 1 and len(diff["compared"]) == len(diff["visits"]), "every visit asked for is compared: %s" % diff["visits"]
|
||||
assert names == ["ab-control.json", "diff-a-a.json", "diff.json", "dump-68-again.json", "dump-68.json", "dump-candidate.json"]
|
||||
assert names == sorted(["ab-control.json", "diff-a-a.json", "diff.json", ab.again_name(tag), ab.dump_name(tag), "dump-candidate.json"])
|
||||
else:
|
||||
assert names == ["ab-control.json", "diff-a-a.json", "dump-68-again.json", "dump-68.json"]
|
||||
assert names == sorted(["ab-control.json", "diff-a-a.json", ab.again_name(tag), ab.dump_name(tag)])
|
||||
@@ -516,26 +516,27 @@ def test_the_summary_groups_by_family_and_is_a_finding_not_a_failure():
|
||||
def test_without_a_clean_dump_the_summary_says_it_and_no_file_is_written(tmp_path):
|
||||
(tmp_path / "dump-68.json").write_text(json.dumps(packed((1.0, 0, {"a": 1}))), encoding="utf-8")
|
||||
summary = tmp_path / "summary.md"
|
||||
assert poison.write_dependence(tmp_path, summary) is None
|
||||
assert poison.write_dependence(tmp_path, summary, "firefox-68") is None
|
||||
assert "No dump of the published engine on the clean runner" in summary.read_text(encoding="utf-8")
|
||||
assert not (tmp_path / poison.DEPENDENCE_FILE).exists()
|
||||
assert not (tmp_path / poison.dependence_file("firefox-68")).exists()
|
||||
|
||||
|
||||
def test_the_dependence_is_written_to_its_own_file_and_to_the_summary(tmp_path):
|
||||
(tmp_path / poison.CLEAN_FILE).write_text(json.dumps(packed((1.0, 0, {"a": 1}))), encoding="utf-8")
|
||||
(tmp_path / poison.clean_file("firefox-68")).write_text(json.dumps(packed((1.0, 0, {"a": 1}))), encoding="utf-8")
|
||||
(tmp_path / "dump-68.json").write_text(json.dumps(packed((1.0, 0, {"a": 2}))), encoding="utf-8")
|
||||
summary = tmp_path / "summary.md"
|
||||
report = poison.write_dependence(tmp_path, summary)
|
||||
assert json.loads((tmp_path / poison.DEPENDENCE_FILE).read_text(encoding="utf-8")) == report
|
||||
report = poison.write_dependence(tmp_path, summary, "firefox-68")
|
||||
assert json.loads((tmp_path / poison.dependence_file("firefox-68")).read_text(encoding="utf-8")) == report
|
||||
assert report["differences"] == [{"seed": 0, "dpr": 1.0, "leaf": "a", "clean": 1, "poisoned": 2}]
|
||||
assert "1 of 1 leaves differ" in summary.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_the_files_of_the_by_product_are_poison_files_which_the_oracle_s_listing_ignores():
|
||||
assert poison.CLEAN_FILE.startswith("poison-") and poison.DEPENDENCE_FILE.startswith("poison-")
|
||||
assert poison.clean_file("firefox-70").startswith("poison-") and poison.dependence_file("firefox-70").startswith("poison-")
|
||||
import ci_ab_oracle as oracle
|
||||
|
||||
assert oracle.clean_name("firefox-68") == poison.CLEAN_FILE
|
||||
for tag in ("firefox-68", "firefox-70"):
|
||||
assert oracle.clean_name(tag) == poison.clean_file(tag), "the clean dump of the oracle and the file the dependence reads are named by one tag"
|
||||
|
||||
|
||||
def test_the_clean_dump_is_the_published_engine_dumped_on_this_machine_and_judges_nothing(tmp_path, monkeypatch):
|
||||
|
||||
@@ -0,0 +1,514 @@
|
||||
"""The control side of every A/B oracle is the PUBLISHED SET, as a user installs it (scripts/ci_published_set.py, ci/py-lock/published.txt).
|
||||
|
||||
Engine candidate 5 (run 46208549074) had every A/B red on a BROKEN CONTROL: the published engine (labelled firefox-68 in the logs, a tag written in the harness, when
|
||||
firefox-70 was the last published) was launched by the CANDIDATE'S core, which no longer declares `zoom.stealth.screen.popup_position`, and an engine refuses a launch
|
||||
whose declarations its core does not emit (rule 7). The pairing the oracle held the candidate to was one no user ever has. A control is the set a user gets:
|
||||
|
||||
* the last `invisible-playwright` on the index, the `invisible-core` it pins exactly, and the engine that core's seal pins, in a venv of their own;
|
||||
* nothing is chosen by hand: no tag, no version, no commit is written in a harness file or a workflow;
|
||||
* installed by hash (ci-03), from the wheelhouse of the run, offline; the lock is one file that .github/workflows/published-set.yml keeps equal to the index;
|
||||
* the candidate's side is what it was: core_ref, wrapper_ref and the candidate engine.
|
||||
|
||||
Without a browser: the first test below is the defect itself on a fake engine that refuses as rule 7 does, with two fake cores (the candidate's lacks a declaration the
|
||||
published engine requires) and the harness's real command line; it is red on the harness that launched the control with the candidate's core. The others hold the lock
|
||||
(known-bad inputs first), the resolver on synthetic index documents, the install commands, and that no tag is written in a harness file.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "scripts"))
|
||||
sys.path.insert(0, str(ROOT / "tests"))
|
||||
import ci_ab_host as host # noqa: E402
|
||||
import ci_ab_network as net # noqa: E402
|
||||
import ci_ab_oracle as ab # noqa: E402
|
||||
import ci_crash_evidence as crash # noqa: E402
|
||||
import ci_host_gate as gate # noqa: E402
|
||||
import ci_published_set as ps # noqa: E402
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
#: The variable that names the python of the published set's venv. Spelled here, so that the defect test below runs on a harness that has no notion of it.
|
||||
PUBLISHED_PYTHON_ENV = "INVPW_PUBLISHED_PYTHON"
|
||||
REQUIRED = "zoom.stealth.screen.popup_position"
|
||||
RULE_7 = "stealth: %s is not declared" % REQUIRED
|
||||
|
||||
|
||||
# -
|
||||
# The defect: the control launched by the candidate's core
|
||||
|
||||
#: What `ci_host_gate.py dump` is for this test: the engine at argv[2] says what it requires its core to declare (`requires.txt` beside it) and refuses, as the engine's
|
||||
#: declaration gate does, when the core it is launched by (the `invisible_core` this python imports) does not declare it; else it writes the visit the page would.
|
||||
FAKE_DUMP = '''\
|
||||
import json, os, sys
|
||||
from pathlib import Path
|
||||
import invisible_core
|
||||
|
||||
binary = Path(sys.argv[2])
|
||||
out = Path(sys.argv[sys.argv.index("--out") + 1])
|
||||
required = binary.with_name("requires.txt").read_text(encoding="utf-8").split()
|
||||
missing = [name for name in required if name not in invisible_core.DECLARED]
|
||||
if missing:
|
||||
print("stealth: %s is not declared by the core %s (rule 7)" % (missing[0], invisible_core.NAME), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
visits = [a.split(":") for i, a in enumerate(sys.argv) if i and sys.argv[i - 1] == "--visit"]
|
||||
for seed, dpr in visits:
|
||||
items = json.loads(ITEMS)
|
||||
(out / ("leg_dpr%s_seed%s.json" % (dpr, seed))).write_text(json.dumps({"leg": "leg", "dpr": float(dpr), "seed": int(seed), "result": {"format": FORMAT, "items": items}}), encoding="utf-8")
|
||||
where = os.environ.get(CRASH_DIR_ENV)
|
||||
if where:
|
||||
Path(where).mkdir(parents=True, exist_ok=True)
|
||||
(Path(where) / "exits.json").write_text(json.dumps({"format": CRASH_FORMAT, "launches": [{"n": 1, "label": {"seed": 0, "dpr": 1.0, "launch": "visit"}, "pid": 1, "returncode": 0}]}), encoding="utf-8")
|
||||
'''
|
||||
|
||||
FAKE_CORE = '''\
|
||||
NAME = %(name)r
|
||||
DECLARED = %(declared)r
|
||||
'''
|
||||
FAKE_SEAL = '''\
|
||||
class _Seal:
|
||||
tag = %(tag)r
|
||||
is_local = False
|
||||
|
||||
def describe(self):
|
||||
return "the seal of the fake core %(name)s: " + self.tag
|
||||
|
||||
|
||||
def active_seal():
|
||||
return _Seal()
|
||||
'''
|
||||
FAKE_DOWNLOAD = '''\
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
ENGINE_DIR_ENV = "INVISIBLE_PLAYWRIGHT_ENGINE_DIR"
|
||||
|
||||
|
||||
def ensure_binary(*args, **kwargs):
|
||||
folder = Path(os.environ[ENGINE_DIR_ENV]) / %(tag)r
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
(folder / "firefox").write_text("the published engine", encoding="utf-8")
|
||||
(folder / "requires.txt").write_text(%(requires)r, encoding="utf-8")
|
||||
return folder / "firefox"
|
||||
'''
|
||||
|
||||
|
||||
def write_core(site: Path, name: str, declared: list, tag: str = "firefox-70", requires: str = "") -> None:
|
||||
package = site / "invisible_core"
|
||||
package.mkdir(parents=True, exist_ok=True)
|
||||
(package / "__init__.py").write_text(FAKE_CORE % {"name": name, "declared": declared}, encoding="utf-8")
|
||||
(package / "seal.py").write_text(FAKE_SEAL % {"name": name, "tag": tag}, encoding="utf-8")
|
||||
(package / "download.py").write_text(FAKE_DOWNLOAD % {"tag": tag, "requires": requires}, encoding="utf-8")
|
||||
|
||||
|
||||
def make_venv(folder: Path, core_name: str, declared: list, requires: str) -> Path:
|
||||
"""A real venv (no pip: it installs nothing) whose site-packages holds a fake `invisible_core` that declares `declared`: the published set's venv."""
|
||||
subprocess.run([sys.executable, "-m", "venv", "--without-pip", str(folder)], check=True, capture_output=True)
|
||||
python = ps.venv_python(folder)
|
||||
purelib = subprocess.run([str(python), "-c", "import sysconfig; print(sysconfig.get_paths()['purelib'])"], check=True, capture_output=True, text=True).stdout.strip()
|
||||
write_core(Path(purelib), core_name, declared, requires=requires)
|
||||
return python
|
||||
|
||||
|
||||
class _GateWithAFakeDump:
|
||||
"""The host gate module, but `ci_host_gate.py dump` is the fake dump script: the command line the harness builds is the real one."""
|
||||
|
||||
def __init__(self, script: Path):
|
||||
self.__file__ = str(script)
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(gate, name)
|
||||
|
||||
|
||||
def _items(seed: int) -> dict:
|
||||
return {"surface": {"navigator": {"hardwareConcurrency": 8 + seed % 3, "language": "en-US"}, "screen": {"width": 1920, "height": 1080}},
|
||||
"text": {"fonts": ["Arial", "Segoe UI"]}, "blend": {"data": "AAEC", "enc": "png", "w": 1, "h": 1}}
|
||||
|
||||
|
||||
def test_the_control_is_launched_by_the_core_it_was_built_for_never_by_the_candidates(tmp_path, monkeypatch, capfd):
|
||||
"""Candidate core: declares only `a`. Candidate engine: needs only `a`. Published core (in the set's venv): declares `a` and the popup position the published engine
|
||||
needs. The job's python imports the candidate core (as the gate's python does); the published engine run by it is refused as rule 7. A harness that launches the control
|
||||
with the job's python (and the job's PYTHONPATH, seal and pin switches) is red here with that refusal; one that launches it in the set's venv is green."""
|
||||
candidate_site = tmp_path / "candidate-site"
|
||||
write_core(candidate_site, "candidate-core", ["a"])
|
||||
published_python = make_venv(tmp_path / "set-venv", "published-core", ["a", REQUIRED], requires="a %s" % REQUIRED)
|
||||
script = tmp_path / "fake_dump.py"
|
||||
script.write_text("ITEMS = %r\nFORMAT = %r\nCRASH_DIR_ENV = %r\nCRASH_FORMAT = %r\n" % (json.dumps(_items(11)), gate.FORMAT, crash.CRASH_DIR_ENV, crash.FORMAT) + FAKE_DUMP, encoding="utf-8")
|
||||
candidate = tmp_path / "candidate-engine" / "firefox"
|
||||
candidate.parent.mkdir()
|
||||
candidate.write_text("the candidate", encoding="utf-8")
|
||||
(candidate.parent / "requires.txt").write_text("a", encoding="utf-8")
|
||||
|
||||
monkeypatch.setattr(ab, "gate", _GateWithAFakeDump(script))
|
||||
monkeypatch.setattr(ab, "MIN_LEAVES", {1.0: 6})
|
||||
monkeypatch.setenv("PYTHONPATH", str(candidate_site)) # the job's python imports the candidate's core, as the gate's does
|
||||
monkeypatch.setenv(PUBLISHED_PYTHON_ENV, str(published_python))
|
||||
monkeypatch.setenv("INVISIBLE_CORE_PIN", "allow")
|
||||
|
||||
# What the OLD harness fetched the control with, in this process: the candidate's core downloads the published engine under the published seal. The new harness asks the set.
|
||||
in_process = []
|
||||
import invisible_core.download as download
|
||||
import invisible_core.seal as seal_module
|
||||
|
||||
def old_fetch(*args, **kwargs):
|
||||
in_process.append("download")
|
||||
return [str(tmp_path / "seal-source")]
|
||||
|
||||
def old_download_file(url, dst, *a, **k):
|
||||
in_process.append("download")
|
||||
Path(dst).write_text("{}", encoding="utf-8")
|
||||
|
||||
def old_ensure(*a, **k):
|
||||
in_process.append("download")
|
||||
folder = Path(os.environ[download.ENGINE_DIR_ENV]) / "firefox-70"
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
(folder / "firefox").write_text("the published engine", encoding="utf-8")
|
||||
(folder / "requires.txt").write_text("a %s" % REQUIRED, encoding="utf-8")
|
||||
return folder / "firefox"
|
||||
|
||||
monkeypatch.setattr(download, "release_asset_urls", old_fetch)
|
||||
monkeypatch.setattr(download, "_download_file", old_download_file)
|
||||
monkeypatch.setattr(download, "ensure_binary", old_ensure)
|
||||
monkeypatch.setattr(seal_module, "load_seal", lambda path: types.SimpleNamespace(tag="firefox-70", is_local=False, describe=lambda: "the published seal"))
|
||||
|
||||
out = tmp_path / "out"
|
||||
rc = ab.run(str(candidate), tmp_path / "candidate.seal.json", "linux-x86_64", out, "firefox-70", visits=[(1.0, 11)])
|
||||
seen = capfd.readouterr()
|
||||
said = seen.out + seen.err
|
||||
assert RULE_7 not in said, ("the published engine was launched by the candidate's core and refused it (BROKEN CONTROL, engine candidate 5): the control is the published set, "
|
||||
"launched in its own venv:\n" + said[-1500:])
|
||||
assert rc == 0 and json.loads((out / "diff.json").read_text(encoding="utf-8"))["verdict"] == "green", said[-1500:]
|
||||
assert not in_process, "the control's engine is fetched by the published set's own core, never in this process by the candidate's: %s" % in_process
|
||||
assert (out / "dump-70.json").is_file() and (out / "dump-candidate.json").is_file()
|
||||
|
||||
|
||||
# -
|
||||
# The seams of the three oracles: the control side runs in the set's python, with nothing of the candidate's job
|
||||
|
||||
JOB_ENV = {"PYTHONPATH": "/candidate/site", "VIRTUAL_ENV": "/candidate/venv", "INVISIBLE_SEAL_FILE": "/candidate/gate.seal.json", "INVISIBLE_CORE_PIN": "allow",
|
||||
"INVISIBLE_CORE_AUTOFIX": "off", "PYTHONHOME": "/candidate/home", "MOZ_LOG": "sync", "STEALTHFOX_GEOIP_MMDB": "/lab/geoip.mmdb"}
|
||||
|
||||
|
||||
class _Done:
|
||||
returncode = 0
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job(monkeypatch):
|
||||
for name in ps.SET_LEAKS:
|
||||
monkeypatch.delenv(name, raising=False)
|
||||
for name, value in JOB_ENV.items():
|
||||
monkeypatch.setenv(name, value)
|
||||
|
||||
|
||||
def _recorded(monkeypatch, module):
|
||||
calls = []
|
||||
monkeypatch.setattr(module.subprocess, "run", lambda cmd, env=None, timeout=None, **k: calls.append((cmd, env)) or _Done())
|
||||
return calls
|
||||
|
||||
|
||||
def _own_cache(monkeypatch):
|
||||
monkeypatch.setattr(ab, "own_cache_env", lambda env, folder, platform=None: dict(env))
|
||||
|
||||
|
||||
def _check_set_side(cmd, env, python, seal):
|
||||
assert cmd[0] == python, "the control runs in the venv of the published set, not in the python of the job"
|
||||
for name in ("PYTHONPATH", "PYTHONHOME", "VIRTUAL_ENV", "MOZ_LOG"):
|
||||
assert name not in env, "%s of the candidate's job reaches the published set's process and can make it import another core" % name
|
||||
assert env["INVISIBLE_CORE_AUTOFIX"] == "off" and "INVISIBLE_CORE_PIN" not in env, "the pin of the set's wrapper on its core stays checked, as on a user's machine"
|
||||
assert env.get("INVISIBLE_SEAL_FILE") == seal and env["STEALTHFOX_GEOIP_MMDB"] == "/lab/geoip.mmdb", "the lab's files still reach it"
|
||||
|
||||
|
||||
def test_the_page_oracle_runs_the_control_dump_in_the_set_s_python(tmp_path, monkeypatch, job):
|
||||
calls = _recorded(monkeypatch, ab)
|
||||
_own_cache(monkeypatch)
|
||||
assert ab.run_dump("pub", None, "linux-x86_64", tmp_path / "o", [(1.0, 11)], python="/set/bin/python") == 0
|
||||
_check_set_side(*calls[0], "/set/bin/python", None)
|
||||
assert calls[0][0][1] == str(Path(gate.__file__))
|
||||
assert ab.run_dump("cand", tmp_path / "s.json", "linux-x86_64", tmp_path / "o", [(1.0, 11)]) == 0
|
||||
cmd, env = calls[1]
|
||||
assert cmd[0] == sys.executable and env["INVISIBLE_SEAL_FILE"] == str(tmp_path / "s.json") and env["PYTHONPATH"] == "/candidate/site", "the candidate's side is as it was"
|
||||
assert env["INVISIBLE_CORE_PIN"] == "allow" and env["INVISIBLE_CORE_AUTOFIX"] == "off"
|
||||
|
||||
|
||||
def test_the_host_oracle_runs_the_control_in_the_set_s_python(tmp_path, monkeypatch, job):
|
||||
calls = _recorded(monkeypatch, host)
|
||||
_own_cache(monkeypatch)
|
||||
monkeypatch.setattr(host.oracle, "own_cache_env", lambda env, folder, platform=None: dict(env))
|
||||
assert host.run_subprocess("pub", None, "linux-x86_64", tmp_path / "f.json", "firefox-70", [11], python="/set/bin/python") == 0
|
||||
_check_set_side(*calls[0], "/set/bin/python", None)
|
||||
assert host.run_subprocess("cand", tmp_path / "s.json", "linux-x86_64", tmp_path / "f.json", "candidate", [11]) == 0
|
||||
assert calls[1][0][0] == sys.executable and calls[1][1]["PYTHONPATH"] == "/candidate/site"
|
||||
|
||||
|
||||
def test_the_network_oracle_runs_the_control_in_the_set_s_python(tmp_path, monkeypatch, job):
|
||||
calls = _recorded(monkeypatch, net)
|
||||
monkeypatch.setattr(ab, "own_cache_env", lambda env, folder, platform=None: dict(env))
|
||||
assert net.run_engine("pub", None, "firefox-70", (11,), tmp_path / "t.json", python="/set/bin/python") == 0
|
||||
_check_set_side(*calls[0], "/set/bin/python", None)
|
||||
assert net.run_engine("cand", str(tmp_path / "s.json"), "candidate", (11,), tmp_path / "t.json") == 0
|
||||
assert calls[1][0][0] == sys.executable and calls[1][1]["INVISIBLE_CORE_PIN"] == "allow"
|
||||
|
||||
|
||||
def test_the_published_engine_of_each_oracle_comes_from_the_set_and_its_python_goes_with_it(tmp_path, monkeypatch):
|
||||
package = tmp_path / "engines" / "firefox-70"
|
||||
package.mkdir(parents=True)
|
||||
(package / "firefox").write_bytes(b"the published engine")
|
||||
monkeypatch.setattr(ab, "fetch_published", lambda tag, work: (str(package / "firefox"), None, "/set/bin/python"))
|
||||
monkeypatch.setattr(host, "stage_dir", lambda base=None: tmp_path / "stage" / "firefox")
|
||||
seen = {}
|
||||
monkeypatch.setattr(host, "run_subprocess", lambda exe, seal, leg, out, label, seeds, crash_with=None, python=None: seen.setdefault(label, python) and 1)
|
||||
host.ab(None, None, "linux-x86_64", tmp_path / "h", "firefox-70", [11])
|
||||
assert seen == {"firefox-70": "/set/bin/python", "firefox-70 again": "/set/bin/python"}, "both runs of the A/A"
|
||||
args = types.SimpleNamespace(published_binary=None, published_seal=None, engine_tag="firefox-70")
|
||||
assert net.published_engine(args, tmp_path) == (str(package / "firefox"), None, "/set/bin/python")
|
||||
given = types.SimpleNamespace(published_binary="/given/firefox", published_seal=None, engine_tag="firefox-70")
|
||||
assert net.published_engine(given, tmp_path) == ("/given/firefox", None, None), "a binary the caller gives (a pull request's A/A) runs as this process does"
|
||||
|
||||
|
||||
def test_the_variable_is_the_one_the_harness_reads():
|
||||
assert ab.PUBLISHED_PYTHON_ENV == PUBLISHED_PYTHON_ENV
|
||||
|
||||
|
||||
def test_a_candidate_with_no_published_set_is_refused_never_held_to_its_own_core(tmp_path, monkeypatch):
|
||||
monkeypatch.delenv(ab.PUBLISHED_PYTHON_ENV, raising=False)
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
ab.fetch_published("firefox-70", tmp_path)
|
||||
assert ab.PUBLISHED_PYTHON_ENV in str(e.value) and "ci_published_set.py install" in str(e.value) and "never the core and the wrapper of the candidate" in str(e.value)
|
||||
monkeypatch.setenv(ab.PUBLISHED_PYTHON_ENV, str(tmp_path / "no-python"))
|
||||
with pytest.raises(RuntimeError):
|
||||
ab.fetch_published(None, tmp_path)
|
||||
|
||||
|
||||
def test_a_label_that_is_not_the_engine_of_the_set_is_refused(tmp_path, monkeypatch):
|
||||
python = make_venv(tmp_path / "set-venv", "published-core", ["a"], requires="a")
|
||||
monkeypatch.setenv(ab.PUBLISHED_PYTHON_ENV, str(python))
|
||||
binary, seal, set_python = ab.fetch_published("firefox-70", tmp_path / "work")
|
||||
assert Path(binary).is_file() and seal is None and set_python == str(python)
|
||||
assert ab.default_tag() == "firefox-70", "the tag of the control is what the set's seal says"
|
||||
with pytest.raises(RuntimeError, match="labelled firefox-68 but the published set carries firefox-70"):
|
||||
ab.fetch_published("firefox-68", tmp_path / "work2")
|
||||
|
||||
|
||||
def _written_tags(path: Path) -> list:
|
||||
"""The `firefox-<N>` string constants of the CODE of a script (docstrings and comments are prose, and may name a release)."""
|
||||
tree = ast.parse(path.read_text(encoding="utf-8"))
|
||||
docstrings = {id(n.body[0].value) for n in ast.walk(tree) if isinstance(n, (ast.Module, ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef))
|
||||
and n.body and isinstance(n.body[0], ast.Expr) and isinstance(getattr(n.body[0], "value", None), ast.Constant)}
|
||||
import re
|
||||
|
||||
return [(n.lineno, n.value) for n in ast.walk(tree) if isinstance(n, ast.Constant) and isinstance(n.value, str) and id(n) not in docstrings
|
||||
and re.fullmatch(r"firefox-\d+(-candidate)?", n.value)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("script", ["ci_ab_oracle.py", "ci_ab_host.py", "ci_ab_network.py", "ci_poison_host.py", "ci_published_set.py"])
|
||||
def test_no_oracle_writes_the_tag_of_the_engine_it_holds_the_candidate_to(script):
|
||||
"""firefox-68 stayed written in the oracles as the control after firefox-69 and firefox-70 were published: the baseline is the published set, so a new release is the new baseline."""
|
||||
assert _written_tags(ROOT / "scripts" / script) == []
|
||||
|
||||
|
||||
def test_the_checker_of_a_written_tag_sees_one(tmp_path):
|
||||
bad = tmp_path / "x.py"
|
||||
bad.write_text('"""docs may say firefox-68."""\nENGINE_TAG = "firefox-68"\n', encoding="utf-8")
|
||||
assert _written_tags(bad) == [(2, "firefox-68")]
|
||||
|
||||
|
||||
# -
|
||||
# The lock
|
||||
|
||||
LOCK = ROOT / "ci" / "py-lock" / "published.txt"
|
||||
GATE_LOCK = ROOT / "ci" / "py-lock" / "gate.txt"
|
||||
H1, H2, H3 = "a" * 64, "b" * 64, "c" * 64
|
||||
|
||||
|
||||
def _lock(**kw) -> str:
|
||||
text = "\n".join([
|
||||
"# header", "# wrapper-requires: greenlet<4.0.0,>=3.1.1 | psutil>=5.9", "# core-requires: platformdirs>=4",
|
||||
"invisible-core==70.83.0 \\", " --hash=sha256:%s \\" % H1, " --hash=sha256:%s" % H2,
|
||||
"invisible-playwright==0.60.0 \\", " --hash=sha256:%s" % H3, ""])
|
||||
for old, new in kw.items():
|
||||
assert old in text, old
|
||||
text = text.replace(old, new)
|
||||
return text
|
||||
|
||||
|
||||
def test_the_committed_lock_reads_and_every_entry_has_hashes_and_an_exact_version():
|
||||
parsed = ps.parse_lock(LOCK.read_text(encoding="utf-8"))
|
||||
assert parsed["wrapper"][0] and parsed["core"][0] and parsed["wrapper"][1] and parsed["core"][1]
|
||||
assert LOCK.read_bytes().count(b"\r") == 0, "LF only"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("what,text,says", [
|
||||
("a range", _lock(**{"invisible-core==70.83.0": "invisible-core>=70.83.0"}), "not `name==version"),
|
||||
("an entry with no hash", _lock(**{"invisible-playwright==0.60.0 \\\n --hash=sha256:" + H3: "invisible-playwright==0.60.0"}), "has no hash"),
|
||||
("a hash that is not a sha256", _lock(**{H3: "zz"}), "not a --hash=sha256"),
|
||||
("the wrapper missing", _lock().split("invisible-playwright")[0], "must hold exactly"),
|
||||
("a duplicated entry", _lock() + "invisible-core==70.83.0 --hash=sha256:%s\n" % H1, "listed twice"),
|
||||
("the requirements of the wrapper unsaid", _lock().replace("# wrapper-requires: greenlet<4.0.0,>=3.1.1 | psutil>=5.9\n", ""), "wrapper-requires"),
|
||||
("a URL", _lock(**{"invisible-core==70.83.0": "invisible-core @ https://x/y.whl"}), "not `name==version"),
|
||||
])
|
||||
def test_a_lock_that_is_not_a_hash_pinned_set_is_refused(what, text, says):
|
||||
with pytest.raises(ValueError, match=says):
|
||||
ps.parse_lock(text)
|
||||
|
||||
|
||||
def test_the_committed_set_installs_over_the_gate_s_own_lock_offline():
|
||||
"""The venv of the set is the gate's third-party lock plus the two wheels, `--no-deps`: every requirement of either must be met by a package that lock holds."""
|
||||
parsed = ps.parse_lock(LOCK.read_text(encoding="utf-8"))
|
||||
assert ps.problems_of_lock(parsed, GATE_LOCK.read_text(encoding="utf-8")) == []
|
||||
|
||||
|
||||
def test_a_requirement_the_gate_lock_does_not_meet_is_named():
|
||||
parsed = ps.parse_lock(_lock())
|
||||
gate_text = "greenlet==3.5.6 \\\n --hash=sha256:%s\npsutil==7.2.2 \\\n --hash=sha256:%s\n" % (H1, H1)
|
||||
found = ps.problems_of_lock(parsed, gate_text)
|
||||
assert any("platformdirs>=4" in p and "does not hold it" in p for p in found), found
|
||||
old = "greenlet==2.0.0 \\\n --hash=sha256:%s\npsutil==7.2.2 \\\n --hash=sha256:%s\nplatformdirs==4.1 \\\n --hash=sha256:%s\n" % (H1, H1, H1)
|
||||
assert any("greenlet<4.0.0,>=3.1.1" in p and "holds greenlet==2.0.0" in p for p in ps.problems_of_lock(parsed, old))
|
||||
|
||||
|
||||
def test_the_wrapper_pins_the_core_of_the_lock_exactly_and_the_ledger_knows_the_version():
|
||||
"""Offline: the lock says what the ledger (PUBLISHED.json, written at each release) says of that version of the wrapper. A lock that names a version nobody published, or
|
||||
a core the wrapper of that version did not pin, is wrong; whether it is the LAST release is the index's to say (published-set.yml)."""
|
||||
parsed = ps.parse_lock(LOCK.read_text(encoding="utf-8"))
|
||||
ledger = json.loads((ROOT / "PUBLISHED.json").read_text(encoding="utf-8"))["released"]
|
||||
rows = [r for r in ledger if r["version"] == parsed["wrapper"][0]]
|
||||
assert len(rows) == 1, "the lock names invisible-playwright %s, which the ledger does not list as published" % parsed["wrapper"][0]
|
||||
requires = [r for r in rows[0]["requires_dist"] if "extra ==" not in r]
|
||||
assert ps.core_pin_of(requires) == parsed["core"][0]
|
||||
others = sorted(r.replace(" ", "") for r in requires if not r.startswith("invisible-core"))
|
||||
assert sorted(r.replace(" ", "") for r in parsed["wrapper_requires"]) == others
|
||||
|
||||
|
||||
# -
|
||||
# The resolver, on documents made here (the index is read by `check` in published-set.yml, never by a unit test)
|
||||
|
||||
def _doc(name: str, version: str, requires: list, files: list) -> dict:
|
||||
return {"info": {"name": name, "version": version, "requires_dist": requires},
|
||||
"urls": [{"filename": f, "packagetype": "bdist_wheel" if f.endswith(".whl") else "sdist", "digests": {"sha256": h}, "yanked": y} for f, h, y in files]}
|
||||
|
||||
|
||||
def _index(wrapper_pin="70.83.0", extra=()):
|
||||
docs = {
|
||||
"invisible-playwright/json": _doc("invisible-playwright", "0.60.0", [], []),
|
||||
"invisible-playwright/0.60.0/json": _doc("invisible-playwright", "0.60.0", ["greenlet<4.0.0,>=3.1.1", "invisible-core==%s" % wrapper_pin, "psutil>=5.9", "pytest>=7; extra == 'dev'"],
|
||||
[("w.whl", H3, False), ("w.tar.gz", H1, False), ("yanked.whl", H2, True)]),
|
||||
"invisible-core/70.83.0/json": _doc("invisible-core", "70.83.0", ["platformdirs>=4", "ruff>=0.6; extra == 'dev'"], [("c.whl", H2, False), ("c.tar.gz", H1, False)]),
|
||||
}
|
||||
docs.update(dict(extra))
|
||||
return lambda url: docs[url.split("/pypi/", 1)[1]]
|
||||
|
||||
|
||||
def test_the_lock_is_made_from_the_last_release_and_the_core_it_pins():
|
||||
text = ps.resolve(_index())
|
||||
parsed = ps.parse_lock(text)
|
||||
assert parsed["wrapper"] == ("0.60.0", sorted([H1, H3])), "every file of the version that is on the index and not yanked, by its sha256"
|
||||
assert parsed["core"] == ("70.83.0", sorted([H1, H2]))
|
||||
assert parsed["wrapper_requires"] == ["greenlet<4.0.0,>=3.1.1", "psutil>=5.9"] and parsed["core_requires"] == ["platformdirs>=4"], "no extra"
|
||||
assert ps.resolve(_index()) == text, "the same index, the same bytes"
|
||||
|
||||
|
||||
def test_a_wrapper_that_does_not_pin_its_core_exactly_is_no_set():
|
||||
with pytest.raises(ValueError, match="does not pin invisible-core exactly once"):
|
||||
ps.core_pin_of(["invisible-core>=70", "psutil>=5.9"])
|
||||
with pytest.raises(ValueError, match="pins invisible-core==70.83.0 but the core document is of 70.84.0"):
|
||||
ps.lock_text(_index()("https://x/pypi/invisible-playwright/0.60.0/json"), _doc("invisible-core", "70.84.0", [], [("c.whl", H2, False)]))
|
||||
|
||||
|
||||
def test_the_check_is_red_when_the_index_has_a_newer_release_and_says_the_command(tmp_path):
|
||||
stale = tmp_path / "published.txt"
|
||||
stale.write_text(ps.resolve(_index()), encoding="utf-8")
|
||||
assert ps.check(_index(), stale) == []
|
||||
newer = {"invisible-playwright/json": _doc("invisible-playwright", "0.61.0", [], []),
|
||||
"invisible-playwright/0.61.0/json": _doc("invisible-playwright", "0.61.0", ["invisible-core==71.84.0", "psutil>=5.9"], [("w2.whl", H1, False)]),
|
||||
"invisible-core/71.84.0/json": _doc("invisible-core", "71.84.0", ["platformdirs>=4"], [("c2.whl", H3, False)])}
|
||||
found = ps.check(_index(extra=newer), stale)
|
||||
assert len(found) == 1 and "invisible-playwright 0.60.0 + invisible-core 70.83.0" in found[0] and "invisible-playwright 0.61.0 + invisible-core 71.84.0" in found[0]
|
||||
assert "resolve --write" in found[0]
|
||||
assert ps.check(_index(), tmp_path / "missing.txt")[0].startswith("missing.txt holds nothing")
|
||||
|
||||
|
||||
def test_an_index_that_cannot_be_read_is_red_not_green():
|
||||
def down(url):
|
||||
raise OSError("the index is down")
|
||||
|
||||
assert "the index is down" in ps.check(down)[0]
|
||||
|
||||
|
||||
# -
|
||||
# The install (offline, by hash) and what is verified of it
|
||||
|
||||
def test_the_install_is_offline_hash_checked_and_in_a_venv_of_its_own(tmp_path, monkeypatch):
|
||||
house = tmp_path / "house"
|
||||
house.mkdir()
|
||||
(house / "lock.txt").write_text("", encoding="utf-8")
|
||||
ran = []
|
||||
monkeypatch.setenv("PYTHONPATH", "/candidate/site")
|
||||
ps.install(house, tmp_path / "venv", LOCK, run=lambda cmd, **kw: ran.append((cmd, kw)))
|
||||
venv_cmd, first, second = ran
|
||||
assert venv_cmd[0][1:] == ["-m", "venv", str(tmp_path / "venv")]
|
||||
for cmd, kw in (first, second):
|
||||
assert cmd[0] == str(ps.venv_python(tmp_path / "venv")) and cmd[1:5] == ["-m", "pip", "install", "--quiet"]
|
||||
assert "--no-index" in cmd and "--require-hashes" in cmd and cmd[cmd.index("--find-links") + 1] == str(house)
|
||||
assert "PYTHONPATH" not in kw["env"], "nothing of the candidate's job"
|
||||
assert first[0][-2:] == ["-r", str(house / "lock.txt")] and "--no-deps" not in first[0]
|
||||
assert "--no-deps" in second[0] and second[0][-2:] == ["-r", str(LOCK)], "the two wheels, by the hashes of the lock, over the third-party lock"
|
||||
|
||||
|
||||
def test_an_install_without_the_gate_s_lock_in_the_wheelhouse_is_refused(tmp_path):
|
||||
with pytest.raises(FileNotFoundError, match="not a py-deps wheelhouse"):
|
||||
ps.install(tmp_path, tmp_path / "venv", LOCK, run=lambda *a, **k: None)
|
||||
|
||||
|
||||
def _identity(**kw):
|
||||
parsed = ps.parse_lock(LOCK.read_text(encoding="utf-8"))
|
||||
prefix = "/set"
|
||||
base = {"prefix": prefix, "core": parsed["core"][0], "core_version": parsed["core"][0], "core_file": prefix + "/lib/invisible_core/__init__.py",
|
||||
"wrapper": parsed["wrapper"][0], "wrapper_file": prefix + "/lib/invisible_playwright/__init__.py", "seal_tag": "firefox-70", "seal_local": False}
|
||||
base.update(kw)
|
||||
return lambda cmd, **k: types.SimpleNamespace(returncode=0, stdout=json.dumps(base), stderr="")
|
||||
|
||||
|
||||
def test_what_the_set_s_python_imports_is_the_lock_from_its_own_venv():
|
||||
assert ps.verify("py", LOCK, run=_identity()) == []
|
||||
assert any("core it runs" in p for p in ps.verify("py", LOCK, run=_identity(core="71.1.0")))
|
||||
assert any("core it runs" in p for p in ps.verify("py", LOCK, run=_identity(core_file="/candidate/src/invisible_core/__init__.py"))), "a core from another place is the candidate's"
|
||||
assert any("wrapper it runs" in p for p in ps.verify("py", LOCK, run=_identity(wrapper_file="/candidate/src/invisible_playwright/__init__.py")))
|
||||
assert any("local seal" in p for p in ps.verify("py", LOCK, run=_identity(seal_local=True)))
|
||||
|
||||
|
||||
def test_a_set_that_cannot_import_is_an_error_not_a_pass():
|
||||
with pytest.raises(RuntimeError, match="could not import the published set"):
|
||||
ps.identity("py", run=lambda cmd, **k: types.SimpleNamespace(returncode=1, stdout="", stderr="ModuleNotFoundError: invisible_core"))
|
||||
|
||||
|
||||
# -
|
||||
# The wiring: the lock is kept equal to the index, and these tests are run by the rounds
|
||||
|
||||
def test_a_workflow_keeps_the_lock_equal_to_the_index_every_day_and_on_a_pull_request_that_touches_it():
|
||||
text = (ROOT / ".github" / "workflows" / "published-set.yml").read_text(encoding="utf-8")
|
||||
assert 'cron: "' in text and "pull_request:" in text and "ci/py-lock/published.txt" in text and "scripts/ci_published_set.py" in text
|
||||
assert "python scripts/ci_published_set.py check" in text and "pip install" not in text, "it reads the index and installs nothing"
|
||||
|
||||
|
||||
def test_this_file_is_run_by_the_whole_unit_suite_of_both_systems():
|
||||
rows = {r["id"]: r for r in json.loads((ROOT / "ci" / "required-suites.json").read_text(encoding="utf-8"))}
|
||||
for suite in ("wrapper.unit.all.linux", "wrapper.unit.all.windows"):
|
||||
assert "tests/test_ci_published_set.py" in rows[suite]["tests"], suite
|
||||
|
||||
|
||||
def test_the_required_suites_of_the_oracles_say_the_control_is_the_set():
|
||||
rows = {r["id"]: r for r in json.loads((ROOT / "ci" / "required-suites.json").read_text(encoding="utf-8"))}
|
||||
for suite in ("wrapper.e2e.ab_oracle", "wrapper.e2e.ab_network", "wrapper.e2e.ab_host"):
|
||||
assert "published set" in rows[suite]["note"].lower(), suite
|
||||
assert "firefox-68" not in rows[suite]["note"], suite
|
||||
Reference in new issue
Block a user