Skip to content

Branch main Algo json pointer operations

github-actions[bot] edited this page Jun 20, 2026 · 75 revisions

Algorithm: Json Pointer Operations

Back to Branch Overview

Field Value
Branch main
Source specs/algorithms/json_pointer_operations.pseudo.md
Commit 5b2aac39fcf8
Synced (UTC) 2026-06-20T05:49:16Z

Visual Context

Algorithm pages define deterministic platform-neutral behavior that downstream repos implement behind native adapters.

flowchart LR
  Input["Input contract"] --> Preconditions["Preconditions"]
  Preconditions --> Decision["Deterministic decision"]
  Decision --> Output["Output contract"]
  Decision --> Diagnostic["Diagnostic envelope"]
  Diagnostic --> Audit["Audit chain"]
Loading

Reading Checklist

Question Where to look
What is deterministic? Read the pseudocode branch table and preconditions.
What blocks unsafe behavior? Look for blocked, ambiguous, policy, or precondition paths.
How is the decision reconstructable? Trace diagnostic and audit requirements.

Source Content

JSON Pointer Operations

Dot-path addressing is superseded. Aeostara uses JSON Pointer-compatible addressing as the normative model.

Rules

  • The empty pointer addresses the whole document.
  • / separates tokens.
  • ~1 decodes to / and ~0 decodes to ~.
  • Object keys containing . are ordinary keys and are not split.
  • Array tokens are base-10 indexes with no leading-sign syntax.
  • Missing is distinct from JSON null.
FUNCTION resolve_pointer(document, pointer) -> PointerResolution
  tokens = decode_json_pointer(pointer)
  current = document
  FOR token IN tokens:
    IF current is object:
      IF token is not an own key:
        RETURN {status: MISSING, value: ABSENT, pointsToMissing: true, pointsToNull: false}
      current = current[token]
    ELSE IF current is array:
      IF token is not a valid array index within bounds:
        RETURN {status: MISSING, value: ABSENT, pointsToMissing: true, pointsToNull: false}
      current = current[index(token)]
    ELSE:
      RETURN {status: MISSING, value: ABSENT, pointsToMissing: true, pointsToNull: false}
  END FOR
  RETURN {status: PRESENT, value: current, pointsToMissing: false, pointsToNull: current == null}
END FUNCTION

Mutation operations must call mutation_precondition_check before modifying a document.

Clone this wiki locally