@gate-forge/pack-playwright 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/bin/gateforge-witness.js +40 -0
- package/dist/attestation/proxy.d.ts +40 -0
- package/dist/attestation/proxy.d.ts.map +1 -0
- package/dist/attestation/proxy.js +78 -0
- package/dist/attestation/proxy.js.map +1 -0
- package/dist/constants.d.ts +130 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +138 -0
- package/dist/constants.js.map +1 -0
- package/dist/discovery/adapters.d.ts +167 -0
- package/dist/discovery/adapters.d.ts.map +1 -0
- package/dist/discovery/adapters.js +276 -0
- package/dist/discovery/adapters.js.map +1 -0
- package/dist/discovery/discover.d.ts +57 -0
- package/dist/discovery/discover.d.ts.map +1 -0
- package/dist/discovery/discover.js +544 -0
- package/dist/discovery/discover.js.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +15 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/inference.d.ts +63 -0
- package/dist/discovery/inference.d.ts.map +1 -0
- package/dist/discovery/inference.js +173 -0
- package/dist/discovery/inference.js.map +1 -0
- package/dist/discovery/pytest-adapter.d.ts +205 -0
- package/dist/discovery/pytest-adapter.d.ts.map +1 -0
- package/dist/discovery/pytest-adapter.js +548 -0
- package/dist/discovery/pytest-adapter.js.map +1 -0
- package/dist/discovery/reconcile.d.ts +106 -0
- package/dist/discovery/reconcile.d.ts.map +1 -0
- package/dist/discovery/reconcile.js +268 -0
- package/dist/discovery/reconcile.js.map +1 -0
- package/dist/discovery/runner-env.d.ts +80 -0
- package/dist/discovery/runner-env.d.ts.map +1 -0
- package/dist/discovery/runner-env.js +139 -0
- package/dist/discovery/runner-env.js.map +1 -0
- package/dist/discovery/static-discovery.d.ts +121 -0
- package/dist/discovery/static-discovery.d.ts.map +1 -0
- package/dist/discovery/static-discovery.js +1028 -0
- package/dist/discovery/static-discovery.js.map +1 -0
- package/dist/discovery/supervised-run.d.ts +110 -0
- package/dist/discovery/supervised-run.d.ts.map +1 -0
- package/dist/discovery/supervised-run.js +328 -0
- package/dist/discovery/supervised-run.js.map +1 -0
- package/dist/discovery/trusted-config.d.ts +103 -0
- package/dist/discovery/trusted-config.d.ts.map +1 -0
- package/dist/discovery/trusted-config.js +117 -0
- package/dist/discovery/trusted-config.js.map +1 -0
- package/dist/fixture/evidence.d.ts +191 -0
- package/dist/fixture/evidence.d.ts.map +1 -0
- package/dist/fixture/evidence.js +366 -0
- package/dist/fixture/evidence.js.map +1 -0
- package/dist/fixture/fixture.d.ts +37 -0
- package/dist/fixture/fixture.d.ts.map +1 -0
- package/dist/fixture/fixture.js +38 -0
- package/dist/fixture/fixture.js.map +1 -0
- package/dist/fixture/witness-client.d.ts +164 -0
- package/dist/fixture/witness-client.d.ts.map +1 -0
- package/dist/fixture/witness-client.js +253 -0
- package/dist/fixture/witness-client.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/json.d.ts +16 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +21 -0
- package/dist/json.js.map +1 -0
- package/dist/reporter/ledger.d.ts +105 -0
- package/dist/reporter/ledger.d.ts.map +1 -0
- package/dist/reporter/ledger.js +197 -0
- package/dist/reporter/ledger.js.map +1 -0
- package/dist/reporter/reporter.cjs +105 -0
- package/dist/reporter/reporter.cjs.map +1 -0
- package/dist/reporter/reporter.d.cts +35 -0
- package/dist/reporter/reporter.d.cts.map +1 -0
- package/dist/reporter/reporter.d.ts +167 -0
- package/dist/reporter/reporter.d.ts.map +1 -0
- package/dist/reporter/reporter.js +673 -0
- package/dist/reporter/reporter.js.map +1 -0
- package/dist/setup.d.ts +49 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +167 -0
- package/dist/setup.js.map +1 -0
- package/dist/supervisor/client.d.ts +73 -0
- package/dist/supervisor/client.d.ts.map +1 -0
- package/dist/supervisor/client.js +164 -0
- package/dist/supervisor/client.js.map +1 -0
- package/dist/supervisor/drain.d.ts +45 -0
- package/dist/supervisor/drain.d.ts.map +1 -0
- package/dist/supervisor/drain.js +235 -0
- package/dist/supervisor/drain.js.map +1 -0
- package/dist/supervisor/index.d.ts +16 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +13 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/supervisor/spool.d.ts +137 -0
- package/dist/supervisor/spool.d.ts.map +1 -0
- package/dist/supervisor/spool.js +263 -0
- package/dist/supervisor/spool.js.map +1 -0
- package/dist/surface.d.ts +134 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +139 -0
- package/dist/surface.js.map +1 -0
- package/dist/witness/adapter-registry.d.ts +38 -0
- package/dist/witness/adapter-registry.d.ts.map +1 -0
- package/dist/witness/adapter-registry.js +158 -0
- package/dist/witness/adapter-registry.js.map +1 -0
- package/dist/witness/bin.d.ts +21 -0
- package/dist/witness/bin.d.ts.map +1 -0
- package/dist/witness/bin.js +172 -0
- package/dist/witness/bin.js.map +1 -0
- package/dist/witness/browser.d.ts +173 -0
- package/dist/witness/browser.d.ts.map +1 -0
- package/dist/witness/browser.js +580 -0
- package/dist/witness/browser.js.map +1 -0
- package/dist/witness/classifications.d.ts +42 -0
- package/dist/witness/classifications.d.ts.map +1 -0
- package/dist/witness/classifications.js +87 -0
- package/dist/witness/classifications.js.map +1 -0
- package/dist/witness/env-attestation.d.ts +98 -0
- package/dist/witness/env-attestation.d.ts.map +1 -0
- package/dist/witness/env-attestation.js +202 -0
- package/dist/witness/env-attestation.js.map +1 -0
- package/dist/witness/loopback-pins.d.ts +79 -0
- package/dist/witness/loopback-pins.d.ts.map +1 -0
- package/dist/witness/loopback-pins.js +244 -0
- package/dist/witness/loopback-pins.js.map +1 -0
- package/dist/witness/server.d.ts +34 -0
- package/dist/witness/server.d.ts.map +1 -0
- package/dist/witness/server.js +2539 -0
- package/dist/witness/server.js.map +1 -0
- package/dist/witness/types.d.ts +643 -0
- package/dist/witness/types.d.ts.map +1 -0
- package/dist/witness/types.js +2 -0
- package/dist/witness/types.js.map +1 -0
- package/package.json +64 -0
- package/python/gateforge_persistence_intents.py +100 -0
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gate-forge/pack-playwright",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "Gateforge Playwright evidence pack: loopback witness service, engine-side adapter execution, trusted evidence fixture, verdict reporter.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"gateforge-witness": "./bin/gateforge-witness.js"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./reporter": {
|
|
19
|
+
"types": "./dist/reporter/reporter.d.ts",
|
|
20
|
+
"require": "./dist/reporter/reporter.cjs",
|
|
21
|
+
"import": "./dist/reporter/reporter.js"
|
|
22
|
+
},
|
|
23
|
+
"./fixture": {
|
|
24
|
+
"types": "./dist/fixture/fixture.d.ts",
|
|
25
|
+
"import": "./dist/fixture/fixture.js"
|
|
26
|
+
},
|
|
27
|
+
"./witness": {
|
|
28
|
+
"types": "./dist/witness/server.d.ts",
|
|
29
|
+
"import": "./dist/witness/server.js"
|
|
30
|
+
},
|
|
31
|
+
"./attestation": {
|
|
32
|
+
"types": "./dist/attestation/proxy.d.ts",
|
|
33
|
+
"import": "./dist/attestation/proxy.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"bin",
|
|
38
|
+
"dist",
|
|
39
|
+
"python"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.build.json",
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
44
|
+
"test": "vitest run"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@gate-forge/core": "^0.1.0",
|
|
48
|
+
"playwright": "1.58.2",
|
|
49
|
+
"typescript": "^5.9.2",
|
|
50
|
+
"yaml": "^2.8.1"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/umiddey/gateforge.git",
|
|
58
|
+
"directory": "packages/pack-playwright"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/umiddey/gateforge/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/umiddey/gateforge#readme"
|
|
64
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Gateforge persistence claim INTENTS writer (server-witnessed channel).
|
|
2
|
+
|
|
3
|
+
THE CONTRACT (this file is only a convenience writer — the JSONL line is
|
|
4
|
+
what matters):
|
|
5
|
+
|
|
6
|
+
File: ``$GATEFORGE_STATE_DIR/spool/$GATEFORGE_RUN_ID/persistence-intents.jsonl``
|
|
7
|
+
Protocol: one JSON object per line, UTF-8, terminated by ``\\n``
|
|
8
|
+
(canonical JSON escapes control characters, so lines are
|
|
9
|
+
NUL-safe; consumers parse a line only once its newline is
|
|
10
|
+
written — partial writes are never misparsed).
|
|
11
|
+
|
|
12
|
+
Line shape::
|
|
13
|
+
|
|
14
|
+
{"entity": "tenant.lead_push_outbox",
|
|
15
|
+
"operation": "create", # create|read|update|delete
|
|
16
|
+
"phase": "pre", # pre|post
|
|
17
|
+
"intent": "expect-absent", # expect-present|expect-absent
|
|
18
|
+
"key": "<entity key>", # scalar, or column-keyed object
|
|
19
|
+
"claimId": "tenant.lead_push_outbox:persistence:create",
|
|
20
|
+
"testId": "<the claim's test id>", # sidecar logical key for mapped tests
|
|
21
|
+
"sequence": 1} # 1-based, strictly increasing per claimId
|
|
22
|
+
|
|
23
|
+
TRUST MODEL (non-negotiable): the supervised test process is UNTRUSTED.
|
|
24
|
+
It may only WRITE intents — it can never stamp evidence. The trusted CLI
|
|
25
|
+
drain forwards each intent to the witness over the verifier-key
|
|
26
|
+
supervisor surface (``GATEFORGE_WITNESS_VERIFIER_KEY`` never reaches this
|
|
27
|
+
process); the WITNESS executes the resource's adapter ``probeServer``
|
|
28
|
+
against the app database itself and, only then, stamps a witnessed
|
|
29
|
+
``persistence.entity`` record with ``channel: "server"``. A missing
|
|
30
|
+
adapter/probe, an unregistered obligation, or a replayed sequence
|
|
31
|
+
resolves to a typed failure — never to satisfaction.
|
|
32
|
+
|
|
33
|
+
Usage (pytest, create postcondition — absent BEFORE, present AFTER)::
|
|
34
|
+
|
|
35
|
+
from gateforge_persistence_intents import gateforge_intent, PRE_INTENT_SETTLE_SECONDS
|
|
36
|
+
|
|
37
|
+
def test_booking_and_outbox_commit_atomically():
|
|
38
|
+
gateforge_intent("tenant.lead_push_outbox", "create", "pre",
|
|
39
|
+
"expect-absent", "<booking_id>",
|
|
40
|
+
"tenant.lead_push_outbox:persistence:create",
|
|
41
|
+
"<claim testId>", 1)
|
|
42
|
+
time.sleep(PRE_INTENT_SETTLE_SECONDS) # allow one trusted drain tick
|
|
43
|
+
... # the real mutation the test performs against the app
|
|
44
|
+
gateforge_intent("tenant.lead_push_outbox", "create", "post",
|
|
45
|
+
"expect-present", "<booking_id>",
|
|
46
|
+
"tenant.lead_push_outbox:persistence:create",
|
|
47
|
+
"<claim testId>", 2)
|
|
48
|
+
|
|
49
|
+
TIMING: ``pre`` intents are observed by the trusted drain at its next
|
|
50
|
+
poll (default cadence 50ms). The witness records whatever is true when
|
|
51
|
+
IT looks, so a mutation racing ahead of the probe honestly grades
|
|
52
|
+
``entityAbsent: false`` and the create postcondition FAILS CLOSED —
|
|
53
|
+
settle one drain tick (``PRE_INTENT_SETTLE_SECONDS``) between the pre
|
|
54
|
+
intent and the mutation to keep honest runs green.
|
|
55
|
+
"""
|
|
56
|
+
import json
|
|
57
|
+
import os
|
|
58
|
+
import time
|
|
59
|
+
|
|
60
|
+
__all__ = ["intents_file", "gateforge_intent", "PRE_INTENT_SETTLE_SECONDS"]
|
|
61
|
+
|
|
62
|
+
#: Settle time (> one default drain poll) between a ``pre`` intent and
|
|
63
|
+
#: the mutation, so the trusted drain observes the before-state.
|
|
64
|
+
PRE_INTENT_SETTLE_SECONDS = 0.15
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def intents_file(state_dir=None, run_id=None):
|
|
68
|
+
"""Resolve the run's intents spool path (env-carried run identity)."""
|
|
69
|
+
state_dir = state_dir or os.environ["GATEFORGE_STATE_DIR"]
|
|
70
|
+
run_id = run_id or os.environ["GATEFORGE_RUN_ID"]
|
|
71
|
+
return os.path.join(state_dir, "spool", run_id, "persistence-intents.jsonl")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def gateforge_intent(entity, operation, phase, intent, key, claim_id, test_id, sequence):
|
|
75
|
+
"""Append one persistence claim intent (see module docstring).
|
|
76
|
+
|
|
77
|
+
A failed append never crashes the test: the claim then simply stays
|
|
78
|
+
blocking without its witnessed record (fail closed).
|
|
79
|
+
"""
|
|
80
|
+
line = json.dumps(
|
|
81
|
+
{
|
|
82
|
+
"entity": str(entity),
|
|
83
|
+
"operation": operation,
|
|
84
|
+
"phase": phase,
|
|
85
|
+
"intent": intent,
|
|
86
|
+
"key": key,
|
|
87
|
+
"claimId": str(claim_id),
|
|
88
|
+
"testId": str(test_id),
|
|
89
|
+
"sequence": int(sequence),
|
|
90
|
+
},
|
|
91
|
+
ensure_ascii=True,
|
|
92
|
+
separators=(",", ":"),
|
|
93
|
+
)
|
|
94
|
+
try:
|
|
95
|
+
path = intents_file()
|
|
96
|
+
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
97
|
+
with open(path, "a", encoding="utf-8") as handle:
|
|
98
|
+
handle.write(line + "\n")
|
|
99
|
+
except OSError as error: # pragma: no cover - env misconfiguration
|
|
100
|
+
print(f"[gateforge] cannot append persistence intent: {error}")
|