[MG_Remote, MG_Test, ci] (P7): sha256(protocol.fbs) is pinned to MOBILEGL_PROTOCOL_CONTROL_REVISION, so a control-schema edit without a bump is red in the unit lane and in flatc-check instead of a silently absent field

- the revision is a hand-bumped integer mixed into wireFingerprint and nothing tied it to protocol.fbs's content; scripts/ci/protocol_revision_pin.py holds {revision -> sha256(protocol.fbs)} in protocol_revision_pins.json and refuses a schema whose digest is not the current revision's, or a revision with no row
- registered as ProtocolSchema.RevisionPinsDigest (label unit, MG_Test/Wire/CMakeLists.txt, --self-test proves both perturbations red before it says green) and as a step of CI's flatc-check job, the one that regenerates the header on every schema edit
- --write records a bump's row and refuses to re-pin an existing revision to a different digest, which is what a schema edit without a bump looks like
- mg_protocol_base.h says where the pin lives beside the revision it pins
- red-once: protocol.fbs touched with one trailing comment, revision left at 1 -> "protocol.fbs has sha256 a7b5c7fb... but MOBILEGL_PROTOCOL_CONTROL_REVISION is still 1, which is pinned to 7fc859f7..." rc=1; restored, green
This commit is contained in:
2026-09-22 21:54:46 -04:00
parent 0293aebb17
commit c69d8dfdc8
5 changed files with 172 additions and 0 deletions
@@ -56,6 +56,13 @@ extern "C" {
// control message changed shape, so a peer built before a control-schema change agreed with one
// built after it and the difference surfaced as whatever the first misread field did. Bump this
// with every protocol.fbs change a peer must agree on.
//
// THE PIN. This is a hand-bumped integer, and the bump is the only thing that moves the
// fingerprint - so a protocol.fbs edit that forgot it would put old and new peers back in
// silent agreement. scripts/ci/protocol_revision_pin.py holds {revision -> sha256(protocol.fbs)}
// (protocol_revision_pins.json) and refuses a schema whose digest is not the current revision's;
// it runs as ProtocolSchema.RevisionPinsDigest (label unit) and in CI's flatc-check job. After a
// bump: `python3 scripts/ci/protocol_revision_pin.py --write` records the new row.
// 1 P7 wave 2-F, PH-7 (4): Welcome.dataNonce and the DataBind message.
#define MOBILEGL_PROTOCOL_CONTROL_REVISION 1
+13
View File
@@ -146,6 +146,19 @@ foreach (wiretest IN ITEMS RemoteClientTest ServerLoopTest SessionHandshakeTest
gtest_discover_tests(${wiretest} DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit)
endforeach ()
# P7 wave 2-F, F fix round (PH-7 (4) review). MOBILEGL_PROTOCOL_CONTROL_REVISION is a hand-bumped
# integer mixed into wireFingerprint, and nothing tied it to protocol.fbs's content: a schema edit
# that forgot the bump would leave old and new peers agreeing on the fingerprint and surface as a
# silently absent field. This entry runs the pin ({revision -> sha256(protocol.fbs)},
# scripts/ci/protocol_revision_pin.py) with its self-test, so that edit is red in the unit lane.
# No compilation, no GL; label unit, the way MobileGLPurity.IncludeClosure is registered.
find_package(Python3 COMPONENTS Interpreter)
if (Python3_Interpreter_FOUND)
add_test(NAME ProtocolSchema.RevisionPinsDigest
COMMAND ${Python3_EXECUTABLE} ${MGL_ROOT}/scripts/ci/protocol_revision_pin.py --self-test)
set_tests_properties(ProtocolSchema.RevisionPinsDigest PROPERTIES LABELS unit)
endif ()
# P6.5 manual fault-injection probe: requires an explicit live peer and is never
# registered with ctest, so a device-less unit run cannot silently skip this gate.
if (NOT WIN32)