Scoped Idempotency Key
Derive a repeatable operation key from tenant, operation, intent ID, and payload.
Version: 1.0.0. License: MIT. Status: tested reference baseline; no comparative ranking is claimed.
Contract
Require nonempty tenant, operation and intent_id. Serialize the entire input with Python json.dumps using sorted keys, ASCII escapes, compact separators and allow_nan=False. SHA-256 those UTF-8 bytes. Return the profile name, key, and serialized bytes as text. A different intent_id identifies an intentional repeat.
The exact required input fields and types are in input.schema.json. Extra fields are rejected at declared object boundaries. JSON duplicate keys and non-finite numbers are rejected by the CLI. Input strings are case-sensitive unless stated otherwise. Array order is preserved unless the contract specifies sorting.
Use
Unpack the ZIP, enter its directory, and run:
python3 baseline.py < example.input.json
python3 -m unittest -v
Python 3.10 or newer, standard library only. The reference implementation exposes run(input_dict) and accepts one JSON object on standard input. Success returns {"ok": true, "result": ...} with exit code 0. Invalid input returns {"ok": false, "error": "..."} with exit code 1. example.output.json contains the result without the CLI envelope. Import callers receive exceptions for invalid input.
Example input
{
"tenant": "team",
"operation": "create",
"intent_id": "request-1",
"payload": {
"b": 2,
"a": 1
}
}
Example result
{
"profile": "arcomm-python-json-v1",
"key": "9f8bff39774b50ffae1d54918b4e9cded4925ec54f715ec8e6d21c1cbaf7e2df",
"serialized": "{\"intent_id\":\"request-1\",\"operation\":\"create\",\"payload\":{\"a\":1,\"b\":2},\"tenant\":\"team\"}"
}
Boundaries
This is a local Python serialization profile, not RFC 8785. Numbers such as 1 and 1.0 produce different keys. Unicode normalization is not performed. No deduplication store, locking, expiry policy, or exactly-once delivery is supplied. Do not put secrets into keys or log the returned serialization when payloads are sensitive.
This package performs no network calls, executes no submitted commands, and writes no user files. Host applications own authorization, resource budgets, and persistence. Example values are fixtures, not recommended policies or limits.
Acceptance and provenance
cases.json records named expected results and rejection cases. test_baseline.py runs those cases and checks the command-line contract. manifest.json records file digests. The specification, implementation, and evidence are separate files so a replacement implementation can target the same contract.
Original code and examples generated for this Arcomm collection. No third-party code is bundled. Read LICENSE for reuse terms.
References
Download
SHA-256: dd0c251dfc53ad8f55593660924bb00afc7b4444f5572e71a15475f8636f93b2
Size: 7026 bytes.