Skip to content

core: add bounded canonical ingress - #190

Merged
yihanzhu merged 13 commits into
mainfrom
codex/portable-core-ingress
Aug 30, 2026
Merged

core: add bounded canonical ingress#190
yihanzhu merged 13 commits into
mainfrom
codex/portable-core-ingress

Conversation

@yihanzhu

@yihanzhu yihanzhu commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Tracks #155

Construction unit: portable-core-ingress (2 of 7)

Exact candidate

  • base: d48ecdb
  • head: f95d180
  • generation: g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386
  • parent spec: c6511d96c1a5e6aed27ba2075b5add65c121f782

Schema G3 dependency

  • merge/current base: d48ecdb
  • schema export: 100644 blob fd3924d414a7d620c2bf5de919a45c2599d572ec
  • registry prefix: this generation remains the exact first entry; later canonical unique entries may append
  • built_against: portable-core-schema G3 comment 5466181650

Scope

  • Adds the literal-generation private ingress shell library.
  • Adds ingress-owned data, ledger mapping, and exact CI tests.
  • Appends only four restore-critical paths to ci/required-files.txt.
  • Does not change schema, registry, workflow, public wrapper/root, docs, live callers, accepted artifacts, or PR Add the v1 portable core contract validator (inactive) #183.

Behavior

  • Reads every input once into a bounded private snapshot.
  • Rejects any lexical source path with a symlinked, missing, empty, dot, or dot-dot component before physical path resolution, then requires the exact generation core-ingress.sh path.
  • A fixed byte pass proves JSON grammar, UTF-8, strict tokens, schema-aligned node depth, layout, and final-LF rules with an explicit stack. Root node depth is zero; container nodes record depth before push; scalar values record current parent depth.
  • Scalars and object keys are written in bounded chunks. jq 1.6 sees only shallow scalar roots and shallow integer key-index pairs; it never receives a document path or nested document.
  • Raw-byte E_LIMIT remains before parse. Within the byte limit, complete parse and canonical proof across all inputs precede parsed-depth E_LIMIT.
  • Every semantic result uses validated marker files. Any nonzero od, awk, jq, comparison, hash, or I/O status remains E_RUNTIME.
  • Tests cover one-million-byte depth-250000 plus width-250000 documents, exact schema depth boundaries, malformed and noncanonical variants, dense and long tokens, deep object order, Unicode order, path ancestry, and dependency failures.
  • Keeps document, profile-set, and stage-run routes private until assembly.

Size explanation
The accepted 230-320 estimate is exceeded, but the diff remains one ingress concern. The 1,110-line private library makes physical loading, the bounded parser, canonical proof, and every raw/temp boundary explicit. The 1,360-line proof covers 20 owned rules, 138 direct and route cases, 44 forced runtime and write failures, both frozen ledgers, pinned jq on Linux x86_64 and macOS x86_64, and macOS arm64 when Rosetta can run the pinned amd64 jq 1.6 asset. It also covers future private modules, append-only registry growth, and restore and activation guards. Compressing these state and fault boundaries would make loading, parser, canonical, precedence, resource, platform, and failure regressions harder to review. This does not waive CI, exact review, or the one-concern rule.

Exact-head proof

  • required CI run 33297437298: SUCCESS
  • full scripts/test/run-all.sh: all 10 test scripts passed
  • owner suite: 20/20 rules; 138/138 direct; 44/44 runtime/error; 5/5 activation/restore; 2/2 review rows; 38/38 legacy rows; failures 0
  • ShellCheck 0.11.0, structure, rename, and diff checks: clean
  • generation export: 100644 blob e882b38b0106aac9142c667771f02e3107f8c52f
  • fresh independent exact-head review is still required; all earlier review is stale

Inactivity
The generation remains incomplete and private. There is no contracts root, public wrapper, live caller, install, profile activation, credential access, deployment, or external write.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Exact-head local proof

  • head: 319e777
  • base: d48ecdb
  • worktree: clean
  • owner suite: owned rules 18/18; direct cases 55/55; runtime/error cases 27/27; activation/restore 4/4; review findings 2/2; legacy assertions 38/38; failures 0
  • full scripts/test/run-all.sh: all 10 test scripts passed
  • ShellCheck 0.11.0 over every tracked shell file: clean
  • structure manifest: clean
  • rename gate: clean
  • git diff check: clean

The exact head still binds schema export fd3924d414a7d620c2bf5de919a45c2599d572ec and registry 5e113105777694a280166e71d31efd19752e9562 from schema G3. The generation remains private and incomplete.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploying ystack with  Cloudflare Pages  Cloudflare Pages

Latest commit: f95d180
Status: ✅  Deploy successful!
Preview URL: https://11fe1629.fabrica-6yx.pages.dev
Branch Preview URL: https://codex-portable-core-ingress.fabrica-6yx.pages.dev

View logs

@yihanzhu

Copy link
Copy Markdown
Owner Author

CI-parity revision

  • new head: 60af033
  • base unchanged: d48ecdb
  • scope: test evidence only; product blob remains 572e8475b2b8102ab7d4b9ffc0f0c6bb0bc04b6f

Changes

  • Replaced an ancestor git-show assertion that cannot work in GitHub shallow checkouts with the established pinned manifest-prefix line count and SHA-256 proof.
  • Corrected the exact 1,048,576-byte fixture to use 128 decoded strings, each within the 8,192-byte schema limit. Its test driver now runs schema parsed limits before envelope shape, so E_SHAPE proves the raw boundary reaches the later shape layer rather than bypassing a parsed E_LIMIT.

Exact-head owner proof

  • 18/18 owned rules
  • 55/55 direct cases
  • 27/27 runtime/error cases
  • 4/4 activation/restore cases
  • 2/2 review findings
  • 38/38 legacy assertions
  • failures: 0
  • ShellCheck 0.11.0 and diff check: clean

Fresh exact-head CI and independent review are required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Owner boundary clarification

The fresh construction brief explicitly assigns this unit fixed private loading of the existing schema module, a private literal-generation-bound shell API, fixed physical package/module checks, and fake cwd/HOME/module-search/alternate-file proof. This is the bounded ingress self-check implemented here.

Assembly remains the sole owner of the public wrapper and root selection, public command/arity routing, cross-member/import grammar guard, generation activation, and the final wrapper-to-generation cross-check. It must source this ingress library and must not copy the ingress schema probe. Ingress resolves only its own private package location; it never resolves a target repository, public generation choice, caller-selected root/module/code, or live configuration.

This records the non-overlapping handoff for the later assembly unit; it does not widen this PR.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Exact-head author handoff

  • head: e953d9f
  • base: d48ecdb
  • remote/local head: exact match
  • worktree: clean
  • required CI run 33288757084: SUCCESS
  • Cloudflare Pages: SUCCESS
  • owner suite: 19/19 rules; 75/75 direct; 29/29 runtime/error; 5/5 activation/restore; 2/2 review rows; 38/38 legacy rows; failures 0
  • exact-head full runner: all 10 test scripts passed
  • ShellCheck 0.11.0, structure, rename, and diff: clean
  • independent read-only preflight: no Important finding

Candidate exports

  • generation export: {path: core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh, mode: 100644, type: blob, oid: f12434cb7d273406b6fe238c8d17ea1c76feb1a5}
  • activation exports: []

Dependency remains exact

  • schema: 100644 blob fd3924d414a7d620c2bf5de919a45c2599d572ec
  • registry: 100644 blob 5e113105777694a280166e71d31efd19752e9562

All older review and proof comments are stale. The formal independent PR review must bind this exact head/base. The package remains private, incomplete, and inactive.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: e953d9f
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-87132/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress rejects these inputs but returns the wrong stable error classes for malformed UTF-8 within strings and valid JSON beyond jq's parser depth ceiling. Both violate the documented parse/canonical/structural-limit contract.

Full review comments:

  • [P2] Reject malformed UTF-8 inside JSON strings — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.AGRQHcstKo/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:314-316
    When an invalid byte occurs inside a quoted string, jq 1.6 replaces it with U+FFFD in both the normal parse and -R probe, so this regex accepts the normalized string. For example, {"x":"<0x80>"}\n reaches the byte comparison and returns E_CANONICAL instead of the required E_PARSE. Add a byte-level UTF-8 check before jq normalization.

  • [P2] Classify jq's depth ceiling as a structural limit — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.AGRQHcstKo/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:308-310
    For valid JSON deeper than jq 1.6's parser ceiling (for example, 257 nested arrays), the first probe exits 4 and this branch reports E_PARSE. The contract's depth limit is 32 and requires over-limit structure to return E_LIMIT, so sufficiently deep values bypass the schema-owned limit and are misreported as malformed JSON.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5466408674

New exact head: d8dfaa4
Base unchanged: d48ecdb

Both findings are fixed within ingress scope:

  1. Malformed UTF-8 no longer reaches jq normalization. A fixed od+awk byte scanner validates RFC-3629 continuation ranges, rejects overlong encodings, surrogate code points, values above U+10FFFF, lone continuations, and truncation. It scans the whole private bounded snapshot, maps invalid bytes to E_PARSE, and maps od/awk or private-read failure to sanitized E_RUNTIME. Tests cover invalid bytes outside and inside strings plus valid 2-, 3-, and 4-byte boundaries.

  2. The same raw scanner tracks JSON quote and escape state, ignores brackets/braces inside strings, and records root-inclusive container depth. Depth 32 proceeds; 33 and 257 return E_LIMIT without relying on jq parsing. The scanner finishes UTF-8 validation before applying the recorded depth result. Tests cover exact 32/33, 257, escaped string delimiters, malformed/unclosed within the limit, tool failures, and multi-input ordering.

Exact-head owner proof: 20/20 rules; 95/95 direct; 32/32 runtime/error; 5/5 activation/restore; 2/2 review findings; 38/38 legacy assertions; failures 0. ShellCheck 0.11.0, rename, and diff are clean. Fresh exact-head CI and formal review are required; all evidence on e953 and earlier is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Exact-head revision handoff

  • head: d8dfaa4
  • base: d48ecdb
  • local/remote head: exact match
  • worktree: clean
  • required CI run 33289988091: SUCCESS
  • Cloudflare Pages: SUCCESS
  • exact-head full runner: all 10 test scripts passed
  • owner suite: 20/20 rules; 95/95 direct; 32/32 runtime/error; 5/5 activation/restore; 2/2 review findings; 38/38 legacy assertions; failures 0
  • ShellCheck 0.11.0, structure, rename, and diff: clean
  • independent exact-head read-only preflight: no Important finding; both findings in formal comment 5466408674 closed

Candidate generation export

  • {path: core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh, mode: 100644, type: blob, oid: 784e895373ec7bcc371b781722c3c3e65dac7d8e}
  • activation exports: []

Dependencies remain exact: schema fd3924d414a7d620c2bf5de919a45c2599d572ec; registry 5e113105777694a280166e71d31efd19752e9562. All earlier formal review evidence is stale; rerun the formal reviewer on this exact head/base. The generation remains incomplete, private, and inactive.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: d8dfaa4
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-8867/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress implementation violates the contract's deterministic error ordering for deep inputs with earlier parse or canonical defects.

Review comment:

  • [P2] Preserve parse and canonical precedence over depth limits — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.77JusWe04y/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:412-415
    For any under-byte-limit input whose raw nesting exceeds 32, this returns E_LIMIT before jq parsing or canonical comparison. Consequently, malformed deep JSON returns E_LIMIT instead of E_PARSE, and valid but noncanonical deep JSON returns E_LIMIT instead of E_CANONICAL, violating the documented parse → canonical → parsed structural limits order. Defer the semantic depth error until those earlier phases pass, using any raw scan only as a safety preflight.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5466464134

New exact head: c2d069a
Base unchanged: d48ecdb

The P2 is fixed without changing scope. Raw depth is now metadata only until every within-byte input passes strict streaming parse and canonical-byte proof. The jq 1.6 streaming canonicalizer uses stream paths, jq key ordering, and jq scalar encoding, so it handles depth 257 without rebuilding the deep value. Only then may parsed depth return E_LIMIT.

New regressions prove malformed deep input returns E_PARSE, noncanonical deep input returns E_CANONICAL, canonical depth 33 and 257 return E_LIMIT, and multi-input parse/canonical faults beat a depth fault.

Exact-head proof: required CI run 33290932571 SUCCESS; full runner 10/10; owner suite 20/20 rules, 100/100 direct, 32/32 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Export blob: c037fa13ca3c902f09046ce14abb4e066fb2f29c. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: c2d069a
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-74466/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

Dense but byte-bounded canonical documents can consume excessive CPU or terminate validation, and the activation guard will reject the next valid planned generation module. Both issues should be resolved before the patch is considered correct.

Full review comments:

  • [P1] Avoid exhausting workers on dense canonical input — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.y69rcPnsg8/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:437-437
    A canonical 1,000,002-byte array containing 500,000 zeroes is below the raw-byte limit, but this reducer updates its state and growing .out string for every scalar. Processing such an input takes tens of seconds or is killed before the schema can return the required E_LIMIT for exceeding 256 members, so a bounded untrusted document can exhaust a validator worker; use a linear canonical-byte check and add a dense near-limit regression.

  • [P2] Allow planned private modules in the activation guard — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.y69rcPnsg8/scripts/test/portable-core-ingress.test.sh:891-893
    When the next planned child adds modules/profile_graph.jq, this find result gains a third line and the ingress test fails, even though that file is an explicitly allowed private generation export. Because run-all.sh reruns this test for every later child, make this guard generation-aware like the schema guard: require schema and ingress while allowing the known pre-assembly module paths.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5466575274

New exact head: f4f820d
Base unchanged: d48ecdb

Both findings are fixed on the same branch.

  1. Dense and deep inputs no longer grow one jq state string per token. Depths through the proven worst-case jq 1.6 boundary use the normal canonicalizer. Deeper values emit bounded stream fragments. The raw strict-token check is a constant-state DFA. Tests cover a 1,048,574-byte dense array, a 1,048,575-byte number, depth 100000, and object/mixed depth 128/129.
  2. The private-generation guard now requires schema and ingress, rejects unknown files and public activation, and allows only the four planned private module paths. Its forward path is tested.

The parse channel is also explicit: stream parse faults append a private NUL marker, while every nonzero jq exit, including forced 5 and 41, is E_RUNTIME.

Exact-head proof: required CI run 33292362213 SUCCESS; full runner 10/10; owner suite 20/20 rules, 112/112 direct, 33/33 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Export blob: 3a08883b1da29095d7fea17b39d1fd380cc4ff7b. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: f4f820d
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-47855/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress implementation appears sound, but the new required test suite is not runnable on a platform it explicitly claims to support.

Review comment:

  • [P2] Stop treating amd64 jq as an arm64 binary — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.8rW4GtRMyg/scripts/test/portable-core-ingress.test.sh:50-51
    On an Apple Silicon host without Rosetta, the Darwin:arm64 branch downloads the x86_64-only jq-osx-amd64 executable, so the subsequent version check cannot run and the mandatory test suite fails. Use a native arm64 jq 1.6 build for this case or report the platform as unsupported.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5466720814

New exact head: 8684259
Base unchanged: d48ecdb

The test-only platform finding is fixed. Darwin:x86_64 and Darwin:arm64 are now separate cases. Apple Silicon uses the fixed amd64 jq 1.6 asset only when executing that exact asset proves Rosetta 2 is available. Without it, the suite reports Darwin:arm64 without Rosetta as unsupported. Digest validation happens before the single version probe; an executable with a wrong version remains an identity failure. No product code changed.

Exact-head proof: required CI run 33292889806 SUCCESS; full runner 10/10; owner suite 20/20 rules, 112/112 direct, 33/33 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Product export is unchanged at 3a08883b1da29095d7fea17b39d1fd380cc4ff7b. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: 8684259
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-73692/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

A missing or failing runtime dependency can bypass the ingress library's sanitized error boundary and leak its absolute repository path before the expected token.

Review comment:

  • [P2] Suppress dirname failures while resolving the source path — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.QGIMaDHAYW/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:41-41
    When PATH lacks dirname or resolves a failing implementation, this command substitution emits Bash's diagnostic before E_RUNTIME; the diagnostic includes the absolute core-ingress.sh path. This violates the promised sanitized error boundary and failure-token-first format, so resolve/check dirname first or redirect stderr inside the substitution.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5466773415

New exact head: b6cf6aa
Base unchanged: d48ecdb

The sanitized-boundary finding is fixed and the same boundary was audited end to end.

  • Source and repository path resolution now suppress the whole group. A dirname that prints a usable path and then fails is rejected as exact E_RUNTIME.
  • The jq version text is accepted only from a successful command. Valid jq-1.6 text with a nonzero exit is E_RUNTIME.
  • Validator byte counts must be digits before arithmetic. Malformed successful WC output is E_RUNTIME.
  • Validator output uses checked read instead of command substitution. Raw NUL, extra output, missing newline, unknown tokens, and tool failures are exact E_RUNTIME without a preceding shell diagnostic.

Exact-head proof: required CI run 33293769853 SUCCESS; full runner 10/10; owner suite 20/20 rules, 116/116 direct, 37/37 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Export blob: 8a65d5a97e396979ed58d5d976052feedbbcaa47. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: b6cf6aa
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-22653/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress path has a readily constructible CPU-exhaustion case within its documented input-size limit. The implementation should preserve bounded validation cost for excessively deep canonical inputs.

Review comment:

  • [P2] Avoid quadratic comparisons of deep stream paths — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.brFtl6D58i/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:602-605
    For canonical JSON containing a deeply nested array with many siblings at its deepest level, every streamed leaf executes two O(depth) slices and compares them. The 1,048,576-byte limit still permits roughly 250,000 nesting levels and 250,000 leaves, producing billions of path operations before the eventual E_LIMIT; this can stall validation for minutes and defeats the resource bound. Compare parent paths without repeatedly copying the full prefixes.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5466855613

New exact head: 03768db
Base unchanged: d48ecdb

The deep-path resource finding is fixed at the root. jq no longer receives document stream paths at any depth.

One fixed od-to-awk pass now validates grammar, UTF-8, strict tokens, layout, final LF, and depth with an explicit stack. It writes scalar and key bytes in bounded chunks plus shallow integer key-index pairs. jq 1.6 canonicalizes only shallow scalar roots and compares only the shallow indexed key pairs. Parse and canonical outcomes use validated files; all nonzero tool statuses remain E_RUNTIME.

Regressions include an exact 1,000,000-byte document with depth 250000 and width 250000 returning E_LIMIT, an end-malformed form returning E_PARSE, a whitespace form returning E_CANONICAL, deep sorted/duplicate/unsorted objects, Unicode key order, deep surrogate cases, long scalars, and forced analyzer/marker failures.

Exact-head proof: required CI run 33295616206 SUCCESS; full runner 10/10; owner suite 20/20 rules, 133/133 direct, 43/43 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Export blob: 22214adb3b12affac532e6e5ea46de92590a07d3. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: 03768db
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-90006/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress implementation is extensively tested, but its permanent CI test incorrectly treats the explicitly append-only generation registry as immutable. This will block valid future generation additions.

Review comment:

  • [P2] Permit append-only growth of the generation registry — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.KaWkrrhjCr/scripts/test/portable-core-ingress.test.sh:1168-1169
    When a later portable-core generation is registered, the append-only registry's blob OID necessarily changes even though this generation's entry and schema export remain untouched. Because scripts/test/run-all.sh executes this test on every CI run, this whole-file OID pin will make every valid future registry append fail CI; verify this generation's exact record and the registry's ordered-prefix invariants instead.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5467060717

New exact head: a2084d8
Base unchanged: d48ecdb

The test-only registry finding is fixed. The schema export blob remains pinned, but the whole registry blob is no longer treated as immutable. The guard now requires exactly one canonical JSON root, pins this generation as the exact first entry, validates every entry shape and OID format, and requires unique generation IDs. A future canonical append passes; a reordered prefix and a two-root file fail.

Exact-head proof: required CI run 33296376633 SUCCESS; full runner 10/10; owner suite 20/20 rules, 134/134 direct, 43/43 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Product export remains 22214adb3b12affac532e6e5ea46de92590a07d3. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: a2084d8
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-35884/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress path validation can accept package paths that traverse symlinked ancestors, violating an explicit code-loading safety invariant. This should be corrected before the generation becomes immutable and publicly assembled.

Review comment:

  • [P1] Reject symlinked ancestors before resolving the source — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.4hrwBD3Aln/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:42-45
    When the library is sourced through a path whose core, v1, or generations component is a symlink to another complete tree, cd -P removes that evidence before required_dir is constructed. The later ! -L checks therefore inspect only the physical targets and pass, allowing schema and root code from a different repository despite R17's no-symlink and same-repository contract. Check the original source-path components before canonicalizing them and bind the result to the wrapper's physical root.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5467126825

New exact head: 7cb64c1
Base unchanged: d48ecdb

The source-path safety finding is fixed before physical resolution. The library now builds its exact lexical absolute source path, rejects every empty, dot, dot-dot, missing, non-directory, or symlinked ancestor, requires a regular non-symlink final file, and then requires that checked path to equal the literal generation core-ingress.sh. A complete otherwise-valid package reached through a symlinked core ancestor returns exact E_RUNTIME. Assembly remains responsible for its final wrapper-to-repository-root cross-check.

Exact-head proof: required CI run 33296902683 SUCCESS; full runner 10/10; owner suite 20/20 rules, 135/135 direct, 44/44 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Export blob: 0c0747bc71380d7e84ae2ba8c38278654cef42ef. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: 7cb64c1
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-64539/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The ingress depth counter disagrees with the accepted schema at an exact boundary, causing valid parsed-depth inputs to receive the wrong error before semantic validation.

Review comment:

  • [P1] Align ingress depth with schema depth — /var/folders/rm/bkx4f4b91vqfn79vk02pcd140000gn/T/tmp.NiC77R0BJu/core/v1/generations/g-14b7ad8ce54c3b8c585ff92063d71551ffc7394cc2294d0297bc7d2b8da2c386/core-ingress.sh:803-804
    For a value whose deepest node is an empty container at schema depth 32, such as 33 nested arrays ending in [], schema::parsed_limits_ok accepts it because the root starts at depth 0. This scanner instead counts 33 container opens and returns E_LIMIT before validation, misclassifying a canonical boundary input that should proceed to shape or semantic validation.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Formal review response — comment 5467184854

New exact head: f95d180
Base unchanged: d48ecdb

The depth boundary now exactly matches schema::parsed_limits_ok. Root node depth is 0. A container records its current parent depth before stack push. Scalar and string values record the current open-container depth. Object keys do not add value depth. An empty container at schema depth 32 proceeds, while the same node at depth 33 returns E_LIMIT; existing scalar depth 32/33 cases remain unchanged.

Exact-head proof: required CI run 33297437298 SUCCESS; full runner 10/10; owner suite 20/20 rules, 138/138 direct, 44/44 runtime/error, 5/5 guards, 2/2 review rows, 38/38 legacy rows; ShellCheck 0.11.0 and repository gates clean. Export blob: e882b38b0106aac9142c667771f02e3107f8c52f. Fresh formal review is required; all older evidence is stale.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: f95d180
Reviewed-base: d48ecdb
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/190-93306/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

No actionable correctness issues were identified. The ingress implementation enforces bounded snapshots, canonical JSON, depth and byte limits, sanitized failures, and fixed schema loading, with extensive regression coverage.

@yihanzhu

Copy link
Copy Markdown
Owner Author

Exact candidate is clean; host merge action blocked

  • head: f95d180
  • base/current main: d48ecdb
  • required CI run 33297437298: SUCCESS
  • final independent review: clean, comment 5467237651
  • merge state: CLEAN / MERGEABLE
  • squash-only ancestry and construction-mode identities reverified

The local host safety approval layer rejected the authorized squash-merge command because it applied the repository operating-mode no-merge text instead of the active construction overlay. I did not retry through another path. Operator action: squash-merge this exact unchanged PR. The next construction run will verify the merge receipt and continue with portable-core-profile-graph.

@yihanzhu
yihanzhu merged commit 6ae9452 into main Aug 30, 2026
2 checks passed
@yihanzhu
yihanzhu deleted the codex/portable-core-ingress branch August 30, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant