Set 7 Secondary Runtime Bundle
Set 7 Secondary Runtime Bundle imports runtime, graph, cartography, stockgrid, and Polymarket bodies and exercises their fixture-bound boundaries.
The write-up
Secondary runtime behavior is exercised directly
Three copied market and numeric bodies are re-run over synthetic fixtures, and each good-input pass is paired with a planted regression that must fail on the right bad input. batch7_secondary_runtime_capsule copies a set of source bodies into a bundle and re-runs three of them against small synthetic fixtures. The three it exercises are numeric and market primitives: the stockgrid feature factory, the Polymarket order-book math, and the Polymarket four-lens scanner. The point is not that the copied code runs. The point is that each exercise is paired with a planted regression, so a check that only passes on good input is backed by a matching check that fails on the right bad input.
Three runtime groups share one metadata-only result
It calls the real copied functions on fixed inputs and writes metadata-only records of status, engine ids, and counts, never inlining a source body, model-output data, or live data. The component reads a fixture directory, imports each copied body, calls its real functions with fixed inputs, and compares the returned numbers to values the original author relied on. It writes metadata-only result records: status, engine ids, a copied-module count, and negative-case outcomes. It never inlines a copied source body, a model-output data, or live market data.
Passing fixtures do not imply hosted readiness
The one question: do the copied market and numeric bodies still behave as their source claims when run in isolation over test-author inputs? It answers one question. Do these copied market and numeric bodies still behave the way their source claims, when run in isolation over inputs the test author controls?
Purpose
How a copied body silently drifts
A copied body can drift in ways a clean-input smoke test never catches, since a bids[0] best-price read or a momentum divide only fails on adversarial input. A copied source body can drift from its original in ways a passing smoke test misses. A best-price reader that takes bids[0] looks correct until the feed returns bids floor-first. A momentum primitive that divides by a price ratio looks correct until the ratio hits -100 percent. A test that only feeds clean input proves the happy path and nothing else.
Each guard gets a paired negative check
Every engine records its good-path numbers and then a negative case that only clears if the guard still holds, where a blocked outcome means the guard fired. This bundle makes the failure explicit. For each of the three engines it records the good-path numbers, then runs a negative case that would only pass if the guard is still in place. The compute_best_prices extrema rule, the _daily_log_momentum_bps refusal, and the resolved-market gate each have a paired negative check. Blocked, here, means the guard fired.
How it works
run drives the spec and anchor checks
run forwards a fixed SPEC through run_crown_jewel_organ, and SOURCE_REQUIRED_ANCHORS confirms each copied body still carries its declared anchor strings before its output is trusted. The runner is run, which forwards a fixed SPEC to run_crown_jewel_organ with _evaluate as the evaluator and evaluate_negative_case as the negative-case evaluator. run_batch7_secondary_bundle is the same call over an exported bundle directory. SPEC also carries SOURCE_REQUIRED_ANCHORS, so the runner checks that each copied body still contains its declared anchor strings, for example def compute_best_prices and Numeric-extrema best-price extraction in clob_snapshot.py, before it trusts the exercise output.
_evaluate folds engine findings into status
_evaluate runs the three engines in order and returns pass only with no findings, recording a blocked code for any non-pass engine and a missing code for any absent id. _evaluate runs the three engines in order and collects findings. If any engine returns a status other than pass it records BATCH7_SECONDARY_ENGINE_EXERCISE_BLOCKED. If an expected engine id is missing from the results it records BATCH7_SECONDARY_ENGINE_EXERCISE_MISSING. It returns pass only when there are no findings, along with engine_count, sorted engine_ids, and copied_macro_source_module_count read from the source manifest.
The three engines:
| Function | Copied body | What it checks |
|---|---|---|
_stockgrid_exercise | tools/stockgrid/stockgrid.py | PayloadFactory primitives return the expected numbers |
_polymarket_clob_exercise | tools/polymarket/clob_snapshot.py | best bid/ask come from extrema, not row order |
_polymarket_score_exercise | tools/polymarket/score.py | a resolved market is gated to zero on one lens |
Four stockgrid primitives, one refusal
_stockgrid_exercise checks four PayloadFactory primitives, including a momentum call that must refuse a -100 percent change because it has no finite log return. _stockgrid_exercise builds a PayloadFactory and calls four primitives. _daily_log_momentum_bps(10.0, 10) must return a positive value above 90. _daily_log_momentum_bps(-100.0, 10) must return nothing: a claimed -100 percent daily change has no finite log return, so the primitive refuses it rather than emitting a misleading number. _zscore on the series [1, 2, 3] must equal [-1.224745, 0.0, 1.224745], and _mean_defined([1, None, "3"]) must equal 2.0. The engine passes only if all four hold.
Best price from extrema, not row order
A mis-sorted book must still yield best bid 0.42 and best ask 0.53 from the extrema rather than the first row, with the trap flag recording the difference. _polymarket_clob_exercise feeds a deliberately mis-sorted book to compute_best_prices. The bids are 0.12, 0.42, 0.25 and the asks are 0.88, 0.53, 0.65. The best bid must be 0.42 (the maximum bid) and the best ask must be 0.53 (the minimum ask), neither of which is the first row on its side. The spread must round to 0.11. It then computes depth at a band with compute_depth_at_band and a compute_depth_imbalance value that must stay in [-1, 1]. The sorted_book_trap_rejected flag records that the chosen prices differ from bids[0] and asks[0].
Resolved markets are gated to zero
Scoring an open and a resolved market confirms the four-lens set and that a settled market gates to 0.0 on NEWSBREAKER, so it cannot surface as a fresh signal. _polymarket_score_exercise scores two NormalizedMarket rows with calculate_lenses: one open, one resolved, identical except for status and price. The lens set must be exactly HOT SEAT, NEWSBREAKER, GOD MODE, SCOUT. The open market must score above zero on NEWSBREAKER and the resolved market must score exactly 0.0. The scorer gates that lens on market resolution, so the fixture confirms a settled market cannot surface as a fresh signal.
Diagram source & refs
flowchart TD fixture["Fixture directory copied bodies + manifest"] anchors["Anchor check SOURCE_REQUIRED_ANCHORS"] stock["_stockgrid_exercise PayloadFactory primitives"] clob["_polymarket_clob_exercise best-price extrema"] score["_polymarket_score_exercise four-lens scan"] negatives["Negative cases refusal, extrema, gate"] result records["metadata-only records status, engine ids, counts"] fixture --> anchors anchors --> stock anchors --> clob anchors --> score stock --> negatives clob --> negatives score --> negatives negatives --> result recordsNegative cases
Three planted regressions, each a code
EXPECTED_NEGATIVE_CASES names three guards, each emitting its stable code only when observed, where a blocked outcome is the intended result of catching the planted regression. EXPECTED_NEGATIVE_CASES names three cases, each with a stable error code. _stockgrid_extreme_momentum_negative re-runs the stockgrid exercise and reports blocked only when the exercise passed and extreme_momentum_refused is true, under code BATCH7_SECONDARY_STOCKGRID_EXTREME_MOMENTUM_REFUSED. _polymarket_sorted_book_trap_negative reports blocked when sorted_book_trap_rejected held, under BATCH7_SECONDARY_POLYMARKET_NUMERIC_EXTREMA_REQUIRED. _polymarket_resolved_market_negative reports blocked when resolved_newsbreaker_gated held, under BATCH7_SECONDARY_POLYMARKET_RESOLVED_MARKET_GATED. evaluate_negative_case routes a case id through _observed_negative_case and emits the expected error code only when the guard is observed. A blocked outcome is the intended result: it means the planted regression was caught.
Prior Art Grounding
Microstructure, log-returns, event markets
The three checks trace to order-book microstructure, log-return feature engineering with its -100 percent singularity, and event-market scanning, all run over synthetic rows only. The three engines sit in ordinary market-data and feature-engineering lineages. Order-book microstructure defines best bid, best ask, spread, and depth imbalance from the two sides of a limit-order book; the extrema rule here is the standard guard against a feed that does not sort its levels. Log-return feature engineering converts a percentage change into a bounded additive quantity and has a well-known singularity at a -100 percent change, which is why the primitive refuses it. Event-market scanning ranks prediction markets by freshness and other signals. The CFTC's prediction markets explainer is a plain boundary reference for what event-market data is and the caution it warrants. These fixtures run only over synthetic rows. They are not live market data and not trading decisions.
Validation Result record Path
Reader-verifiable fixture command, run from microcosm-substrate/:
Focused test, run from the repository root:
PYTHONPATH=src ./repo-pytest \
tests/test_batch7_secondary_runtime_capsule.py \
-q --basetemp /tmp/microcosm-batch7-secondary-runtime-tests
What a pass writes and asserts
A pass means all three engines returned their expected numbers with no engine missing and every negative case fired, writing result, result record, and board files. A pass means all three engines returned their expected numbers, no expected engine was missing, and each negative case fired. The fixture run writes batch7_secondary_runtime_capsule_result.json, batch7_secondary_runtime_capsule_validation_receipt.json, and batch7_secondary_runtime_capsule_board.json under the result record directory; the exported-bundle re-run uses the run-batch7-secondary-bundle action over exported_batch7_secondary_runtime_capsule_bundle.
Scope boundary
Scope limit
The narrow proof boundary
The strongest claim is narrow: three anchor-checked copied bodies still return their authors' numbers over fixed synthetic inputs, with every planted regression caught. The strongest claim this component supports is narrow. Three source bodies, copied into a bundle and anchor-checked, still return the numbers their authors relied on over fixed synthetic inputs, and each planted regression is caught. That is the proof boundary.
What it never authorizes
It grants no live market access, wallet authority, or investment-related actions, and dispatches no provider, mutates no source, and claims no launch, public sharing, or semantic correctness. It authorizes nothing beyond that. It is not live market access, wallet or account authority, or a market-data feed. It gives no investment-related actions. It does not export browser or session state, dispatch a provider or model, mutate the copied source, or prove the private and public roots are byte-identical. It is not a launch, not a public sharing, and not a claim that the scoring or momentum systems are complete or semantically correct. The AUTHORITY_CEILING constant holds every one of these fields false.
Context & evidence
In short Set 7 Secondary Runtime Bundle binds the accepted batch7_secondary_runtime_capsule component to copied runtime view-model, lane-progress, graph-lens, graph-projection, cartography, stockgrid, and Polymarket source bodies. It exercises eight fixture engines, source digest anchors, required anchors, UI witness metadata, synthetic runtime packets, synthetic market rows, negative cases, and scope limits while excluding browser/session export, wallet authority, live market data, investment-related actions, external model access, launch-scope decision, whole-system equivalence, semantic truth, and complete UI or ranking coverage.
Scope limit Fixture-bound public source-body import and secondary runtime/market witness evidence only; no browser/session export, wallet authority, live market data, investment-related actions, external model access, launch-scope decision, whole-system equivalence, semantic truth, source-file changes, or complete UI/ranking coverage proof.
Covers Secondary Runtime Source Bundle
Source
Source Source module: src/microcosm_core/organs/batch7_secondary_runtime_capsule.py · Design note · Source registry