Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/simulators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ jobs:
path: |
${{ runner.temp }}/plxnative-replay/**/plxnative-events.log
${{ runner.temp }}/plxnative-replay/**/sim.out
${{ runner.temp }}/plxnative-replay/**/process.json
if-no-files-found: ignore
retention-days: 7
- name: Launch and capture 1080p frame
Expand Down
4 changes: 1 addition & 3 deletions ci/allow/forks/screens.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# count: 3
# count: 1
# Test/production forks (docs/sans-io.md), area `screens`: one line per production-visible `#[cfg(..)]` / `cfg!(..)` whose predicate reads `test` or `feature = "test-support"`
# (`not(test)`, `not(any(test, feature = "test-support"))`, ...) in every machine crate (data/, plex/, media/, session/, screens/, ui/, appkit/ and machine/), keyed `<path>::<item name>` (an attribute on an item), `<path>::<enclosing fn>` (a statement or an inline `cfg!`) or `<path>::<struct>` (a field).
# Logic is one thing in production and tests deliver it events: there is no cfg(test) fork. Spec: ci/check-deps.sh `forks`.
# The gate compares this list to the tree as an exact multiset: a new site fails it, and so does a line whose site is gone, so it only shrinks. A migration lands by deleting its lines; do not add one to make a new site pass.
rust-modules/screens/src/legal.rs::build_sha
rust-modules/screens/src/library/lookahead.rs::rows
rust-modules/screens/src/login.rs::harness_driven
3 changes: 1 addition & 2 deletions ci/allow/forks/ui.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# count: 13
# count: 12
# Test/production forks (docs/sans-io.md), area `ui`: one line per production-visible `#[cfg(..)]` / `cfg!(..)` whose predicate reads `test` or `feature = "test-support"`
# (`not(test)`, `not(any(test, feature = "test-support"))`, ...) in every machine crate (data/, plex/, media/, session/, screens/, ui/, appkit/ and machine/), keyed `<path>::<item name>` (an attribute on an item), `<path>::<enclosing fn>` (a statement or an inline `cfg!`) or `<path>::<struct>` (a field).
# Logic is one thing in production and tests deliver it events: there is no cfg(test) fork. Spec: ci/check-deps.sh `forks`.
# The gate compares this list to the tree as an exact multiset: a new site fails it, and so does a line whose site is gone, so it only shrinks. A migration lands by deleting its lines; do not add one to make a new site pass.
rust-modules/ui/src/card_motion.rs::enforced_limit
rust-modules/ui/src/containers/modal.rs::kick
rust-modules/ui/src/containers/transition.rs::PageImage
rust-modules/ui/src/containers/transition.rs::plan
Expand Down
22 changes: 6 additions & 16 deletions ci/allow/fxlanes/app.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# count: 11
# Bridge::app_effect arms off the ordered lane (docs/sans-io.md), area `app`: one line per `AppFx::<Variant>` arm that does not push `Fx::Deliver(..)`,
# keyed `<path>::AppFx::<Variant>`. An arm that parks its request on a side queue of the bridge is a second lane with its own timing; a result returns as one addressed event on the FIFO.
# Spec: ci/check-deps.sh `fxlanes`.
# The gate compares this list to the tree as an exact multiset: a new site fails it, and so does a line whose site is gone, so it only shrinks. A migration lands by deleting its lines; do not add one to make a new site pass.
rust-modules/src/app/bridge.rs::AppFx::Catalog
rust-modules/src/app/bridge.rs::AppFx::Content
rust-modules/src/app/bridge.rs::AppFx::Home
rust-modules/src/app/bridge.rs::AppFx::ItemMenu
rust-modules/src/app/bridge.rs::AppFx::Library
rust-modules/src/app/bridge.rs::AppFx::Loop
rust-modules/src/app/bridge.rs::AppFx::Player
rust-modules/src/app/bridge.rs::AppFx::Preferences
rust-modules/src/app/bridge.rs::AppFx::Search
rust-modules/src/app/bridge.rs::AppFx::SessionEffect
rust-modules/src/app/bridge.rs::AppFx::Watchlist
# count: 0
# Bridge::app_effect arms off the ordered lane (docs/sans-io.md), area `app`.
# Direct deliveries stay on the dispatcher FIFO. External variants must be unreachable here,
# explicitly classified to yield, and handled by the taken-head runner; check-app-command-routing.py
# proves that contract before the exact fxlanes scan accepts an unreachable arm.
# New side queues or unproved arms fail; this ledger only shrinks.
124 changes: 124 additions & 0 deletions ci/check-app-command-routing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/usr/bin/env python3
"""Prove that unreachable app-effect arms really yield to the FIFO runner."""
from pathlib import Path
import re
import sys

import rust_test_modules as rust
from ui_boundaries import production_tokens, command_storage_violations


BRIDGE = Path("rust-modules/src/app/bridge.rs")


def functions(tokens, name):
ends = rust.group_ends(tokens)
for i in range(len(tokens) - 1):
if tokens[i:i + 2] != [('code', 'fn'), ('code', name)]:
continue
j = i + 2
while j < len(tokens) and tokens[j] != ('code', '{'):
j = ends[j] + 1 if j in ends else j + 1
if j < len(tokens):
yield tokens[j + 1:ends[j]]


def text(tokens):
return ''.join(value if kind == 'code' else 'STRING' for kind, value in tokens)


def variants(tokens):
return set(re.findall(r'AppFx::(\w+)', text(tokens)))


def arms(tokens, subject):
ends = rust.group_ends(tokens)
prefix = [('code', value) for value in subject]
for start in range(len(tokens) - len(prefix)):
if tokens[start:start + len(prefix)] != prefix:
continue
opened = start + len(prefix)
if tokens[opened] != ('code', '{'):
continue
stop, i = ends[opened], opened + 1
result = []
while i < stop:
if tokens[i] == ('code', ','):
i += 1
continue
head = i
while i < stop and tokens[i:i + 2] != [('code', '='), ('code', '>')]:
i = ends[i] + 1 if i in ends else i + 1
if i == stop:
raise ValueError('missing match arm arrow')
pattern, i = tokens[head:i], i + 2
body = i
if tokens[i] == ('code', '{'):
i = ends[i] + 1
else:
while i < stop and tokens[i] != ('code', ','):
i = ends[i] + 1 if i in ends else i + 1
result.append((pattern, tokens[body:i]))
return result
raise ValueError('missing match ' + ''.join(subject))


def violations(source):
tokens = production_tokens(source)
routers = list(functions(tokens, 'app_effect'))
classifiers = [body for body in functions(tokens, 'external_app_fx')
if text(body).startswith('matches!(fx,')]
runners = list(functions(tokens, 'execute_yielded_command'))
if len(routers) != 1 or len(classifiers) != 1 or len(runners) != 1:
return ['missing unique app router, pure classifier or FIFO runner']
classifier = classifiers[0]
if not re.fullmatch(r'matches!\(fx,AppFx::\w+\(_\)(?:\|AppFx::\w+\(_\))*\)', text(classifier)):
return ['external classification must be the explicit pure variant match']
external = variants(classifier)
routed = set()
errors = command_storage_violations(source)
for head, body in arms(routers[0], ['match', 'fx']):
names = variants(head)
if text(body) == 'unreachable!(STRING)':
routed |= names
if not names or not names <= external:
errors.append('unreachable variant is not externally yielded: ' + ','.join(sorted(names)))
elif names & external:
errors.append('external variant still executes in app_effect: ' + ','.join(sorted(names & external)))
if routed != external:
errors.append('external classification and unreachable routing differ')
runner = runners[0]
if text(runner).count('d.take_app_command()?') != 1 or text(tokens).count('.take_app_command(') != 1:
errors.append('runner must take exactly one dispatcher FIFO head through the sole drain')
executed = set()
for head, body in arms(runner, ['match', 'command', '.', 'effect']):
if not text(body).startswith('unreachable!'):
executed |= variants(head)
if re.search(r'\.(?:push|push_back|extend)\(', text(body)):
errors.append('runner arm parks work instead of completing its taken head')
if not external <= executed:
errors.append('yielded variant lacks runner execution: ' + ','.join(sorted(external - executed)))
return errors


def main():
try:
errors = violations(BRIDGE.read_text(encoding='utf-8'))
root = Path('rust-modules/src')
tests = rust.wholly_test_files(root)
for path in sorted((root / 'app').rglob('*.rs')):
if path == BRIDGE or path.resolve() in tests:
continue
source = path.read_text(encoding='utf-8')
errors.extend(f'{path}: {error}' for error in command_storage_violations(source))
if '.take_app_command(' in text(production_tokens(source)):
errors.append(f'{path}: FIFO head taken outside the unique runner')
except (OSError, ValueError) as error:
errors = [str(error)]
for error in errors:
print('app-command-routing: ' + error, file=sys.stderr)
return bool(errors)


if __name__ == '__main__':
sys.exit(main())
18 changes: 15 additions & 3 deletions ci/check-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ ok() { echo " ok — $*"; }
# RULES must name the `want` calls in order; every run ends by checking that, whatever it selected.
RULES=(browse-owner viewstate-owner person-owner search-owner hubs-owner metadata-owner libm ticks wall
fpflags present effect mutators mutators-visibility nav ui-owner-legacy ui-owner-files owned-damage
owned-wake cards layer sessionwrite uistorage legacypage sibling textmeasure dt ladder hittest frame
owned-wake cards layer sessionwrite screen-runtime-io uistorage legacypage sibling textmeasure dt ladder hittest frame
sink route fnlen testmod threads blocking workers globals forks fxlanes tmppath paging allowlist-counts)
deps_usage() {
echo "check-deps: $*" >&2
Expand Down Expand Up @@ -945,6 +945,12 @@ if [ -n "$(grep_code '(crate|super)::app::' "$SRC_SCREENS")" ]; then
else ok "layer"; fi
fi # layer
want sessionwrite && gate sessionwrite 'session::load\(' "$SRC_SCREENS" "$SRC_UI" "$SRC_MACHINE" "$SRC_APPKIT"
# Screen-local helpers/import aliases are scanned as production too; test ownership
# comes from declarations, never filename suffixes. No IO-port-wide exemption.
if want screen-runtime-io; then
if python3 ci/ui_boundaries.py; then ok "screen-runtime-io"
else fail "screen-runtime-io: use captured inputs or typed effects"; fi
fi # screen-runtime-io
# uistorage: the LIBRARY (`ui/`) never names the storage layer (§2.1: `ui/` may name only
# `crate::{gfx,text,paths,task}`). A ui-owned sweep that needs the app's removal rule takes it as an
# injected `fn` (`ui::rec::erase_owned_artifacts`). Zero, no allowlist. The wider table is not a
Expand Down Expand Up @@ -1203,6 +1209,8 @@ fi # testmod
# to the count yet — it exists so a FUTURE import cannot go unmatched the way the bare
# `thread::spawn(` spelling used to.
if want threads; then
# A flat all(test-or-test-support, feature...) conjunction remains wholly test-owned;
# any(test, production-feature) does not and must still be scanned (harness controls).
threads_bad=0
while IFS= read -r f; do
# a wholly-test file is test code exactly like an inline `#[cfg(test)] mod` block, which the
Expand All @@ -1217,7 +1225,7 @@ while IFS= read -r f; do
if ! allowed threads "$f"; then echo " $f:$line"; threads_bad=$((threads_bad+1)); fi
done < <(awk '
skip>0 { n=gsub(/\{/,"{"); m=gsub(/\}/,"}"); depth+=n-m; if (depth<=0) skip=0; prev=$0; next }
prev ~ /^[[:space:]]*#\[cfg\((test|any\(test, feature = "test-support"\))\)\][[:space:]]*$/ && /^[[:space:]]*(pub(\([^)]*\))?[[:space:]]+)?mod[[:space:]]/ { skip=1; depth=gsub(/\{/,"{")-gsub(/\}/,"}"); if (depth<=0) skip=0; prev=$0; next }
prev ~ /^[[:space:]]*#\[cfg\((test|any\(test, feature = "test-support"\)|all\((test|any\(test, feature = "test-support"\)), [^()]*\))\)\][[:space:]]*$/ && /^[[:space:]]*(pub(\([^)]*\))?[[:space:]]+)?mod[[:space:]]/ { skip=1; depth=gsub(/\{/,"{")-gsub(/\}/,"}"); if (depth<=0) skip=0; prev=$0; next }
{ print NR":"$0; prev=$0 }' "$f" | grep -E "$pat" | grep -vE '^[0-9]+:\s*//' || true)
# ...over the files that spell `spawn(` at all — a superset of both matched spellings, and the `awk`
# below only drops `#[cfg(test)] mod` blocks, so the count is unchanged.
Expand Down Expand Up @@ -1575,9 +1583,13 @@ fi # forks
# `<path>::AppFx::<Variant>`, one line for EACH variant on an arm's head (`AppFx::A(r) | AppFx::B(r) => ..`
# is two), and `<path>::AppFx::_` for an arm whose head names none (`other => ..`, `_ => ..`).
if want fxlanes; then
# Unreachable arms are allowed only after proving the explicit external classification
# and the corresponding taken-head runner arm. A side queue plus unreachable still fails.
if python3 ci/check-app-command-routing.py; then :
else fail "fxlanes: external FIFO proof failed"; fi
fxlanes_sites=$(
grep -rlE --include='*.rs' 'fn app_effect' "$SRC" 2>/dev/null | sort \
| LG_MODE=arm LG_ARM_FN=app_effect LG_ARM_MATCH='(^|[^A-Za-z0-9_])match[[:space:]]+fx[[:space:]]*\{' LG_ARM_OK='Fx::Deliver\(' \
| LG_MODE=arm LG_ARM_FN=app_effect LG_ARM_MATCH='(^|[^A-Za-z0-9_])match[[:space:]]+fx[[:space:]]*\{' LG_ARM_OK='Fx::Deliver\(|unreachable!\(' \
ledger_scan | sort
)
LG_LEDGERS="$(echo ci/allow/fxlanes/*.txt)" LG_AREA_CHECK=1 \
Expand Down
8 changes: 4 additions & 4 deletions ci/list-caps.ini
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,6 @@ route = the trailing "+N" overflow pill opens the remaining libraries
class = not-a-list
reason = Copies the one focused grid band into the fixed band array.

[screens/src/library/lookahead.rs::DEFAULT_ROWS]
class = work
reason = Rows of posters kept warm ahead of travel (decode prefetch).

[screens/src/library/lookahead.rs::ROWS_MAX]
class = work
reason = Most rows a dev trigger may ask the prefetch to keep warm; bounded by the texture ahead-set.
Expand Down Expand Up @@ -1228,6 +1224,10 @@ reason = The hero title fallback wraps to two display lines; this is text layout

# ---- ui ------------------------------------------------------------

[ui/src/anim.rs::SETTLE_LOG_MAX]
class = not-a-list
reason = Dev-only settle diagnostic buffer retains 96 ordered records until the app frame-tail drain; newest overflow is counted, with no cap on browsable content or animation state.

[ui/src/card_motion.rs::MAX_SAMPLE_MS]
class = not-a-list
reason = MAX_SAMPLE_MS: uI timing, geometry, recorder or frame-budget bound; not a list.
Expand Down
6 changes: 4 additions & 2 deletions ci/proofs/platform-generated-enums.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"571415d64a9885248f852b402153feedd4660acbe03606e4796c59659726049f",
"03a6e18f576dcbaff66c3d7405923b155302bfb2996bb373dac115ece055a5bf",
"d08b44dbff241962286eb7e1f85897073ba9f2f712a2ba935837f901635369a8",
"9b1ffb66c7ba2eb9fdffcb4bcbf0a29cda87a003cce69b16c73567c8bc0a65b0"
"9b1ffb66c7ba2eb9fdffcb4bcbf0a29cda87a003cce69b16c73567c8bc0a65b0",
"b2794fd0febbbd98febfb45e12fedadcbb58900b02674af7f665bd15adea458d"
]
},
"text_hashing": "sha256-utf8-bytes-crlf-to-lf-local-root-version-v1",
Expand Down Expand Up @@ -76,7 +77,8 @@
"string slots use Rust Debug escaping; numeric slots are integers",
"install_identities writes only install_identities.rs, never languages.rs",
"PR1366: PressRead identity/live/active and owned-present sibling/test modules; canonical machine child and doc-only u32 newtype producer unchanged",
"PR1385: Canon byte-feed loops inlined (impl Canon and canon_tests only, FNV-1a byte stream unchanged); newtype macro and its ten u32 invocations unchanged"
"PR1385: Canon byte-feed loops inlined (impl Canon and canon_tests only, FNV-1a byte stream unchanged); newtype macro and its ten u32 invocations unchanged",
"UI FIFO on PR1385: AppCommandId(u64), AppCommandOutcome and generic AppCommand<F,R> appended after unchanged doc-only newtype producer and its ten u32 invocations; none certified as generated declarations"
],
"assumptions": [
"Offline source-backed unit-enum proof; certificate changes require source review.",
Expand Down
14 changes: 8 additions & 6 deletions ci/readonly_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from readonly_dependencies import _local_sha, _sha, _json, _manifest_paths, _configs, _workspace_hashes, WORKSPACE_HASHING

CERTIFICATE_PATH = Path(__file__).with_name('proofs') / 'platform-generated-enums.json'
CERTIFICATE_SHA256 = 'c737368bf0642a51f34c3424f9545eaa8becb72dc2206ae5f1a40ddcc3c7f67e'
CERTIFICATE_SHA256 = '39cfebbd3047735fc32cedbb1402f667d623377f91cd89b134667d8d90b7a761'
SOURCES = ['platform/Cargo.toml', 'platform/src/lib.rs', 'platform/src/i18n/mod.rs',
'platform/build.rs', 'platform/build_support/catalog.rs', 'build_support/install_identities.rs',
'machine/src/lib.rs', 'machine/src/machine.rs']
Expand All @@ -24,7 +24,8 @@
MACHINE_SOURCES = ['571415d64a9885248f852b402153feedd4660acbe03606e4796c59659726049f',
'03a6e18f576dcbaff66c3d7405923b155302bfb2996bb373dac115ece055a5bf',
'd08b44dbff241962286eb7e1f85897073ba9f2f712a2ba935837f901635369a8',
'9b1ffb66c7ba2eb9fdffcb4bcbf0a29cda87a003cce69b16c73567c8bc0a65b0']
'9b1ffb66c7ba2eb9fdffcb4bcbf0a29cda87a003cce69b16c73567c8bc0a65b0',
'b2794fd0febbbd98febfb45e12fedadcbb58900b02674af7f665bd15adea458d']
MACHINE_LIB_SOURCES = ['105afdbb05fb762e6752cef260b6d928b1d828993350aaa71651f96cee0c3188',
'c35d39ae620b5607e7035222ab1023799adaf091d6a4f737a847dd70b26c1b36']

Expand All @@ -34,9 +35,9 @@

def source_hashes(root):
sources = {p: _local_sha((root / p).read_bytes()) for p in SOURCES}
# Reviewed variants add NavOp::SelectTabWithChild or PressRead identity/live/active, or rewrite
# the Canon byte-feed loops; the complete doc-only newtype producer and its u32 invocations
# are unchanged.
# Reviewed variants add navigation/press facts, inline Canon byte-feed loops, or append
# the owned AppCommand declarations. The complete doc-only newtype producer and its ten
# u32 invocations, include namespaces and writer contracts remain unchanged.
if sources['machine/src/machine.rs'] not in MACHINE_SOURCES: raise ValueError('unreviewed machine source')
sources['machine/src/machine.rs'] = MACHINE_SOURCES
# Owned-present migration changes sibling/test modules, never the canonical machine child.
Expand Down Expand Up @@ -65,7 +66,8 @@ def produce_certificate(root):
'string slots use Rust Debug escaping; numeric slots are integers',
'install_identities writes only install_identities.rs, never languages.rs',
'PR1366: PressRead identity/live/active and owned-present sibling/test modules; canonical machine child and doc-only u32 newtype producer unchanged',
'PR1385: Canon byte-feed loops inlined (impl Canon and canon_tests only, FNV-1a byte stream unchanged); newtype macro and its ten u32 invocations unchanged'],
'PR1385: Canon byte-feed loops inlined (impl Canon and canon_tests only, FNV-1a byte stream unchanged); newtype macro and its ten u32 invocations unchanged',
'UI FIFO on PR1385: AppCommandId(u64), AppCommandOutcome and generic AppCommand<F,R> appended after unchanged doc-only newtype producer and its ten u32 invocations; none certified as generated declarations'],
'assumptions': __doc__.splitlines()}


Expand Down
Loading
Loading