magisk-zapret2/zapret2/scripts
Repository files (latest commit first)
Filename Latest commit message Latest commit date
loop-uh 05b9e0af8c Let one preset change be one transaction, not six conversations
Applying a preset was a conversation the app held with the module: snapshot
runtime.ini, ask whether the service was running, read runtime.ini again, stage
a candidate, commit it, verify it, then restart. Seven privileged round trips,
each paying a libsu round trip and a full common.sh sourcing, and — worse — the
rollback decisions lived in Kotlin. The app was deciding what the module's state
was, which is exactly what the typed machine payload exists to prevent.

zapret2/scripts/zapret-apply-preset.sh is now the single app-facing entry point
for that mutation. It sources the lifecycle helpers once, inherits the Android
lease through ZAPRET2_LIFECYCLE_TOKEN, and under that one lock it validates the
request with the packaged name policy, qualifies the preset through the same
compile-and-dry-run the preview machinery already owned, publishes the selection
through runtime-config.sh --commit-candidate, and hands the replacement to
zapret-start.sh --replace exactly as zapret-restart.sh does. Nothing here
reimplements a transaction that already had an owner.

Because the qualification happens before the commit, an incompatible preset is
now refused with the live selection untouched instead of being written, failed
and rolled back. A failed replacement restores the previous generation and says
so, and a rollback that cannot restore it says that instead — the payload
distinguishes the two, carrying the exact Z2_ERROR identity of whichever nested
stage refused. A service the user had stopped is still only saved to, measured
from the committed lifecycle receipt the way zapret-status.sh derives Z2_PROCESS.

The app projects that payload and nothing more. It keeps the stepwise flow for
one reason: a module generation installed before this entry point existed cannot
grow it, so the same round trip answers with an unsupported sentinel and the old
path runs. A payload that is truncated, inconsistent or written by a newer module
is never guessed at — the repository reads the published selection, and accepts
an application only when the live owner generation is the one this lease stamped,
which is the same proof the restart path already required.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 16:58:07 +03:00
..
lifecycle Measure the removal facts on the receipt uninstall failure prints too 2026-07-25 11:25:15 +03:00
command-builder.sh Fix the defects the third review round found 2026-07-25 03:58:55 +03:00
common.sh Let a locked transaction keep the owner fact it already proved 2026-07-25 15:45:23 +03:00
firewall-reconciler.sh Name the extension the kernel refused 2026-07-25 14:55:31 +03:00
package-contract.sh Let one preset change be one transaction, not six conversations 2026-07-25 16:58:07 +03:00
runtime-config.sh 2.0.8 2026-07-24 19:32:25 +03:00
runtime-init.sh 2.0.1 2026-07-24 00:43:14 +03:00
sync-winws2-presets.py 2.0.8 2026-07-24 19:32:25 +03:00
zapret-apply-preset.sh Let one preset change be one transaction, not six conversations 2026-07-25 16:58:07 +03:00
zapret-full-rollback.sh Let a teardown keep the proof it produced 2026-07-25 13:22:01 +03:00
zapret-restart.sh the big penis 2026-07-22 13:50:44 +03:00
zapret-start.sh Build the ruleset from what the kernel has, not from what it should have 2026-07-25 14:01:34 +03:00
zapret-status.sh Carry the IPv6 reservation across every boundary that reports it 2026-07-25 11:09:07 +03:00
zapret-stop.sh Let a stop report its own reservation on its own receipt 2026-07-25 11:30:35 +03:00