Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/release-signing-key.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGpsF40BEAC+Olumai3qpCWXV6QYFufotbsG2TK+mIvFfHxOjX0qq24PsGW7
D3iXxAYxG1Ohu3dNIM7Rj2lvLpxL1si6pJCvuD8vSnuhuubcpOJJIhGeG4S+r3sy
CFbgYw5Wde0t9MG4Gr5+p6OB0o3yeOeLB8Xeyk+jTZ/O9ukGgpGANNu8wMpEKE5t
06mjYPcajUdpPCs0FIC9WhyyPBQw4CLywMuJ1amnrs+yWDyaJogkw39m1/VZtnHE
FEg9PLg3SKq60DydI2kiOL2ozum/nj9y0Oe+wxNH+k+ACokZsoGV5PMG+PcDsOO/
dPQ1v1Jm7aKAl6pyyV/jCq9tU43toKXD5MHm8Rffsb1nfgRHERzbqcl9bxsxmk1/
62ePdc3RWiqlMS0YdqXYkd7yFtrZmJUL5xrRB0bI5tEbH0i4yema73WeSMV4PSlq
xU71TdA41Tq9OgmKKpVfWAThunKg50Dt1JXApTnCVMuEG+ejdvzXDwqlH+T9fXnp
knVgMpusZhhk4S9rP4QTmBmwNJZMIOMYNoKja0K/VAjKTfYmSHSrhpdWCkD71tqF
vD3RfTG/QohuhUz34EzN9pIpZpBAAQ6LHfISVLp9R8wdDRlOm0ICK6eVWooxtdLP
x6dQA/C4MApbuRj1pKgfwCk1X0k6HkZJA8KOqDWdmthHuFS6l1//LCVzeQARAQAB
tChQaGlsaXAgWiAoZ3BnIGZvciB0ZWFxbCkgPGluZm9AdGVhcWwuaW8+iQJUBBMB
CgA+FiEE0ZXN0QKIVz1lAZPaa58fi+AL1ZUFAmpsF40CGwMFCQHhM4AFCwkIBwIG
FQoJCAsCBBYCAwECHgECF4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9f5Aun6AOCjwQNneZ
QCad98Aov4EvyhTT7opivw==
=gHhI
-----END PGP PUBLIC KEY BLOCK-----
15 changes: 14 additions & 1 deletion .github/workflows/example-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,20 @@ jobs:
done
docker logs teaql-python-example-s3
exit 1
- run: ./scripts/verify-examples.sh
- name: Verify all retained examples
run: ./scripts/verify-examples.sh
env:
TEAQL_EXAMPLES_EVIDENCE_DIR: ${{ runner.temp }}/teaql-python-examples-evidence
- name: Retain compact example diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: python-example-evidence
path: |
${{ runner.temp }}/teaql-python-examples-evidence/
logs/*.log
if-no-files-found: warn
retention-days: 7
- name: Stop dedicated S3 example fixture
if: always()
run: docker rm -f teaql-python-example-s3 || true
67 changes: 33 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,62 @@
name: Publish Python package
name: Promote qualified python packages

on:
workflow_dispatch:
inputs:
release_tag:
description: Existing immutable signed Python release tag
description: Existing signed tag whose exact packages passed internal qualification
required: true
type: string
qualification_sha256:
description: SHA-256 of logging-qualification.json retained with the release evidence
required: true
type: string
push:
tags:
- "python-v*"

env:
TEAQL_RELEASE_TAG: ${{ inputs.release_tag || github.ref_name }}
concurrency:
group: python-public-promotion
cancel-in-progress: false

jobs:
build:
verify:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Validate immutable release tag input
shell: bash
run: '[[ "$TEAQL_RELEASE_TAG" =~ ^python-v[0-9]+\.[0-9]+\.[0-9]+$ ]]'
- uses: actions/checkout@v4
with:
ref: ${{ inputs.release_tag || github.ref }}
- name: Verify checked out tag source
shell: bash
run: |
test "$(git cat-file -t "$TEAQL_RELEASE_TAG")" = tag
test "$(git rev-parse "$TEAQL_RELEASE_TAG^{commit}")" = "$(git rev-parse HEAD)"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m pip install --upgrade build
- run: python -m pip install --editable ".[test,telemetry,object-storage-s3]"
- name: Verify tag matches package version
ref: ${{ inputs.release_tag }}
fetch-depth: 0
- name: Verify signed source and qualified package bytes
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ inputs.release_tag }}
QUALIFICATION_SHA256: ${{ inputs.qualification_sha256 }}
shell: bash
run: |
test "${TEAQL_RELEASE_TAG#python-v}" = "$(python -c 'import importlib.metadata; print(importlib.metadata.version("teaql"))')"
- run: python -m pytest
- run: python -m build
export GNUPGHOME="$RUNNER_TEMP/teaql-release-signatures"
mkdir -m 700 "$GNUPGHOME"
gpg --batch --import .github/release-signing-key.asc
python3 scripts/verify-qualified-release.py \
--tag "$RELEASE_TAG" --manifest-sha256 "$QUALIFICATION_SHA256" \
--language python --repository "$GITHUB_REPOSITORY"
- uses: actions/upload-artifact@v4
with:
name: python-distributions
path: dist/
name: qualified-python-packages
path: qualified-packages/
if-no-files-found: error

publish:
needs: build
needs: verify
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/teaql/
environment: pypi
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: python-distributions
path: dist/
name: qualified-python-packages
path: qualified-packages/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: qualified-packages/
24 changes: 24 additions & 0 deletions docs/releases/0.6.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 0.6.0: JSON and human runtime logging

Both `json` and `human` logging presentations are supported. JSON remains the
default. Select the presentation when composing the runtime logger; an explicit
application option takes precedence over the server `TEAQL_LOG_FORMAT` setting.
The exact accepted values are `json` and `human`.

Both presentations use the same privacy-safe event projection. Human SQL is
readable and indented across multiple lines. File output preserves severity,
UTF-8 whole-event rotation, UTC-day rollover, retention and concurrent writers.
A non-empty file using the other presentation is rejected before archive changes.
Plaintext SQL acknowledgement and existing privacy controls retain their meaning.

Choose a fresh destination when changing an existing file's presentation. Existing
generated APIs do not require regeneration for this logging feature.


Tracking: https://github.com/teaql/teaql-python/issues/73; coordinated release https://github.com/teaql/teaql-conformance/issues/248.

Release status and the source, internal-artifact and public-delivery gates are
recorded separately in teaql/teaql-conformance,
`evidence/2026-11-18-logging-release`. These notes do not establish publication.

Ordinary audit files keep model-marked values masked when the separate plaintext debug acknowledgement is enabled. Existing explicit custom audit projections retain their opt-in behavior.
13 changes: 8 additions & 5 deletions examples/conformance/test_sql_log_intent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Verify generated query intent survives execution in the conformance app."""
import json
import os
from pathlib import Path
import subprocess
Expand All @@ -12,6 +13,8 @@ def test_generated_queries_retain_intent_at_sql_sink(self):
repo = Path(__file__).resolve().parents[2]
env = dict(os.environ)
env.pop("TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS", None)
env.pop("TEAQL_LOG_FORMAT", None)
env["TEAQL_LOG_ENDPOINT"] = "stdout"
env["PYTHONPATH"] = os.pathsep.join((str(repo / "examples" / "conformance"), str(repo / "src")))
with tempfile.TemporaryDirectory(prefix="teaql-conformance-log-test-") as directory:
env["TEAQL_CONFORMANCE_DB"] = str(Path(directory) / "conformance.sqlite")
Expand All @@ -20,12 +23,12 @@ def test_generated_queries_retain_intent_at_sql_sink(self):
output = result.stdout + result.stderr
self.assertEqual(0, result.returncode, output)
generated_flow = output.split("PASS Mutation ledger identity", 1)[-1]
queries = [line for line in generated_flow.splitlines()
if line.startswith("[TeaQL SQL]") and "[select]" in line]
records = [json.loads(line) for line in generated_flow.splitlines() if line.startswith("{")]
queries = [row for row in records if row.get("event") == "sql.select"]
self.assertGreater(len(queries), 0, output)
for line in queries:
self.assertNotIn("comment=None", line)
self.assertNotIn("purpose=None", line)
for row in queries:
self.assertTrue(row.get("comment") and row["comment"].strip(), row)
self.assertTrue(row.get("purpose") and row["purpose"].strip(), row)
self.assertIn("PASS Python minimum runtime conformance: 8/8", output)


Expand Down
17 changes: 10 additions & 7 deletions examples/order-management/test_sql_log_intent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check the regenerated order library's SQL intent through its real app."""
import json
import os
from pathlib import Path
import subprocess
Expand All @@ -12,22 +13,24 @@ def test_generated_queries_retain_intent_at_sql_sink(self):
repo = Path(__file__).resolve().parents[2]
env = dict(os.environ)
env.pop("TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS", None)
env.pop("TEAQL_LOG_FORMAT", None)
env["TEAQL_LOG_ENDPOINT"] = "stdout"
env["PYTHONPATH"] = os.pathsep.join((str(repo / "examples" / "order-management" / "python-lib-core"), str(repo / "src")))
with tempfile.TemporaryDirectory(prefix="teaql-order-log-test-") as directory:
env["TEAQL_ORDER_MANAGEMENT_DB"] = str(Path(directory) / "order.sqlite")
result = subprocess.run([sys.executable, str(Path(__file__).with_name("python-app-console") / "app.py")],
cwd=repo, env=env, capture_output=True, text=True, timeout=90)
output = result.stdout + result.stderr
self.assertEqual(0, result.returncode, output)
queries = [line for line in output.splitlines()
if line.startswith("[TeaQL SQL]") and "[select]" in line]
records = [json.loads(line) for line in output.splitlines() if line.startswith("{")]
queries = [row for row in records if row.get("event") == "sql.select"]
self.assertGreater(len(queries), 0, output)
for line in queries:
self.assertNotIn("comment=None", line)
self.assertNotIn("purpose=None", line)
for row in queries:
self.assertTrue(row.get("comment") and row["comment"].strip(), row)
self.assertTrue(row.get("purpose") and row["purpose"].strip(), row)
self.assertNotIn("masked-in-quick-start", output)
customer_sql = next((line for line in output.splitlines()
if "INSERT INTO customer_data" in line), "")
customer_sql = next((row.get("sql", "") for row in records
if "INSERT INTO customer_data" in row.get("sql", "")), "")
self.assertIn("/* masked */", customer_sql)
self.assertIn("'Acme Retail'", customer_sql)
self.assertIn("[schema] ensured 7 generated entity tables", output)
Expand Down
13 changes: 8 additions & 5 deletions examples/school-management/test_sql_log_intent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exercise the regenerated School library through its real application flow."""
import json
import os
from pathlib import Path
import subprocess
Expand All @@ -12,19 +13,21 @@ def test_generated_queries_retain_intent_at_sql_sink(self):
repo = Path(__file__).resolve().parents[2]
env = dict(os.environ)
env.pop("TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS", None)
env.pop("TEAQL_LOG_FORMAT", None)
env["TEAQL_LOG_ENDPOINT"] = "stdout"
env["PYTHONPATH"] = os.pathsep.join((str(repo / "examples" / "school-management"), str(repo / "src")))
with tempfile.TemporaryDirectory(prefix="teaql-school-log-test-") as directory:
env["TEAQL_SCHOOL_MANAGEMENT_DB"] = str(Path(directory) / "school.sqlite")
result = subprocess.run([sys.executable, "-m", "app.main"], cwd=repo,
env=env, capture_output=True, text=True, timeout=90)
output = result.stdout + result.stderr
self.assertEqual(0, result.returncode, output)
queries = [line for line in output.splitlines()
if line.startswith("[TeaQL SQL]") and "[select]" in line]
records = [json.loads(line) for line in output.splitlines() if line.startswith("{")]
queries = [row for row in records if row.get("event") == "sql.select"]
self.assertGreater(len(queries), 0, output)
for line in queries:
self.assertNotIn("comment=None", line)
self.assertNotIn("purpose=None", line)
for row in queries:
self.assertTrue(row.get("comment") and row["comment"].strip(), row)
self.assertTrue(row.get("purpose") and row["purpose"].strip(), row)
self.assertIn("PASS Python School Management", output)


Expand Down
27 changes: 15 additions & 12 deletions examples/task_board/test_task_board.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Run the real example; do not infer governance from process exit zero alone."""
import json
import os
from pathlib import Path
import subprocess
Expand All @@ -12,35 +13,37 @@ def test_default_logs_have_intent_and_mask_business_values(self):
repo = Path(__file__).resolve().parents[2]
env = dict(os.environ)
env.pop("TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS", None)
env.pop("TEAQL_LOG_FORMAT", None)
env["TEAQL_LOG_ENDPOINT"] = "stdout"
env["PYTHONPATH"] = str(repo / "src")
with tempfile.TemporaryDirectory(prefix="teaql-task-board-test-") as temporary:
env["TEAQL_TASK_BOARD_DB"] = str(Path(temporary) / "task-board.db")
result = subprocess.run([sys.executable, str(Path(__file__).with_name("main.py"))],
env=env, capture_output=True, text=True, timeout=90)
output = result.stdout + result.stderr
self.assertEqual(0, result.returncode, output)
records = [json.loads(line) for line in output.splitlines() if line.startswith("{")]
queries = writes = 0
for line in output.splitlines():
if not line.startswith("[TeaQL SQL]"):
for row in records:
if row.get("category") != "SQL":
continue
if "[select]" in line or "[query]" in line:
if row.get("event") in ("sql.select", "sql.query"):
queries += 1
self.assertNotIn("comment=None", line)
self.assertNotIn("purpose=None", line)
self.assertNotIn("comment= purpose=", line)
self.assertNotIn("purpose= auditReason=", line)
elif any(f"[{kind}]" in line for kind in ("insert", "update", "delete")):
self.assertTrue(row.get("comment") and row["comment"].strip(), row)
self.assertTrue(row.get("purpose") and row["purpose"].strip(), row)
elif row.get("event") in ("sql.insert", "sql.update", "sql.delete"):
writes += 1
self.assertNotIn("auditReason=None", line)
self.assertNotIn("auditReason= tracePath=", line)
self.assertTrue(row.get("audit_reason") and row["audit_reason"].strip(), row)
self.assertGreater(queries, 0, output)
self.assertGreater(writes, 0, output)
self.assertIn("PASS task board: governed Q/E/mutation and masked detail", output)
self.assertNotIn("PRIVATE-TASK-DETAIL", output)
self.assertIn("'PR***************IL' /* masked */", output)
self.assertIn("'RENAME'", output)
self.assertIn("comment='page renamed task' purpose='verify paginated task intent'", output)
self.assertIn("comment='stream renamed task' purpose='verify streamed task intent'", output)
self.assertTrue(any(row.get("comment") == "page renamed task" and
row.get("purpose") == "verify paginated task intent" for row in records))
self.assertTrue(any(row.get("comment") == "stream renamed task" and
row.get("purpose") == "verify streamed task intent" for row in records))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "teaql"
version = "0.5.0"
version = "0.6.0"
description = "TeaQL Runtime and Data Service for Python"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
Loading
Loading