feat(apply): support staged strategy groups

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-10 09:24:43 +03:00
1 parent 468532dc8f
commit 2d4e4878ae
9 files changed
+776 -71

No files matched your search

+27 -7
View File
@@ -1,6 +1,6 @@
# Fresh managed-test target contract (not deployed)
`managed init|status|apply` is exclusively for a **new dedicated container**
`managed init|status|active-ids|apply` is exclusively for a **new dedicated container**
which owns its entire config. The existing/dev/production container must refuse
these commands. A role env or CLI-created identity is not enough. Provisioning
must supply all of the following before any managed command can run:
@@ -36,14 +36,18 @@ fragment**, not this full-config adapter. No such integration is implemented.
# Only after fresh-target provisioning establishes the entire contract above:
zapret-autotune managed init
zapret-autotune managed status
zapret-autotune managed apply --frontend-candidate 1 # bootstrap before discovery
zapret-autotune managed active-ids # JSON for supervisor; no health probe
zapret-autotune managed apply --frontend-candidate 1 --googlevideo-candidate 2
```
Init refuses nonempty directories except an exact private disabled baseline;
it never overwrites/adopts another config. It creates identity, journal and
backup; repeated initialization, symlinks, hardlinks, public/unowned files and
unsafe ancestors are refused. Status reports committed generation/hash/groups,
not config, secrets or live health; drift and pending transactions fail closed.
unsafe ancestors are refused. Status reports generation/hash/transaction state,
validated active IDs/groups and unresolved groups, not config, secrets or live
health. Pending or unverifiable state reports unknown groups and no active IDs;
drift fails closed. `active-ids` fails closed on pending or unverifiable state.
Init/status do not reload or probe, but both verify runtime and listener ownership.
All managed commands verify that the expected IPv4 listener is owned by a running
@@ -55,8 +59,14 @@ but is never used inside the target. The standalone `health youtube` command
retains its separate generic loopback contract; managed activation is stricter.
Ambient proxies/direct fallback are disabled. Player API OK is **not playback**.
Apply requires distinct positive qualified frontend/exact-GGC SQLite candidate
IDs, complete endpoint × TLS evidence and inert shell-safe arguments. It opens
Apply accepts one or both frontend/exact-GGC SQLite candidate IDs, requiring
distinct positive IDs, at most one per group, complete endpoint × TLS evidence
and inert shell-safe arguments. The arguments are the full desired active set,
not patches: omitting a group removes it. Frontend-only bootstrap supports Player
API discovery before GGC scanning; GGC-only is also permitted. No missing profile
is invented, and missing groups remain unresolved. Player API OK never asserts
GGC/video playback or full-profile health. A supervisor can read `managed active-ids`
and explicitly retain the other group while replacing a failed one. It opens
the candidate DB read-only via `ZAPRET_AUTOTUNE_DB`; candidates are not active
state. Bindings/inputs are checked before pending transaction reconciliation.
Production reload is exclusively the fixed argv
@@ -77,7 +87,17 @@ restoring an earlier active config reinstates its firewall/daemon state.
The config replacement is atomic; the init script's stop/start sequence is
not a zero-interruption or kernel-atomic firewall transaction.
The transaction engine is unchanged: same-directory staging/fsync/rename,
Journal v2 persists complete committed and pending candidate ID lists alongside
their hashes. Commit promotes the pending list; rollback/crash reconciliation
restores the prior list and hash. Reporting validates qualification/groups and
exact rendered hash against the read-only DB. Status reports invalid refs as
unresolved; `active-ids` and activation fail closed on invalid refs.
Legacy v1 journals keep the exact deployed hash and unknown IDs: status marks
both groups unresolved, and active-ids refuses to infer a list. A guarded full-set
apply upgrades to v2 only after the exact old hash matches; rollback preserves
the unknown legacy deployment. Re-init cannot adopt an existing deployment.
The transaction engine retains same-directory staging/fsync/rename,
durable journal/backup, advisory locking, external drift rejection, rollback
and fail-closed crash reconciliation. Failed rollback reload remains pending.
Directories must not be writable by untrusted processes; hostile concurrent
@@ -100,7 +120,7 @@ requirement; mountinfo alone cannot establish the storage lifecycle.
Injected unit tests cover exact identity/path/config, mountpoint refusal,
old-container-like env, SOCKS port/process refusal, correct fresh-target success,
non-overwrite, transaction rollback and redaction. Tests/build/network are
deferred to the producer; not run by this increment:
deferred to the orchestrator; not run by this increment:
```sh
go test ./cmd/zapret-autotune -run TestManaged