Repository navigation
Sync runtime history portably on macOS - #798
Conversation
Adds a source guard to the native source guard tests: any engine source that calls fdatasync must also provide a branch for Apple platforms, where fdatasync is not declared. On engine main 5191950 the guard fails on src/runtime_context.cpp; the runtime source is unchanged here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runtime history flush called ::fdatasync unconditionally, which does
not compile on macOS ("no member named 'fdatasync' in the global
namespace"). On Apple platforms it now uses fcntl(F_FULLFSYNC) with an
fsync fallback, the same pattern the other fdatasync users in the engine
already carry, keeping the EINTR retry and the storage error on failure.
The non-Apple fdatasync loop is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.
Not checked: tests were not run; no formal proof of the changed code.
Graphify review — findings
Fixes runtime history flushing on Apple by switching flush_pages to F_FULLFSYNC with an fsync fallback and an EINTR retry loop, while other platforms keep the fdatasync loop. The fallback means a failed or interrupted full sync can drop to the weaker fsync guarantee, which is the durability risk in this path. Adds a portability scan to scripts/test_native_source_guard.py that parses #if/#elif/#else conditions to reject any ::fdatasync call still reachable on Apple. It fails closed on unreadable input, symlinks, empty source trees, or zero calls found, and runs an 18-case self-test before the real scan. Teaches _mask_cpp to skip C++17 digit separators like 1'024 so they are no longer mistaken for character-literal quotes.
Worth a look
- Interrupted F_FULLFSYNC can silently fall back to weaker fsync —
src/runtime_context.cpp:270· Escalate · medium- unverified hypothesis — survived the adversarial refute pass; needs human review
- Full-sync errors are silently downgraded —
src/runtime_context.cpp:272· Escalate · medium- unverified hypothesis — survived the adversarial refute pass; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 91 functions depend on the 89 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
main()— 1 callers, 6 callees
Verification — 91 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 91 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
3 of 1400 test file(s) selected (0%) via static blast radius.
scripts/test_native_source_guard.py— impact, changed-testtests/test_request_feed_inventory_admission.py— impacttests/test_runtime_context.cpp— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
docs/pages/examples-rust.md§ src/main.rs (lines 32-289): references changed symbolsparse,takedocs/pages/sink-vectors.md§ Report sink golden vectors {#sink_vectors} (lines 1-138): references changed symbolsparsedocs/pine-adapter-kernel-notes.md§ 4. Other orphaned fill / bracket / margin notes (lines 819-1024): references changed symbolstake
· 1 grounded finding(s) anchored inline below.
| @@ -363,6 +573,8 @@ def self_test() -> int: | |||
| def main() -> int: | |||
There was a problem hiding this comment.
main()
fans out to 6 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
Update the two symbol citations after an import shifted their definitions. The documentation's scope, checker, assertions and runtime are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Engine v1.11.0's source does not compile on macOS:
src/runtime_context.cppcalls::fdatasyncin the runtime history flush, and macOS does not declare it (error: no member named 'fdatasync' in the global namespace). The engine's own CI has no macOS leg, so it showed up only in a downstream macOS build. Engine release archives are Linux-only and are not affected.Change
src/runtime_context.cpp: on Apple platforms the flush usesfcntl(F_FULLFSYNC)with anfsyncfallback, the pattern the otherfdatasyncusers in the engine already carry. The EINTR retry and the storage error on failure are kept. The non-Applefdatasyncloop is unchanged.scripts/test_native_source_guard.py: a source guard that fails when an engine source callsfdatasyncwithout an Apple branch.Red first
51919507atsrc/runtime_context.cpp; with the fix (second commit) it passes.🤖 Generated with Claude Code