ci: real-sites, the admission judges the list and not the luck of a site; the minimum is half the list
The rule "unstable means out" does not converge: five passes cannot tell an unstable site from a rare failure on the side of stock, and every real site has one (a load timeout once in five for one, a challenge page once in five for another). In the round a cell is red only if stock is good in all three runs, so a failure of stock removes information from its cell and never gives blame. - The admission is red only for a defect of the list: an invalid list, a pass that is missing, a site never good in any pass of a system and not of the class protetta, more than 4 protetta, more than 20 sites. A site good in some passes stays, and the report gives its count per system. It computes no minimum. - The judge computes the minimum of informative cells from the list: half the sites, rounded up. min_informative leaves sites.json, and a file that still has it is refused as invalid. - duckduckgo comes back: 15 sites, no min_informative. - The tests of the old rule are replaced; min_tests 2059 and 2060.
This commit is contained in:
1 parent
324246b343
commit
dae1d2c870
6 files changed
+205
-241
No files matched your search
@@ -23,11 +23,13 @@
|
||||
# a push is compared with the head it replaced; if that compare cannot be made (a forced push, no `before`, an API error) the admission runs, in doubt measure.
|
||||
#
|
||||
# ADMISSION. A push to a pull request that changes tests/realsites/sites.json runs the admission AND the round (14 jobs: the plan, 2 of the round, 10 passes of the admission and
|
||||
# its report). The admission is stock alone, five passes per site and per system (a job per pass, so that a list of thirty sites stays inside the limit of a job). It
|
||||
# decides: its report says, per site, keep or drop with the reason (at most 20 kept; blocked five of five is kept only in the class protetta, at most 4, as data; an
|
||||
# outcome that is not the same five of five is dropped) and the `min_informative` to write (the kept sites that are good five of five, minus 3; the lowest of the two
|
||||
# systems), and it is red when the file holds a site it would drop or a `min_informative` of 0 or above the computed one. Where stock does not find the marker, its
|
||||
# cell in the artifact also holds the status, the title and the first 40 element ids of the page, to fix the marker in the same pull request; the judge ignores them.
|
||||
# its report). The admission is stock alone, five passes per site and per system (a job per pass, so that a list of thirty sites stays inside the limit of a job). It is
|
||||
# red only for a defect of the list, never for the luck of one site: an invalid list (a `min_informative` in the file is one), a pass that is missing, a site never good in
|
||||
# any pass of a system that is not of the class protetta (a wrong marker, or a fixed block), more than 4 protetta, more than 20 sites. A site good in some passes stays,
|
||||
# and the report gives its count per system ("4 of 5 on linux"): every real site has a rare failure on the side of stock, five passes cannot tell it from instability,
|
||||
# and in the round it only removes information from that cell. The minimum of information is not sampled and is not in the file: the judge asks for half the sites,
|
||||
# rounded up. Where stock does not find the marker, its cell in the artifact also holds the status, the title and the first 40 element ids of the page, to fix the marker
|
||||
# in the same pull request; the judge ignores them.
|
||||
#
|
||||
# TOKEN. The token of the workflow is in three steps and nowhere else: the plan and the report of the admission (they call `gh`) and the install and fetch of the
|
||||
# round (the engine is downloaded from GitHub; that step launches no browser). A step that runs the passes never sees it.
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
{"id": "wrapper.unit.page", "giro": "G1", "os": ["linux", "windows"], "min_tests": 72, "exact": true, "tests": ["tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_page_number_follows_the_call.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_the_hand_over_of_a_popup_holds_under_concurrency.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py"], "marker": "unit", "needs_root": false, "note": "72 = 44 + 3+9+5+1+10 of the popup hand-over (24 counted at the collection before; was 20 = 3+8+1+8 before 6200bc2). The page dispatcher's wait for Page.ready and what it hands over; the drive gate goes through the core (the engine waits for the session's road)."},
|
||||
{"id": "wrapper.e2e.compositing", "giro": "G2", "os": ["linux", "windows"], "min_tests": 3, "exact": true, "tests": ["tests/test_software_compositing_is_declared_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The engine DECLARES software compositing on every machine (core: the compositing entries of zoom.stealth.gfx.feature_status carry the VM decision, and on Windows gfx.webrender.software=true, gfx.webrender.software.d3d11=false). 3 = (1) the compositor read from a privileged context is 'WebRender (Software)' on Windows and on Linux (windowUtils.layerManagerType of each window: Troubleshoot.snapshot().graphics throws on this engine, `ext is null`, so it is not the route); (2) the GPU process uses under 1.5 s of CPU on the fixed 10-scene loop of one browser (Windows runner: 0.32 s declared, 2.7-4.2 s not, runs 43652292533 and 43642744101; on Linux it is held to the bound if a GPU process exists); (3) the 86 keys of the page-bytes probe plus the canvas 2D scenes (drawImage scaled with smoothing off/low/medium/high, text with linear/radial/conic gradients) equal tests/data/page_bytes_<os>.json, PNGs on decoded pixels. EXPECTED RED on the core 64.71.0 (tests 1 and 2 on Windows). The reference of Windows holds the 75 stable keys and 6 of the 11 PNG keys of run 43652292533; the five other PNG keys and the new canvas keys, and all of Linux, are written from the first run on the engine of the reference (the failure of test 3 prints RECORD-BEGIN ... RECORD-END with the entries to merge): a reference that is not complete is red, never skipped."},
|
||||
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 19, "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."},
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2063, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_backcompat.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_lab_geoip.py", "tests/test_ci_lab_geoip_verify.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_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.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_css_calc_is_windows_e2e.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_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_expose_binding_refusal.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_math_sin_cos_tan_are_windows_e2e.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_preload_newtab_reaches_the_core_only_when_asked.py", "tests/test_protocol_names_are_declared.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_publish_gate_wiring.py", "tests/test_pyproject_names_real_paths.py", "tests/test_Line truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2064, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_backcompat.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_lab_geoip.py", "tests/test_ci_lab_geoip_verify.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_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.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_css_calc_is_windows_e2e.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_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_expose_binding_refusal.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_math_sin_cos_tan_are_windows_e2e.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_prefs_composition_arm_on_windows.py", "tests/test_preload_newtab_reaches_the_core_only_when_asked.py", "tests/test_protocol_names_are_declared.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_publish_gate_wiring.py", "tests/test_pyproject_names_real_pathsLine truncated
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2059, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_backcompat.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_lab_geoip.py", "tests/test_ci_lab_geoip_verify.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_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.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_css_calc_is_windows_e2e.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_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_expose_binding_refusal.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_math_sin_cos_tan_are_windows_e2e.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_preload_newtab_reaches_the_core_only_when_asked.py", "tests/test_protocol_names_are_declared.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_publish_gate_wiring.py", "tests/test_pyproject_names_real_paths.py", "tests/test_Line truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2060, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_backcompat.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_lab_geoip.py", "tests/test_ci_lab_geoip_verify.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_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.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_css_calc_is_windows_e2e.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_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_expose_binding_refusal.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_math_sin_cos_tan_are_windows_e2e.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_prefs_composition_arm_on_windows.py", "tests/test_preload_newtab_reaches_the_core_only_when_asked.py", "tests/test_protocol_names_are_declared.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_publish_gate_wiring.py", "tests/test_pyproject_names_real_pathsLine truncated
|
||||
]
|
||||
+65
-94
@@ -17,11 +17,12 @@ The rule, per site, over the runs that are available for that site:
|
||||
* INCOMPLETE: a cell that differs in the first pass (one browser good, the other not) must have three runs per browser; without them it is not a red cell but a
|
||||
problem, "giro incompleto" (the job is red, the round's fault);
|
||||
* NO INFORMATION: stock is not good in every run (a site that blocks, has fallen or has changed). Never red. The outcome of ours is still reported, as data;
|
||||
* the job is RED when a cell is red or incomplete, when a site of the list was not visited by both browsers, when the list has no sites, when ``min_informative``
|
||||
is below 1, or when fewer cells than ``min_informative`` carry information ("il giro non ha misurato": the round is broken, not the wrapper; an empty round is
|
||||
never green).
|
||||
* the job is RED when a cell is red or incomplete, when a site of the list was not visited by both browsers, when the list has no sites, or when fewer cells carry
|
||||
information than half the sites, rounded up (``information_minimum``: 8 of 15; "il giro non ha misurato": the round is broken, not the wrapper; an empty round is
|
||||
never green). The minimum is not a field of the file and is not sampled: a failure of stock only removes information from its cell, and never gives blame.
|
||||
|
||||
THE RUNS. ``judge(stock_runs, ours_runs, sites, min_informative)`` takes lists of runs; a run is the dict ``{site id: cell}`` of one pass. The workflow supplies, per browser, the first pass over the whole list (``<browser>-1.json``) and, only for the
|
||||
THE RUNS. ``judge(stock_runs, ours_runs, sites)`` takes lists of runs; a run is the dict ``{site id: cell}`` of one pass. The workflow supplies, per browser, the first
|
||||
pass over the whole list (``<browser>-1.json``) and, only for the
|
||||
sites whose first-pass cells differ (``differing``: one browser good and the other not), two more passes of those sites alone, in the order stock, ours, stock,
|
||||
ours (``<browser>-2.json``, ``<browser>-3.json``). A site is "visited" when it is in the FIRST pass of each browser; a site absent from a later pass is only a
|
||||
site that did not differ. A cell that did not differ has one run each: good and good is green, and bad and bad is no information.
|
||||
@@ -31,7 +32,9 @@ The function is pure (no file, no clock, no network): ``main`` reads the files a
|
||||
judge_real_sites.py judge --sites tests/realsites/sites.json --stock FILE... --ours FILE... [--summary summary.md] [--result result.json]
|
||||
judge_real_sites.py differing --sites tests/realsites/sites.json --stock FILE --ours FILE (ids of the cells that differ, one comma-joined line)
|
||||
judge_real_sites.py admit --sites tests/realsites/sites.json --os LABEL FILE... [--os LABEL FILE...] [--summary admission.md]
|
||||
exit 1 when the file holds a site the admission would drop, or its min_informative is 0 or above the computed one; 0 for an empty list
|
||||
exit 1 only for a defect of the list, never for the luck of one site: an invalid list (a ``min_informative`` in the file is one), a pass that is missing, a
|
||||
site never good in any pass on a system and not of the class protetta, more than 4 protetta, more than 20 sites. A site good in some passes stays, with its
|
||||
count per system. 0 for an empty list.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -50,7 +53,7 @@ CLASSES = ("calma", "giornale", "negozio", "applicazione", "protetta")
|
||||
RUNS_OF_A_DIFFERING_CELL = 3
|
||||
#: Red: stock good in every one of its three runs and ours not good in at least this many of its three.
|
||||
BAD_RUNS_FOR_RED = 2
|
||||
#: The admission keeps at most this many sites, of which at most MAX_PROTECTED are of the class PROTECTED (kept as data when stock is blocked there).
|
||||
#: A list has at most this many sites, of which at most MAX_PROTECTED are of the class PROTECTED (kept as data: stock may be blocked there).
|
||||
MAX_KEPT = 20
|
||||
MAX_PROTECTED = 4
|
||||
PROTECTED = "protetta"
|
||||
@@ -100,10 +103,13 @@ def _visited(runs, site_id) -> bool:
|
||||
return bool(runs) and isinstance(runs[0], dict) and site_id in runs[0]
|
||||
|
||||
|
||||
def judge(stock_runs, ours_runs, sites, min_informative) -> Judgement:
|
||||
def information_minimum(site_count) -> int:
|
||||
"""The cells that must carry information for the round to have measured: half the sites, rounded up."""
|
||||
return (site_count + 1) // 2
|
||||
|
||||
|
||||
def judge(stock_runs, ours_runs, sites) -> Judgement:
|
||||
"""The verdict, the table and the exit code of one job. Pure: it reads only its arguments and changes none of them."""
|
||||
if not isinstance(min_informative, int) or isinstance(min_informative, bool):
|
||||
raise ValueError("min_informative is an integer, not %r" % (min_informative,))
|
||||
table, problems = [], []
|
||||
informative = red = ours_good_stock_not = 0
|
||||
for site in sites:
|
||||
@@ -138,10 +144,8 @@ def judge(stock_runs, ours_runs, sites, min_informative) -> Judgement:
|
||||
table.append({**base, "state": state, "stock": stock, "ours": ours})
|
||||
if not sites:
|
||||
problems.append("%s: the list has no sites" % NOT_MEASURED)
|
||||
elif min_informative < 1:
|
||||
problems.append("%s: min_informative is %d, the minimum of a list that measures is 1" % (NOT_MEASURED, min_informative))
|
||||
elif informative < min_informative:
|
||||
problems.append("%s: %d cells with information, the minimum is %d" % (NOT_MEASURED, informative, min_informative))
|
||||
elif informative < information_minimum(len(sites)):
|
||||
problems.append("%s: %d cells with information of %d sites, the minimum is %d" % (NOT_MEASURED, informative, len(sites), information_minimum(len(sites))))
|
||||
code = 1 if problems else 0
|
||||
return Judgement("red" if code else "green", code, table, informative, red, ours_good_stock_not, problems)
|
||||
|
||||
@@ -153,84 +157,50 @@ def differing_sites(stock_first, ours_first, sites) -> list:
|
||||
|
||||
|
||||
def admission(runs_by_os, sites, expected_runs=5) -> dict:
|
||||
"""The admission of a list: stock alone, ``expected_runs`` passes per system. Per site and system the outcome is "good" (the same good cell in every pass),
|
||||
"blocked" (the same cell in every pass, not good) or "unstable" (not the same in every pass, or a pass missing). The decision per site, over the systems:
|
||||
|
||||
* unstable on any system: DROP, whatever its class;
|
||||
* blocked on any system: KEEP only if its class is ``protetta`` (kept as data, at most ``MAX_PROTECTED`` of that class, the good ones first), else DROP;
|
||||
* good on every system: KEEP, in the order of the list, while the list has fewer than ``MAX_KEPT`` sites.
|
||||
|
||||
``min_informative`` is the number of the kept sites that are good five of five, minus 3 (not below 0); the lowest of the systems is the one to write.
|
||||
Only the five fields of a cell are compared: what a pass adds to diagnose a marker (``diagnosis``) is not part of the outcome."""
|
||||
report = {"problems": []}
|
||||
outcome = {}
|
||||
"""The passes of stock alone, ``expected_runs`` per system, counted per site and system: how many were good. Only the five fields of a cell count: what a pass
|
||||
adds to diagnose a marker (``diagnosis``) is not part of the outcome. A site good in some passes is not a defect, whatever its count: a rare failure of stock
|
||||
is every real site's, and it only removes information from the round."""
|
||||
report = {"problems": [], "expected_runs": expected_runs}
|
||||
for label, runs in runs_by_os.items():
|
||||
if len(runs) != expected_runs:
|
||||
report["problems"].append("%s: %d passes of stock, %d expected" % (label, len(runs), expected_runs))
|
||||
rows = []
|
||||
for site in sites:
|
||||
cells = _cells(runs, site["id"])
|
||||
full = len(runs) == expected_runs and len(cells) == expected_runs and all(isinstance(c, dict) for c in cells)
|
||||
same = full and all([c.get(n) for n in FIELDS] == [cells[0].get(n) for n in FIELDS] for c in cells)
|
||||
rows.append({"id": site["id"], "class": site.get("class", ""), "same": bool(same), "good": bool(same and is_good(cells[0])),
|
||||
"why": (_why(cells[:1]) or "good") if same else "differs between passes, or missing"})
|
||||
outcome[(label, site["id"])] = "unstable" if not same else ("good" if is_good(cells[0]) else "blocked")
|
||||
report[label] = {"rows": rows, "same": sum(1 for r in rows if r["same"]), "good": sum(1 for r in rows if r["good"])}
|
||||
labels = list(runs_by_os)
|
||||
decisions = {}
|
||||
protected, plain = [], []
|
||||
for index, site in enumerate(sites):
|
||||
seen = {label: outcome[(label, site["id"])] for label in labels}
|
||||
unstable = [label for label, o in seen.items() if o == "unstable"]
|
||||
blocked = [label for label, o in seen.items() if o == "blocked"]
|
||||
if unstable:
|
||||
decisions[site["id"]] = ("drop", "stock outcome not the same 5 of 5 on %s" % ", ".join(unstable))
|
||||
elif site.get("class") == PROTECTED:
|
||||
protected.append((bool(blocked), index, site))
|
||||
elif blocked:
|
||||
decisions[site["id"]] = ("drop", "stock blocked 5 of 5 on %s and the class is not %s" % (", ".join(blocked), PROTECTED))
|
||||
else:
|
||||
plain.append(site)
|
||||
for rank, (blocked, _index, site) in enumerate(sorted(protected, key=lambda t: (t[0], t[1]))):
|
||||
if rank < MAX_PROTECTED:
|
||||
decisions[site["id"]] = ("keep", "stock blocked 5 of 5, kept as data (%s)" % PROTECTED if blocked else "good 5 of 5 (%s)" % PROTECTED)
|
||||
else:
|
||||
decisions[site["id"]] = ("drop", "more than %d sites of the class %s" % (MAX_PROTECTED, PROTECTED))
|
||||
room = MAX_KEPT - sum(1 for d, _r in decisions.values() if d == "keep")
|
||||
for rank, site in enumerate(plain):
|
||||
decisions[site["id"]] = ("keep", "good 5 of 5") if rank < room else ("drop", "more than %d sites kept" % MAX_KEPT)
|
||||
report["decisions"] = [{"id": s["id"], "class": s.get("class", ""), "decision": decisions[s["id"]][0], "reason": decisions[s["id"]][1],
|
||||
"outcome": {label: outcome[(label, s["id"])] for label in labels}} for s in sites]
|
||||
kept = {d["id"] for d in report["decisions"] if d["decision"] == "keep"}
|
||||
report["kept"] = [s["id"] for s in sites if s["id"] in kept]
|
||||
lows = []
|
||||
for label in labels:
|
||||
report[label]["kept_good"] = sum(1 for r in report[label]["rows"] if r["good"] and r["id"] in kept)
|
||||
report[label]["min_informative"] = max(report[label]["kept_good"] - 3, 0)
|
||||
lows.append(report[label]["min_informative"])
|
||||
report["min_informative"] = min(lows) if lows else 0
|
||||
rows.append({"id": site["id"], "class": site.get("class", ""), "good": sum(1 for c in cells if is_good(c)), "runs": len(runs), "why": _why(cells)})
|
||||
report[label] = {"rows": rows}
|
||||
report["labels"] = list(runs_by_os)
|
||||
return report
|
||||
|
||||
|
||||
def admission_problems(report, sites, min_informative) -> list:
|
||||
"""What makes the admission red: a site of the file that the admission would drop, a pass that is missing, a ``min_informative`` of 0 or above the one the
|
||||
admission computes (lower is fine, from 1). An empty list is not asked anything: there is nothing to admit."""
|
||||
def admission_problems(report, sites) -> list:
|
||||
"""What makes the admission red: a defect of the list, never the luck of one site. A pass that is missing; a site never good in any pass of a system and not of the
|
||||
class protetta (a wrong marker, or a fixed block); more than MAX_PROTECTED sites of the class protetta; more than MAX_KEPT sites. (An invalid list is refused
|
||||
when it is read.) An empty list is not asked anything: there is nothing to admit."""
|
||||
if not sites:
|
||||
return []
|
||||
out = list(report["problems"])
|
||||
out += ["%s: the admission would drop it (%s)" % (d["id"], d["reason"]) for d in report["decisions"] if d["decision"] == "drop"]
|
||||
if min_informative < 1:
|
||||
out.append("min_informative is %d: write %d at most, and at least 1" % (min_informative, report["min_informative"]))
|
||||
elif min_informative > report["min_informative"]:
|
||||
out.append("min_informative is %d, above the %d the admission computes" % (min_informative, report["min_informative"]))
|
||||
for label in report["labels"]:
|
||||
out += ["%s: never good on %s%s" % (r["id"], label, " (%s)" % r["why"] if r["why"] else "")
|
||||
for r in report[label]["rows"] if r["good"] == 0 and r["class"] != PROTECTED]
|
||||
protected = sum(1 for site in sites if site.get("class") == PROTECTED)
|
||||
if protected > MAX_PROTECTED:
|
||||
out.append("%d sites of the class %s, more than %d" % (protected, PROTECTED, MAX_PROTECTED))
|
||||
if len(sites) > MAX_KEPT:
|
||||
out.append("%d sites, more than %d" % (len(sites), MAX_KEPT))
|
||||
return out
|
||||
|
||||
|
||||
def validate_sites(sites) -> list:
|
||||
"""The problems of a list: every site has an id (unique, lowercase letters, digits and hyphens), an https url, a marker and one of the five classes."""
|
||||
if not isinstance(sites, list):
|
||||
return ["the sites are not a list"]
|
||||
"""The problems of a list: every site has an id (unique, lowercase letters, digits and hyphens), an https url, a marker and one of the five classes. Given the
|
||||
whole file (a dict) it also refuses a ``min_informative``: the minimum is computed by the judge from the number of sites and is not written anywhere."""
|
||||
out, seen = [], set()
|
||||
if isinstance(sites, dict):
|
||||
if "min_informative" in sites:
|
||||
out.append("min_informative is not a field of the list: the judge computes the minimum (half the sites, rounded up)")
|
||||
sites = sites.get("sites", [])
|
||||
if not isinstance(sites, list):
|
||||
return out + ["the sites are not a list"]
|
||||
for i, site in enumerate(sites):
|
||||
if not isinstance(site, dict):
|
||||
out.append("site %d is not an object" % i)
|
||||
@@ -274,23 +244,24 @@ def render_markdown(result: Judgement) -> str:
|
||||
|
||||
|
||||
def render_admission(report: dict, verdict_problems=()) -> str:
|
||||
labels = [k for k in report if k not in ("problems", "min_informative", "decisions", "kept")]
|
||||
lines = ["## Admission of the list: stock, same outcome in every pass", "",
|
||||
"- sites kept: %d of %d" % (len(report.get("kept", [])), len(report.get("decisions", []))),
|
||||
"- min_informative to write in sites.json (kept sites good 5 of 5, minus 3, the lowest of the systems): **%d**" % report["min_informative"], ""]
|
||||
for label in labels:
|
||||
entry = report[label]
|
||||
lines.append("- %s: same outcome in every pass %d, good in every pass %d, kept and good %d, min_informative %d"
|
||||
% (label, entry["same"], entry["good"], entry["kept_good"], entry["min_informative"]))
|
||||
lines += ["", "| site | class | " + " | ".join(labels) + " | decision | reason |", "|---|---|" + "---|" * len(labels) + "---|---|"]
|
||||
for d in report.get("decisions", []):
|
||||
lines.append("| %s | %s | %s | %s | %s |" % (d["id"], d["class"], " | ".join(d["outcome"].get(label, "-") for label in labels), d["decision"], d["reason"]))
|
||||
if labels:
|
||||
lines += ["", "What stock showed where it was not good, per system (the cells of the passes also hold the status, the title and the first ids of the page where the marker was not found):", ""]
|
||||
labels = report.get("labels", [])
|
||||
lines = ["## Admission of the list: stock, %d passes per system" % report.get("expected_runs", 0), ""]
|
||||
sites = [r for r in report[labels[0]]["rows"]] if labels else []
|
||||
lines += ["| site | class | " + " | ".join(labels) + " | note |", "|---|---|" + "---|" * len(labels) + "---|"]
|
||||
for index, site in enumerate(sites):
|
||||
counts, notes = [], []
|
||||
for label in labels:
|
||||
for r in report[label]["rows"]:
|
||||
if r["same"] and not r["good"]:
|
||||
lines.append("- %s, %s: %s" % (label, r["id"], r["why"]))
|
||||
r = report[label]["rows"][index]
|
||||
counts.append("%d of %d on %s" % (r["good"], r["runs"], label))
|
||||
if r["good"] == 0 and r["class"] == PROTECTED:
|
||||
notes.append("never good on %s, kept as data" % label)
|
||||
elif r["good"] == 0:
|
||||
notes.append("never good on %s" % label)
|
||||
lines.append("| %s | %s | %s | %s |" % (site["id"], site["class"], " | ".join(counts), "; ".join(notes)))
|
||||
shown = [(label, r) for label in labels for r in report[label]["rows"] if r["good"] < r["runs"] and r["why"]]
|
||||
if shown:
|
||||
lines += ["", "What stock showed where it was not good (the cells of the passes also hold the status, the title and the first ids of the page where the marker was not found):", ""]
|
||||
lines += ["- %s, %s: %s" % (label, r["id"], r["why"]) for label, r in shown]
|
||||
if report["problems"]:
|
||||
lines += ["", "### Problems", ""] + ["- " + p for p in report["problems"]]
|
||||
lines += ["", "**Verdict: %s**" % ("red" if verdict_problems else "green")]
|
||||
@@ -305,8 +276,8 @@ def _read_json(path):
|
||||
|
||||
def _read_sites(path):
|
||||
data = _read_json(path)
|
||||
sites = data.get("sites", [])
|
||||
problems = validate_sites(sites)
|
||||
problems = validate_sites(data)
|
||||
sites = data.get("sites", []) if not problems else []
|
||||
if problems:
|
||||
raise SystemExit("the list of sites is not valid:\n " + "\n ".join(problems))
|
||||
return data, sites
|
||||
@@ -350,13 +321,13 @@ def main(argv=None) -> int:
|
||||
return 0
|
||||
if args.command == "admit":
|
||||
report = admission({group[0]: [_cells_of(f) for f in group[1:]] for group in args.os}, sites, args.expected_runs)
|
||||
problems = admission_problems(report, sites, data.get("min_informative", 0))
|
||||
problems = admission_problems(report, sites)
|
||||
text = render_admission(report, problems)
|
||||
if args.summary:
|
||||
_write(args.summary, text)
|
||||
print(text)
|
||||
return 1 if problems else 0
|
||||
result = judge([_cells_of(f) for f in args.stock], [_cells_of(f) for f in args.ours], sites, data.get("min_informative", 0))
|
||||
result = judge([_cells_of(f) for f in args.stock], [_cells_of(f) for f in args.ours], sites)
|
||||
text = render_markdown(result)
|
||||
if args.summary:
|
||||
_write(args.summary, text)
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
{
|
||||
"description": "The pages the real-sites round visits with one browser at a time (scripts/run_real_sites.py), judged by scripts/judge_real_sites.py: the published wrapper against stock Firefox driven by stock Playwright, on the same runner. Only URL, marker and class are kept here.",
|
||||
"fields": {
|
||||
"min_informative": "Integer, at the top level. The fewest cells that must carry information (stock good in every run) for the round to count as having measured. Fixed after the admission of the list: the number of sites that are good 5 of 5 for stock, minus 3. Below it the job is red, with the message that the round did not measure.",
|
||||
"classes": "The kinds of page a site may be.",
|
||||
"sites": "The list. The admission of a pull request that touches this file says which of its sites stay.",
|
||||
"sites": "The list, at most 20 sites and at most 4 of the class protetta. The judge asks for information from half of them, rounded up (8 of 15): there is no minimum written in this file, and a file that has one is not a list.",
|
||||
"id": "Per site. A short unique name made of lowercase letters, digits and hyphens. It keys the cells of both browsers.",
|
||||
"url": "Per site. The page to open, https, without a login. The document is the page the status is read from.",
|
||||
"marker": "Per site. A CSS selector that matches something only when the real page arrived (not an error page, not a block page, not a consent wall).",
|
||||
"class": "Per site. One of the classes: calma (a quiet page), giornale (a newspaper full of advertising), negozio (a shop), applicazione (a single-page application or a search), protetta (a page behind protection)."
|
||||
},
|
||||
"classes": ["calma", "giornale", "negozio", "applicazione", "protetta"],
|
||||
"min_informative": 11,
|
||||
"sites": [
|
||||
{"id": "developer-mozilla", "url": "https://developer.mozilla.org/en-US/", "marker": "#content", "class": "calma"},
|
||||
{"id": "python", "url": "https://www.python.org/", "marker": "[role=\"main\"]", "class": "calma"},
|
||||
@@ -23,6 +21,7 @@
|
||||
{"id": "otto", "url": "https://www.otto.de/", "marker": "#avContent", "class": "negozio"},
|
||||
{"id": "apple", "url": "https://www.apple.com/it/store", "marker": "[role=\"main\"]", "class": "negozio"},
|
||||
{"id": "mediamarkt", "url": "https://www.mediamarkt.de/", "marker": "main", "class": "negozio"},
|
||||
{"id": "duckduckgo", "url": "https://duckduckgo.com/", "marker": "#searchbox_homepage", "class": "applicazione"},
|
||||
{"id": "bing", "url": "https://www.bing.com/search?q=wikipedia", "marker": "#b_results", "class": "applicazione"},
|
||||
{"id": "openstreetmap", "url": "https://www.openstreetmap.org/", "marker": "#map", "class": "applicazione"},
|
||||
{"id": "walmart", "url": "https://www.walmart.com/", "marker": "main", "class": "protetta"}
|
||||
|
||||
+128
-136
@@ -7,8 +7,10 @@ cells that differ):
|
||||
* RED: stock is good in all three runs and ours is not good in at least two of the three;
|
||||
* INCOMPLETE: a cell that differs in the first pass has three runs of each browser; without them it is a problem ("giro incompleto"), never a red cell;
|
||||
* NO INFORMATION: stock is not good in every run (a blocked, fallen or changed site): never red, ours is reported as data;
|
||||
* the job is red too when a site was not visited by both browsers, when the list has no sites or ``min_informative`` is below 1, or when fewer cells than
|
||||
``min_informative`` carry information ("il giro non ha misurato"); the admission is red when the file holds a site it would drop or a minimum it cannot back.
|
||||
* the job is red too when a site was not visited by both browsers, when the list has no sites, or when fewer cells carry information than half the sites rounded
|
||||
up ("il giro non ha misurato"); the minimum is computed from the list and is not a field of the file;
|
||||
* the admission is red only for a defect of the list (a pass missing, a site never good on a system and not protetta, more than 4 protetta, more than 20 sites, a
|
||||
``min_informative`` in the file), never because a site was good in some passes and not in all.
|
||||
|
||||
The six cases of the design come first, each on known-bad input; the rest are the helpers around them. No time is read or asserted anywhere here.
|
||||
"""
|
||||
@@ -66,7 +68,7 @@ def row(result, site_id):
|
||||
def test_stock_good_three_of_three_and_ours_good_once_is_red():
|
||||
stock = runs_of("site-a", cell(), cell(), cell())
|
||||
ours = runs_of("site-a", cell(), cell(load="timeout"), cell(status="4xx"))
|
||||
result = judge(stock, ours, [SITE], 1)
|
||||
result = judge(stock, ours, [SITE])
|
||||
assert row(result, "site-a")["state"] == "red"
|
||||
assert result.verdict == "red" and result.exit_code == 1
|
||||
assert result.red == 1
|
||||
@@ -75,7 +77,7 @@ def test_stock_good_three_of_three_and_ours_good_once_is_red():
|
||||
def test_stock_good_three_of_three_and_ours_good_twice_is_green():
|
||||
stock = runs_of("site-a", cell(), cell(), cell())
|
||||
ours = runs_of("site-a", cell(), cell(), cell(networkidle="timeout"))
|
||||
result = judge(stock, ours, [SITE], 1)
|
||||
result = judge(stock, ours, [SITE])
|
||||
assert row(result, "site-a")["state"] == "green"
|
||||
assert result.verdict == "green" and result.exit_code == 0
|
||||
assert result.red == 0 and result.informative == 1
|
||||
@@ -89,7 +91,7 @@ def test_stock_good_three_of_three_and_ours_good_twice_is_green():
|
||||
], ids=["blocked in all runs", "bad in the last run", "bad in the first run", "canary of stock fails"])
|
||||
def test_a_stock_that_is_not_good_gives_no_information_and_is_never_red(stock_cells):
|
||||
ours = runs_of("site-a", cell(load="error:NS_ERROR_NET_RESET"), cell(load="timeout"), cell(status="5xx"))
|
||||
result = judge(anchored(runs_of("site-a", *stock_cells)), anchored(ours), [ANCHOR, SITE], 1)
|
||||
result = judge(anchored(runs_of("site-a", *stock_cells)), anchored(ours), [ANCHOR, SITE])
|
||||
assert row(result, "site-a")["state"] == "no_information"
|
||||
assert result.red == 0 and result.informative == 1, "the anchor is the one cell with information"
|
||||
assert result.verdict == "green" and result.exit_code == 0
|
||||
@@ -98,7 +100,7 @@ def test_a_stock_that_is_not_good_gives_no_information_and_is_never_red(stock_ce
|
||||
def test_the_outcome_of_ours_is_reported_where_stock_gives_no_information():
|
||||
stock = runs_of("site-a", cell(status="4xx"), cell(status="4xx"), cell(status="4xx"))
|
||||
ours = runs_of("site-a", cell(), cell(), cell())
|
||||
result = judge(anchored(stock), anchored(ours), [ANCHOR, SITE], 1)
|
||||
result = judge(anchored(stock), anchored(ours), [ANCHOR, SITE])
|
||||
assert row(result, "site-a")["state"] == "no_information"
|
||||
assert row(result, "site-a")["ours"]["good"] == 3 and row(result, "site-a")["stock"]["good"] == 0
|
||||
assert result.ours_good_stock_not == 1
|
||||
@@ -108,35 +110,24 @@ def test_the_outcome_of_ours_is_reported_where_stock_gives_no_information():
|
||||
def test_a_site_missing_from_one_of_the_two_passes_is_red():
|
||||
stock = [{"site-a": cell(), "site-b": cell()}]
|
||||
ours = [{"site-a": cell()}]
|
||||
result = judge(stock, ours, [SITE, OTHER], 1)
|
||||
result = judge(stock, ours, [SITE, OTHER])
|
||||
assert row(result, "site-b")["state"] == "missing"
|
||||
assert result.verdict == "red" and result.exit_code == 1
|
||||
assert any("site-b" in p and "ours" in p for p in result.problems), result.problems
|
||||
# the same site missing from the pass of stock is just as red, and a pass that is not there at all misses every site
|
||||
flipped = judge(ours, stock, [SITE, OTHER], 1)
|
||||
flipped = judge(ours, stock, [SITE, OTHER])
|
||||
assert flipped.verdict == "red" and any("site-b" in p and "stock" in p for p in flipped.problems)
|
||||
nothing = judge([], stock, [SITE, OTHER], 1)
|
||||
nothing = judge([], stock, [SITE, OTHER])
|
||||
assert nothing.verdict == "red" and len(nothing.problems) >= 2
|
||||
|
||||
|
||||
def test_informative_cells_below_the_minimum_make_the_round_red_with_its_reason():
|
||||
stock = [{"site-a": cell(), "site-b": cell(status="4xx")}] + [{"site-b": cell(status="4xx")}] * 2
|
||||
ours = [{"site-a": cell(), "site-b": cell()}] + [{"site-b": cell()}] * 2
|
||||
result = judge(stock, ours, [SITE, OTHER], 2)
|
||||
assert result.informative == 1
|
||||
assert result.verdict == "red" and result.exit_code == 1
|
||||
assert any("il giro non ha misurato" in p for p in result.problems), result.problems
|
||||
enough = judge(stock, ours, [SITE, OTHER], 1)
|
||||
assert enough.verdict == "green" and enough.problems == []
|
||||
|
||||
|
||||
def test_a_canary_that_fails_only_for_ours_with_the_real_page_good_is_red():
|
||||
stock = runs_of("site-a", cell(), cell(), cell())
|
||||
ours = runs_of("site-a", cell(canary="no"), cell(canary="no"), cell(canary="no"))
|
||||
for r in ours:
|
||||
# the real page was good in every other respect
|
||||
assert {k: v for k, v in r["site-a"].items() if k != "canary"} == {k: v for k, v in GOOD.items() if k != "canary"}
|
||||
result = judge(stock, ours, [SITE], 1)
|
||||
result = judge(stock, ours, [SITE])
|
||||
assert row(result, "site-a")["state"] == "red"
|
||||
assert "canary" in row(result, "site-a")["ours"]["why"]
|
||||
assert result.verdict == "red" and result.exit_code == 1
|
||||
@@ -145,12 +136,12 @@ def test_a_canary_that_fails_only_for_ours_with_the_real_page_good_is_red():
|
||||
# --- the runs of a cell, and the numbers -----------------------------------------------------------------------------------------------------
|
||||
def test_a_cell_that_did_not_differ_has_one_run_each_and_the_later_runs_hold_only_the_differing_cells():
|
||||
# good and good in the first pass is green and is not asked again
|
||||
result = judge([{"site-a": cell()}], [{"site-a": cell()}], [SITE], 1)
|
||||
result = judge([{"site-a": cell()}], [{"site-a": cell()}], [SITE])
|
||||
assert row(result, "site-a")["state"] == "green" and row(result, "site-a")["stock"]["runs"] == 1
|
||||
# the later runs hold only the differing cells: a site absent from them is not a missing site
|
||||
stock = [{"site-a": cell(), "site-b": cell()}, {"site-a": cell()}, {"site-a": cell()}]
|
||||
ours = [{"site-a": cell(), "site-b": cell()}, {"site-a": cell()}, {"site-a": cell()}]
|
||||
result = judge(stock, ours, [SITE, OTHER], 2)
|
||||
result = judge(stock, ours, [SITE, OTHER])
|
||||
assert result.verdict == "green" and row(result, "site-b")["stock"]["runs"] == 1 and row(result, "site-a")["stock"]["runs"] == 3
|
||||
|
||||
|
||||
@@ -158,7 +149,7 @@ def test_the_judge_does_not_touch_what_it_is_given():
|
||||
stock = runs_of("site-a", cell(), cell(), cell())
|
||||
ours = runs_of("site-a", cell(load="timeout"), cell(load="timeout"), cell())
|
||||
before = copy.deepcopy((stock, ours, [SITE]))
|
||||
judge(stock, ours, [SITE], 1)
|
||||
judge(stock, ours, [SITE])
|
||||
assert (stock, ours, [SITE]) == before
|
||||
|
||||
|
||||
@@ -168,7 +159,7 @@ def test_the_three_numbers_of_the_summary():
|
||||
{"site-a": cell(), "site-c": cell(status="4xx")}]
|
||||
ours = [{"site-a": cell(load="timeout"), "site-b": cell(), "site-c": cell()}, {"site-a": cell(status="5xx"), "site-c": cell()},
|
||||
{"site-a": cell(marker=False), "site-c": cell()}]
|
||||
result = judge(stock, ours, sites, 1)
|
||||
result = judge(stock, ours, sites)
|
||||
assert (result.informative, result.red, result.ours_good_stock_not) == (2, 1, 1)
|
||||
text = judge_module.render_markdown(result)
|
||||
assert "site-a" in text and "site-b" in text and "site-c" in text
|
||||
@@ -197,72 +188,104 @@ def _site(site_id, klass="calma"):
|
||||
return {"id": site_id, "url": "https://%s.example/" % site_id, "marker": "#main", "class": klass}
|
||||
|
||||
|
||||
MEDIAMARKT = {"id": "mediamarkt", "url": "https://www.mediamarkt.de/", "marker": "main", "class": "negozio"}
|
||||
DUCKDUCKGO = {"id": "duckduckgo", "url": "https://duckduckgo.com/", "marker": "#searchbox_homepage", "class": "applicazione"}
|
||||
#: What the two sites really did, once in five passes, on Linux: a challenge page for the address of the runner, and a load that did not finish.
|
||||
MEDIAMARKT_CHALLENGE = {"load": "ok", "networkidle": "ok", "status": "4xx", "marker": False, "canary": "ok"}
|
||||
DUCKDUCKGO_TIMEOUT = {"load": "timeout", "networkidle": "ok", "status": "none", "marker": False, "canary": "ok"}
|
||||
|
||||
|
||||
def _passes(per_site, n=5):
|
||||
"""``per_site``: id -> a cell, or a function of the pass number (to make an unstable site). Five passes of stock."""
|
||||
"""``per_site``: id -> a cell, or a function of the pass number. ``n`` passes of stock."""
|
||||
return [{sid: (c(i) if callable(c) else c) for sid, c in per_site.items()} for i in range(n)]
|
||||
|
||||
|
||||
def _decisions(report):
|
||||
return {d["id"]: (d["decision"], d["reason"]) for d in report["decisions"]}
|
||||
def _admit_args(tmp_path, sites, passes_by_os, extra_in_file=None):
|
||||
"""The file of the list and the passes of stock of each system, written; returns the arguments of the ``admit`` command."""
|
||||
sites_file = tmp_path / "sites.json"
|
||||
sites_file.write_text(json.dumps({**(extra_in_file or {}), "sites": sites}), encoding="utf-8")
|
||||
groups = []
|
||||
for label, passes in passes_by_os.items():
|
||||
files = []
|
||||
for n, cells in enumerate(passes, 1):
|
||||
path = tmp_path / ("%s-%d.json" % (label, n))
|
||||
path.write_text(json.dumps({"browser": "stock", "cells": cells}), encoding="utf-8")
|
||||
files.append(str(path))
|
||||
groups += ["--os", label, *files]
|
||||
return ["admit", "--sites", str(sites_file), *groups, "--summary", str(tmp_path / "admission.md")]
|
||||
|
||||
|
||||
def test_admission_keeps_the_good_drops_the_blocked_and_the_unstable_and_says_why():
|
||||
sites = [_site("good"), _site("blocked", "giornale"), _site("unstable"), _site("shield", "protetta"), _site("shield-unstable", "protetta")]
|
||||
runs = _passes({"good": cell(), "blocked": cell(status="4xx"), "unstable": lambda i: cell(load="timeout") if i == 3 else cell(),
|
||||
"shield": cell(status="4xx"), "shield-unstable": lambda i: cell(status="4xx") if i == 0 else cell()})
|
||||
report = judge_module.admission({"linux": runs, "windows": [dict(r) for r in runs]}, sites, expected_runs=5)
|
||||
decided = _decisions(report)
|
||||
assert decided["good"][0] == "keep" and "good 5 of 5" in decided["good"][1]
|
||||
assert decided["blocked"][0] == "drop" and "blocked 5 of 5" in decided["blocked"][1]
|
||||
assert decided["unstable"][0] == "drop" and "not the same 5 of 5" in decided["unstable"][1]
|
||||
assert decided["shield"][0] == "keep" and "as data" in decided["shield"][1]
|
||||
assert decided["shield-unstable"][0] == "drop", "an unstable site is always dropped, whatever its class"
|
||||
assert report["kept"] == ["good", "shield"]
|
||||
assert report["linux"]["same"] == 3 and report["linux"]["good"] == 1
|
||||
text = judge_module.render_admission(report)
|
||||
assert "| blocked | giornale |" in text and "| drop |" in text and "| keep |" in text and "not the same 5 of 5" in text
|
||||
def _summary(tmp_path):
|
||||
return (tmp_path / "admission.md").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_admission_blocked_on_one_system_only_is_blocked_there():
|
||||
sites = [_site("a"), _site("b", "protetta")]
|
||||
linux = _passes({"a": cell(), "b": cell()})
|
||||
windows = _passes({"a": cell(status="4xx"), "b": cell(status="4xx")})
|
||||
decided = _decisions(judge_module.admission({"linux": linux, "windows": windows}, sites, expected_runs=5))
|
||||
assert decided["a"][0] == "drop" and "windows" in decided["a"][1]
|
||||
assert decided["b"][0] == "keep"
|
||||
def test_the_minimum_of_information_is_half_the_sites_rounded_up():
|
||||
assert [judge_module.information_minimum(n) for n in (0, 1, 2, 3, 14, 15, 20)] == [0, 1, 1, 2, 7, 8, 10]
|
||||
|
||||
|
||||
def test_admission_keeps_at_most_four_protected_and_twenty_in_all():
|
||||
sites = [_site("p%d" % i, "protetta") for i in range(6)] + [_site("c%02d" % i) for i in range(22)]
|
||||
runs = _passes({s["id"]: (cell(status="4xx") if s["id"] in ("p0", "p1") else cell()) for s in sites})
|
||||
report = judge_module.admission({"linux": runs}, sites, expected_runs=5)
|
||||
decided = _decisions(report)
|
||||
protected = [i for i in decided if i.startswith("p") and decided[i][0] == "keep"]
|
||||
assert sorted(protected) == ["p2", "p3", "p4", "p5"], "within the four, the good ones of the class come before the ones kept as data"
|
||||
assert decided["p0"][0] == "drop" and "4" in decided["p0"][1]
|
||||
assert len(report["kept"]) == 20
|
||||
assert [i for i in report["kept"] if i.startswith("c")] == ["c%02d" % i for i in range(16)], "the others fill the rest in the order of the list"
|
||||
assert decided["c16"][0] == "drop" and "20" in decided["c16"][1]
|
||||
assert report["linux"]["kept_good"] == 20 and report["min_informative"] == 17
|
||||
# a class with fewer good sites than four keeps the blocked ones as data, and they do not count
|
||||
blocked_first = judge_module.admission({"linux": _passes({s["id"]: (cell(status="4xx") if s["id"] in ("p0", "p1") else cell()) for s in sites[:2]})},
|
||||
sites[:2], expected_runs=5)
|
||||
assert blocked_first["kept"] == ["p0", "p1"] and blocked_first["linux"]["kept_good"] == 0
|
||||
def test_a_site_good_in_some_passes_stays_with_its_count_and_the_admission_is_green(tmp_path):
|
||||
sites = [_site("steady"), MEDIAMARKT, DUCKDUCKGO]
|
||||
linux = _passes({"steady": cell(), "mediamarkt": lambda i: MEDIAMARKT_CHALLENGE if i == 2 else cell(),
|
||||
"duckduckgo": lambda i: DUCKDUCKGO_TIMEOUT if i == 4 else cell()})
|
||||
windows = _passes({s["id"]: cell() for s in sites})
|
||||
assert judge_module.main(_admit_args(tmp_path, sites, {"linux": linux, "windows": windows})) == 0
|
||||
text = _summary(tmp_path)
|
||||
assert "4 of 5 on linux" in text and "5 of 5 on windows" in text
|
||||
assert "mediamarkt" in text and "duckduckgo" in text
|
||||
assert "min_informative" not in text, "the admission computes no minimum"
|
||||
|
||||
|
||||
def test_admission_min_informative_is_the_good_five_of_five_minus_three():
|
||||
sites = [_site("s%d" % i) for i in range(8)]
|
||||
big = judge_module.admission({"linux": _passes({s["id"]: cell() for s in sites})}, sites, expected_runs=5)
|
||||
assert big["linux"]["good"] == 8 and big["linux"]["min_informative"] == 5 and big["min_informative"] == 5
|
||||
assert "min_informative" in judge_module.render_admission(big)
|
||||
few = judge_module.admission({"linux": _passes({"s0": cell()})}, sites[:1], expected_runs=5)
|
||||
assert few["min_informative"] == 0, "never below 0"
|
||||
def test_a_site_never_good_on_a_system_and_not_protected_is_red(tmp_path):
|
||||
sites = [_site("steady"), _site("wrong-marker", "giornale")]
|
||||
linux = _passes({"steady": cell(), "wrong-marker": cell(marker=False)})
|
||||
windows = _passes({s["id"]: cell() for s in sites})
|
||||
assert judge_module.main(_admit_args(tmp_path, sites, {"linux": linux, "windows": windows})) == 1
|
||||
assert "wrong-marker" in _summary(tmp_path) and "never good on linux" in _summary(tmp_path)
|
||||
# the same site, good on Linux and never good on Windows, is just as red
|
||||
assert judge_module.main(_admit_args(tmp_path, sites, {"linux": windows, "windows": linux})) == 1
|
||||
assert "never good on windows" in _summary(tmp_path)
|
||||
|
||||
|
||||
def test_admission_refuses_a_run_that_is_missing():
|
||||
report = judge_module.admission({"linux": [{"site-a": cell()}] * 4}, [SITE], expected_runs=5)
|
||||
assert report["problems"] and report["linux"]["same"] == 0
|
||||
assert _decisions(report)["site-a"][0] == "drop"
|
||||
def test_a_protected_site_never_good_is_kept_up_to_four(tmp_path):
|
||||
def blocked(count):
|
||||
sites = [_site("steady")] + [_site("shield%d" % i, "protetta") for i in range(count)]
|
||||
cells = {s["id"]: (cell() if s["id"] == "steady" else cell(status="4xx", marker=False)) for s in sites}
|
||||
return sites, {"linux": _passes(cells), "windows": _passes(cells)}
|
||||
|
||||
sites, passes = blocked(4)
|
||||
assert judge_module.main(_admit_args(tmp_path, sites, passes)) == 0
|
||||
sites, passes = blocked(5)
|
||||
assert judge_module.main(_admit_args(tmp_path, sites, passes)) == 1
|
||||
assert "more than 4" in _summary(tmp_path)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("count, exit_code", [(20, 0), (21, 1)])
|
||||
def test_a_list_of_more_than_twenty_sites_is_red(tmp_path, count, exit_code):
|
||||
sites = [_site("s%02d" % i) for i in range(count)]
|
||||
cells = {s["id"]: cell() for s in sites}
|
||||
assert judge_module.main(_admit_args(tmp_path, sites, {"linux": _passes(cells), "windows": _passes(cells)})) == exit_code
|
||||
if exit_code:
|
||||
assert "more than 20" in _summary(tmp_path)
|
||||
|
||||
|
||||
def test_the_admission_is_red_for_a_pass_that_is_missing(tmp_path):
|
||||
cells = {"steady": cell()}
|
||||
assert judge_module.main(_admit_args(tmp_path, [_site("steady")], {"linux": _passes(cells, 4), "windows": _passes(cells)})) == 1
|
||||
assert "4 passes of stock, 5 expected" in _summary(tmp_path)
|
||||
|
||||
|
||||
def test_the_admission_of_an_empty_list_is_green(tmp_path):
|
||||
assert judge_module.main(_admit_args(tmp_path, [], {"linux": _passes({}), "windows": _passes({})})) == 0
|
||||
|
||||
|
||||
def test_a_list_with_a_min_informative_is_not_a_list(tmp_path):
|
||||
problems = judge_module.validate_sites({"min_informative": 3, "sites": [_site("a")]})
|
||||
assert any("min_informative" in p for p in problems), problems
|
||||
assert judge_module.validate_sites({"sites": [_site("a")]}) == []
|
||||
cells = {"a": cell()}
|
||||
with pytest.raises(SystemExit) as refused:
|
||||
judge_module.main(_admit_args(tmp_path, [_site("a")], {"linux": _passes(cells), "windows": _passes(cells)}, {"min_informative": 3}))
|
||||
assert "min_informative" in str(refused.value)
|
||||
|
||||
|
||||
def test_what_a_pass_adds_to_diagnose_a_marker_does_not_enter_the_judgement():
|
||||
@@ -270,12 +293,14 @@ def test_what_a_pass_adds_to_diagnose_a_marker_does_not_enter_the_judgement():
|
||||
# the judge: the extra field changes nothing, a good cell stays good and a diagnosed one is the same as one without
|
||||
assert judge_module.is_good(cell(diagnosis={"status": 200, "title": "x", "ids": []}))
|
||||
stock = runs_of("site-a", cell(), cell(), cell())
|
||||
with_diagnosis = judge(stock, runs_of("site-a", diagnosed, diagnosed, diagnosed), [SITE], 1)
|
||||
without = judge(stock, runs_of("site-a", cell(marker=False), cell(marker=False), cell(marker=False)), [SITE], 1)
|
||||
assert (with_diagnosis.verdict, with_diagnosis.table[0]["state"], with_diagnosis.table[0]["ours"]["why"]) == (without.verdict, without.table[0]["state"], without.table[0]["ours"]["why"])
|
||||
# the admission: five passes that differ only in the diagnosis are the same outcome
|
||||
runs = [{"site-a": cell(marker=False, diagnosis={"status": 403, "title": "t%d" % i, "ids": [str(i)]})} for i in range(5)]
|
||||
assert _decisions(judge_module.admission({"linux": runs}, [_site("site-a", "protetta")], expected_runs=5))["site-a"][0] == "keep"
|
||||
with_diagnosis = judge(stock, runs_of("site-a", diagnosed, diagnosed, diagnosed), [SITE])
|
||||
without = judge(stock, runs_of("site-a", cell(marker=False), cell(marker=False), cell(marker=False)), [SITE])
|
||||
assert (with_diagnosis.verdict, with_diagnosis.table[0]["state"], with_diagnosis.table[0]["ours"]["why"]) == \
|
||||
(without.verdict, without.table[0]["state"], without.table[0]["ours"]["why"])
|
||||
# the admission counts the good passes by the five fields: a diagnosis does not make a pass good or bad
|
||||
runs = [{"site-a": cell(marker=False, diagnosis={"status": 403, "title": "t%d" % i, "ids": [str(i)]})} for i in range(4)] + [{"site-a": cell()}]
|
||||
row = judge_module.admission({"linux": runs}, [_site("site-a", "protetta")], expected_runs=5)["linux"]["rows"][0]
|
||||
assert (row["good"], row["runs"]) == (1, 5)
|
||||
|
||||
|
||||
# --- an incomplete round is not a red cell, and an empty round did not measure ---------------------------------------------------------------
|
||||
@@ -283,84 +308,51 @@ def test_a_differing_cell_without_its_three_runs_is_an_incomplete_round_and_not_
|
||||
for runs in (1, 2):
|
||||
stock = [{"site-a": cell(), "site-b": cell()}] + [{"site-a": cell()}] * (runs - 1)
|
||||
ours = [{"site-a": cell(load="timeout"), "site-b": cell()}] + [{"site-a": cell(load="timeout")}] * (runs - 1)
|
||||
result = judge(stock, ours, [SITE, OTHER], 1)
|
||||
result = judge(stock, ours, [SITE, OTHER])
|
||||
assert row(result, "site-a")["state"] == "incomplete", runs
|
||||
assert result.red == 0, "the missing runs are the round's fault, not a cell that is red"
|
||||
assert result.verdict == "red" and result.exit_code == 1
|
||||
assert any("giro incompleto" in p and "site-a" in p for p in result.problems), result.problems
|
||||
# a cell that differs the other way round (stock not good, ours good) is asked three times too
|
||||
reverse = judge([{"site-a": cell(status="4xx"), "site-b": cell()}], [{"site-a": cell(), "site-b": cell()}], [SITE, OTHER], 1)
|
||||
reverse = judge([{"site-a": cell(status="4xx"), "site-b": cell()}], [{"site-a": cell(), "site-b": cell()}], [SITE, OTHER])
|
||||
assert row(reverse, "site-a")["state"] == "incomplete" and reverse.verdict == "red"
|
||||
# with its three runs the same cell is judged
|
||||
full = judge(runs_of("site-a", cell(), cell(), cell()), runs_of("site-a", cell(load="timeout"), cell(load="timeout"), cell()), [SITE], 1)
|
||||
full = judge(runs_of("site-a", cell(), cell(), cell()), runs_of("site-a", cell(load="timeout"), cell(load="timeout"), cell()), [SITE])
|
||||
assert row(full, "site-a")["state"] == "red" and not any("giro incompleto" in p for p in full.problems)
|
||||
|
||||
|
||||
def test_a_cell_that_did_not_differ_needs_no_more_runs():
|
||||
result = judge([{"site-a": cell(), "site-b": cell(status="4xx")}], [{"site-a": cell(), "site-b": cell(load="timeout")}], [SITE, OTHER], 1)
|
||||
result = judge([{"site-a": cell(), "site-b": cell(status="4xx")}], [{"site-a": cell(), "site-b": cell(load="timeout")}], [SITE, OTHER])
|
||||
assert [r["state"] for r in result.table] == ["green", "no_information"]
|
||||
assert result.verdict == "green" and result.problems == []
|
||||
|
||||
|
||||
def test_a_round_with_no_sites_did_not_measure():
|
||||
for stock, ours in (([{}], [{}]), ([], [])):
|
||||
for minimum in (0, 1, 5):
|
||||
result = judge(stock, ours, [], minimum)
|
||||
assert result.verdict == "red" and result.exit_code == 1, minimum
|
||||
assert any("il giro non ha misurato" in p for p in result.problems), result.problems
|
||||
result = judge(stock, ours, [])
|
||||
assert result.verdict == "red" and result.exit_code == 1
|
||||
assert any("il giro non ha misurato" in p for p in result.problems), result.problems
|
||||
|
||||
|
||||
def test_a_minimum_below_one_did_not_measure():
|
||||
stock, ours = runs_of("site-a", cell(), cell(), cell()), runs_of("site-a", cell(), cell(), cell())
|
||||
for minimum in (0, -1):
|
||||
result = judge(stock, ours, [SITE], minimum)
|
||||
assert result.verdict == "red" and result.exit_code == 1, minimum
|
||||
assert any("il giro non ha misurato" in p and "minimum" in p for p in result.problems), result.problems
|
||||
assert judge(stock, ours, [SITE], 1).verdict == "green"
|
||||
def _fifteen(informative):
|
||||
"""Fifteen sites, the first ``informative`` of them good for both browsers, the others blocked for both (no information, and not a difference)."""
|
||||
sites = [_site("s%02d" % i) for i in range(15)]
|
||||
run = {s["id"]: (cell() if i < informative else cell(status="4xx")) for i, s in enumerate(sites)}
|
||||
return judge([dict(run)], [dict(run)], sites)
|
||||
|
||||
|
||||
# --- the admission decides ----------------------------------------------------------------------------------------------------------------
|
||||
def _admit_files(tmp_path, sites, min_informative, cells_of_site):
|
||||
"""The file of the list and five passes of stock for each system, every pass with ``cells_of_site`` (site id -> cell)."""
|
||||
sites_file = tmp_path / "sites.json"
|
||||
sites_file.write_text(json.dumps({"min_informative": min_informative, "sites": sites}), encoding="utf-8")
|
||||
groups = []
|
||||
for label in ("linux", "windows"):
|
||||
files = []
|
||||
for n in range(1, 6):
|
||||
path = tmp_path / ("%s-%d.json" % (label, n))
|
||||
path.write_text(json.dumps({"browser": "stock", "cells": cells_of_site}), encoding="utf-8")
|
||||
files.append(str(path))
|
||||
groups += ["--os", label, *files]
|
||||
return ["admit", "--sites", str(sites_file), *groups, "--summary", str(tmp_path / "admission.md")]
|
||||
|
||||
|
||||
def test_the_admission_is_red_when_the_file_holds_a_site_the_admission_would_drop(tmp_path):
|
||||
sites = [_site("good-%d" % i) for i in range(5)] + [_site("blocked", "giornale")]
|
||||
cells = {s["id"]: cell() for s in sites}
|
||||
cells["blocked"] = cell(status="4xx")
|
||||
assert judge_module.main(_admit_files(tmp_path, sites, 2, cells)) == 1
|
||||
text = (tmp_path / "admission.md").read_text(encoding="utf-8")
|
||||
assert "blocked" in text and "would drop" in text
|
||||
# the list without that site, and with the minimum the admission computes, is green
|
||||
assert judge_module.main(_admit_files(tmp_path, sites[:5], 2, {s["id"]: cell() for s in sites[:5]})) == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("written, exit_code", [(0, 1), (3, 1), (9, 1), (2, 0), (1, 0)], ids=["zero", "above by one", "far above", "equal", "lower"])
|
||||
def test_the_admission_is_red_when_the_minimum_is_zero_or_above_the_computed_one(tmp_path, written, exit_code):
|
||||
sites = [_site("good-%d" % i) for i in range(5)] # 5 good five of five, minus 3: the admission computes 2
|
||||
assert judge_module.main(_admit_files(tmp_path, sites, written, {s["id"]: cell() for s in sites})) == exit_code
|
||||
assert "min_informative" in (tmp_path / "admission.md").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_the_admission_of_an_empty_list_is_green(tmp_path):
|
||||
assert judge_module.main(_admit_files(tmp_path, [], 0, {})) == 0
|
||||
def test_eight_informative_cells_out_of_fifteen_is_enough_and_seven_is_not():
|
||||
enough = _fifteen(8)
|
||||
assert enough.informative == 8 and enough.verdict == "green" and enough.problems == []
|
||||
short = _fifteen(7)
|
||||
assert short.informative == 7 and short.verdict == "red" and short.exit_code == 1
|
||||
assert any("il giro non ha misurato" in p and "minimum is 8" in p for p in short.problems), short.problems
|
||||
|
||||
|
||||
# --- the files ------------------------------------------------------------------------------------------------------------------------------
|
||||
def test_the_cli_reads_the_cells_and_writes_the_summary_and_the_exit_code(tmp_path):
|
||||
sites_file = tmp_path / "sites.json"
|
||||
sites_file.write_text(json.dumps({"min_informative": 1, "sites": [SITE]}), encoding="utf-8")
|
||||
sites_file.write_text(json.dumps({"sites": [SITE]}), encoding="utf-8")
|
||||
|
||||
def write(name, cells):
|
||||
path = tmp_path / name
|
||||
@@ -378,7 +370,7 @@ def test_the_cli_reads_the_cells_and_writes_the_summary_and_the_exit_code(tmp_pa
|
||||
|
||||
def test_the_sites_file_has_its_schema_and_every_site_a_class():
|
||||
data = json.loads((ROOT / "tests" / "realsites" / "sites.json").read_text(encoding="utf-8"))
|
||||
assert isinstance(data["min_informative"], int) and data["min_informative"] >= 0
|
||||
assert "min_informative" not in data and "min_informative" not in data["fields"], "the minimum is half the sites, computed by the judge"
|
||||
assert isinstance(data["sites"], list) and set(data["classes"]) == {"calma", "giornale", "negozio", "applicazione", "protetta"}
|
||||
for field in ("id", "url", "marker", "class"):
|
||||
assert data["fields"][field].strip()
|
||||
|
||||
@@ -147,7 +147,7 @@ def _run(tmp_path, monkeypatch, mode, extra=()):
|
||||
|
||||
monkeypatch.setattr(runner.metadata, "version", version)
|
||||
sites = tmp_path / "sites.json"
|
||||
sites.write_text(json.dumps({"min_informative": 1, "sites": SITES}), encoding="utf-8")
|
||||
sites.write_text(json.dumps({"sites": SITES}), encoding="utf-8")
|
||||
out = tmp_path / "cells.json"
|
||||
assert runner.main(["--browser", mode, "--sites", str(sites), "--out", str(out), *extra]) == 0
|
||||
return package, json.loads(out.read_text(encoding="utf-8"))
|
||||
|
||||
Reference in new issue
Block a user