Programming Language

Nocter

A self-contained systems language built around simplicity, encapsulation, and foolproof design.

/development/reviews/v0.22.0-phase-5.md

v0.22.0 Phase 5 Standard-Library Stabilization Review

Outcome

Phase 5 is complete. The completed JSON implementation passed its adversarial source qualification, and the standard-library audit corrected three concrete cross-module defects without expanding the public API. No unresolved correctness or responsibility-boundary finding remains in the reviewed scope. Version identity, artifact generation, installed-home qualification, and publication remain release-preparation work.

Failure and Ownership Policy

Vec, String, and the table shared by Map and Set previously constructed separate capacity errors. The table's std.map.capacity_overflow spelling leaked one public collection's name through Set. All unrepresentable collection capacities now use one std/internal/mem constructor and the already specified std.mem.capacity_overflow code. A native contract proves the shared identity for Vec, String, and Map while preserving each collection's state after failure.

Ordinary Vec.insert previously flattened both recoverable bounds and allocation failures into the allocation-abort path. It now validates bounds through the standard safety boundary before calling the failure-atomic recoverable insertion core. The core remains the sole owner of growth and element movement; no second insertion algorithm or error-code comparison was added.

Formatting copied scalar values by reconstructing a raw slice locally, and OnceIter manually took and replaced optional storage. Both operations now cross focused generic helpers in std/internal/ptr. This removes direct public-pointer dependencies from fmt and iter, keeps the unsafe representation proof in one responsibility, and leaves call sites expressed in value terms.

JSON Adversarial Qualification

The existing same-module tests remain colocated intentionally: they exercise private cursor, Number, Unicode, parser, and traversal invariants that an external public package cannot observe. Public integration remains independently covered by the Writer, process, editor, and example tests. Phase 5 adds coverage for:

  • i64 and u64 extrema, first out-of-range values, exact exponent normalization, huge negative exponents, and non-integral projection;
  • the maximum Unicode scalar, invalid surrogate combinations, escaped solidus, raw controls, BOM, non-JSON whitespace, trailing tokens, and decoded duplicate names;
  • compact uppercase control escapes and preservation of exact Number spelling;
  • shared capacity failure identity, failure atomicity, deep explicit-stack traversal, selected allocator affinity, and destination failure.

The audit found one cursor, one Number grammar and normalized shape, one parser state machine, one String/Writer traversal, one escaping engine, and one private failure classification for each recoverable core. No JSON decision is repeated in the compiler, editor, example, or output adapter.

Public Contracts and Dependency Review

Frequently used Map, Set, Vec, String, memory, formatting, I/O, path, and process declarations now carry documentation in their module contract roots. LSP hover can therefore explain construction, capacity, ownership, failure, and iteration behavior without reading implementation files or exposing representation fields.

The standard-library dependency test remains an exact reviewed graph, not a permissive allowlist. It records removal of fmt -> ptr and iter -> ptr, records the intentional Vec bounds-termination dependency, and fails on either a new unreviewed edge or a stale expected edge. The final graph has no public JSON-to-representation dependency and no private internal module with global visibility.

Qualification

Phase 5 passed:

  • cargo test --workspace --quiet in development/compiler/;
  • all ten focused native standard-library contract tests, including 20 JSON internal cases, three public Writer cases, and the expanded collection failure matrix;
  • cargo clippy --workspace --all-targets -- -D warnings;
  • cargo fmt --all -- --check;
  • canonical formatter qualification for every runnable example;
  • generated documentation and link validation through node docs/build-docs.js;
  • git diff --check and a final authority/representation review.

At Phase 5 closure, the public JSON chapter remained future direction because the published v0.21.0 toolchain did not contain it. Release preparation subsequently promoted the chapter only after the deterministic v0.22.0 artifact and a fresh installed home passed their complete qualification gate.