mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-21 00:41:57 +09:00
[MG_Remote] (P6/dl): every session death goes through one funnel
Step two of CONTRACT-P6 5.2. The ~90 scattered `MGLOG_F("...Fatal{...}"); std::abort();`
pairs under MG_Remote/ become one call each to SessionFail(MGFatalFamily, fmt, ...),
which logs, echoes to stderr, counts, and aborts in one place. a6's census
found no single chokepoint existed; now there is one, and step three hangs the
SessionFault-to-peer publish off it.
THE MESSAGE STRING IS PASSED VERBATIM. The contract requires the log lines, the
CI greps and every red-once byte-identical, so SessionFail does not compose the
line from the family - it takes the SAME string the site handed MGLOG_F and
forwards it unchanged. The family enum rides alongside, redundantly, so the
funnel has the coarse wire FatalCode without parsing the string. The census now
checks that redundancy the way it checks WireLogFatal: every SessionFail call's
string must carry a Fatal{ word, so the enum and the string cannot silently
disagree.
The conversion was mechanical - 89 sites by a transform that injects the family
as MGLOG_F's new first argument and drops the trailing abort - with three sites
fixed by hand that the transform would have broken: a stub macro, and two
if/else-then-shared-abort blocks (PersistentMapTracker's adopt-tier and
SurfaceOpCodec's three surface-error branches) where a naive rewrite stole the
abort from the earlier branches and would have let them fall through. The
death tests are the safety net for byte-identity, and every one stayed green.
Four std::abort() remain under MG_Remote/, all inside the two funnels
(WireLog.cpp, FatalFunnel.cpp); the census exempts both files because their
callers carry the family word, and its baseline drops from 93 aborts to 4.
SessionFaultCount() is the one telemetry point S8 will assert zero over a good
run.
G1 re-measured: 0 symbol diff, .text unchanged at 0xa52203 (FatalFunnel and
FatalFamily live under MG_Remote/, compiled only in the disaggregated build).
Unit 2358 (one pre-existing environmental failure), integration-split 186/186,
integration-spawn 102/102, retrace 6/6, census 0 unmarked.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// MobileGL - MobileGL/MG_Remote/FatalFunnel.h
|
||||
// Copyright (c) 2025-2026 MobileGL-Dev
|
||||
// Licensed under the GNU Lesser General Public License v3.0:
|
||||
// https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
// https://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
// End of Source File Header
|
||||
|
||||
// P6 `dl` (CONTRACT-P6 5.2). THE ONE PLACE A SESSION DIES.
|
||||
//
|
||||
// Every `Fatal{...}` under MG_Remote/ used to be an MGLOG_F followed by its own std::abort().
|
||||
// a6 counted ~92 of them. Scattered, they gave the funnel's three benefits to nobody: there was
|
||||
// no single place to publish a SessionFault to the peer before dying, no single telemetry point,
|
||||
// and no way for a census to be sure a new death was named. This is that place.
|
||||
//
|
||||
// THE MESSAGE STRING IS PASSED VERBATIM, family word and all. The contract requires the log
|
||||
// lines, the CI greps and every red-once to be byte-identical, so SessionFail does not compose
|
||||
// the line from the family - it takes the SAME string the site used to hand MGLOG_F and forwards
|
||||
// it unchanged. The family enum rides ALONGSIDE, redundantly, so the funnel knows the coarse wire
|
||||
// FatalCode without parsing the string; a test asserts the enum's name appears in the string, so
|
||||
// the redundancy cannot rot into disagreement.
|
||||
//
|
||||
// NOT in WireLog.h: that header is deliberately dependency-light (ITransport.h's rule, the
|
||||
// include-graph purity gate), and this needs FatalFamily.h, which pulls the protocol header. The
|
||||
// header-layer sites that must stay pure keep using WireLogFatal, whose own abort routes through
|
||||
// the same publisher in WireLog.cpp.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <MG_Remote/FatalFamily.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace MobileGL::MG_Remote {
|
||||
|
||||
// Logs the line (byte-identical to the old MGLOG_F), echoes it to stderr so a death test can
|
||||
// see it, publishes a SessionFault{family, ...} to the peer if one is connected, bumps the
|
||||
// telemetry counter, and aborts. `fmt` is the FULL original message, e.g.
|
||||
// "MGPipe: Fatal{RingOverrun, \"SEG_CMD\"} - %s ...".
|
||||
[[noreturn]]
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
__attribute__((format(printf, 2, 3)))
|
||||
#endif
|
||||
void SessionFail(MGFatalFamily family, const char* fmt, ...);
|
||||
|
||||
// How many times a session has ended through the funnel this process. Exit gate S8 asserts
|
||||
// this is zero over a whole good run; a test reads it to prove the funnel was reached.
|
||||
::std::uint64_t SessionFaultCount();
|
||||
|
||||
} // namespace MobileGL::MG_Remote
|
||||
Reference in New Issue
Block a user