Skip to main content

Reference implementation of the GTAF Runtime Enforcement Core

Project description

GTAF Runtime (Python)

Official reference implementation of the GTAF Runtime Enforcement core.

This repository is gtaf-runtime-py.

gtaf-runtime is a deterministic, artifact-driven enforcement gate for delegated actions.
It consumes evaluated governance outputs (for example DRC + referenced artifacts) and returns binary runtime outcomes.

Status

This repository is the runtime enforcement implementation, not the normative reference.
Current package version: 0.1.0.

Scope

This repository contains:

  • a minimal enforcement API (enforce, with backward-compatible evaluate alias)
  • deterministic rule evaluation with default-deny behavior
  • machine-readable deny reason codes
  • tests for allow/deny and rule-order edge cases

Runtime Specification

The runtime projection contract is formally defined in SPEC.md.

Projection v0.1 documents the exact input surface consumed by enforce() and reflects the current implementation without redefining normative GTAF artifacts. The canonical Projection v0.1 contract fixture kit is contract_fixtures/v0.1/. Normative Projection v0.1 runtime contract: docs/projection-v0.1.md.

Runtime Stability & Compatibility

Stability Level

The current package version is 0.1.x.

The runtime is considered alpha with respect to API ergonomics, but the Projection v0.1 semantic contract is frozen.

This means:

  • Enforcement semantics defined in docs/projection-v0.1.md are stable.
  • Evaluation order, first-failure behavior, and reason code meaning are frozen for Projection v0.1.
  • Runtime API ergonomics (e.g., module organization, helper layout) may evolve as long as enforcement semantics remain unchanged.

Projection Contract Freeze (v0.1)

Projection v0.1 defines a deterministic runtime contract.

For Projection version "0.1":

  • Canonical evaluation order is frozen.
  • First-failure semantics are frozen.
  • Ordering sensitivity rules are frozen.
  • Reason code meaning is frozen.

Any change to these semantics requires a MAJOR version increment of the Projection contract.

Supported Projection Versions

The runtime currently supports Projection version:

  • "0.1"

If a DRC declares an unsupported gtaf_ref.version, enforce() SHALL return:

  • outcome="DENY"
  • reason_code="UNSUPPORTED_GTAF_VERSION"

Future Projection versions (e.g. "0.2") require explicit runtime support.

Breaking Changes (MAJOR)

The following changes are considered breaking at the Projection contract level and require a MAJOR version increment:

  • Changing evaluation order.
  • Changing first-failure semantics.
  • Changing meaning of any existing reason code.
  • Changing binary outcome semantics (EXECUTE / DENY).
  • Renaming or removing reason codes.
  • Changing ordering sensitivity behavior for refs resolution.
  • Changing the contract-visible INTERNAL_ERROR fallback behavior.

Non-Breaking Changes

The following are considered non-breaking:

  • Internal refactoring.
  • Performance improvements.
  • Logging improvements.
  • Documentation updates.
  • CI changes.
  • Non-semantic helper utilities.
  • Internal module reorganization.

Public Runtime Contract Surface

The following surface is considered stable and safe for external consumers (including gtaf-sdk-py):

  • gtaf_runtime.enforce(...)
  • gtaf_runtime.evaluate(...) (alias of enforce)
  • The EnforcementResult output contract shape (including outcome and reason_code)
  • Projection v0.1 semantics as defined in:
    • docs/projection-v0.1.md
    • SPEC.md
    • contract_fixtures/v0.1/
  • The supported Projection version policy (currently "0.1")

Structural DRC validation is guaranteed as part of the enforce() contract flow (first evaluation stage), but no separate validation helper function is considered a stable public API.

Internal / Non-Contractual Implementation Details

The following are NOT part of the public contract and may change without notice:

  • Underscore-prefixed helpers (e.g. _validate_drc_schema)
  • Internal resolution helpers
  • Internal module layout
  • Private utilities
  • Internal evaluation mechanics

Consumers and SDK MUST NOT rely on internal or underscore-prefixed symbols.

Relationship to SDK

gtaf-runtime-py is the deterministic enforcement core.

gtaf-sdk-py is optional and layered on top of the runtime.

The SDK MUST rely only on the documented public runtime contract surface and MUST NOT depend on internal implementation details.

The SDK MUST NOT alter or reinterpret runtime enforcement semantics.

JSON Schemas

Projection v0.1 is additionally formalized using JSON Schemas under gtaf_runtime/schemas/.

These schemas describe the exact runtime projection surface consumed by enforce() and can be used by integrators or SDKs to validate inputs prior to runtime execution.

Packaged schema resources can be accessed via importlib.resources from gtaf_runtime.schemas.

Schema validation is not performed automatically by the runtime core.

Non-Goals

gtaf-runtime is not:

  • a governance authoring tool
  • a normative GTAF reference publication
  • a certification or compliance platform

Public API

from gtaf_runtime import enforce

result = enforce(drc, context, artifacts)
if result.outcome == "DENY":
    raise PermissionError(result.reason_code)

Backward compatibility:

from gtaf_runtime import evaluate  # alias to enforce

Installation

Install from PyPI:

pip install gtaf-runtime

Install from local checkout:

pip install .

Minimal import verification:

python -c "import gtaf_runtime; from gtaf_runtime import enforce; print('ok')"

Runtime Semantics (Minimal)

  • Outcomes: EXECUTE or DENY
  • Decision mode: deterministic, first failing rule wins
  • Ambiguity/error handling: deny by default
  • Explainability fields: outcome, drc_id, revision, valid_until, reason_code, refs

Local Development

Run tests:

python -m unittest discover -s tests -p 'test_*.py' -v

Repository Structure

  • gtaf_runtime/: runtime library
  • tests/: enforcement behavior tests
  • gtaf_runtime/schemas/: packaged Projection v0.1 schema artifacts

License

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gtaf_runtime-0.1.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gtaf_runtime-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file gtaf_runtime-0.1.0.tar.gz.

File metadata

  • Download URL: gtaf_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for gtaf_runtime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d9e1e8c7ee20a0534a9115bc54193c31b36fb6eae25064e1a4ed3cca57ffe69
MD5 af2af5590ffecbfbfa4343b3299dcc3e
BLAKE2b-256 8d6b55a5acecf9421e10db6430e2b0196af99a963f08596ae10e0907335f7426

See more details on using hashes here.

File details

Details for the file gtaf_runtime-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gtaf_runtime-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for gtaf_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8897c99f3d08b5fe72e5bc011a9bb7e3564ee525541ad171dc54745ff719a47f
MD5 3dff7e083bbe9c7cf65e08f69d3a8576
BLAKE2b-256 236500f99581ded8cfe0e432363e18d9e10091f356dc03a5a93a872b93bc7cd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page