Skip to content

Experiment formal browser session source plan 01

Kennedy Mosoti edited this page Oct 13, 2026 · 1 revision

browser session source plan 01

Prospective: NOT RUN. Clean head 3aaa71b7bb175d7b18157e143cbcb4bad8bbd969.

C-080 literal AB/C registration red is preserved at wiki724a74a: four missing-checker controls plus five actual-finalizer counterexamples. Oracle-only3aaa adds139/removes1(net138), preserving legacy check_sessions through one shared semantic row validator without row mutation. AB/C explicit two-state identity/freshness/request/stop receipts bind one global240-second deadline and550ms pacing. Full session-clock discovery includes all13 methods:four new AB/C controls plusnine unchanged wire/isolation/row/lifecycle/image controls. Lifecycle controls use tiny real owned Python process groups and fake compiler commands, not a C/Rust build or actual browser. The unchanged full-finalizer controls remain known red and deliberately excluded; C-084 per-launch cgroup amendment is separate pending work. Native packaged adapter/unshifted same-call witness remains pending.

Root runs four exact serial source cells. Every cell uses the driver, resource_group, a fresh full DATA namespace census, full1GiB reserve,95GB admission including reserve/100GB ceiling,16GiB memory high/20GiBmax/no swap/1800seconds. Dirty/moved source or any project workload refuses admission. Any unexpected failure stops this sequence; retain failures and report exact command/exit/stop. Inspect cleanup and read #59 after each cell. Existing Bun1.4.0/106 individual ignored locked dependency links/cache are reused without installation. No VM, installation, native browser, simulator, Rust/C compile, smoke or FULL is launched.

Pins

  • /run/media/kmosoti/data/FabricO11y/results/candidate-build-fresh-8fb6f413179b-01/run-step-browser-session-source-01.py SHA-256 0ae1410b952957269e00df8474893b6202e6311adcd1fd83b8328c2ca95a7208.
  • /run/media/kmosoti/data/FabricO11y/scratch/console-access-acceptance/tools/ui/session_clock_oracle.py SHA-256 6b02bfc73e1ffe0e8c18fdc4822f555f570e68fcbb8021425f9a3d8f5b40e216.
  • /run/media/kmosoti/data/FabricO11y/scratch/console-access-acceptance/tools/ui/test_session_clock.py SHA-256 440d73f6c3dded5f4ec6a6917b8ea641f9258f9917c8cad23095abe2bf85c88b.
  • /run/media/kmosoti/data/FabricO11y/scratch/console-access-acceptance/tools/ui/test_role_matrix.py SHA-256 e068f5669cf21cb2d2411e94689bb28518c8d8f8b08ba87eafaea97c51301432.
  • /run/media/kmosoti/data/FabricO11y/scratch/console-access-acceptance/docs/experiments/formal/console-session-clock-protocol.md SHA-256 a3d3f996ae1b1d612c69afc267a96e1d027e92c35f6d0fbfe53f68c582cf6bb7.

Exact commands

python3 -B /run/media/kmosoti/data/FabricO11y/results/candidate-build-fresh-8fb6f413179b-01/run-step-browser-session-source-01.py browser-session-source-controls-01 1073741824 env PYTHONPATH=tools/ui python3 -B -m unittest discover -s tools/ui -p test_session_clock.py -v
python3 -B /run/media/kmosoti/data/FabricO11y/results/candidate-build-fresh-8fb6f413179b-01/run-step-browser-session-source-01.py browser-session-docs-check-01 1073741824 env PATH=/run/media/kmosoti/data/FabricO11y/tools/bun-1.4.0:/usr/local/bin:/usr/bin:/bin BUN_INSTALL_CACHE_DIR=/run/media/kmosoti/data/FabricO11y/tools/docs-bun-cache /run/media/kmosoti/data/FabricO11y/tools/bun-1.4.0/bun tools/docs/check.mjs
python3 -B /run/media/kmosoti/data/FabricO11y/results/candidate-build-fresh-8fb6f413179b-01/run-step-browser-session-source-01.py browser-session-docs-tests-01 1073741824 env PATH=/run/media/kmosoti/data/FabricO11y/tools/bun-1.4.0:/usr/local/bin:/usr/bin:/bin BUN_INSTALL_CACHE_DIR=/run/media/kmosoti/data/FabricO11y/tools/docs-bun-cache /run/media/kmosoti/data/FabricO11y/tools/bun-1.4.0/bun tools/docs/check.test.mjs
python3 -B /run/media/kmosoti/data/FabricO11y/results/candidate-build-fresh-8fb6f413179b-01/run-step-browser-session-source-01.py browser-session-docs-hooks-01 1073741824 env PATH=/run/media/kmosoti/data/FabricO11y/tools/bun-1.4.0:/usr/local/bin:/usr/bin:/bin BUN_INSTALL_CACHE_DIR=/run/media/kmosoti/data/FabricO11y/tools/docs-bun-cache python3 -B tools/docs/test_hooks.py

Full production delta

diff --git a/tools/ui/session_clock_oracle.py b/tools/ui/session_clock_oracle.py
index 52dfb3e..c0ce14e 100644
--- a/tools/ui/session_clock_oracle.py
+++ b/tools/ui/session_clock_oracle.py
@@ -57,6 +57,10 @@ def check_isolation(row, target_pid, helper_sha256, executable_sha256):
 
 
 def check_sessions(rows, sessions, target_pid):
+    _check_session_rows(rows, sessions, {key: target_pid for key in ('A', 'B', 'C')})
+
+
+def _check_session_rows(rows, sessions, targets):
     require(set(sessions)=={'A','B','C'} and len({s['hash'] for s in sessions.values()})==3, 'session-identities')
     for session in sessions.values():
         require(type(session['hash']) is str and len(session['hash'])==64 and all(c in '0123456789abcdef' for c in session['hash']), 'session-identities')
@@ -69,7 +73,7 @@ def check_sessions(rows, sessions, target_pid):
     seen={key:session['baseline_seen_s'] for key,session in sessions.items()}
     for row,(cell,key,second,status) in zip(rows,expected):
         session=sessions[key]
-        require(row['cell']==cell and row['session_hash']==session['hash'] and row['pid']==target_pid, 'session-binding')
+        require(row['cell']==cell and row['session_hash']==session['hash'] and row['pid']==targets[key], 'session-binding')
         require(row['issued_s']==session['issued_s'] and row['expires_s']==session['expires_s'] and row['last_seen_s']==seen[key], 'session-baseline')
         require(row['request_s']==second, 'session-boundary')
         require(row['server_call_s']==second, 'session-boundary-inconclusive')
@@ -77,3 +81,137 @@ def check_sessions(rows, sessions, target_pid):
         if key=='C':require(0<=second-seen[key]<1800, 'session-idle-confound')
         else:require(second<session['expires_s'], 'session-absolute-confound')
         if status==200:seen[key]=second
+
+
+def _integer(value, minimum=0):
+    return type(value) is int and value >= minimum
+
+
+def _hex_identity(value, length=64):
+    return type(value) is str and len(value) == length and all(c in '0123456789abcdef' for c in value)
+
+
+def _absolute_path(value):
+    return (type(value) is str and value.startswith('/') and '\0' not in value
+            and all(part not in ('', '.', '..') for part in value.split('/')[1:]))
+
+
+def check_session_fixtures(rows, sessions, fixtures):
+    """Check receipt consistency; native identity and freshness need actual admission."""
+    require(type(fixtures) is dict and set(fixtures) == {'AB', 'C'}, 'session-fixture-keys')
+    require(all(type(fixture) is dict for fixture in fixtures.values()), 'session-fixture-keys')
+    images = ('candidate_commit', 'package_sha256', 'executable_sha256', 'helper_sha256')
+    for field in images:
+        values = [fixtures[key].get(field) for key in ('AB', 'C')]
+        require(all(_hex_identity(value, 40 if field == 'candidate_commit' else 64) for value in values)
+                and values[0] == values[1], 'session-fixture-images')
+
+    targets, intervals, states, stops = {}, {}, {}, {}
+    common_deadline = None
+    for key in ('AB', 'C'):
+        fixture = fixtures[key]
+        binding = fixture.get('process_binding')
+        require(type(binding) is dict, 'session-fixture-process')
+        pid = binding.get('pid')
+        require(_integer(pid, 1) and pid not in targets.values(), 'session-fixture-pid')
+        targets[key] = pid
+        mappings = binding.get('helper_maps')
+        require(_integer(binding.get('start_ticks'), 1)
+                and type(binding.get('cgroup')) is str and bool(binding['cgroup'].strip())
+                and binding.get('executable_sha256') == fixture['executable_sha256']
+                and binding.get('helper_sha256') == fixture['helper_sha256']
+                and _absolute_path(binding.get('libc')) and _hex_identity(binding.get('libc_sha256'))
+                and type(mappings) is list and bool(mappings), 'session-fixture-process')
+        for mapping in mappings:
+            require(isinstance(mapping, (list, tuple)) and len(mapping) == 3
+                    and type(mapping[0]) is str and len(mapping[0].split(':')) == 2
+                    and all(part and all(c in '0123456789abcdef' for c in part) for part in mapping[0].split(':'))
+                    and type(mapping[1]) is str and bool(mapping[1])
+                    and all(c in '0123456789' for c in mapping[1]) and any(c != '0' for c in mapping[1])
+                    and _absolute_path(mapping[2]), 'session-fixture-process')
+
+        run, deadline, start, stop = (fixture.get(field) for field in
+                ('run_started_monotonic_ns', 'deadline_monotonic_ns', 'started_monotonic_ns', 'stopped_monotonic_ns'))
+        require(all(_integer(value) for value in (run, deadline, start, stop))
+                and deadline == run + 240_000_000_000 and run <= start < stop <= deadline,
+                'session-fixture-deadline')
+        require(common_deadline is None or common_deadline == (run, deadline), 'session-fixture-deadline')
+        common_deadline = (run, deadline)
+        intervals[key] = (start, stop)
+
+    require(isinstance(rows, (list, tuple)) and len(rows) == 32, 'session-completeness')
+    require(type(sessions) is dict and set(sessions) == {'A', 'B', 'C'}, 'session-identities')
+    session_fields = {'hash', 'issued_s', 'expires_s', 'baseline_seen_s'}
+    require(all(type(session) is dict and session_fields <= session.keys()
+                and _hex_identity(session['hash']) for session in sessions.values()), 'session-identities')
+    row_fields = {'cell', 'session_hash', 'pid', 'issued_s', 'expires_s', 'last_seen_s',
+                  'request_s', 'server_call_s', 'status', 'error'}
+    last_dispatch, last_request = None, {}
+    for index, row in enumerate(rows):
+        key = 'AB' if index < 2 else 'C'
+        require(type(row) is dict and _integer(row.get('pid'), 1)
+                and row['pid'] == targets[key], 'session-fixture-row')
+        require(row_fields <= row.keys(), 'session-binding')
+        before, call, after = (row.get(field) for field in
+                ('request_before_monotonic_ns', 'server_call_monotonic_ns', 'request_after_monotonic_ns'))
+        start, stop = intervals[key]
+        require(all(_integer(value) for value in (before, call, after))
+                and start <= before <= call <= after <= stop, 'session-fixture-window')
+        require(last_dispatch is None or before - last_dispatch >= 550_000_000, 'session-fixture-pacing')
+        last_dispatch = before
+        last_request[key] = max(last_request.get(key, 0), after)
+
+    for key in ('AB', 'C'):
+        fixture = fixtures[key]
+        binding = fixture['process_binding']
+        pid = targets[key]
+        run = common_deadline[0]
+        start, stop = intervals[key]
+        before, after = fixture.get('state_before'), fixture.get('state_after')
+        require(type(before) is dict and type(after) is dict, 'session-fixture-state')
+        for state in (before, after):
+            require(_absolute_path(state.get('path')) and _integer(state.get('device'))
+                    and _integer(state.get('inode'), 1), 'session-fixture-state')
+        identity = (before['path'], before['device'], before['inode'])
+        require(identity == (after['path'], after['device'], after['inode'])
+                and _integer(after.get('observed_monotonic_ns'))
+                and start <= after['observed_monotonic_ns'] <= stop, 'session-fixture-state')
+        if states:
+            previous = states['AB']
+            require(identity[0] != previous[0] and identity[1:] != previous[1:], 'session-fixture-state')
+        states[key] = identity
+        created, observed = before.get('created_monotonic_ns'), before.get('observed_monotonic_ns')
+        require(_integer(created) and _integer(observed) and run <= created < observed < start
+                and type(before.get('initial_entries')) is list and before['initial_entries'] == []
+                and 'copy_source' in before and before['copy_source'] is None
+                and before.get('descriptor_held') is True, 'session-fixture-fresh')
+
+        groups, observations = fixture.get('owned_groups'), fixture.get('stop_observations')
+        require(type(groups) is list and bool(groups) and type(observations) is list
+                and len(groups) == len(observations), 'session-fixture-stop')
+        identities = set()
+        for group in groups:
+            require(type(group) is dict and _integer(group.get('pgid'), 1)
+                    and _integer(group.get('start_ticks'), 1), 'session-fixture-stop')
+            group_identity = (group['pgid'], group['start_ticks'])
+            require(group_identity not in identities, 'session-fixture-stop')
+            identities.add(group_identity)
+        require((pid, binding['start_ticks']) in identities, 'session-fixture-stop')
+        matched, observed_stops = set(), []
+        for observation in observations:
+            require(type(observation) is dict and _integer(observation.get('pgid'), 1)
+                    and _integer(observation.get('start_ticks'), 1), 'session-fixture-stop')
+            group_identity = (observation['pgid'], observation['start_ticks'])
+            require(group_identity in identities and group_identity not in matched
+                    and type(observation.get('population')) is int and observation['population'] == 0
+                    and observation.get('confirmed') is True
+                    and _integer(observation.get('observed_monotonic_ns'))
+                    and start <= observation['observed_monotonic_ns'] <= stop, 'session-fixture-stop')
+            matched.add(group_identity)
+            observed_stops.append(observation['observed_monotonic_ns'])
+        stops[key] = observed_stops
+
+    require(intervals['AB'][1] < intervals['C'][0], 'session-fixture-order')
+    for key in ('AB', 'C'):
+        require(all(observed >= last_request[key] for observed in stops[key]), 'session-fixture-stop')
+    _check_session_rows(rows, sessions, {'A': targets['AB'], 'B': targets['AB'], 'C': targets['C']})

Clone this wiki locally