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
25 changes: 25 additions & 0 deletions dag/test/claim/char_at_unicode_witness_test.dag
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module test.claim.char_at_unicode_witness

data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly

data char_at_unicode_witness_note: String = "CHARAT-0 discriminating control: char_at indexes Unicode code points, not UTF-8 bytes. A byte-offset implementation returns the wrong character at index 1 on \"aéb\" (continuation byte U+00A9 misread as ©) while code-point indexing returns U+00E9."

fn ae_b_sample() -> String {
concat("a", concat(from_code_point(cp: 233), "b"))
}

test fn char_at_indexes_code_points_on_multibyte_text() -> Bool {
let s = ae_b_sample()
char_at(s: s, pos: 0) == "a"
&& code_point(c: char_at(s: s, pos: 1)) == 233
&& char_at(s: s, pos: 2) == "b"
}

test fn char_at_byte_offset_would_mismatch_at_index_one() -> Bool {
let s = ae_b_sample()
code_point(c: char_at(s: s, pos: 1)) != code_point(c: "©")
}

test fn string_length_counts_code_points_not_bytes() -> Bool {
string_length(s: ae_b_sample()) == 3
}
83 changes: 83 additions & 0 deletions scripts/run-charat0-json-scaling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
# SCAFFOLD — CHARAT-0 parse_json survival slope comparison beside json_parse_scaling_probe
# (not a general scripts/ home; same transport class as docs/probes/run_frontier_probe_survey_per_module.sh).
# dissolve-on: delete when CHARAT-0 string-indexing acceptance enrolls a floor witness,
# STR-RC-0 scaffold retires, or large-regime measurement refutes and the branch reverts.
# Runtime-present: invokes json_parse_scaling_probe seed bin with JSON_PARSE_PROBE_MODE=survival
# per (carrier, size) in a fresh process; compares origin/main interpreter vs dispatch HEAD.
set -euo pipefail

ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"

PRE_DIR="/tmp/charat0-main-measure"
SIZES=(20000 40000 80000)
TIMEOUT_SEC=600

termination_label() {
local ec="$1"
case "$ec" in
0) echo "completed" ;;
2) echo "parse_failed" ;;
137|134|9) echo "killed (OOM or signal)" ;;
124) echo "timeout" ;;
*) echo "failed" ;;
esac
}

git fetch origin main --depth=1
MAIN_REF="origin/main"

echo "# charat0_scaling head=$(git rev-parse HEAD)"
echo "# charat0_scaling main=$(git rev-parse "$MAIN_REF")"

cargo build --release -p v1-compiler --bin json_parse_scaling_probe
POST_BIN="$ROOT/target/release/json_parse_scaling_probe"

rm -rf "$PRE_DIR"
git worktree remove --force "$PRE_DIR" 2>/dev/null || true
git worktree prune 2>/dev/null || true
git worktree add --detach "$PRE_DIR" "$MAIN_REF"
PROBE_SRC="$ROOT/src/v1/stage0/src/bin/json_parse_scaling_probe.rs"
cp "$PROBE_SRC" "$PRE_DIR/src/v1/stage0/src/bin/json_parse_scaling_probe.rs"
if ! grep -q json_parse_scaling_probe "$PRE_DIR/src/v1/stage0/Cargo.toml"; then
cat >>"$PRE_DIR/src/v1/stage0/Cargo.toml" <<'EOF'

# SCAFFOLD — CHARAT-0 / STR-RC-0 measurement transport (not floor-enrolled).
# dissolve-on: enrolled witness or refuted hypothesis (see json_parse_scaling_probe.rs marker).
[[bin]]
name = "json_parse_scaling_probe"
path = "src/bin/json_parse_scaling_probe.rs"
EOF
fi
(
cd "$PRE_DIR"
CARGO_TARGET_DIR="$PRE_DIR/target" cargo build --release -p v1-compiler --bin json_parse_scaling_probe
)
PRE_BIN="$PRE_DIR/target/release/json_parse_scaling_probe"

run_one() {
local label="$1"
local bin="$2"
local size="$3"
echo "=== $label target_bytes=$size (fresh process) ==="
set +e
timeout "$TIMEOUT_SEC" env \
JSON_PARSE_PROBE_MODE=survival \
JSON_PARSE_TARGET_BYTES="$size" \
"$bin"
local ec=$?
set -e
echo "# exit_code=$ec"
echo "# termination=$(termination_label "$ec")"
if [ "$ec" -ne 0 ]; then
echo "probe_refused label=$label target_bytes=$size exit_code=$ec termination=$(termination_label "$ec")" >&2
exit "$ec"
fi
}

echo "label\ttarget_bytes\telapsed_ms\tmembers_found\toutcome"
for size in "${SIZES[@]}"; do
run_one "pre-main" "$PRE_BIN" "$size"
run_one "post-charat" "$POST_BIN" "$size"
done
22 changes: 11 additions & 11 deletions src/v1/stage0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ path = "src/bin/claim_batch.rs"
name = "claim_executor"
path = "src/bin/claim_executor.rs"

# CHARAT-0 / STR-RC-0 measurement scaffold (not floor-enrolled).
# Local transport for `extdeps.languages.json.parse` `parse_json` interpreter scaling.
# Modes: `scaling` (sub-40KB grid), `large` (100/200/507KB decisive regime), plus
# `survival` and `memo_receipt` for mechanism receipts.
# DISSOLUTION: delete when CHARAT-0 string-indexing acceptance enrolls a floor witness
# (or STR-RC-0 scaffold retires), or when large-regime measurement refutes and reverts.
# Carrier: `JSON_PARSE_SCALING_PROBE_SCAFFOLD_MARKER` in json_parse_scaling_probe.rs.
[[bin]]
name = "json_parse_scaling_probe"
path = "src/bin/json_parse_scaling_probe.rs"

# Resolved-type owned-data discovery for Consolidation #4553 glob discovery.
# Hand-written CI tool (like claim_batch); exposes neutral decl facts only.
[[bin]]
Expand Down Expand Up @@ -276,17 +287,6 @@ path = "src/bin/compile_clean_diagnostic_histogram.rs"
name = "compile_clean_unlisted_import_census"
path = "src/bin/compile_clean_unlisted_import_census.rs"

# SCAFFOLD (DESIGN §7 seed-retained HAND-RUST / STR-RC-0) — local measurement transport
# for `extdeps.languages.json.parse` `parse_json` interpreter scaling. NOT floor-enrolled.
# Modes: `scaling` (sub-40KB grid, fixed-cost dominated) and `large` (100/200/507KB
# decisive regime — post must survive sizes pre reportedly OOM'd on, or refute).
# CHECKABLE RECEIPT: large-mode TSV rows `ok` vs host kill; not a sub-40KB exponent claim.
# DISSOLUTION: delete when STR-RC-0 enrolls a floor witness or large-regime refutes and reverts.
# Carrier: `JSON_PARSE_SCALING_PROBE_SCAFFOLD_MARKER` in json_parse_scaling_probe.rs.
[[bin]]
name = "json_parse_scaling_probe"
path = "src/bin/json_parse_scaling_probe.rs"

# B0 control witness (#7943, review 49798 / operator ruling): proves the
# GENERATED stage0 realization of declaration_exposure_from_containment under
# NamespaceStructuralRootExposure dispatches to three distinct outcomes
Expand Down
9 changes: 5 additions & 4 deletions src/v1/stage0/src/bin/json_parse_scaling_probe.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(clippy::disallowed_macros)]

//! SCAFFOLD (DESIGN §7 seed-retained HAND-RUST / STR-RC-0) — host transport for
//! SCAFFOLD (DESIGN §7 seed-retained HAND-RUST / CHARAT-0, STR-RC-0) — host transport for
//! `parse_json` survival and mechanism measurements on the v1 interpreter.
//!
//! NOT floor-enrolled — run standalone via `cargo run --release -p v1-compiler --bin
Expand All @@ -11,13 +11,14 @@
//!
//! CHECKABLE RECEIPT: survival mode records Present parse + member count vs process death.
//!
//! DISSOLUTION: delete this bin when STR-RC-0 acceptance is floor-enrolled with a modeled
//! witness, or when large-regime measurement refutes the hypothesis and the branch reverts.
//! DISSOLUTION: delete this bin when CHARAT-0 string-indexing acceptance is floor-enrolled
//! with a modeled witness (or STR-RC-0 scaffold retires), or when large-regime measurement
//! refutes the hypothesis and the branch reverts.
//! Receipt: `rg JSON_PARSE_SCALING_PROBE_SCAFFOLD_MARKER src/v1/stage0` until deletion.

/// Grep receipt for scaffold dissolution (`rg JSON_PARSE_SCALING_PROBE_SCAFFOLD_MARKER`).
pub const JSON_PARSE_SCALING_PROBE_SCAFFOLD_MARKER: &str =
"STR-RC-0 json_parse_scaling_probe measurement transport (not floor-enrolled)";
"CHARAT-0 STR-RC-0 json_parse_scaling_probe measurement transport (not floor-enrolled)";

use std::process::ExitCode;
use std::time::Instant;
Expand Down
Loading