@gate-forge/witness 0.9.1 → 0.10.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/README.md +15 -0
- package/dist/client/witness-client.d.ts +14 -1
- package/dist/client/witness-client.d.ts.map +1 -1
- package/dist/client/witness-client.js +15 -0
- package/dist/client/witness-client.js.map +1 -1
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -0
- package/dist/constants.js.map +1 -1
- package/dist/witness/server.d.ts.map +1 -1
- package/dist/witness/server.js +254 -7
- package/dist/witness/server.js.map +1 -1
- package/dist/witness/types.d.ts +52 -4
- package/dist/witness/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -91,6 +91,21 @@ credential never reaches a record, the run state, a log or a report. The
|
|
|
91
91
|
full argument is in `packages/cli/guides/TEST-ENVIRONMENT.md`. Without a
|
|
92
92
|
registration the read is byte-identical to today's behavior.
|
|
93
93
|
|
|
94
|
+
## Per-session origin diagnostics
|
|
95
|
+
|
|
96
|
+
The fixture routes only `GATEFORGE_APP_BASE_URL` onto the session proxy. A
|
|
97
|
+
suite that loads some other origin — its own base URL, often one that never
|
|
98
|
+
reached the test process because it was missing from `envAllowlist` — routes
|
|
99
|
+
nothing, the witness observes nothing, and every `observed-e2e` claim
|
|
100
|
+
finalizes as missing while the tests pass. The fixture reports those
|
|
101
|
+
unrouted same-host/loopback origins through the session-authenticated
|
|
102
|
+
`POST /sessions/page-origins`, and the zero-traffic note quotes them.
|
|
103
|
+
|
|
104
|
+
Its authority is *a sentence in a note*. It is kept in witness memory for the
|
|
105
|
+
session, dropped with it, and mints no record: no verdict, no report and no
|
|
106
|
+
run state can depend on it. A suite that reports a lie about its own page only
|
|
107
|
+
makes its own failure message wrong.
|
|
108
|
+
|
|
94
109
|
## The operator's fixture/actor provider
|
|
95
110
|
|
|
96
111
|
A declared behavior case names a `fixture` recipe and an `actor`. The witness
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BehaviorExecuteRequest, BehaviorExecuteResponse, BehaviorPrincipalRequest, BehaviorPrincipalResponse, BrowserActionRequest, BrowserActionResponse, BrowserSurfaceRequest, BrowserVisibleRequest, BrowserVisibleResponse, IntervalCloseResponse, IntervalOpenResponse, PersistenceRequest, PersistenceResponse, PreObservationRequest, PreObservationResponse, RecordsRequest, RecordsResponse, SessionIdentityRequest, SessionIdentityResponse, SessionResolveRequest, SessionResolveResponse } from '../witness/types.js';
|
|
1
|
+
import type { BehaviorExecuteRequest, BehaviorExecuteResponse, BehaviorPrincipalRequest, BehaviorPrincipalResponse, BrowserActionRequest, BrowserActionResponse, BrowserSurfaceRequest, BrowserVisibleRequest, BrowserVisibleResponse, IntervalCloseResponse, IntervalOpenResponse, PersistenceRequest, PersistenceResponse, PreObservationRequest, PreObservationResponse, RecordsRequest, RecordsResponse, SessionIdentityRequest, SessionIdentityResponse, SessionPageOriginRequest, SessionPageOriginResponse, SessionResolveRequest, SessionResolveResponse } from '../witness/types.js';
|
|
2
2
|
/** A witness call that failed (status + single-cause diagnostic). */
|
|
3
3
|
export declare class WitnessRequestError extends Error {
|
|
4
4
|
readonly status: number;
|
|
@@ -61,6 +61,19 @@ export declare class WitnessClient {
|
|
|
61
61
|
* only ever register for the session the caller is running under.
|
|
62
62
|
*/
|
|
63
63
|
registerSessionIdentity(request: SessionIdentityRequest): Promise<SessionIdentityResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* POST /sessions/page-origins (plan 0.9.2 item F): reports the origins
|
|
66
|
+
* this test's page requested that the fixture did NOT route onto the
|
|
67
|
+
* session proxy, so the zero-traffic note can name the real cause (a
|
|
68
|
+
* suite base URL that differs from GATEFORGE_APP_BASE_URL) instead of
|
|
69
|
+
* only blaming the fixture page.
|
|
70
|
+
*
|
|
71
|
+
* It is DIAGNOSTIC TEXT: the witness keeps it in memory for this
|
|
72
|
+
* session, mints no record from it, and grades nothing on it. Session
|
|
73
|
+
* authenticated, so it can only ever report for the session the caller
|
|
74
|
+
* is running under.
|
|
75
|
+
*/
|
|
76
|
+
reportSessionPageOrigins(request: SessionPageOriginRequest): Promise<SessionPageOriginResponse>;
|
|
64
77
|
/**
|
|
65
78
|
* POST /sessions/intervals/open (Phase 1): marks the start of a
|
|
66
79
|
* UI-action observation interval on the witness's monotonic clock.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"witness-client.d.ts","sourceRoot":"","sources":["../../src/client/witness-client.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,eAAe,EAEf,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAE7B,qEAAqE;AACrE,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;gBACnB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW;CAM1E;AAiCD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAkB1C;AACD;;;;;;;GAOG;AACH,qBAAa,aAAa;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAGzB,GAAG,GAAE,MAA4B,EACjC,KAAK,GAAE,MAAM,GAAG,SAAsC,EACtD,SAAS,SAAO;I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;;;;;;;OAQG;IACG,iBAAiB,CACrB,OAAO,EAAE,kBAAkB,GAAG;QAC5B,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;KACtB,GACA,OAAO,CAAC,mBAAmB,CAAC;IAa/B;;;;;OAKG;IACG,sBAAsB,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC;QAAE,UAAU,EAAE,IAAI,CAAA;KAAE,CAAC;IAIhC;;;;;;OAMG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIlF;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIrF;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAIlF;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAI3F,qDAAqD;IAChD,WAAW,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAAC;YAiChD,OAAO;CAoCtB;AAMD,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -133,6 +133,21 @@ export class WitnessClient {
|
|
|
133
133
|
async registerSessionIdentity(request) {
|
|
134
134
|
return this.request('/sessions/identity', request);
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* POST /sessions/page-origins (plan 0.9.2 item F): reports the origins
|
|
138
|
+
* this test's page requested that the fixture did NOT route onto the
|
|
139
|
+
* session proxy, so the zero-traffic note can name the real cause (a
|
|
140
|
+
* suite base URL that differs from GATEFORGE_APP_BASE_URL) instead of
|
|
141
|
+
* only blaming the fixture page.
|
|
142
|
+
*
|
|
143
|
+
* It is DIAGNOSTIC TEXT: the witness keeps it in memory for this
|
|
144
|
+
* session, mints no record from it, and grades nothing on it. Session
|
|
145
|
+
* authenticated, so it can only ever report for the session the caller
|
|
146
|
+
* is running under.
|
|
147
|
+
*/
|
|
148
|
+
async reportSessionPageOrigins(request) {
|
|
149
|
+
return this.request('/sessions/page-origins', request);
|
|
150
|
+
}
|
|
136
151
|
/**
|
|
137
152
|
* POST /sessions/intervals/open (Phase 1): marks the start of a
|
|
138
153
|
* UI-action observation interval on the witness's monotonic clock.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"witness-client.js","sourceRoot":"","sources":["../../src/client/witness-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"witness-client.js","sourceRoot":"","sources":["../../src/client/witness-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AA4BzB,qEAAqE;AACrE,MAAM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AC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAC/D,CAAC;QACJ,CAAC;QACD,OAAO,IAAS,CAAC;IACnB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -37,6 +37,23 @@ export declare const PERSISTENCE_KIND = "persistence.entity";
|
|
|
37
37
|
* persistence kind) and never engine-driven.
|
|
38
38
|
*/
|
|
39
39
|
export declare const OBSERVED_KIND = "persistence.observed";
|
|
40
|
+
/**
|
|
41
|
+
* Observe-channel transport kind (plan 0.9.2 item D): issued ONLY by
|
|
42
|
+
* the witness's observe finalize for a `http:request-observed` /
|
|
43
|
+
* `http:response-status-ok` claim the supervisor registered
|
|
44
|
+
* observed-e2e, carrying the declaring session's own proxied exchanges.
|
|
45
|
+
* Never suite-submittable (`/records` accepts only `ui.action` /
|
|
46
|
+
* `ui.visible-result`). Mirrors `HTTP_OBSERVED_KIND` in
|
|
47
|
+
* `@gate-forge/core`'s `verdict/pack-verifiers.ts` — keep in lockstep.
|
|
48
|
+
*/
|
|
49
|
+
export declare const HTTP_OBSERVED_KIND = "http.observed";
|
|
50
|
+
/**
|
|
51
|
+
* Upper bound on the exchanges one `http.observed` record carries. A
|
|
52
|
+
* session that drove more gets the first CAP exchanges in observation
|
|
53
|
+
* order plus `truncated: true` in the payload: the cap can only hide
|
|
54
|
+
* an exchange (fail-closed), never invent one.
|
|
55
|
+
*/
|
|
56
|
+
export declare const OBSERVED_EXCHANGES_CAP = 500;
|
|
40
57
|
export declare const KNOWN_RECORD_KINDS: readonly string[];
|
|
41
58
|
/** Persistence kinds are ONLY issued by the witness (engine-side adapter reads). */
|
|
42
59
|
export declare const KNOWN_PERSISTENCE_KINDS: readonly string[];
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD,0DAA0D;AAC1D,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AAEpE,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,kCAAkC,CAAC;AAExE,wEAAwE;AACxE,eAAO,MAAM,cAAc,cAAc,CAAC;AAC1C,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD,0DAA0D;AAC1D,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AAEpE,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,kCAAkC,CAAC;AAExE,wEAAwE;AACxE,eAAO,MAAM,cAAc,cAAc,CAAC;AAC1C,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AACrD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;;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E,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC,yDAAyD;AACzD,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,qDAAqD;AACrD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAK/C,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -37,6 +37,23 @@ export const PERSISTENCE_KIND = 'persistence.entity';
|
|
|
37
37
|
* persistence kind) and never engine-driven.
|
|
38
38
|
*/
|
|
39
39
|
export const OBSERVED_KIND = 'persistence.observed';
|
|
40
|
+
/**
|
|
41
|
+
* Observe-channel transport kind (plan 0.9.2 item D): issued ONLY by
|
|
42
|
+
* the witness's observe finalize for a `http:request-observed` /
|
|
43
|
+
* `http:response-status-ok` claim the supervisor registered
|
|
44
|
+
* observed-e2e, carrying the declaring session's own proxied exchanges.
|
|
45
|
+
* Never suite-submittable (`/records` accepts only `ui.action` /
|
|
46
|
+
* `ui.visible-result`). Mirrors `HTTP_OBSERVED_KIND` in
|
|
47
|
+
* `@gate-forge/core`'s `verdict/pack-verifiers.ts` — keep in lockstep.
|
|
48
|
+
*/
|
|
49
|
+
export const HTTP_OBSERVED_KIND = 'http.observed';
|
|
50
|
+
/**
|
|
51
|
+
* Upper bound on the exchanges one `http.observed` record carries. A
|
|
52
|
+
* session that drove more gets the first CAP exchanges in observation
|
|
53
|
+
* order plus `truncated: true` in the payload: the cap can only hide
|
|
54
|
+
* an exchange (fail-closed), never invent one.
|
|
55
|
+
*/
|
|
56
|
+
export const OBSERVED_EXCHANGES_CAP = 500;
|
|
40
57
|
export const KNOWN_RECORD_KINDS = [
|
|
41
58
|
UI_ACTION_KIND,
|
|
42
59
|
UI_VISIBLE_RESULT_KIND,
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEjD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAEtD,qEAAqE;AACrE,MAAM,CAAC,MAAM,sBAAsB,GAAG,6BAA6B,CAAC;AAEpE,oEAAoE;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,+BAA+B,CAAC;AAExE,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AA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oot":"","sources":["../../src/witness/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/witness/server.ts"],"names":[],"mappings":"AA0JA,OAAO,EAWL,UAAU,EASX,MAAM,kBAAkB,CAAC;AAqC1B,OAAO,KAAK,EA8CV,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AA4KpB,uDAAuD;AACvD,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAuzBD;;;;;;;;GAQG;AACH,OAAO,EAAE,UAAU,EAAE,CAAC;AA4DtB;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA4LlF;AAi0JD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/witness/server.js
CHANGED
|
@@ -77,6 +77,14 @@
|
|
|
77
77
|
* every read, and a wrong tenant makes the row unfound (fail closed).
|
|
78
78
|
* Without a registration the adapter reads through the process-global
|
|
79
79
|
* witness environment seat, exactly as before.
|
|
80
|
+
* - `POST /sessions/page-origins` — SESSION-AUTHENTICATED: the running
|
|
81
|
+
* fixture reports the origins its page requested that the routing
|
|
82
|
+
* helper did NOT rewrite onto the session proxy (`{sessionId,
|
|
83
|
+
* sessionToken, appBaseUrl, origins}`). DIAGNOSTIC TEXT and nothing
|
|
84
|
+
* else: kept in witness memory for the session, dropped with it, and
|
|
85
|
+
* read by exactly one consumer — the zero-traffic note, which names the
|
|
86
|
+
* mismatched origin and both fixes instead of guessing. It mints no
|
|
87
|
+
* record and grades no verdict.
|
|
80
88
|
* - `POST /sessions/intervals/{open,close}` — the fixture marks a
|
|
81
89
|
* witness-recorded observation interval per UI action (start/end ticks
|
|
82
90
|
* from the witness's monotonic clock). Proxy exchanges observed
|
|
@@ -146,7 +154,7 @@ import { readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
|
146
154
|
import { join, resolve } from 'node:path';
|
|
147
155
|
import { ATTESTATION_VERSION, attestationMac, behaviorActionDigestOf, DEFAULT_QUEUE_POLL_INTERVAL_MS, DEFAULT_QUEUE_TERMINAL_TIMEOUT_MS, BehaviorCatalogSchema, BEHAVIOR_CASE_KIND, enumerationDigestOf, interpretObservedPath, pathMatchesShape, recordIdOf, resolveHttpRoute, } from '@gate-forge/core';
|
|
148
156
|
import { canonicalOf } from '../json.js';
|
|
149
|
-
import { DEFAULT_REQUEST_TIMEOUT_MS, KNOWN_RECORD_KINDS, LOOPBACK_HOSTNAME, OBSERVED_KIND, PERSISTENCE_KIND, RUN_HEADER, VERIFIER_HEADER, } from '../constants.js';
|
|
157
|
+
import { DEFAULT_REQUEST_TIMEOUT_MS, HTTP_OBSERVED_KIND, KNOWN_RECORD_KINDS, LOOPBACK_HOSTNAME, OBSERVED_KIND, OBSERVED_EXCHANGES_CAP, PERSISTENCE_KIND, RUN_HEADER, VERIFIER_HEADER, } from '../constants.js';
|
|
150
158
|
import { loadAdapters, makeAdapterContext } from './adapter-registry.js';
|
|
151
159
|
import { AttestationError, assertLoopback, envFingerprintMismatch, probeEnvFingerprint, } from './env-attestation.js';
|
|
152
160
|
import { hostResolverRules, isLoopbackAddress, pinnedLoopbackIps, pinnedGet } from './loopback-pins.js';
|
|
@@ -948,6 +956,7 @@ export async function startWitness(options) {
|
|
|
948
956
|
sessions: new Map(),
|
|
949
957
|
workerSessions: new Map(),
|
|
950
958
|
sessionIdentities: new Map(),
|
|
959
|
+
sessionPageOrigins: new Map(),
|
|
951
960
|
// The engine browser is OPTIONAL here and required only by the
|
|
952
961
|
// ENGINE-BROWSER proof channel: this package is runner-neutral and
|
|
953
962
|
// must not assume a browser is installed. A witness started without
|
|
@@ -1673,6 +1682,10 @@ async function handleRequest(state, req, res) {
|
|
|
1673
1682
|
await handleSessionIdentity(state, res, (await readBody(req)));
|
|
1674
1683
|
return;
|
|
1675
1684
|
}
|
|
1685
|
+
if (req.method === 'POST' && path === '/sessions/page-origins') {
|
|
1686
|
+
await handleSessionPageOrigins(state, res, (await readBody(req)));
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1676
1689
|
if (req.method === 'POST' && path === '/sessions/intervals/open') {
|
|
1677
1690
|
await handleIntervalOpen(state, res, (await readBody(req)));
|
|
1678
1691
|
return;
|
|
@@ -2805,6 +2818,7 @@ async function handleSessionClose(state, res, body) {
|
|
|
2805
2818
|
// never be consumed by a later call.
|
|
2806
2819
|
state.observeSnapshots.delete(sessionId);
|
|
2807
2820
|
state.sessionIdentities.delete(sessionId);
|
|
2821
|
+
state.sessionPageOrigins.delete(sessionId);
|
|
2808
2822
|
sendJson(res, 200, { sealed: true });
|
|
2809
2823
|
return;
|
|
2810
2824
|
}
|
|
@@ -2821,6 +2835,7 @@ async function handleSessionClose(state, res, body) {
|
|
|
2821
2835
|
// The registered identity dies with the session: a later read has no
|
|
2822
2836
|
// credential of this session's to inherit, ever.
|
|
2823
2837
|
state.sessionIdentities.delete(session.sessionId);
|
|
2838
|
+
state.sessionPageOrigins.delete(session.sessionId);
|
|
2824
2839
|
// The dedicated channel dies with the session: nothing can observe
|
|
2825
2840
|
// (or submit) through it afterwards. The engine browser context dies
|
|
2826
2841
|
// too — a sealed session's pages are never driven again.
|
|
@@ -2879,6 +2894,92 @@ async function handleSessionIdentity(state, res, body) {
|
|
|
2879
2894
|
state.sessionIdentities.set(session.sessionId, { seat, values: Object.freeze(credential) });
|
|
2880
2895
|
sendJson(res, 200, { registered: true, seat });
|
|
2881
2896
|
}
|
|
2897
|
+
/**
|
|
2898
|
+
* `POST /sessions/page-origins` — SESSION-AUTHENTICATED (plan 0.9.2
|
|
2899
|
+
* item F): the running fixture reports the origins its page requested
|
|
2900
|
+
* that the routing helper did NOT rewrite onto the session proxy.
|
|
2901
|
+
*
|
|
2902
|
+
* This rides the SAME channel, authentication and lifecycle as the
|
|
2903
|
+
* identity beside it — session-authenticated, witness memory, dropped
|
|
2904
|
+
* with the session — so it is not a second trust path. What differs is
|
|
2905
|
+
* what it may do: NOTHING. It mints no record, grades nothing, and never
|
|
2906
|
+
* reaches the run state, a log or a report. Its only consumer is the
|
|
2907
|
+
* zero-traffic note a finalize already emits, which names the mismatched
|
|
2908
|
+
* origin and both fixes instead of guessing.
|
|
2909
|
+
*
|
|
2910
|
+
* Refusals mirror the identity handler: a foreign credential → 403, a
|
|
2911
|
+
* sealed or released session → 409, and a malformed origin → 400, so a
|
|
2912
|
+
* half-parsed origin can never reach the note.
|
|
2913
|
+
*/
|
|
2914
|
+
async function handleSessionPageOrigins(state, res, body) {
|
|
2915
|
+
if (!isPlainObject(body)) {
|
|
2916
|
+
throw new HttpError(400, 'page origin report body must be an object');
|
|
2917
|
+
}
|
|
2918
|
+
// Authenticated as the session it names: a caller can only report for
|
|
2919
|
+
// the session whose secret it presents.
|
|
2920
|
+
const session = requireOpenSession(state, body);
|
|
2921
|
+
const appBaseUrl = parseOrigin(body['appBaseUrl'], 'the app base URL the fixture routes');
|
|
2922
|
+
const reported = body['origins'];
|
|
2923
|
+
if (!Array.isArray(reported) || reported.length === 0) {
|
|
2924
|
+
throw new HttpError(400, 'page origin report requires at least one origin');
|
|
2925
|
+
}
|
|
2926
|
+
const origins = reported.map((origin) => parseOrigin(origin, 'each reported origin'));
|
|
2927
|
+
const previous = state.sessionPageOrigins.get(session.sessionId);
|
|
2928
|
+
// One bounded set per session: a page can request a mismatched origin
|
|
2929
|
+
// thousands of times, and the note only ever needs the first few.
|
|
2930
|
+
const merged = [];
|
|
2931
|
+
for (const origin of [...(previous?.origins ?? []), ...origins]) {
|
|
2932
|
+
if (origin === appBaseUrl || merged.includes(origin))
|
|
2933
|
+
continue;
|
|
2934
|
+
if (merged.length >= PAGE_ORIGIN_REPORT_CAP)
|
|
2935
|
+
break;
|
|
2936
|
+
merged.push(origin);
|
|
2937
|
+
}
|
|
2938
|
+
state.sessionPageOrigins.set(session.sessionId, {
|
|
2939
|
+
appBaseUrl,
|
|
2940
|
+
origins: Object.freeze(merged),
|
|
2941
|
+
});
|
|
2942
|
+
sendJson(res, 200, { recorded: true });
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* One reported origin, parsed and reduced to its origin form. A value
|
|
2946
|
+
* that is not an absolute http(s) URL is refused rather than repaired:
|
|
2947
|
+
* the note quotes origins, and a repaired one would name a host the
|
|
2948
|
+
* suite never asked for.
|
|
2949
|
+
*/
|
|
2950
|
+
function parseOrigin(value, what) {
|
|
2951
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
2952
|
+
throw new HttpError(400, `${what} must be a non-empty origin string`);
|
|
2953
|
+
}
|
|
2954
|
+
let parsed;
|
|
2955
|
+
try {
|
|
2956
|
+
parsed = new URL(value);
|
|
2957
|
+
}
|
|
2958
|
+
catch {
|
|
2959
|
+
throw new HttpError(400, `${what} '${value}' is not an absolute URL`);
|
|
2960
|
+
}
|
|
2961
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
2962
|
+
throw new HttpError(400, `${what} '${value}' must be an http(s) URL`);
|
|
2963
|
+
}
|
|
2964
|
+
return parsed.origin;
|
|
2965
|
+
}
|
|
2966
|
+
/**
|
|
2967
|
+
* The origin-mismatch sentence the zero-traffic note appends, or '' when
|
|
2968
|
+
* the session reported nothing (or the session is not open enough to
|
|
2969
|
+
* carry a report). DIAGNOSTIC TEXT: it quotes what the fixture observed
|
|
2970
|
+
* and the base URL it was configured with, and it decides nothing — the
|
|
2971
|
+
* claim still blocks exactly as it did before the sentence existed.
|
|
2972
|
+
*/
|
|
2973
|
+
function pageOriginNote(state, session) {
|
|
2974
|
+
const report = state.sessionPageOrigins.get(session.sessionId);
|
|
2975
|
+
if (report === undefined || report.origins.length === 0)
|
|
2976
|
+
return '';
|
|
2977
|
+
const named = report.origins.map((origin) => `'${origin}'`).join(', ');
|
|
2978
|
+
return (`this test's page requested ${named}, which the fixture did not route: it rewrites only ` +
|
|
2979
|
+
`GATEFORGE_APP_BASE_URL ('${report.appBaseUrl}') onto this session's proxy — set ` +
|
|
2980
|
+
'GATEFORGE_APP_BASE_URL to the origin your suite uses, or add your suite\'s base-URL variable ' +
|
|
2981
|
+
'to envAllowlist in runtime.yml so it reaches the test process');
|
|
2982
|
+
}
|
|
2882
2983
|
/**
|
|
2883
2984
|
* The adapter identity one session registered for itself, or null (the
|
|
2884
2985
|
* process-global environment seat). Only the session's OWN reads may
|
|
@@ -4065,9 +4166,20 @@ async function handleObserveFinalize(state, res, verifier, body) {
|
|
|
4065
4166
|
}
|
|
4066
4167
|
const finalized = [];
|
|
4067
4168
|
const notes = [];
|
|
4169
|
+
// ONE snapshot of the session's transport record content, taken
|
|
4170
|
+
// BEFORE any claim finalizes: the persistence branch consumes its
|
|
4171
|
+
// matched exchange single-use out of `state.observed`, so a transport
|
|
4172
|
+
// claim walked after it would otherwise see an empty log and finalize
|
|
4173
|
+
// with a zero-traffic note — blaming the fixture page for a request
|
|
4174
|
+
// that demonstrably traversed the proxy. The claim loop order
|
|
4175
|
+
// (obligation ids are sorted at session open) must not decide what a
|
|
4176
|
+
// transport record carries. Persistence-vs-persistence consumption is
|
|
4177
|
+
// untouched: it still matches against the LIVE log, so one exchange
|
|
4178
|
+
// can never credit two persistence claims.
|
|
4179
|
+
const transport = transportSnapshot(state, session);
|
|
4068
4180
|
const claims = session.claims.filter((claim) => state.observeDeclarations?.has(claim));
|
|
4069
4181
|
for (const claimId of claims) {
|
|
4070
|
-
const outcome = await finalizeObserveClaim(state, session, claimId);
|
|
4182
|
+
const outcome = await finalizeObserveClaim(state, session, claimId, transport);
|
|
4071
4183
|
if ('record' in outcome)
|
|
4072
4184
|
finalized.push(outcome.record);
|
|
4073
4185
|
else
|
|
@@ -4076,13 +4188,77 @@ async function handleObserveFinalize(state, res, verifier, body) {
|
|
|
4076
4188
|
const response = { finalized, notes };
|
|
4077
4189
|
sendJson(res, 200, response);
|
|
4078
4190
|
}
|
|
4079
|
-
/**
|
|
4080
|
-
|
|
4191
|
+
/**
|
|
4192
|
+
* What every zero-traffic Observe note says about the LIKELY cause
|
|
4193
|
+
* (plan 0.9.2 finding E).
|
|
4194
|
+
*
|
|
4195
|
+
* A session that proxied nothing is nearly always a suite whose `page`
|
|
4196
|
+
* never came from Gateforge's fixture: that fixture is what rewrites
|
|
4197
|
+
* the app origin onto the supervisor's session proxy
|
|
4198
|
+
* (`routePageThroughSessionProxy`), so a page built on plain
|
|
4199
|
+
* Playwright talks straight to the app and the witness never sees the
|
|
4200
|
+
* traffic. The test still passes — which is exactly why this note has
|
|
4201
|
+
* to name the cause instead of only restating "no traffic".
|
|
4202
|
+
*/
|
|
4203
|
+
const FIXTURE_PAGE_CAUSE = "the most likely cause is that this test's page is not Gateforge's fixture page — " +
|
|
4204
|
+
'base the suite shared fixture on @gate-forge/pack-playwright/fixture (test/expect), so ' +
|
|
4205
|
+
'its traffic passes through the session proxy';
|
|
4206
|
+
/**
|
|
4207
|
+
* How many distinct unrouted origins one session keeps (plan 0.9.2
|
|
4208
|
+
* item F). A broken run can name hundreds; the note needs the first few
|
|
4209
|
+
* to name the cause, and a bounded set can never grow the witness's
|
|
4210
|
+
* memory with a page's traffic.
|
|
4211
|
+
*/
|
|
4212
|
+
const PAGE_ORIGIN_REPORT_CAP = 5;
|
|
4213
|
+
/**
|
|
4214
|
+
* The cause clause a zero-traffic note ends with, chosen by what the
|
|
4215
|
+
* session actually reported: an origin mismatch is a SPECIFIED cause and
|
|
4216
|
+
* supersedes the generic fixture-page guess (a report can only exist when
|
|
4217
|
+
* the fixture page ran, so the guess it replaces is already refuted).
|
|
4218
|
+
*/
|
|
4219
|
+
function zeroTrafficCause(state, session) {
|
|
4220
|
+
const reported = pageOriginNote(state, session);
|
|
4221
|
+
return reported === '' ? FIXTURE_PAGE_CAUSE : reported;
|
|
4222
|
+
}
|
|
4223
|
+
function transportSnapshot(state, session) {
|
|
4224
|
+
const watermark = state.runContext === null ? 0 : state.observedSeqAtBind;
|
|
4225
|
+
const seen = Object.create(null);
|
|
4226
|
+
const exchanges = [];
|
|
4227
|
+
let truncated = false;
|
|
4228
|
+
for (const exchange of state.observed) {
|
|
4229
|
+
if (exchange.sessionId !== session.sessionId || exchange.seq <= watermark)
|
|
4230
|
+
continue;
|
|
4231
|
+
const key = `${exchange.method} ${exchange.path} ${String(exchange.status)}`;
|
|
4232
|
+
if (key in seen)
|
|
4233
|
+
continue;
|
|
4234
|
+
seen[key] = true;
|
|
4235
|
+
if (exchanges.length >= OBSERVED_EXCHANGES_CAP) {
|
|
4236
|
+
truncated = true;
|
|
4237
|
+
continue;
|
|
4238
|
+
}
|
|
4239
|
+
exchanges.push({ method: exchange.method, url: exchange.path, status: exchange.status });
|
|
4240
|
+
}
|
|
4241
|
+
return { exchanges, truncated };
|
|
4242
|
+
}
|
|
4243
|
+
/**
|
|
4244
|
+
* Resolves one observe-declared claim (record or typed note, never
|
|
4245
|
+
* throws). `persistence:*` claims resolve against the session's own
|
|
4246
|
+
* proxied traffic PLUS independent adapter reads — and consume their
|
|
4247
|
+
* match single-use out of that live log. The transport contracts
|
|
4248
|
+
* resolve against `transport`, the snapshot taken before the claim loop
|
|
4249
|
+
* (see {@link finalizeHttpObserveClaim}); anything else the channel
|
|
4250
|
+
* cannot prove is a typed note.
|
|
4251
|
+
*/
|
|
4252
|
+
async function finalizeObserveClaim(state, session, claimId, transport) {
|
|
4081
4253
|
const note = (detail) => ({ note: `observe '${claimId}': ${detail}` });
|
|
4082
4254
|
const resourceId = resourceIdOfObligation(claimId);
|
|
4083
|
-
const
|
|
4255
|
+
const contract = claimId.slice(resourceId.length + 1);
|
|
4256
|
+
const operation = observeOperation(contract);
|
|
4084
4257
|
if (operation === null) {
|
|
4085
|
-
|
|
4258
|
+
if (OBSERVED_TRANSPORT_CONTRACTS.includes(contract)) {
|
|
4259
|
+
return finalizeHttpObserveClaim(state, session, claimId, transport);
|
|
4260
|
+
}
|
|
4261
|
+
return note(`the Observe channel proves persistence:* and ${OBSERVED_TRANSPORT_CONTRACTS.join(' / ')} only — this claim stays blocking`);
|
|
4086
4262
|
}
|
|
4087
4263
|
let adapterName;
|
|
4088
4264
|
let adapter;
|
|
@@ -4125,7 +4301,8 @@ async function finalizeObserveClaim(state, session, claimId) {
|
|
|
4125
4301
|
}
|
|
4126
4302
|
if (matches.length === 0) {
|
|
4127
4303
|
return note(`no ${binding.method} ${binding.path} exchange (2xx) for this session through the observation ` +
|
|
4128
|
-
|
|
4304
|
+
`proxy — drive traffic through the session proxy prefix before claiming the obligation; ` +
|
|
4305
|
+
zeroTrafficCause(state, session));
|
|
4129
4306
|
}
|
|
4130
4307
|
if (matches.length > 1) {
|
|
4131
4308
|
return note(`${String(matches.length)} matching ${binding.method} ${binding.path} exchanges — ambiguous, ` +
|
|
@@ -4267,6 +4444,76 @@ async function finalizeObserveClaim(state, session, claimId) {
|
|
|
4267
4444
|
record: { obligationId: claimId, recordId: issued.recordId, operation, entityId: read.entityId },
|
|
4268
4445
|
};
|
|
4269
4446
|
}
|
|
4447
|
+
/**
|
|
4448
|
+
* The transport contracts the Observe channel serves (plan 0.9.2 item
|
|
4449
|
+
* D). `http:frontend-request-observed` is deliberately absent and
|
|
4450
|
+
* always will be: it needs independent browser attribution the session
|
|
4451
|
+
* proxy origin never carries. `http:effect-verified` /
|
|
4452
|
+
* `http:read-result-verified` are absent because they need
|
|
4453
|
+
* engine-owned state-scope observations, not a transport exchange.
|
|
4454
|
+
*/
|
|
4455
|
+
const OBSERVED_TRANSPORT_CONTRACTS = [
|
|
4456
|
+
'http:request-observed',
|
|
4457
|
+
'http:response-status-ok',
|
|
4458
|
+
];
|
|
4459
|
+
/**
|
|
4460
|
+
* Resolves ONE `http:request-observed` / `http:response-status-ok`
|
|
4461
|
+
* claim into a witnessed `http.observed` record carrying the exchanges
|
|
4462
|
+
* the witness proxied for THIS session (plan 0.9.2 item D).
|
|
4463
|
+
*
|
|
4464
|
+
* What travels comes from `transport` — the snapshot the finalize took
|
|
4465
|
+
* ONCE before walking any claim (see {@link transportSnapshot}), so the
|
|
4466
|
+
* record states what the session's proxy saw and never what a
|
|
4467
|
+
* neighbouring claim happened to leave behind. The snapshot itself is
|
|
4468
|
+
* the session's own observation order, deduplicated by
|
|
4469
|
+
* `(method, url, status)` and capped at {@link OBSERVED_EXCHANGES_CAP}
|
|
4470
|
+
* — a record over the cap says so with `truncated: true`. The witness
|
|
4471
|
+
* does NOT decide whether an exchange matches the obligation's
|
|
4472
|
+
* endpoint: core grades every exchange through the SAME matcher the
|
|
4473
|
+
* `http.request` path uses, so there is exactly one endpoint resolver
|
|
4474
|
+
* in the product.
|
|
4475
|
+
*
|
|
4476
|
+
* The bind watermark (plan §11.4) applies exactly as it does for
|
|
4477
|
+
* persistence: an exchange that completed before the trusted context
|
|
4478
|
+
* bound predates this invocation and never travels. A session that
|
|
4479
|
+
* proxied nothing gets a typed `missing-traffic` note and NO record —
|
|
4480
|
+
* an empty record would grade as "the witness observed nothing that
|
|
4481
|
+
* attributes", which is the same block for a different reason.
|
|
4482
|
+
*
|
|
4483
|
+
* Args:
|
|
4484
|
+
* state: the witness state (ledger + page-origin report).
|
|
4485
|
+
* session: the OPEN-or-released session being finalized.
|
|
4486
|
+
* claimId: the transport obligation id the record is issued under.
|
|
4487
|
+
* transport: the session's snapshot exchanges (taken before the
|
|
4488
|
+
* claim loop).
|
|
4489
|
+
*
|
|
4490
|
+
* Returns:
|
|
4491
|
+
* `{record}` with the issued record id, or a typed `{note}`.
|
|
4492
|
+
*/
|
|
4493
|
+
function finalizeHttpObserveClaim(state, session, claimId, transport) {
|
|
4494
|
+
if (transport.exchanges.length === 0) {
|
|
4495
|
+
return {
|
|
4496
|
+
note: `observe '${claimId}': no HTTP exchange passed through this session's observation proxy ` +
|
|
4497
|
+
'before finalize — drive the endpoint through the session proxy prefix before claiming ' +
|
|
4498
|
+
`the obligation; ${zeroTrafficCause(state, session)}`,
|
|
4499
|
+
};
|
|
4500
|
+
}
|
|
4501
|
+
const { exchanges, truncated } = transport;
|
|
4502
|
+
// The record binds runId/claimId/testId and rides the same ledger
|
|
4503
|
+
// attestation MAC as every witnessed record: the contents are
|
|
4504
|
+
// witness-produced (proxy capture), so `engine-observed` origin and
|
|
4505
|
+
// witnessed trust. The suite drove the browser, so the record is
|
|
4506
|
+
// stamped `channel: 'observe'` — the exact discriminant core admits
|
|
4507
|
+
// alongside persistence, never the engine-browser channel.
|
|
4508
|
+
const issued = issueRecord(state, claimId, HTTP_OBSERVED_KIND, session.testId, {
|
|
4509
|
+
channel: OBSERVE_CHANNEL,
|
|
4510
|
+
sessionId: session.sessionId,
|
|
4511
|
+
exchanges,
|
|
4512
|
+
...(truncated ? { truncated: true } : {}),
|
|
4513
|
+
}, 'engine-observed');
|
|
4514
|
+
session.activity += 1;
|
|
4515
|
+
return { record: { obligationId: claimId, recordId: issued.recordId } };
|
|
4516
|
+
}
|
|
4270
4517
|
/**
|
|
4271
4518
|
* `POST /witness/server-persistence` — SUPERVISOR ONLY (run token +
|
|
4272
4519
|
* verifier key; the trusted CLI drain forwards intents the supervised
|