3"""Process-authority mutation catalog for HIL convergence selftests."""
5from __future__
import annotations
7import hil_convergence_safety_process_source_fixtures
as process_source_fixtures
8import hil_convergence_safety_runtime_fixtures
as runtime_fixtures
9import hil_convergence_safety_source_fixtures
as source_fixtures
11Mutation = tuple[str, str, str, str]
13_BOUND_EXIT_MUTATION_LABELS = frozenset(
15 "descriptor-bound wrong entry refusal removed",
16 "descriptor-bound canonical entry proof removed",
17 "parent-death watchdog selftest removed",
18 "live-supervisor watchdog deadline selftest removed",
19 "closed death descriptor selftest removed",
20 "bound-exit supervisor failure cases removed",
21 "stall fixture descendant marker removed",
22 "hardlink publication group proof removed",
23 "missing payload entry proof removed",
24 "nested phase parent identity binding removed",
25 "nested phase root receipt binding removed",
26 "supervisor failure payload regressed to full entry",
27 "supervisor launcher interpreter changed",
28 "supervisor launcher no-bytecode flag removed",
29 "supervisor launcher isolation flag removed",
30 "supervisor launcher site-import refusal removed",
31 "supervisor launcher bound program removed",
32 "supervisor launcher bound entry environment removed",
33 "supervisor launcher process descriptor option removed",
34 "supervisor launcher process descriptor changed",
35 "supervisor launcher cases descriptor option removed",
36 "supervisor launcher cases descriptor changed",
41def _process_authority_mutations_1() -> tuple[Mutation, ...]:
42 """Return one bounded group of process-authority mutations."""
45 "case signal dispatch image lock load removed",
47 "\n load_image_lock_selftest\n selftest_case_signal_child ",
48 "\n selftest_case_signal_child ",
51 "image lock jobs-table lookup bypassed",
52 "devcontainer_image_selftest",
53 " done < <(jobs -r -l)",
54 " done < <(printf '[1] 1 Running\\n')",
57 "descriptor-bound wrong entry refusal removed",
58 "devcontainer_image_selftest",
59 ' if output="$(RA8_SELFTEST_BOUND_ENTRY="$wrong_entry" \\\n',
60 ' if output="$(RA8_SELFTEST_BOUND_ENTRY="" \\\n',
63 "descriptor-bound canonical entry proof removed",
64 "devcontainer_image_selftest",
65 ' output="$(RA8_SELFTEST_BOUND_ENTRY="$SCRIPT_DIR/devcontainer_image.sh" \\\n',
66 ' output="$(RA8_SELFTEST_BOUND_ENTRY="" \\\n',
69 "group selection explicit success removed",
70 "devcontainer_image_selftest",
72 ' select_selftest_group_id "$tmp" "$rejected" >/dev/null 2>&1 && return 1\n'
75 (
' select_selftest_group_id "$tmp" "$rejected" >/dev/null 2>&1 && return 1\n done'),
80def _process_authority_mutations_1b() -> tuple[Mutation, ...]:
81 """Return the second bounded group of process-authority mutations."""
84 "image lock verified PID signal reverted to stale jobspec",
85 "devcontainer_image_selftest",
86 ' builtin kill -"$signal" "$child"',
87 ' builtin kill -"$signal" "$job_spec"',
90 "signal controller PID local renamed to controller",
91 "devcontainer_image_signal_selftest",
93 ' local launcher_mode="${5:-}" controller_pid pending '
94 'ready="$3/controller-launcher.ready"'
97 ' local launcher_mode="${5:-}" controller pending '
98 'ready="$3/controller-launcher.ready"'
102 "image lock controller group signal reduced to direct PID",
103 "devcontainer_image_signal_selftest",
104 ' signal_owned_controller_group "$signal" "$controller" ||',
105 ' signal_owned_live_child "$signal" "$controller" ||',
108 "image lock controller group authorization removed",
109 "devcontainer_image_signal_selftest",
110 ' controller_group_signal_is_authorized "$controller" || return 1',
114 "image lock controller group target reduced to PID",
115 "devcontainer_image_signal_selftest",
116 ' builtin kill -"$signal" -- "-$controller"',
117 ' builtin kill -"$signal" -- "$controller"',
120 "allocation KILL direct-child guard removed",
121 "devcontainer_image_selftest_cases",
122 ' signal_owned_live_child KILL "$child" ||',
126 "suite-root nested allocation selection removed",
127 "devcontainer_image_selftest",
129 ' if [[ -n "$SELFTEST_SUITE_ROOT" ]]; then\n selftest_suite_'
130 "root_is_safe || return 1"
132 " if false; then\n true",
137def _process_authority_mutations_2() -> tuple[Mutation, ...]:
138 """Return one bounded group of process-authority mutations."""
141 "suite-root parent grammar reverted to ten characters",
142 "devcontainer_image_selftest",
143 ' "$suffix" =~ ^[0-9a-f]{32}$ && ! -L "$canonical" && -d "$canonical" &&',
144 ' "$suffix" =~ ^[[:alnum:]]{10}$ && ! -L "$canonical" && -d "$canonical" &&',
147 "portable Bash 3 shell identity replaced by BASHPID",
148 "devcontainer_image_selftest",
149 ' local destination="$1" value="$$:${BASH_SUBSHELL:-0}"',
150 ' local destination="$1" value="$BASHPID"',
153 "fresh allocation signal process bypassed",
154 "devcontainer_image_selftest_cases",
156 ' if /bin/bash -p -- "$SCRIPT_DIR/devcontainer_image.sh" \\\n '
157 ' --selftest-allocation-checkpoint-child "$phase" "$receipt" \\\n'
162 "fresh case signal process bypassed",
163 "devcontainer_image_signal_selftest",
165 ' if /bin/bash -p -- "$SCRIPT_DIR/devcontainer_image.sh" \\\n '
166 ' --selftest-case-signal-child "$signal" "$tmp" "$SELFTEST_TMP_'
174def _process_authority_mutations_3() -> tuple[Mutation, ...]:
175 """Return one bounded group of process-authority mutations."""
178 "selftest atomic directory allocation replaced by mktemp create",
179 "devcontainer_image_selftest",
180 ' if (umask 077 && mkdir -m 0700 -- "$candidate"); then',
181 (
' if SELFTEST_TMP_DIR="$(mktemp -d "$SELFTEST_TMP_ROOT/unsafe.XXXXXXXXXX")"; then'),
184 "selftest suite-root binding removed",
185 "devcontainer_image_selftest_cases",
186 ' establish_selftest_suite_root || die "selftest: could not bind its suite root"',
190 "selftest suite-root completion proof removed",
191 "devcontainer_image_selftest_cases",
192 ' clear_selftest_suite_root || die "selftest: suite-root cleanup did not complete"',
196 "worker group direct-child authority removed",
197 "devcontainer_image_lock_selftest",
199 ' worker_group_is_safe && [[ "$SELFTEST_WORKER_PGID" == "$SELF'
200 'TEST_WORKER_PID" ]] &&\n shell_owns_live_child "$SELFTEST_WO'
203 " worker_group_is_safe",
208def _process_authority_mutations_4() -> tuple[Mutation, ...]:
209 """Return one bounded group of process-authority mutations."""
212 "shared worker process-group binding removed",
213 "devcontainer_image_lock_selftest",
214 ' [[ "$pgid" == "$PPID" && "$pgid" != "$pid" ]] ||',
215 ' [[ "$pgid" == "$pid" ]] ||',
218 "isolated worker process-group binding removed",
219 "devcontainer_image_lock_selftest",
221 ' [[ "$pgid" == "$pid" ]] || die "selftest isolated worker i'
222 's not its group leader"'
227 "worker leader TERM resistance removed",
228 "devcontainer_image_lock_selftest",
230 " pre-ready-hang | signal-controller | post-ready-build-hang"
231 ") trap '' HUP INT TERM ;;"
233 " pre-ready-hang | signal-controller | post-ready-build-hang) true ;;",
236 "process-enumeration failure scenario removed",
237 "devcontainer_image_selftest_cases",
238 ' selftest_ps_failure_cleanup "$tmp"',
244def _process_authority_mutations_5() -> tuple[Mutation, ...]:
245 """Return one bounded group of process-authority mutations."""
248 "rebound process-group refusal removed",
249 "devcontainer_image_lock_selftest",
251 ' ! worker_group_signal_is_authorized ||\n die "selftest: re'
252 'bound numeric process group gained signal authority"'
257 "process-enumeration descendant proof removed",
258 "devcontainer_image_lock_selftest",
260 ' assert_no_surviving_descendants ||\n die "selftest: repeat'
261 'ed ps failure left a signal-ignoring descendant"'
266 "bound-exit supervisor pre-spawn signal block removed",
267 "devcontainer_image_selftest_supervisor",
268 "old_mask = signal.pthread_sigmask(signal.SIG_BLOCK, MANAGED_SIGNALS)",
272 "bound-exit payload signal reset removed",
273 "devcontainer_image_selftest_supervisor",
275 " _reset_managed_signals()\n try:\n os.e"
276 "xecl( # noqa: S606 -- fixed Bash and descriptor-bound entry"
279 " try:\n os.execl( # noqa: S606 -- fixed prot"
280 "ected Bash and descriptor-bound entry"
286def _process_authority_mutations_6() -> tuple[Mutation, ...]:
287 """Return one bounded group of process-authority mutations."""
290 "bound-exit parent-death pipe removed",
291 "devcontainer_image_selftest_process",
292 "self.death_read, self.death_write = os.pipe2(os.O_CLOEXEC)",
293 "self.death_read, self.death_write = (None, None)",
296 "bound-exit parent-death descriptor propagation removed",
297 "devcontainer_image_selftest_process",
298 "inherited = [source_descriptor, self.death_read, root_descriptor]",
299 "inherited = [source_descriptor, root_descriptor]",
302 "bound-exit controller interpreter changed",
303 "devcontainer_image_selftest_process",
304 " argv = (\n sys.executable,",
305 ' argv = (\n os.environ["PYTHON"],',
308 "bound-exit controller no-bytecode isolation removed",
309 "devcontainer_image_selftest_process",
310 ' argv = (\n sys.executable,\n "-B",',
311 ' argv = (\n sys.executable,\n "--version",',
316def _process_authority_mutations_7() -> tuple[Mutation, ...]:
317 """Return one bounded group of process-authority mutations."""
320 "bound-exit controller isolated-mode flag removed",
321 "devcontainer_image_selftest_process",
322 ' argv = (\n sys.executable,\n "-B",\n "-I",',
323 " argv = (\n sys.executable,\n"
324 ' "-B",\n "--version",',
327 "bound-exit controller site-import refusal removed",
328 "devcontainer_image_selftest_process",
329 ' argv = (\n sys.executable,\n "-B",\n'
331 ' argv = (\n sys.executable,\n "-B",\n'
332 ' "-I",\n "--version",',
335 "bound-exit controller immutable helper path removed",
336 "devcontainer_image_selftest_process",
337 ' argv = (\n sys.executable,\n "-B",\n'
338 ' "-I",\n "-S",\n SUPERVISOR_PROGRAM,\n'
340 ' argv = (\n sys.executable,\n "-B",\n'
342 ' "scripts/ci/devcontainer_image_selftest_supervisor.py",\n'
346 "bound-exit payload fixed Bash path removed",
347 "devcontainer_image_selftest_supervisor",
354def _process_authority_mutations_8() -> tuple[Mutation, ...]:
355 """Return one bounded group of process-authority mutations."""
358 "bound-exit payload protected Bash mode removed",
359 "devcontainer_image_selftest_supervisor",
364 "bound-exit parent-death polling removed",
365 "devcontainer_image_selftest_supervisor",
366 "ready, _, _ = select.select((death_descriptor,), (), (), POLL_SECONDS)",
370 "bound-exit controller group cleanup reduced to controller PID",
371 "devcontainer_image_selftest_supervisor",
372 "os.killpg(os.getpgrp(), signal.SIGKILL)",
373 "os.kill(os.getpid(), signal.SIGKILL)",
376 "bound-exit terminal payload is polled after reap",
377 "devcontainer_image_selftest_supervisor",
378 " if not published:\n child_status = _poll_payload(child)",
379 " if True:\n child_status = _poll_payload(child)",
384def _process_authority_mutations_9() -> tuple[Mutation, ...]:
385 """Return one bounded group of process-authority mutations."""
388 "bound-exit controller liveness proof removed",
389 "devcontainer_image_selftest_supervisor",
390 ' supervisor.require_running("after publishing status")',
394 "bound receipt hardlink refusal removed",
395 "devcontainer_image_selftest_supervisor",
396 " or metadata.st_nlink != 1",
400 "bound receipt owner binding removed",
401 "devcontainer_image_selftest_supervisor",
402 " or metadata.st_uid != os.getuid()",
406 "bound receipt mode binding removed",
407 "devcontainer_image_selftest_supervisor",
408 " or stat.S_IMODE(metadata.st_mode) != RECEIPT_MODE",
414def _process_authority_mutations_10() -> tuple[Mutation, ...]:
415 """Return one bounded group of process-authority mutations."""
418 "bound receipt truncation removed",
419 "devcontainer_image_selftest_supervisor",
420 " os.ftruncate(descriptor, 0)",
424 "status receipt no-follow descriptor removed",
425 "devcontainer_image_selftest_supervisor",
426 " descriptor = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)",
427 " descriptor = os.open(path, os.O_RDONLY)",
430 "process stat bytes parser replaced with text decoding",
431 "devcontainer_image_selftest_process",
432 '(entry / "stat").read_bytes()',
433 '(entry / "stat").read_text(encoding="ascii").encode("ascii")',
436 "emergency cleanup process identity check removed",
437 "devcontainer_image_selftest_supervisor_cases",
438 " if not _identity_is_current(authority):\n return False",
439 " if False:\n return False",
444def _process_authority_mutations_11() -> tuple[Mutation, ...]:
445 """Return one bounded group of process-authority mutations."""
448 "parent-death watchdog selftest removed",
449 "devcontainer_image_selftest",
451 ' run_bound_exit_supervisor --selftest-parent-death "$stall_entr'
452 'y" "$tmp" \\\n "$SELFTEST_TMP_IDENTITY" || {'
457 "live-supervisor watchdog deadline selftest removed",
458 "devcontainer_image_selftest",
460 ' run_bound_exit_supervisor --selftest-watchdog-expiry "$stall_'
461 'entry" "$tmp" \\\n "$SELFTEST_TMP_IDENTITY" || {'
466 "closed death descriptor selftest removed",
467 "devcontainer_image_selftest",
469 ' run_bound_exit_supervisor --selftest-closed-death-fd "$stall_'
470 'entry" "$tmp" \\\n "$SELFTEST_TMP_IDENTITY" || {'
475 "controller close failure bypasses group KILL",
476 "devcontainer_image_selftest_supervisor",
478 " for private_descriptor in (death_descriptor, root_descriptor):\n"
479 " with suppress(OSError):\n"
480 " os.close(private_descriptor)\n"
481 " os.killpg(os.getpgrp(), signal.SIGKILL)"
484 " for private_descriptor in (death_descriptor, root_descriptor):\n"
485 " os.close(private_descriptor)\n"
486 " os.killpg(os.getpgrp(), signal.SIGKILL)"
492def _process_authority_mutations_12() -> tuple[Mutation, ...]:
493 """Return one bounded group of process-authority mutations."""
496 "bound-exit group cleanup reduced to leader PID",
497 "devcontainer_image_selftest_process",
498 "os.killpg(leader, signal.SIGKILL)",
499 "os.kill(leader, signal.SIGKILL)",
502 "bound-exit cleanup signal block moved after authority checks",
503 "devcontainer_image_selftest_process",
505 " signal.pthread_sigmask(signal.SIG_BLOCK, MANAGED_SIGNA"
506 "LS)\n if self.authority_lost:"
509 " if self.authority_lost:\n signal"
510 ".pthread_sigmask(signal.SIG_BLOCK, MANAGED_SIGNALS)"
514 "bound-exit status atomic publication removed",
515 "devcontainer_image_selftest_supervisor",
516 "os.link(temporary, path, follow_symlinks=False)",
517 'path.write_text(value, encoding="ascii")',
520 "bound-exit supervisor failure cases removed",
521 "devcontainer_image_selftest",
522 "selftest_bound_exit_supervisor_failures() {",
523 "selftest_bound_exit_supervisor_failures_disabled() {",
528def _process_authority_mutations_13() -> tuple[Mutation, ...]:
529 """Return the hidden supervisor runtime-proof mutations."""
532 "closed death descriptor source fd propagation removed",
533 "devcontainer_image_selftest_supervisor_cases",
534 " inherited = [source_descriptor, root_descriptor]",
535 " inherited = [root_descriptor]",
538 "closed death descriptor expected KILL status weakened",
539 "devcontainer_image_selftest_supervisor_cases",
540 "return 0 if observed and cleaned and child.returncode == -signal.SIGKILL else 1",
541 "return 0 if observed and cleaned and child.returncode is not None else 1",
544 "watchdog expiry pre-release proof removed",
545 "devcontainer_image_selftest_supervisor_cases",
547 " pre_release_proven = killed_receipt and members is not None\n"
548 " pre_release_proven = pre_release_proven and members <= {authority.pid}"
550 " pre_release_proven = True",
553 "watchdog expiry test deadline extended",
554 "devcontainer_image_selftest_supervisor_cases",
555 "launch = ControllerLaunch(entry, status, SELFTEST_WATCHDOG_TIMEOUT_SECONDS)",
556 "launch = ControllerLaunch(entry, status, WATCHDOG_TIMEOUT_SECONDS)",
559 "hardlink publication preservation proof removed",
560 "devcontainer_image_selftest_supervisor_cases",
562 'preserved = victim.read_bytes() == b"preserve\\n" and '
563 "victim.stat().st_nlink == HARDLINK_COUNT"
568 "missing payload exec status weakened",
569 "devcontainer_image_selftest_supervisor",
570 " except OSError:\n os._exit(127)",
571 " except OSError:\n os._exit(1)",
576def _process_authority_mutations_15() -> tuple[Mutation, ...]:
577 """Return public Bash dispatch mutations after the supervisor split."""
580 "hardlink publication group proof removed",
581 "devcontainer_image_selftest",
583 ' run_bound_exit_supervisor --selftest-hardlink-bound "$stall_'
584 'entry" "$tmp" \\\n "$SELFTEST_TMP_IDENTITY" || {'
589 "missing payload entry proof removed",
590 "devcontainer_image_selftest",
592 ' run_bound_exit_supervisor --selftest-missing-entry "$tmp" '
593 '"$SELFTEST_TMP_IDENTITY" || {'
600def _process_authority_mutations_14() -> tuple[Mutation, ...]:
601 """Return the watchdog observation and runner-lifetime mutations."""
604 "watchdog exact KILL receipt weakened",
605 "devcontainer_image_selftest_supervisor_cases",
606 "killed = result.si_code == os.CLD_KILLED and result.si_status == signal.SIGKILL",
607 "killed = result is not None",
610 "watchdog runner liveness proof removed",
611 "devcontainer_image_selftest_supervisor_cases",
612 "if pre_release_proven and runner_is_live:",
613 "if pre_release_proven:",
616 "watchdog post-release group proof removed",
617 "devcontainer_image_selftest_supervisor_cases",
618 "watchdog_succeeded = expected and _wait_group_gone(authority.group)",
619 "watchdog_succeeded = expected",
622 "watchdog post-reap PID guard conflated with expected status",
623 "devcontainer_image_selftest_supervisor_cases",
625 " runner_status = _wait_direct_child_status(runner)\n"
626 " runner_reaped = runner_status is not None\n"
627 " expected = runner_status == STALL_STATUS"
630 " runner_status = _wait_direct_child_status(runner)\n"
631 " runner_reaped = runner_status == STALL_STATUS\n"
632 " expected = runner_status == STALL_STATUS"
636 "hardlink runner post-reap signal guard removed",
637 "devcontainer_image_selftest_supervisor_cases",
639 " if not hardlink_runner_reaped:\n"
640 " with suppress(ProcessLookupError):"
642 " if True:\n with suppress(ProcessLookupError):",
645 "stall fixture descendant marker removed",
646 "devcontainer_image_selftest",
647 ' "exec -a \\"\\$0\\" /bin/sleep 30" >"$destination") || return 1',
648 ' "/bin/sleep 30" >"$destination") || return 1',
653def _main_descriptor_mutations() -> tuple[Mutation, ...]:
654 """Return mutations for descriptor-bound main-script path authority."""
657 "main descriptor basename predicate removed",
658 "devcontainer_image",
659 ' "$ra8_bound_entry" == /*/devcontainer_image.sh &&\n',
663 "main descriptor file and link predicate removed",
664 "devcontainer_image",
665 ' -f "$ra8_bound_entry" && ! -L "$ra8_bound_entry" &&\n',
669 "main descriptor canonical path predicate removed",
670 "devcontainer_image",
671 ' [[ "$ra8_bound_entry" == "$SCRIPT_DIR/devcontainer_image.sh" ]] || {\n',
677def _helper_parent_mutations() -> tuple[Mutation, ...]:
678 """Return mutations for canonical helper-parent path bindings."""
680 (
"lifecycle",
"devcontainer_image_selftest",
"SELFTEST_HELPER_PARENT_DIR"),
681 (
"cases",
"devcontainer_image_selftest_cases",
"SELFTEST_CASES_PARENT_DIR"),
682 (
"signal",
"devcontainer_image_signal_selftest",
"SELFTEST_SIGNAL_PARENT_DIR"),
683 (
"lock",
"devcontainer_image_lock_selftest",
"SELFTEST_LOCK_HELPER_PARENT_DIR"),
687 f
"{label} helper canonical parent proof removed",
690 ' "${DEVCONTAINER_SELFTEST_PARENT:-}" == '
691 f
'"${variable}/devcontainer_image.sh" &&\n'
693 (f
' "${{DEVCONTAINER_SELFTEST_PARENT:-}}" == "${variable}/not-main.sh" &&\n'),
695 for label, key, variable
in specifications
699def _entry_descriptor_mutations() -> tuple[Mutation, ...]:
700 """Return mutations for the reserved descriptor execution namespace."""
701 key =
"devcontainer_image_selftest_process"
704 "entry descriptor floor lowered into helper range",
706 "ENTRY_EXEC_DESCRIPTOR_MINIMUM = 64",
707 "ENTRY_EXEC_DESCRIPTOR_MINIMUM = 8",
710 "entry descriptor reservation call removed",
712 " descriptor = _reserve_entry_descriptor(descriptor)",
713 " descriptor = descriptor",
716 "entry descriptor propagation removed",
718 " inherited.append(self.entry_descriptor)",
722 "entry descriptor high-FD duplication removed",
725 " reserved = fcntl.fcntl(\n"
727 " fcntl.F_DUPFD_CLOEXEC,\n"
728 " ENTRY_EXEC_DESCRIPTOR_MINIMUM,\n"
731 " reserved = os.dup(descriptor)",
734 "entry descriptor original close removed",
736 " os.close(descriptor)",
740 "entry descriptor CLOEXEC readback removed",
742 " descriptor_flags = fcntl.fcntl(reserved, fcntl.F_GETFD)",
743 " descriptor_flags = fcntl.FD_CLOEXEC",
748def _entry_descriptor_predicate_mutations() -> tuple[Mutation, ...]:
749 """Return the two independent reserved-descriptor predicate mutations."""
750 key =
"devcontainer_image_selftest_process"
753 "entry descriptor reservation bound removed",
755 " if reserved < ENTRY_EXEC_DESCRIPTOR_MINIMUM or not (",
759 "entry descriptor CLOEXEC predicate removed",
762 " if reserved < ENTRY_EXEC_DESCRIPTOR_MINIMUM or not "
763 "(descriptor_flags & fcntl.FD_CLOEXEC):"
765 (
" if reserved < ENTRY_EXEC_DESCRIPTOR_MINIMUM or not (descriptor_flags >= 0):"),
770def _tmp_root_mutations() -> tuple[Mutation, ...]:
771 """Return mutations for canonical and nested allocation-parent proofs."""
772 key =
"devcontainer_image_selftest_cases"
775 "allocation parent proof call removed",
777 ' selftest_temp_root_is_safe || die "selftest: allocation parent authority is unsafe"',
781 "canonical tmp special-mode proof removed",
783 ' "$(file_special_mode "$SELFTEST_TMP_ROOT")" == "1777" ]]',
784 ' -d "$SELFTEST_TMP_ROOT" ]]',
787 "nested suite-root safety proof removed",
790 ' "$SELFTEST_TMP_ROOT_IDENTITY" == "$SELFTEST_SUITE_ROOT_IDENTITY" ]] &&\n'
791 " selftest_suite_root_is_safe"
794 ' "$SELFTEST_TMP_ROOT_IDENTITY" == "$SELFTEST_SUITE_ROOT_IDENTITY" ]] &&\n'
801def _suite_anchor_validation_mutations() -> tuple[Mutation, ...]:
802 """Bind suite-anchor path, identity, owner, mode, and depth validation."""
803 lifecycle =
"devcontainer_image_selftest"
806 "suite anchor canonical path binding removed",
808 ' "$anchor" == "$canonical/ra8-devcontainer-image-selftest.$suffix" &&',
812 "suite anchor identity binding removed",
814 ' "$(file_identity "$anchor")" == "$SELFTEST_SUITE_ANCHOR_IDENTITY" &&',
818 "suite anchor owner binding removed",
820 ' "$(file_owner_id "$anchor")" == "$SELFTEST_SUITE_ANCHOR_OWNER_UID" &&',
824 "suite anchor mode binding removed",
826 ' "$(file_mode "$anchor")" == "700" ]]',
830 "suite anchor child depth binding removed",
832 ' [[ "$suite" == "$SELFTEST_SUITE_ANCHOR/ra8-devcontainer-image-selftest.$suffix" &&',
838def _suite_anchor_flow_mutations() -> tuple[Mutation, ...]:
839 """Bind suite-anchor production, dispatch, and receipt authority."""
840 lifecycle =
"devcontainer_image_selftest"
841 cases =
"devcontainer_image_selftest_cases"
844 "suite anchor producer path removed",
846 ' SELFTEST_SUITE_ANCHOR="$SELFTEST_TMP_DIR"',
847 ' SELFTEST_SUITE_ANCHOR=""',
850 "suite anchor producer identity removed",
852 ' SELFTEST_SUITE_ANCHOR_IDENTITY="$SELFTEST_TMP_IDENTITY"',
853 ' SELFTEST_SUITE_ANCHOR_IDENTITY=""',
856 "suite anchor producer owner removed",
858 ' SELFTEST_SUITE_ANCHOR_OWNER_UID="$SELFTEST_TMP_OWNER_UID"',
859 ' SELFTEST_SUITE_ANCHOR_OWNER_UID=""',
862 "suite anchor receiver path removed",
864 ' SELFTEST_SUITE_ANCHOR="$3"',
865 ' SELFTEST_SUITE_ANCHOR=""',
868 "suite anchor receiver identity removed",
870 ' SELFTEST_SUITE_ANCHOR_IDENTITY="$4"',
871 ' SELFTEST_SUITE_ANCHOR_IDENTITY=""',
874 "suite anchor receiver owner removed",
876 ' SELFTEST_SUITE_ANCHOR_OWNER_UID="$5"',
877 ' SELFTEST_SUITE_ANCHOR_OWNER_UID=""',
880 "suite anchor dispatcher propagation removed",
882 ' "$tmp" "$SELFTEST_TMP_IDENTITY" "$SELFTEST_SUITE_ANCHOR" \\\n'
883 ' "$SELFTEST_SUITE_ANCHOR_IDENTITY" "$SELFTEST_SUITE_ANCHOR_OWNER_UID"; then',
884 ' "$tmp" "$SELFTEST_TMP_IDENTITY" "" "" ""; then',
889def _process_authority_mutations() -> tuple[Mutation, ...]:
890 """Return the unassigned image-lock process-authority mutation catalog."""
892 *_process_authority_mutations_1(),
893 *_process_authority_mutations_1b(),
894 *_process_authority_mutations_2(),
895 *_process_authority_mutations_3(),
896 *_process_authority_mutations_4(),
897 *_process_authority_mutations_5(),
898 *_process_authority_mutations_6(),
899 *_process_authority_mutations_7(),
900 *_process_authority_mutations_8(),
901 *_process_authority_mutations_9(),
902 *_process_authority_mutations_10(),
903 *_process_authority_mutations_11(),
904 *_process_authority_mutations_12(),
905 *_process_authority_mutations_13(),
906 *_process_authority_mutations_14(),
907 *_process_authority_mutations_15(),
908 *_main_descriptor_mutations(),
909 *_helper_parent_mutations(),
910 *_entry_descriptor_mutations(),
911 *_entry_descriptor_predicate_mutations(),
912 *_tmp_root_mutations(),
913 *_suite_anchor_validation_mutations(),
914 *_suite_anchor_flow_mutations(),
915 *runtime_fixtures.process_authority_mutations(),
916 *source_fixtures.process_authority_mutations(),
917 *process_source_fixtures.process_authority_mutations(),
921def process_authority_mutations() -> tuple[Mutation, ...]:
922 """Assign every mutation to the source module that owns its target bytes."""
926 "devcontainer_image_bound_exit_selftest"
927 if label
in _BOUND_EXIT_MUTATION_LABELS
932 for label, key, old, new
in _process_authority_mutations()