OKHAM.org Documentation EnglishCastellano

Release candidate 0.2.0-rc.2

OTC · Example

Open original JSON

{
  "otc": "0.1.0",
  "id": "okham.memory.type.save.request",
  "name": "Request save data",
  "description": "Typed data for the existing OBC save runtime; no model-supplied operations or permissions.",
  "fields": [
    {
      "name": "payload",
      "type": "object",
      "required": true
    }
  ],
  "schema": {
    "type": "object",
    "required": [
      "payload"
    ],
    "additionalProperties": false,
    "properties": {
      "payload": {
        "type": "object",
        "required": [],
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "kind": {
            "enum": [
              "context",
              "task",
              "decision",
              "note",
              "architecture",
              "process",
              "policy",
              "test_suite"
            ]
          },
          "content": {
            "type": "object",
            "description": "Complete new raw suite or intentional complete replacement. For field repairs use patches with the observed saved/draft reference and omit content."
          },
          "type_ref": {
            "type": "string"
          },
          "record_id": {
            "type": "string",
            "description": "Actual saved suite record UUID for updates, paired with its current revision; never the raw suite operation id."
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "description": "Exact current saved record revision for compare-and-swap; stale updates reject rather than rebase."
          },
          "status": {
            "enum": [
              "active",
              "completed",
              "blocked",
              "proposed",
              "archived"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "maxItems": 20
          },
          "relations": {
            "type": "array",
            "maxItems": 40,
            "items": {
              "type": "object",
              "required": [
                "type",
                "target"
              ],
              "additionalProperties": false,
              "properties": {
                "type": {
                  "enum": [
                    "part_of",
                    "depends_on",
                    "related_to"
                  ]
                },
                "target": {
                  "type": "string"
                }
              }
            }
          },
          "source_paths": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 16
          },
          "validity": {
            "enum": [
              "current",
              "needs_review",
              "superseded"
            ]
          },
          "task_id": {
            "type": "string"
          },
          "draft_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Owner-bound rejected draft reference paired with draft_revision; not a public saved record."
          },
          "draft_revision": {
            "type": "integer",
            "minimum": 1,
            "description": "Exact draft version returned by the host; a successful save consumes the draft."
          },
          "patches": {
            "type": "array",
            "minItems": 1,
            "maxItems": 16,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "path"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500,
                  "description": "RFC6901 pointer into the raw suite, relative to the optional case_id/assertion_id. set replaces or adds an object member only when its parent exists; /- explicitly appends an array item. No implicit parents, fixtures or array gaps are created."
                },
                "op": {
                  "enum": [
                    "set",
                    "remove"
                  ],
                  "description": "set (default) assigns value at the existing parent; remove deletes an existing target. The whole atomic batch and complete resulting suite must validate before persistence."
                },
                "value": {
                  "description": "New literal JSON value required for set; not a patch document, expression or file reference. Omitted suite fields stay unchanged. remove does not consume value."
                },
                "case_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Select exactly one existing case by its stable id; path is then relative to that case. Unknown/ambiguous identities fail without changes."
                },
                "assertion_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "description": "Together with case_id select exactly one existing assertion by id; path is relative to that assertion. Use an explicit array append for a genuinely new assertion."
                }
              }
            }
          }
        },
        "anyOf": [
          {
            "required": [
              "content"
            ]
          },
          {
            "required": [
              "draft_id",
              "draft_revision",
              "patches",
              "kind"
            ]
          },
          {
            "required": [
              "record_id",
              "revision",
              "patches",
              "kind"
            ]
          }
        ],
        "allOf": [
          {
            "not": {
              "required": [
                "content",
                "patches"
              ]
            }
          },
          {
            "not": {
              "required": [
                "record_id",
                "draft_id"
              ]
            }
          }
        ],
        "dependentRequired": {
          "record_id": [
            "revision"
          ],
          "revision": [
            "record_id"
          ],
          "draft_id": [
            "draft_revision",
            "patches",
            "kind"
          ],
          "draft_revision": [
            "draft_id"
          ]
        }
      }
    }
  },
  "version": "0.1.0",
  "status": "draft",
  "metadata": {
    "projectionEditing": {
      "projection": "suite",
      "paths": "RFC6901 relative to the raw suite, never the compiled OFR envelope.",
      "targets": [
        "record_id/revision",
        "draft_id/draft_revision"
      ],
      "patches": "1-16 atomic set/remove operations; optional case_id/assertion_id scope the pointer. /- appends one complete array item only at the end of a path; it is not a wildcard for existing items. Omitted fields remain unchanged; one rejected patch rejects the entire batch.",
      "concurrency": "Original record revision CAS; no automatic rebase. Rejected updates retain their base record revision.",
      "read": {
        "tool": "memory_get",
        "projection": "suite"
      },
      "identity": "Persisted suite id is immutable; hashes, compiled OFR and revisions are host-owned.",
      "inspection": {
        "tool": "memory_get",
        "projection": "suite",
        "missingModes": [
          "error",
          "report"
        ],
        "default": "error",
        "reportRequiresPaths": true,
        "responseType": "okham.memory.type.suite.path.inspection",
        "behavior": "report returns pointer-keyed fields with present flags and observed repair context; strict default still rejects missing paths. No values or parents are synthesized."
      },
      "patchErrors": {
        "contextType": "okham.memory.type.suite.path.inspection",
        "fields": [
          "code",
          "path",
          "resolved_path",
          "paths",
          "patch_index",
          "path_context"
        ],
        "snapshot": "Unchanged input before rejected atomic batch; permissions and revision checks are unchanged."
      },
      "drafts": {
        "lifetimeMs": 900000,
        "maxEntries": 32,
        "persisted": {
          "code": "SUITE_DRAFT_PERSISTED",
          "message": "This draft was already saved as a project suite. The returned revision was observed at persistence, not confirmed current. Read the saved suite before editing; no operation was retargeted.",
          "recovery": {
            "tool": "memory_get",
            "instruction": "Use projection:suite and the returned record_id. Read current fields and revision, then patch only remaining changes with that saved reference. Do not recreate the suite or replay files."
          }
        },
        "notFound": "SUITE_DRAFT_NOT_FOUND: no live draft or completed-draft reference exists for this owner. Use the latest saved suite UUID if available; otherwise recover the current step before deciding whether a new raw definition is needed. A restart is not established by this error."
      }
    },
    "normative": {
      "typeRef": "okham.standards.type.normative.profile",
      "standard": "BCP14",
      "requirements": []
    }
  }
}