Skip to content

Commit 6b601ef

Browse files
committed
Kernel: session-day facts on a certified cycle of an exchange zone resolve no calendar interval per bar (R5 lane PERF-ZONED)
PERF-KEDGE recovered KERNEL-EDGE's per-bar cost on UTC calendars only. On every other zone present_session_day still resolved the bar's script interval through the calendar memo at every bar, and read the label and both neighbours through it: a New York 5-minute FeedTolerant run cost 1.73x the instructions of 1a0e7ea (+2,443 Ir a bar), a Tokyo 1-minute run 1.22x (+3,439). native_calendar::cycle_certificate certifies the session day holding an instant when the zone makes its cycle read from that day alone: UTC or a fixed offset, or, under glibc or macOS, a TZif v2+ zone whose 64-bit table covers the reach (22 days around the cycle, widened by the spacing) and whose transitions there move the offset by at most 3 hours, between offsets within 14 hours of UT, never backwards while keeping the daylight-saving flag, and at least 8 days apart, each read back from libc (localtime on both sides, chained). Then every civil time in reach resolves to the first instant the wall clock reaches it, whatever was resolved before: one reading is found from any start; the two readings of a fold that flips the flag are both found (glibc's mktime probes a week at a time for the flag asked, and the spacing puts that probe on the fold's own side; macOS's mktime keeps no state) and resolve_stamp keeps the earlier; a gap resolves to the move itself inside the 14-hour search. So the cycles tile, each instant's local date is within a day of its cycle's open date, the memo's candidate lookup finds exactly that day, and no other day holds its instants. The zone is asked first, around the instant, and a day is resolved only where it holds: a refused certificate asks the calendar nothing. On a certified cycle present_session_day reads an instant in one of the day's spans in session on the day's ordinal, and an instant whose fixed bucket (fixed_bucket_ms, the calendar's own unit) meets no span out of session, resolving nothing. A bucket that reaches a span from outside one, every instant a certificate refuses, the walk and the scheduled close make the calls they always made. Measured on spark (instructions:u, A725 core 12): - zoned configs, 3000 bars idle, main 1a0e7ea / f1f3febd / this commit: NY 5m tolerant 1.7294x -> 1.0000x, NY 1m tolerant 1.7648x -> 0.9993x, Tokyo 1m tolerant 1.2201x -> 1.0003x; every canonical and tolerant config of NY, Tokyo, Chicago, London, Kolkata and UTC at most 1.0008x main; - the 100 public slots against f1f3febd: median 0.9952 (magnifier on), 0.9942 (off), no slot above 1.0; against main 1.0013 / 1.0001; - the budget workload: +0.41% over main at f1f3febd, +0.32% here. Identity (spark, f1f3febd against this commit, byte for byte): 100 slots x magnifier off/on with trade digests, equity and broker_state_hash; the 132-configuration battery on 8 host variants with every hash column; the KERNEL-EDGE probes and the AUDIT4 acid tests; PERF-KEDGE's facts battery (9,216 rows); a new 60-window zoned facts battery (45,600 rows: 2024 changes of New York, Chicago, Denver, Los Angeles, St John's, Havana, Santiago, London, Berlin, Dublin, Sydney, Lord Howe, Auckland, Chatham, Casablanca, Troll; Sao Paulo 2018/19, Tehran 2021, Apia and Tongatapu at +14, Caracas, Pyongyang; constant zones; and the refused folds and jumps of Tokyo 1887, Sitka and Juneau 1867, Apia 2011, Kwajalein 1969, Moscow 2011/2014, Recife 2000, New York 1883 and 2040, Amsterdam 1937, Manila 1844); the Pine witness replay. - native_calendar.cpp / native_calendar_memo.hpp: cycle_certificate, fixed_bucket_ms, SessionDayMemo::libc_local_reads() (a derived cost reading), the TZif v2+ table reader, and tz_read_resource shared with the identity digest. - native_execution_consumer: the certified-cycle cache (four entries, the last hit first), certified_point, certified_interval_meets_span; the PERF-KEDGE UTC member calendar_is_utc() is gone (a UTC calendar certifies every cycle). ADR-0001 rule 2: a generic capability of the run's own calendar -- its zone is data, the same for every venue -- with no spec field, switch or Pine vocabulary, and no answer moves. The only platform condition picks the libcs whose mktime the proof reads; elsewhere TZif zones take the exact path. Nothing is hashed: the facts fold into no digest and the new members are derived memos. Witness, tests/test_native_session_day_zoned.cpp (kernel-only): certificates at real transitions (New York, Chicago, London, Sydney, Lord Howe 2024 certified where the host's table lists them; Tokyo, Kolkata, a fixed offset, Apia at +14, Sitka's +14:58:47 and Moscow 2015 certified; Tokyo 1887, Sitka 1867, Apia 2011, Kwajalein 1969, Moscow 2014, Recife 2000, New York 2040 and POSIX zones refused, a refused certificate reading nothing), each certified cycle checked against the memo-free session_day_at; the same tapes under each TZif zone and its POSIX twin (never certified) present identical facts at every decision point over 8 windows, 7 sessions and 12 runs each, plus the magnifier, seconds and undetected paths (700 runs, 0 mismatches); and New York and Tokyo FeedTolerant batches resolve no interval for their facts where their twins resolve one a bar. Fail-before at f1f3febd: "no member named 'libc_local_reads' in 'pineforge::native_calendar::SessionDayMemo'". 17 of 19 mutants fail it; the two that survive loosen guards no zone in the host's database reaches (the 14-hour offset bound, the libc chain check). The PERF-KEDGE witness's probe reads the memo's UTC decision directly and its header records the change. Floors: kernel 278 -> 279, release 679 -> 680, PR registration 660/660/669 -> 661/661/670 (ci_verify.py, its self-test pin and docs/ci.md). 24 doc anchors carried through the exact line map from f1f3febd; the 6 that cite the two rewritten floor lines set by hand (ci_verify.py:253, :365). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 27e1f384f1063c13efe3961ff58b8a0c6410c425) INT27 pick note: the lane's base f1f3febd is PERF-KEDGE's tip, which INT26 carries as a3b4b97/debbd7f1. Every source, header and test hunk applied unchanged against INT26's text (each file's patch is byte-identical to the lane's), and no other caller of PERF-KEDGE's calendar_is_utc() is left on the merged tree. The floors are INT26's plus K-RUNERR's plus this lane's row: kernel 287 run (288 registered), release 705, PR registration 686/686/695 (ci_verify.py, its self-test pin and docs/ci.md). The docs conflicts were citation digits, merged token by token (INT27's single re-anchor pass sets every digit on the integrated tree), and the one floors paragraph, rewritten with the merged counts.
1 parent 43f25c9 commit 6b601ef

16 files changed

Lines changed: 1363 additions & 88 deletions

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ What each gate refuses:
152152
### The floors
153153

154154
`ci_verify.py` counts the CTest rows that actually **ran** and fails below a
155-
floor — `KERNEL_MIN_TESTS` ci_verify.py:260 and `RELEASE_MIN_TESTS`
156-
ci_verify.py:350.
155+
floor — `KERNEL_MIN_TESTS` ci_verify.py:247 and `RELEASE_MIN_TESTS`
156+
ci_verify.py:364.
157157
A deleted or silently skipped row is a failure, not a quieter run. If your
158158
change adds rows, raise the floor in the same commit and say by how much; if it
159159
legitimately removes one, lower it deliberately and say why. `--min-tests`

‎docs/adr/0001-kernel-adapter-boundary.md‎

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

‎docs/ci.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ requires the rows that actually ran to equal the second count, and records
102102
`registered`, `labelled = registered - selected`, and `ran` in
103103
`ctest-exclusion.log` and `ci-summary.json`. A skip, missing executable, lost
104104
registration below the PR registration floor, unreadable enumeration, or
105-
missing label fails. The PR registration floors at INT26 are 684 for Debug
106-
and sanitizers and 693 for native (653 and 662 at the INT24 base, plus wave G's
107-
six rows, wave H's twenty-four and INT26's own tape row). The full-run release
108-
and kernel floors are 703 and 286 rows that ran; full runs do not exclude a
109-
label.
105+
missing label fails. The PR registration floors at INT27 are 686 for Debug
106+
and sanitizers and 695 for native (653 and 662 at the INT24 base, plus wave G's
107+
six rows, wave H's twenty-four, INT26's own tape row and the K-RUNERR and
108+
PERF-ZONED rows). The full-run release and kernel floors are 705 and 287 rows
109+
that ran; full runs do not exclude a label.
110110

111111
Preflight also runs the detached-comment census of the kernel compile closure
112112
(`detached-comments`: `scripts/measure_detached_comments.py --check-ceiling`)

‎docs/design/native-feature-parity.md‎

Lines changed: 10 additions & 10 deletions
Large diffs are not rendered by default.

‎docs/pages/contributing-llm.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ finding to report, not a step to take.
117117
`scripts/check_doc_reverts.py`.
118118

119119
10. **A test row never silently disappears.** Each profile counts the rows that
120-
*ran* against a floor: `KERNEL_MIN_TESTS` ci_verify.py:260 and
121-
`RELEASE_MIN_TESTS` ci_verify.py:350. Adding rows means raising the floor
120+
*ran* against a floor: `KERNEL_MIN_TESTS` ci_verify.py:247 and
121+
`RELEASE_MIN_TESTS` ci_verify.py:364. Adding rows means raising the floor
122122
in the same commit.
123123

124124
## The recipe for a lane
@@ -264,7 +264,7 @@ measurement that produced it, so a later change to it is visible as a change to
264264
the record, not as an edit to a literal.
265265

266266
**floor** — the minimum number of CTest rows a profile must actually run
267-
(`KERNEL_MIN_TESTS` ci_verify.py:260, `RELEASE_MIN_TESTS` ci_verify.py:350). It
267+
(`KERNEL_MIN_TESTS` ci_verify.py:247, `RELEASE_MIN_TESTS` ci_verify.py:364). It
268268
counts rows that ran, so a skipped row does not pad it.
269269

270270
**receipt** — the recorded evidence an ABI-comparison row needs (a prepared

‎docs/pages/native-engine.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ spec fields.
463463
The rich `run(bars, n, input_tf, script_tf, inputs, syminfo, overrides, …)`
464464
overload (`engine.hpp:1623-1634`) is **not** refused as a source mutation: it
465465
reaches `NativeExecutionConsumer::run_rich`
466-
(`native_execution_consumer.cpp:9229-9269`), which admits the begin, checks the
466+
(`native_execution_consumer.cpp:9258-9298`), which admits the begin, checks the
467467
timeframe arguments against the spec, preflights and pumps the batch exactly
468468
like the plain overload. `inputs` / `syminfo` / `overrides` are carried only as
469469
`NativeBeginArgs` fields to `prepare_native_begin` — the overrides as the
@@ -2099,7 +2099,7 @@ default, set while no run is active — because each row is a full
20992099
the live state, not the run's length: the closed rows enter through a running
21002100
digest). With the switch on,
21012101
one row follows each point, after the extremes that point just folded
2102-
(`record_script_report_point`, `native_execution_consumer.cpp:7881`), so
2102+
(`record_script_report_point`, `native_execution_consumer.cpp:7910`), so
21032103

21042104
```text
21052105
broker_state_hash_len == equity_curve_len == script_bars_processed
@@ -2910,7 +2910,7 @@ Only completed buckets are published, so this recipe has no lookahead by
29102910
construction. It is the same class the kernel's own subscription evaluator
29112911
aggregates with, and the one the kernel's `script_bucket_completions` query
29122912
feeds when the Pine scheduler asks how its input span buckets
2913-
(`TimeframeAggregator` `native_execution_consumer.cpp:7963`). What it does
2913+
(`TimeframeAggregator` `native_execution_consumer.cpp:7992`). What it does
29142914
**not** give you is what a
29152915
declared subscription does: an `authoritative_bars` feed, the `gaps` and
29162916
`lookahead` delivery rules, the lazy-seal chronology, a C spelling, and the

‎docs/pages/pine-to-native.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ rather than defaulted.
127127
| `commission_type` | `NativeFeeKind` native_run_spec.hpp:19 | `fee_kind` pineforge.h:502 | `native_open_lots_strategy.cpp` | `Percent`, `CashPerUnit`, `CashPerExecution` — the same three TradingView offers. |
128128
| `commission_value` | `fee_value` native_run_spec.hpp:590 | `fee_value` pineforge.h:502 | `native_open_lots_strategy.cpp` | Quoted per execution by `quote_execution_commissions` engine_execution.cpp:1588. A cash-per-execution ticket is split by units over every slice of that execution. |
129129
| `slippage` | `slippage_ticks` native_run_spec.hpp:584 | `slippage_ticks` pineforge.h:502 | `native_price_grid_strategy.cpp` | Raw `ticks * price_tick`, applied once native_execution_consumer.cpp:3980-3981. TradingView's round-then-slip order is adapter-only. |
130-
| `process_orders_on_close` | `NativeCloseExecution` native_run_spec.hpp:33 | `close_execution` pineforge.h:503 | `native_open_lots_strategy.cpp` | `AfterCalculation` emits the post-calculation close point native_execution_consumer.cpp:7588-7589, so a request submitted in bar *k*'s calculation fills at bar *k*'s own close. |
130+
| `process_orders_on_close` | `NativeCloseExecution` native_run_spec.hpp:33 | `close_execution` pineforge.h:503 | `native_open_lots_strategy.cpp` | `AfterCalculation` emits the post-calculation close point native_execution_consumer.cpp:7632-7633, so a request submitted in bar *k*'s calculation fills at bar *k*'s own close. |
131131
| `pyramiding` | `max_open_lots` native_run_spec.hpp:596 | `max_open_lots` pineforge.h:505 | `native_open_lots_strategy.cpp` | Caps surviving+new physical lots (`resulting_lot_count` native_execution_consumer.cpp:2974). The Pine adapter keeps its own per-cycle *entry count*, ruled **adapter-policy** in ADR-0001's table row `max_open_lots`; measured against TradingView it is not TradingView's rule, and this cap is the closer one (14 of 15 tape scenarios against 8, `tests/test_pyramiding_count_differential.cpp`). Lowered onto the cap, four corpus probes move away from TradingView, for want of its first-eligible-point rule, so the adapter keeps its count. |
132132
| `default_qty_type` | `Sized` native_order.hpp:164 with `CashValue` native_order.hpp:91 or `EquityFraction` native_order.hpp:97 | `PF_NATIVE_INTENT_SIZED` native_c_api.h:348 with `size_basis` native_c_api.h:2123 | `native_sized_report_strategy.cpp` | The size is a property of the *request*, not of the run: a native host may size one order by cash and the next by equity fraction. `Transact` native_order.hpp:41 is the fixed-units form. Pine itself has no per-call `qty_type` — TradingView's compiler refuses one — so a script's `strategy.entry(qty = ...)` is always units; the source layer's typed per-call entry, which only generated or C++ callers reach, converts its money exactly as the declared default does. |
133133
| `default_qty_value` | the basis's own scalar: `CashValue::cash` native_order.hpp:92, `EquityFraction::fraction` native_order.hpp:98 | `intent_value` native_c_api.h:2127 | `native_sized_report_strategy.cpp` | `SizeTime` native_order.hpp:106 chooses *when* the basis resolves and `SizePrice` native_order.hpp:146 *which* price it converts at; both compose. |

‎scripts/ci_verify.py‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,14 @@
257257
# test_removed_public_spellings); PAR-ORDERS and CI-FLAKE add no row. All
258258
# nine register in release too. 287 registered, 286 run: the WebSocket row
259259
# still skips on a system libcurl.
260-
KERNEL_MIN_TESTS = 286
260+
# 287 run = those 286 plus lane PERF-ZONED:
261+
# +1 PERF-ZONED test_native_session_day_zoned (session-day facts on a
262+
# certified cycle of an exchange zone without a calendar
263+
# interval per bar: certificates at real transitions, the
264+
# POSIX twin's facts at every decision point, the cost
265+
# pinned)
266+
# It registers in release too. 288 registered, 287 run.
267+
KERNEL_MIN_TESTS = 287
261268
# Release-row floor, the same gate for the default profile. Before lane P7
262269
# only the kernel profile had one, so a row that left release alone (a
263270
# source-bound TU dropped from TEST_SOURCES, a deleted twin or ABI row) left a
@@ -393,7 +400,9 @@
393400
# 704 = those 703 plus lane K-RUNERR's test_security_finer_than_feed: its TU
394401
# reaches the source layer, so it registers in release only and the kernel
395402
# floor does not move. No release row skips, so 704 registered is 704 run.
396-
RELEASE_MIN_TESTS = 704
403+
# 705 = those 704 plus PERF-ZONED's source-free row KERNEL_MIN_TESTS lists
404+
# above, which registers here too.
405+
RELEASE_MIN_TESTS = 705
397406
# ADR-0001 ruled-count floors, beside the ctest floors (R5 lane H-DOCGATES,
398407
# AUDIT4-opus X13 / docs-a N7). check_kernel_residuals.py counts the rulings
399408
# its vocabulary reads -- 174 identifiers and 45 texts on the lane's tree: the
@@ -418,9 +427,10 @@
418427
# at INT26, each with wave H's twenty-four rows of RELEASE_MIN_TESTS
419428
# (H-MEASURE +12, H-DOCGATES +3, K-OCA-KEEP +1, PAR-ORDERS-2 +4, PAR-MARGIN
420429
# +1, PAR-MARGIN-2 +1, PERF-KEDGE +1, PAR-CASHFEE +1), counted the same way;
421-
# 684/684/693 with INT26 round 2's tape row.
430+
# 684/684/693 with INT26 round 2's tape row; 686/686/695 with lane
431+
# K-RUNERR's and lane PERF-ZONED's rows (+1 each).
422432
# An excluded run must still discover at least this many rows before -LE.
423-
EXCLUDED_REGISTERED_MIN = {'debug': 684, 'sanitizers': 684, 'native': 693}
433+
EXCLUDED_REGISTERED_MIN = {'debug': 686, 'sanitizers': 686, 'native': 695}
424434
# The ctest stage's bound. A full sanitizers run (push to main, a manual
425435
# dispatch, the maintainers' verification) ran out of its 30 minutes twice on
426436
# main's four-core runner before every row had finished, so it gets an hour; a

‎scripts/test_ci_verify.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ def test_ctest_label_exclusion_is_forwarded(self):
13311331

13321332
def test_pr_exclusion_proves_registered_minus_labelled_equals_ran(self):
13331333
self.assertEqual(ci_verify.EXCLUDED_REGISTERED_MIN,
1334-
{'debug': 684, 'sanitizers': 684, 'native': 693})
1334+
{'debug': 686, 'sanitizers': 686, 'native': 695})
13351335
for profile, registered in ci_verify.EXCLUDED_REGISTERED_MIN.items():
13361336
with self.subTest(profile=profile):
13371337
code, summary, scripted, _ = self.run_profile(

0 commit comments

Comments
 (0)