Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
4a42c2d
Refresh maintained examples from generator v4.2.0 (qualification cand…
Nov 19, 2026
2fc124c
Bind refreshed passive metadata to explicit generated-file inventories
Nov 19, 2026
e6c555e
Include passive manifests in complete scalar and expression fixture i…
Nov 19, 2026
9de3ad5
Align application creation calls and retained Assist with generator v…
Nov 19, 2026
572ead9
Preserve managed-creation callers while restoring generator compatibi…
Nov 19, 2026
b35c0d4
Regenerate current examples with the qualified generator compatibilit…
Nov 19, 2026
9168680
Preserve example coverage with current collection and diagnostic cont…
Nov 19, 2026
b64cd6a
Preserve natural creation and failed Context Fix behavior with curren…
Nov 19, 2026
e108de6
Bind current examples to one qualified generator source revision
Nov 19, 2026
6dba387
Generate current examples with the qualified stable-intent producer
Nov 19, 2026
7aa1080
Move School business consumers into generated Python scopes and prese…
Nov 20, 2026
f80f1b0
Record School business, bootstrap and existing data preservation evid…
Nov 20, 2026
7559d1f
Use the generated Python workspace entry for the retained Order busin…
Nov 20, 2026
8c28195
Record Python Order workspace, privacy and same-database qualification
Nov 20, 2026
c1211e7
Show School Facets through native generated library and application w…
Nov 20, 2026
8d73cba
Record focused python examples/facet-trace business qualification
Nov 20, 2026
7eab457
Bind exact scope provenance and preserve the generated WorkItem busin…
Nov 20, 2026
656871e
Record focused python examples/conformance business qualification
Nov 20, 2026
10d85e1
Show purchase-order Fix and loaded-graph boundaries in native Python …
Nov 20, 2026
e1cd5dc
Fingerprint moved purchase-order graph probes at their native workspa…
Nov 20, 2026
a505c31
Record focused python examples/fix-e-alignment business qualification
Nov 20, 2026
0d84420
Explain the purchase-order model, native workspace and business verif…
Nov 20, 2026
6a594b3
Host Catalog and Entry validation in native model-generated workspace…
Nov 20, 2026
c810070
Record focused python examples/natural-messages business qualification
Nov 20, 2026
74355ab
Explain the Catalog model, workspace entry and located validation out…
Nov 20, 2026
da41dfb
Host Context-derived business fields in current scopes while preservi…
Nov 20, 2026
c071aeb
Use the Assist-confirmed managed creation result and preserve all Con…
Nov 20, 2026
06fc556
Record focused python examples/context-derived business qualification
Nov 20, 2026
e8d8591
Explain the Context-derived Catalog scene and preserved historical ca…
Nov 20, 2026
b004c9b
Show governed numbering on generated purchase orders
Nov 20, 2026
5fde6d0
Record focused python examples/business-id business qualification
Nov 20, 2026
6b1c4b9
Demonstrate Context business-day cutover on generated delivery orders
Nov 20, 2026
788def1
Record focused python examples/business-clock business qualification
Nov 20, 2026
ab2d0dd
Place example capabilities in generated business workspaces
Nov 20, 2026
43d1964
Record focused python examples/mutation-policy business qualification
Nov 20, 2026
0384f8a
Place robot task board entries in their generated console workspace
Nov 20, 2026
aaa0d65
Record focused python examples/task_board business qualification
Nov 20, 2026
473d483
Show scoped internal identity allocation with warehouse purchase orders
Nov 20, 2026
7f46f32
Record focused python examples/internal-id business qualification
Nov 20, 2026
c4c0275
Apply independent tenant policies to one generated procurement request
Nov 20, 2026
0d16076
Record focused python examples/query-policy business qualification
Nov 20, 2026
087464b
Show exact freight values in the generated quote workspace while reta…
Nov 20, 2026
2b8cf36
Record focused python examples/scalar-type-probe business qualification
Nov 20, 2026
b4fc166
Show typed python Context capabilities in vendor-registration
Nov 20, 2026
9a9445f
Decode the typed audit entity ID in the supplier example
Nov 20, 2026
0570900
Read the retained supplier name through the generated expression
Nov 20, 2026
fc7c34e
Record focused python examples/typed-extension-spi business qualifica…
Nov 20, 2026
58a3d70
Demonstrate dispatch documents in three native naming profiles
Nov 20, 2026
75bd392
Record focused python examples/expression-profiles business qualifica…
Nov 20, 2026
5e5e30a
Run TraceChain and its standard order scenarios in native generated w…
Nov 20, 2026
d0deae3
Record focused python examples/trace-chain business qualification
Nov 20, 2026
11cfa87
Record the standard Order model and nested TraceChain verification
Nov 20, 2026
e7805ea
File and retrieve an order receipt through the Python model workspace
Nov 20, 2026
2059fbb
Limit order receipt cleanup to the object created by the workspace
Nov 20, 2026
e70775e
Record focused python examples/object-storage business qualification
Nov 20, 2026
8b744e0
Explain the order receipt workflow and provider calibration
Nov 20, 2026
81a3198
Apply Python order edits through scoped opaque line references
Nov 20, 2026
a37788b
Document the reference editor and bind the canonical evidence path
Nov 20, 2026
8702379
Record focused python examples/opaque-entity-reference business quali…
Nov 20, 2026
b085a04
Restore emitted passive metadata manifests for Python examples
Nov 20, 2026
2859fa3
Require the emitted manifest in the current Context library guard
Nov 20, 2026
86b9732
Resolve Python example domain modules from their sibling libraries
Nov 20, 2026
74d9ca1
Merge current runtime main into native example workspaces
Nov 24, 2026
f4205ee
Regenerate native examples with Generator v5.0.0
Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ own Python APIs.
These application-code excerpts assume the example's generated imports, trusted
Context and an existing object identity. `Q` and `E` belong to the generated
domain library, not a generic runtime object with arbitrary field strings.
See the [application source](examples/school-management/app/main.py) for complete setup.
See the [application source](examples/school-management/python-app-console/app/main.py) for complete setup.

```python
def school_type_details():
Expand Down Expand Up @@ -261,7 +261,7 @@ python -m venv .venv
. .venv/bin/activate
python -m pip install -e .
export PYTHONPATH="$PWD/src"
(cd examples/school-management && python -m app.main)
(cd examples/school-management/python-app-console && python -m app.main)
```

The [School example](examples/school-management/README.md)
Expand Down
17 changes: 15 additions & 2 deletions examples/business-clock/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# Context-owned Business Clock example
# Place delivery orders across a business-day cutover

A delivery desk accepts orders immediately before and after its business day
changes. `model.xml` defines the delivery platform, reference and order date.
The generated `python-lib-core/` is consumed by `python-app-console/app/main.py`.
The console sets a trusted Context clock, uses the generated API to place both
orders, and reloads both dates through Q and E. An unavailable business clock
rejects the next order before it is written. The prior order keeps its date.

The SDK's example inventory runs this workspace and the original operational
cache and clock calibration below. The focused Conformance gate repeats the
workspace on one SQLite file and independently reads all four persisted orders.

## Original clock and cache calibration

This minimal example proves that a fixed provider, scoped to one `UserContext`,
drives both business time and business date. It does not change the process
Expand All @@ -21,5 +34,5 @@ queue probes do not introduce a new public API. No remote backend is implied.
Run it from the repository root:

```bash
PYTHONPATH=src python examples/business-clock/main.py
PYTHONPATH=src python examples/business-clock/python-app-console/calibration/main.py
```
6 changes: 6 additions & 0 deletions examples/business-clock/model.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<root name="delivery-order-cutover-service" org="teaql" data_service="sqlite">
<platform name="Delivery Hub"/>
<delivery_order platform="platform()" reference="Delivery Reference|[1,80]"
order_date="date()"/>
</root>
46 changes: 46 additions & 0 deletions examples/business-clock/python-app-console/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# delivery-order-cutover-service application instructions

## TeaQL workspace rules

- Work in application-owned files. Keep the generated domain library read-only.
- Discover API names and signatures through model-aware Assist only.
Do not read or search generated library source for API discovery. Use the
original evaluated KSML file or directory and its exact entity and field names.
- Ask for the current entity and action first. Request field-level query help
only for the fields you use. If Assist lacks the operation, report
`MISSING_ASSIST` with the entity, action, and relevant field or diagnostic.

```text
cargo teaql --input [model] python-assist-[action]/[entity]
cargo teaql --input [model] python-assist-query/[entity].[field]
```

Replace the bracketed values with the actual model path, action, entity, and
field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and
`expression`. Validate API usage by compiling and testing the application.

- Use the trusted `UserContext` as the only runtime argument for generated query
execution and saves. Resolve tenant, actor, authorization, and provider
resources from trusted application setup.
- Keep queries bounded and provide a non-empty purpose and comment. Supply a
non-empty audit reason for writes through the API shown by Assist.

## Application entry and context

Start in `app/main.py`. Use `create_context()` to install the generated
Runtime Module and configure the provider before calling `context.ensure_schema()`.

Every query is bounded and has non-blank comment and purpose. Use generated Q
for loading and E for loaded traversal. Load all scalar fields before mutation;
mark_for_deletion() and save(context) the composed graph with a non-blank audit_as
reason. Child reasons remain local; unannotated children inherit their parent.
Public execution accepts only UserContext. Schema changes are explicit through
context.ensure_schema(), with generated bootstrap intact.

Verify twice on one SQLite file without database cleanup. Use unique test labels,
keep generated library hashes unchanged, and retain commands, exit statuses and
skipped/unverified checks. Local source tests do not prove a published artifact.

## Optional standard telemetry

See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics.
13 changes: 13 additions & 0 deletions examples/business-clock/python-app-console/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# delivery-order-cutover-service Python console

From this workspace, run `PYTHONPATH=../python-lib-core python -m app.main` with the TeaQL runtime installed.
Installing the generated Runtime Module is passive;
schema reconciliation remains an explicit application action.
The console main() explicitly awaits `context.ensure_schema()` after `create_context()`
and before reporting readiness. Importing the console or calling `create_context()`
does not reconcile schema.


## Optional standard telemetry

See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics.
45 changes: 45 additions & 0 deletions examples/business-clock/python-app-console/STANDARD_TELEMETRY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Standard OpenTelemetry module

Use the optional standard module supplied by the selected TeaQL runtime. Match
its version to the runtime dependency selected by the model and workspace;
keep local source or internal Registry overrides during development. Do not
upgrade to an unrelated public release just to enable telemetry. A runtime
without this module reports `module_unavailable`; package installation alone
does not enable export.

On a supported backend, configure these trusted process variables before startup, never
through a query, JSON or TFP payload:

```bash
export TEAQL_TELEMETRY_ENABLED=true
export TEAQL_TELEMETRY_SERVICE_NAME=payment-service
export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318
```

Without enablement, startup reports `disabled` and all three activation variables;
no SDK export resources are created. Enabled startup reports safe effective
settings, full recording and masking. Invalid settings produce a fixed safe
diagnostic, not a claim of successful export. Never print credentials or raw
configuration values.

The module automatically records supported Q, graph mutation and physical SQL
operations as traces, logs and metrics. SQL is expanded with masked parameters;
plaintext debugging never authorizes plaintext telemetry export. Full recording
does not promise lossless delivery when bounded queues or exporters fail.
Do not add per-method spans or replace the customer's global SDK providers.

Keep schema reconciliation explicit. Run the generated ensure-schema and seed
flow through the same configured runtime to observe startup settings and audited,
idempotent seeding. Telemetry setup must not run ensure-schema implicitly.
Flush and shut down the owned pipeline at application shutdown, not per query.
Exporter failures do not change business results; durable business audit remains
an independent path.


### Python assembly

Select the `telemetry` extra on the application's existing `teaql` dependency
(`teaql[telemetry]`), retaining the version and source or Registry selected by the
workspace. UserContext startup loads the module only when enabled. No application
SDK initialization or per-method spans are required; set the three variables
before starting the process.
83 changes: 83 additions & 0 deletions examples/business-clock/python-app-console/app/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"""Place delivery orders on opposite sides of a controlled business-day cutover."""
import asyncio
from datetime import datetime, timezone
import json
import os

from E import E
from Q import Q
from runtime_module import GENERATED_RUNTIME_MODULE
from teaql.provider.sqlite import create_sqlite_service
from teaql.runtime import FixedBusinessClock, UserContext


class UnavailableBusinessClock:
def now(self):
raise RuntimeError("BUSINESS_CLOCK_UNAVAILABLE")


def create_context() -> UserContext:
context = UserContext.new().install(GENERATED_RUNTIME_MODULE)
service = create_sqlite_service(os.environ["TEAQL_DATABASE_CONNECTION_STRING"])
return context.insert_resource("dataService", service)


async def place_order(context, reference):
order_date = context.business_date()
order = await (
Q.delivery_orders().comment("Initialize the delivery order")
.purpose("Record a delivery on the current business day").new_entity(context)
)
order.update_platform(1).update_reference(reference).update_order_date(order_date)
await order.audit_as("Record the delivery date chosen by the business clock").save(context)
return order


async def load_order(context, reference):
return await (
Q.delivery_orders().with_reference_is(reference).limit(2)
.comment("Read the delivery order by its reference")
.purpose("Check the persisted business-day assignment").execute_for_one(context)
)


async def main() -> None:
context = create_context()
await context.ensure_schema()

label = os.environ["TEAQL_DELIVERY_ORDER_ROUND"]
before_ref, after_ref = f"DEL-{label}-before", f"DEL-{label}-after"
before = datetime(2026, 10, 1, 23, 59, tzinfo=timezone.utc)
after = datetime(2026, 10, 2, 0, 1, tzinfo=timezone.utc)
context.with_business_clock(FixedBusinessClock(before))
first = await place_order(context, before_ref)
context.with_business_clock(FixedBusinessClock(after))
second = await place_order(context, after_ref)
assert first.id != second.id

rows = []
for identity, reference, expected in (
(first.id, before_ref, before.date()),
(second.id, after_ref, after.date()),
):
stored = await load_order(context, reference)
assert stored is not None and stored.id == identity
actual = E.delivery_order(stored).order_date().eval()
assert actual == expected
rows.append(dict(id=identity, reference=reference, date=actual.isoformat()))

rejected_ref = f"DEL-{label}-unavailable"
context.with_business_clock(UnavailableBusinessClock())
try:
await place_order(context, rejected_ref)
except RuntimeError as error:
assert str(error) == "BUSINESS_CLOCK_UNAVAILABLE"
else:
raise AssertionError("An order was accepted without a business day")
context.with_business_clock(FixedBusinessClock(after))
assert await load_order(context, rejected_ref) is None
print("DELIVERY_ORDER_CUTOVER=" + json.dumps(dict(round=label, orders=rows, rejected=rejected_ref)))


if __name__ == "__main__":
asyncio.run(main())
10 changes: 10 additions & 0 deletions examples/business-clock/python-app-console/generated-files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"AGENTS.md": "56af083188babd9ec298847ead3776fbe183e887c58a31e6b95d76b2ec2f4883",
"README.md": "2bf7b340a746100e74a4057748d429ba96715b4614be4d245f6f9567ec05b52c",
"STANDARD_TELEMETRY.md": "03391e8a7ff96c207269a3374437d7a95a16ac6563c58d6b054ab38e3bda3712",
"app/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"app/main.py": "79b5d83dcffd63f653fc375765510af866efacb10efc15a0113c912bb73c31c1",
"teaql-i18n.json": "2124e73c8dc281f0027d79351975fcb004d39dde8f360f2b7ba79b883b14df3f",
"teaql/checker-model.json": "0e171b4cedea7b7490eeb6e04edafb7d714dc459984994a1499101ec8896bf70",
"teaql/model-provenance.json": "fd02a405389543c733f76cfb406ad588e9c3f268da871aeb0d7ce28b28cf5fde"
}
106 changes: 106 additions & 0 deletions examples/business-clock/python-app-console/teaql-i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"schema": "teaql.i18n/v1",
"defaultLocale": "en",
"locales": {
"de": {
"vocabulary": {
},
"messages": {
}
},
"ko": {
"vocabulary": {
},
"messages": {
}
},
"pt": {
"vocabulary": {
},
"messages": {
}
},
"zh-TW": {
"vocabulary": {
},
"messages": {
}
},
"fil": {
"vocabulary": {
},
"messages": {
}
},
"en": {
"vocabulary": {
"property.platform.name": "Name",
"entity.deliveryOrder": "Delivery Order",
"entity.platform": "Platform",
"property.platform.id": "Id",
"property.deliveryOrder.reference": "Reference",
"property.deliveryOrder.orderDate": "Order Date",
"property.deliveryOrder.platform": "Platform",
"property.deliveryOrder.id": "Id",
"property.platform.version": "Version",
"property.deliveryOrder.version": "Version"
},
"messages": {
}
},
"fr": {
"vocabulary": {
},
"messages": {
}
},
"zh-CN": {
"vocabulary": {
},
"messages": {
}
},
"es": {
"vocabulary": {
},
"messages": {
}
},
"ar": {
"vocabulary": {
},
"messages": {
}
},
"vi": {
"vocabulary": {
},
"messages": {
}
},
"th": {
"vocabulary": {
},
"messages": {
}
},
"uk": {
"vocabulary": {
},
"messages": {
}
},
"ja": {
"vocabulary": {
},
"messages": {
}
},
"id": {
"vocabulary": {
},
"messages": {
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"teaql.checker-model/v1","revision":"sha256:dd8d4479af2f856361aa2c380355cb6cf62e84fb5ac6cf2374b723666970ca83","entities":{"DeliveryOrder":{"labels":{"en":"delivery order"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_date","labels":{"en":"order date"},"aliases":["OrderDate","orderDate"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"reference","labels":{"en":"reference"},"aliases":["Reference"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"platform"},"fields":[{"name":"delivery_order_list","targetType":"DeliveryOrder","labels":{"en":"delivery order"},"aliases":["DeliveryOrderList","deliveryOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:dc40f6866698122fdcdbf5b97b8aae020c3689c187d7339c4de6f218956c41fa","generatorVersion":"783ff0d8"}
Loading
Loading