Contracts first (T02–T04): approval claim schema with issuer, freshness,
and binding digest; local transactional outbox wire; load-bearing cadence
as heartbeat or reconciliation (layer.yaml declared).
Then the object (T06–T08): SQLite closed state machine, CAS supersession,
distinct-approver fail-closed, revocation without holder cooperation,
outbox insert in the same transaction. Tests fail the mutation when
emission fails, and revoke while the drain sink is down.
Introspection GET /v1/approvals/{id}/claim is a PIP fact, not a decision.
No public consume (T05 waits on GH-WP-0002-T06). Canon T-06 coverage for
wrong binding, expiry, revoke, and supersede.
FLEX-WP-0017 T03 is unblocked on this object; T05 remains blocked only on
consumption ordering.
Assistant: grok
Assistant-Session: 01a04ceb-2057-7e20-b0f9-c282964d5dd9
28 lines
916 B
Python
28 lines
916 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
from wsgiref.simple_server import make_server
|
|
|
|
from .api import App
|
|
from .store import Engine
|
|
|
|
|
|
def main(argv: list[str] | None = None) -> int:
|
|
parser = argparse.ArgumentParser(prog="approval-engine")
|
|
sub = parser.add_subparsers(dest="cmd", required=True)
|
|
serve = sub.add_parser("serve", help="serve the introspection API")
|
|
serve.add_argument("--db", default="approvals.sqlite")
|
|
serve.add_argument("--host", default="127.0.0.1")
|
|
serve.add_argument("--port", type=int, default=8787)
|
|
args = parser.parse_args(argv)
|
|
if args.cmd == "serve":
|
|
engine = Engine(args.db)
|
|
httpd = make_server(args.host, args.port, App(engine))
|
|
print(f"approval-engine on http://{args.host}:{args.port} db={args.db}")
|
|
httpd.serve_forever()
|
|
return 0
|
|
return 2
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|