@capagents/forgeqe 3.1.8 → 3.2.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/HOW_TO_USE.md +51 -4
- package/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/docs-site/docs/area-operations/index.html +25 -2
- package/dist/docs-site/docs/area-quality/index.html +17 -3
- package/dist/docs-site/docs/area-setup/index.html +1 -1
- package/dist/docs-site/docs/get-started/index.html +18 -2
- package/dist/docs-site/docs/overview/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1972 -1930
- package/dist/template.html +12 -12
- package/dist/vendor/ibm-ace.js +2 -0
- package/dist/web/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/web/assets/{3d-force-graph-OeCdKJJ-.js → 3d-force-graph-Bhmgjf_7.js} +1 -1
- package/dist/web/assets/Agent-Dx4aOB_h.js +8 -0
- package/dist/web/assets/AgentWork-D0MS10up.js +2 -0
- package/dist/web/assets/ApiTests-DUoEh0nX.js +10 -0
- package/dist/web/assets/Browse-BGgyLuL3.js +1 -0
- package/dist/web/assets/Chat-CEHUI2ty.js +3 -0
- package/dist/web/assets/{CommandPalette-zRrrp6F_.js → CommandPalette-rY8rp79k.js} +1 -1
- package/dist/web/assets/Compare-B_NCvogR.js +1 -0
- package/dist/web/assets/Cost-sm-6tWRQ.js +1 -0
- package/dist/web/assets/Data-CFyxbwPS.js +6 -0
- package/dist/web/assets/Desktop-A_D4LTis.js +1 -0
- package/dist/web/assets/DesktopReview-CM7xmpHS.js +2 -0
- package/dist/web/assets/Evidence-BlTkmzfE.js +1 -0
- package/dist/web/assets/Explore-DyGqAEff.js +2 -0
- package/dist/web/assets/Features-BjPR9gCe.js +1 -0
- package/dist/web/assets/Flags-C_DneXS9.js +2 -0
- package/dist/web/assets/Flaky-l5ugC_ER.js +1 -0
- package/dist/web/assets/Impact-7TXQHcsW.js +3 -0
- package/dist/web/assets/Jobs-xRLNI-8l.js +5 -0
- package/dist/web/assets/KindPage-BZu1Zo4S.js +6 -0
- package/dist/web/assets/Migration-DKsyDwDO.js +8 -0
- package/dist/web/assets/Observability-CVwKJ-fI.js +1 -0
- package/dist/web/assets/PageAgent-C1X5ot6v.js +1 -0
- package/dist/web/assets/Product-iHqLyIhD.js +12 -0
- package/dist/web/assets/Production-C8eGcwCi.js +1 -0
- package/dist/web/assets/Quality-BVsN6u0E.js +1 -0
- package/dist/web/assets/Readiness-BWlbiTeu.js +1 -0
- package/dist/web/assets/Record-C7qgNFqs.js +1 -0
- package/dist/web/assets/Regression-ChleHlqe.js +5 -0
- package/dist/web/assets/RelationGraph-CzR_Hs8A.js +1 -0
- package/dist/web/assets/Reports-CIcKyoHH.js +2 -0
- package/dist/web/assets/Response-D2ZeO8uW.js +9 -0
- package/dist/web/assets/Responsive-DCfw-Oz3.js +3 -0
- package/dist/web/assets/RunDiff-COaxhvKm.js +1 -0
- package/dist/web/assets/Runs-3qx2qf56.js +2 -0
- package/dist/web/assets/Settings-DG2k3Lno.js +21 -0
- package/dist/web/assets/Steps-CN4n8U1I.js +3 -0
- package/dist/web/assets/TestCases-BEfJFp5h.js +1 -0
- package/dist/web/assets/TestData-SO2qqaAF.js +2 -0
- package/dist/web/assets/TestDebt-DIYhbhjh.js +1 -0
- package/dist/web/assets/TestManagement-D7q6G3YN.js +4 -0
- package/dist/web/assets/WhatsNew-DqBLhhgk.js +1 -0
- package/dist/web/assets/{agents-C0Jg2pN8.js → agents-BUWN-VJv.js} +1 -1
- package/dist/web/assets/{coverage-BB9BLjGz.js → coverage-DCtiu73T.js} +4 -4
- package/dist/web/assets/dataParts-BdmBLsU9.js +3 -0
- package/dist/web/assets/{diff-cbn6NGtL.js → diff-DEgLgw6R.js} +1 -1
- package/dist/web/assets/families-CrnKBjis.js +1 -0
- package/dist/web/assets/{highlight--Ayfy7Gy.js → highlight-DSLpJ_Dq.js} +1 -1
- package/dist/web/assets/index-DAteDsgB.css +2 -0
- package/dist/web/assets/index-RJ1kEHuo.js +64 -0
- package/dist/web/assets/input-Be3YOEK2.js +1 -0
- package/dist/web/assets/logLevel-Dq8s6DZz.js +3 -0
- package/dist/web/assets/palette-Dcoz5crU.js +1 -0
- package/dist/web/assets/{paletteCommands-ar4wAGok.js → paletteCommands-fwv5XVOS.js} +1 -1
- package/dist/web/assets/parts-CkI14hIv.js +1 -0
- package/dist/web/assets/productParts-BOUMBM_H.js +1 -0
- package/dist/web/assets/qualityParts-8KI3JCY8.js +1 -0
- package/dist/web/assets/recordTest-kf2ykEQF.js +1 -0
- package/dist/web/assets/route-D8G-pTdk.js +1 -0
- package/dist/web/assets/stepper-CQSK6KS0.js +1 -0
- package/dist/web/index.html +7 -7
- package/docs/OBSERVABILITY.md +233 -0
- package/docs/user-guide.html +59 -6
- package/forgeqe.example.yaml +5 -1
- package/llms.example.json +1 -1
- package/package.json +2 -1
- package/prompts/browser-persona.md +1 -1
- package/py/forgeqe_desktop/handhooks.py +106 -4
- package/py/forgeqe_desktop/handrecord.py +77 -2
- package/py/forgeqe_desktop/service.py +22 -5
- package/py/forgeqe_desktop/workflow.py +47 -2
- package/py/forgeqe_engine/copilot_gateway.py +139 -5
- package/py/forgeqe_engine/copilot_models.py +186 -0
- package/py/forgeqe_engine/diagnostics.py +119 -2
- package/py/forgeqe_engine/llm.py +85 -1
- package/py/forgeqe_engine/persona.py +3 -2
- package/py/forgeqe_engine/service.py +36 -10
- package/py/forgeqe_mobile/record.py +95 -5
- package/dist/web/assets/Agent-DrdDwck4.js +0 -8
- package/dist/web/assets/AgentWork-wNaA-i2T.js +0 -2
- package/dist/web/assets/ApiTests-B3X6NIn8.js +0 -10
- package/dist/web/assets/Browse-Cd1DEgYR.js +0 -1
- package/dist/web/assets/Chat-4GknHS5Z.js +0 -3
- package/dist/web/assets/Compare-DJVhkzqO.js +0 -1
- package/dist/web/assets/Cost-CbKnuQuB.js +0 -1
- package/dist/web/assets/Data-Bt5yqqvq.js +0 -6
- package/dist/web/assets/Desktop-CPDo3Ir-.js +0 -1
- package/dist/web/assets/DesktopReview-CCaqTSu5.js +0 -1
- package/dist/web/assets/Evidence-BAuIgj1h.js +0 -1
- package/dist/web/assets/Explore-BqzEPdP7.js +0 -2
- package/dist/web/assets/Features-DFuPCW9x.js +0 -1
- package/dist/web/assets/Flags-UBakvqIq.js +0 -2
- package/dist/web/assets/Flaky-DUzdfQW4.js +0 -1
- package/dist/web/assets/Impact-jLZqUzz9.js +0 -3
- package/dist/web/assets/Jobs-De3NyY5s.js +0 -5
- package/dist/web/assets/KindPage-DWznWcLB.js +0 -6
- package/dist/web/assets/Migration-BdOq6RO6.js +0 -2
- package/dist/web/assets/PageAgent-dVvZtNoB.js +0 -1
- package/dist/web/assets/Product-ByZ8Qr3i.js +0 -12
- package/dist/web/assets/Production-D8L2TchK.js +0 -1
- package/dist/web/assets/Quality-CSZEuhZo.js +0 -1
- package/dist/web/assets/Readiness-bBu_84mx.js +0 -1
- package/dist/web/assets/Record-DWJEDj2C.js +0 -1
- package/dist/web/assets/Regression-D2VkPIhZ.js +0 -5
- package/dist/web/assets/RelationGraph-q5H4bYjq.js +0 -1
- package/dist/web/assets/Reports-dF-O5HTI.js +0 -2
- package/dist/web/assets/Response-D4JW3pwi.js +0 -9
- package/dist/web/assets/Responsive-CLX9S27s.js +0 -3
- package/dist/web/assets/RunDiff-BuL_-GwF.js +0 -1
- package/dist/web/assets/Runs-DyyaAiyA.js +0 -2
- package/dist/web/assets/Settings-DnG6_QQj.js +0 -21
- package/dist/web/assets/Steps-C-0zwG7T.js +0 -2
- package/dist/web/assets/TestCases-DXk9qsEL.js +0 -1
- package/dist/web/assets/TestData-D4al7-3Z.js +0 -2
- package/dist/web/assets/TestDebt-BzOVDuS8.js +0 -1
- package/dist/web/assets/TestManagement-T-NIlhc9.js +0 -1
- package/dist/web/assets/Tosca-D7tqMGK0.js +0 -3
- package/dist/web/assets/WhatsNew-DBViE2Qt.js +0 -1
- package/dist/web/assets/dataParts-D56_9p6T.js +0 -3
- package/dist/web/assets/families-gkpkloLT.js +0 -1
- package/dist/web/assets/filters-Culzq1j1.js +0 -1
- package/dist/web/assets/fold-UP5ihvz-.js +0 -1
- package/dist/web/assets/head-BpR3dGRT.js +0 -1
- package/dist/web/assets/index-CljX5dI4.js +0 -64
- package/dist/web/assets/index-CwAqcn-z.css +0 -2
- package/dist/web/assets/input-D7iHeNXz.js +0 -1
- package/dist/web/assets/logos-B4e5nBuL.js +0 -1
- package/dist/web/assets/palette-lUno7fso.js +0 -1
- package/dist/web/assets/parts-DbdUgAZS.js +0 -1
- package/dist/web/assets/productParts-DSrnTFn8.js +0 -1
- package/dist/web/assets/qualityParts-D_U5zhKC.js +0 -1
- package/dist/web/assets/recordTest-D9zuJ-aG.js +0 -1
- package/dist/web/assets/route-Dg53WdFu.js +0 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# Observability: an opt-in OpenTelemetry export of ForgeQE's own work (design)
|
|
2
|
+
|
|
3
|
+
Status: all four phases are built: T1 (settings, approval, exporter, traces), T2 (metrics), T3 (the Settings page) and
|
|
4
|
+
T4 (protobuf bodies, log records). Both T4 pieces are off unless asked for. The open questions at the end are
|
|
5
|
+
still open, and T1 takes this design's defaults for them: home only, no test file names, cost included.
|
|
6
|
+
|
|
7
|
+
Today ForgeQE observes itself only on the machine it runs on: session logs (`src/sessionLog.ts`), the usage ledger
|
|
8
|
+
(`src/tokenomics/ledger.ts`), the audit in Settings › Activity, run health (`src/feedback/health.ts`) and task records.
|
|
9
|
+
It also turns every exporter off on purpose: `src/privacy.ts` sets `OTEL_SDK_DISABLED` and strips `OTEL_EXPORTER_OTLP_*`
|
|
10
|
+
from every process it starts, and the agent runtime runs with `openTelemetry: false`.
|
|
11
|
+
|
|
12
|
+
This design lets a team send **what ForgeQE did, how long it took, what it cost and where it failed** to its own
|
|
13
|
+
OpenTelemetry collector (Grafana, Datadog, Honeycomb, Jaeger, Azure Monitor, ...), **without ever sending what it read
|
|
14
|
+
or wrote**: no prompt, reply, page text, test code, tracker text or secret.
|
|
15
|
+
|
|
16
|
+
## Using it
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
forgeqe telemetry set --endpoint https://otel.example.com:4318 --header Authorization=OTEL_COLLECTOR_TOKEN
|
|
20
|
+
forgeqe telemetry approve # at a terminal: type the collector's host to turn it on
|
|
21
|
+
forgeqe telemetry test # one test span now
|
|
22
|
+
forgeqe telemetry status # settings, this project's id, whether it exports from here, the last result
|
|
23
|
+
forgeqe telemetry off
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- Or in the web app: **Settings › Observability** (`web/src/settings/observability.tsx`, gateway `src/web/telemetry.ts`).
|
|
27
|
+
Save never turns it on; Turn on shows the sample and takes the collector's host typed; Turn off takes nothing; Send a
|
|
28
|
+
test span; the last result. A header's secret is named by its variable, its value saved in Settings › Secrets and
|
|
29
|
+
never sent to the page. Each change is in the audit log.
|
|
30
|
+
- The settings are in `~/.forgeqe/telemetry.json` (`src/telemetry/settings.ts`); the last result in
|
|
31
|
+
`telemetry-status.json` beside it. `set` never turns the export on, and a new host drops the old approval.
|
|
32
|
+
- Every command that writes a session log exports its session (`startTelemetry` in `src/cli/index.ts`, from the
|
|
33
|
+
session log's events and the usage ledger's calls) and flushes for at most 2 s when it ends (`src/index.ts`).
|
|
34
|
+
`forgeqe web` itself writes no session log; the chats and jobs it starts each export their own session.
|
|
35
|
+
- A session ended by a signal (Ctrl+C twice, a kill) loses what had not been sent yet; the timer sends every 5 s.
|
|
36
|
+
- Metrics are sent at every level (`metrics` sends metrics only, no spans), every minute and when the session ends
|
|
37
|
+
(`src/telemetry/metrics.ts`). They are deltas: each request holds what happened since the one before, so many short
|
|
38
|
+
ForgeQE processes add up without clashing. A backend that wants cumulative counters (Prometheus) takes them through
|
|
39
|
+
the collector's `deltatocumulative` processor. Each process has a random `service.instance.id`.
|
|
40
|
+
|
|
41
|
+
## The dashboard in the web app
|
|
42
|
+
|
|
43
|
+
**AI Assurance › Governance › Observability** (`web/src/pages/Observability.tsx`, gateway `src/web/observability.ts`)
|
|
44
|
+
shows the same numbers on this computer, whether or not the export is on: sessions a day and the ones with an error,
|
|
45
|
+
sessions by command, browser runs by how they ended, turn times, tool calls and errors by tool, session-health
|
|
46
|
+
signatures, model calls by model (speed and cost, from this project's ledger calls), and the latest problems. It
|
|
47
|
+
reads the logs only through `sessionLogFiles` (the Cost page's reader: no link, only the logs folder) and every number
|
|
48
|
+
through the export's allowlist (`logFor`, `toolName`, the run statuses and model ids of `spans.ts`, `sessionHealth`), so
|
|
49
|
+
nothing a log says is shown: a problem is in ForgeQE's own words, a session named by its log only. Read only; the window
|
|
50
|
+
is 7, 30 or 90 days.
|
|
51
|
+
|
|
52
|
+
## Principles
|
|
53
|
+
|
|
54
|
+
1. **Off unless a person turns it on, on this computer.** No project file, `.env`, environment variable or agent can
|
|
55
|
+
turn it on or move where it sends.
|
|
56
|
+
2. **Shapes, not content.** What leaves is a fixed allowlist of attributes per event, each of a known shape (a name of
|
|
57
|
+
ForgeQE's own list, a number, a boolean, an id of its shape). Free text is never exported, however it was scrubbed.
|
|
58
|
+
3. **It never changes a run.** Exporting cannot block, slow, fail or retry a run; a broken collector is said once and
|
|
59
|
+
costs nothing else.
|
|
60
|
+
4. **Only ForgeQE's own process exports.** The processes it starts (engine, agent runtime, the repository's tests) keep
|
|
61
|
+
telemetry off exactly as now.
|
|
62
|
+
5. **What is sent can be seen.** The page shows a real sample of the next payload before turning it on.
|
|
63
|
+
|
|
64
|
+
## Where the setting lives
|
|
65
|
+
|
|
66
|
+
`forgeqe.yaml` comes from the repository, so a hostile repository could otherwise point the export at its own server
|
|
67
|
+
and learn what the team runs. So:
|
|
68
|
+
|
|
69
|
+
- The export is configured only in ForgeQE's home (`~/.forgeqe/telemetry.json`, mode 0600, written atomically, read back
|
|
70
|
+
as untrusted by `readTelemetry`), like vault connections.
|
|
71
|
+
- A project's `forgeqe.yaml` may say only `telemetry: off` (to keep a sensitive project out of an export that is on).
|
|
72
|
+
Any other value there is reported and ignored.
|
|
73
|
+
- `OTEL_EXPORTER_OTLP_*`, `OTEL_SERVICE_NAME` and the like are never read, from the shell or a `.env`.
|
|
74
|
+
- Turning it on, or changing the endpoint, needs a person: the Settings page with the endpoint's host typed, or
|
|
75
|
+
`forgeqe telemetry approve` at a terminal. Each change is audited.
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"enabled": true,
|
|
80
|
+
"endpoint": "https://otel.example.internal:4318",
|
|
81
|
+
"headers": { "Authorization": "OTEL_COLLECTOR_TOKEN" },
|
|
82
|
+
"level": "traces",
|
|
83
|
+
"service": "forgeqe-qa-team",
|
|
84
|
+
"projects": "all"
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- `endpoint`: https only, http only for `127.0.0.1` / `localhost` (a collector on this computer, or Evidence's own
|
|
89
|
+
receiver). No user name, query or fragment. Checked by `telemetryEndpoint`.
|
|
90
|
+
- `headers`: a header's value is only a variable's name, read from the credential store or the environment when sent.
|
|
91
|
+
The name is added to `privateEnvNames`, and `secretNameAllowed` decides which names are allowed. No response, log or
|
|
92
|
+
page ever carries the value.
|
|
93
|
+
- `level`: `metrics` (counts and durations only), `traces` (adds spans), or `traces+errors` (adds an error's kind and
|
|
94
|
+
ForgeQE's own error code). There is no level that sends content.
|
|
95
|
+
- `projects`: `all`, or a list of project ids that may export.
|
|
96
|
+
|
|
97
|
+
## What is sent
|
|
98
|
+
|
|
99
|
+
### Resource
|
|
100
|
+
|
|
101
|
+
`service.name` (the setting, else `forgeqe`), `service.version`, `forgeqe.project` (a SHA-256 of the project's path
|
|
102
|
+
with a salt kept in the home, so a backend can group by project without learning its name or path), `os.type`. No host
|
|
103
|
+
name, user name or path.
|
|
104
|
+
|
|
105
|
+
### Traces (level `traces`)
|
|
106
|
+
|
|
107
|
+
One trace per session (a chat, `forgeqe run`, a suite, a job the web app starts). Its spans are made from ForgeQE's
|
|
108
|
+
own events at the point where they are already logged (`logEvent`, `recordCall`), after the session log's redaction,
|
|
109
|
+
and then **reduced to the allowlist** by `spanFor(kind, data)`. An event kind with no mapping sends nothing.
|
|
110
|
+
|
|
111
|
+
| Span | From | Attributes (the whole list) |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `forgeqe.session` | `session` | `forgeqe.command` (of `COMMANDS`), `forgeqe.unattended` |
|
|
114
|
+
| `forgeqe.turn` | `agent.turn` | `forgeqe.outcome` (done, stopped, needs_input, failed), `forgeqe.voice` |
|
|
115
|
+
| `forgeqe.run` | `run.done` | `forgeqe.run.status`, `forgeqe.run.steps`, `forgeqe.case` (a key of `CASE_KEY`'s shape only) |
|
|
116
|
+
| `gen_ai.chat` | `recordCall` | `gen_ai.operation.name`, `gen_ai.system`, `gen_ai.request.model` (the profile's model id), `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `forgeqe.area`, `forgeqe.pick`, `forgeqe.cost` and `forgeqe.currency` |
|
|
117
|
+
| `forgeqe.tool` | `tool.call`, `tool.result` | `gen_ai.tool.name` (only ForgeQE's own tool names, or `system_tool` for a proxied one), `forgeqe.tool.error` (boolean) |
|
|
118
|
+
| `forgeqe.route` | `model.route` | `forgeqe.area`, `forgeqe.route.reason` (of its fixed list), `forgeqe.route.fallback` |
|
|
119
|
+
| `forgeqe.engine` | `engine.exit` | `forgeqe.engine.code`, `forgeqe.engine.killed` |
|
|
120
|
+
|
|
121
|
+
The model-call spans follow OpenTelemetry's generative-AI conventions for names and usage, and **never** set
|
|
122
|
+
`gen_ai.prompt`, `gen_ai.completion`, `gen_ai.input.messages` or tool arguments and results. A span's status is
|
|
123
|
+
`ERROR` when the event says it failed. Its description is set only at `traces+errors`, and only to an error code of
|
|
124
|
+
ForgeQE's own list (`not_reachable`, `timeout`, `empty_reply`, `refused`, ...). It is never the message.
|
|
125
|
+
|
|
126
|
+
Explicitly never exported: prompts, replies, thoughts, tool arguments and results, page text, URLs (not even the
|
|
127
|
+
host), file paths, test code, case titles, tracker text, SQL, stderr, a stack trace, an exception message, or
|
|
128
|
+
anything `redactForLog` would have scrubbed.
|
|
129
|
+
|
|
130
|
+
### Metrics (every level)
|
|
131
|
+
|
|
132
|
+
Kept in memory and sent every 60 s, and at the end, as OTLP sums and histograms with delta temporality:
|
|
133
|
+
|
|
134
|
+
- `forgeqe.runs` (by status, command), `forgeqe.run.duration` (s)
|
|
135
|
+
- `gen_ai.client.token.usage` (histogram, by model and `gen_ai.token.type`), `gen_ai.client.operation.duration` (s)
|
|
136
|
+
- `forgeqe.cost` (by area, currency)
|
|
137
|
+
- `forgeqe.tool.calls`, `forgeqe.tool.errors` (by tool name)
|
|
138
|
+
- `forgeqe.health` (by `sessionHealth` signature name): the kinds of trouble ForgeQE already counts in its own words
|
|
139
|
+
- `forgeqe.telemetry.dropped`, so a backend can see that the export lost something
|
|
140
|
+
- At most 500 attribute sets between two requests; more are left out and counted as dropped. While the collector is
|
|
141
|
+
down, at most 10 metric requests wait; older ones are dropped and counted, never merged.
|
|
142
|
+
|
|
143
|
+
### Logs (T4, off unless asked for)
|
|
144
|
+
|
|
145
|
+
`logs: true` (`forgeqe telemetry set --logs on`, or the page's "Problems as log records") sends problems as OTLP log
|
|
146
|
+
records to `/v1/logs` (`logFor`, `src/telemetry/spans.ts`): a severity (WARN 13, ERROR 17, the levels the web app
|
|
147
|
+
colours amber and red), `forgeqe.event` (the event's kind, one of `LOG_EVENTS`) and the same allowlisted facts its span
|
|
148
|
+
carries, tied to the session's trace and root span. A record never has a body: an error's kind (`errorCode`) is
|
|
149
|
+
worked out by code, its message never leaves. Made for an error, a failed turn, a failed tool call, a failed run, an
|
|
150
|
+
engine that ended badly, a model profile that failed, a nudged or refused step; nothing else.
|
|
151
|
+
|
|
152
|
+
## The exporter
|
|
153
|
+
|
|
154
|
+
- **ForgeQE's own small exporter, not the OpenTelemetry SDK.** The SDK reads `OTEL_*` variables, which ForgeQE
|
|
155
|
+
deliberately ignores, and it can auto-instrument modules. It would also add to the bundle `scripts/runtime.ts` keeps
|
|
156
|
+
small, and it makes "only the allowlist leaves" hard to prove. The exporter is `src/telemetry/` and needs no new
|
|
157
|
+
dependency.
|
|
158
|
+
- **OTLP/HTTP with JSON bodies** (`/v1/traces`, `/v1/metrics`, `/v1/logs`), which every collector accepts, or, with
|
|
159
|
+
`protocol: protobuf` (T4), protobuf bodies (`application/x-protobuf`) made from that same JSON by
|
|
160
|
+
`src/telemetry/protobuf.ts`: field numbers of opentelemetry-proto v1.3.2, a strict table that throws on a key it does
|
|
161
|
+
not know rather than skip it. A trace request round-trips through the Evidence receiver's own decoder in the tests.
|
|
162
|
+
- `fetch` with TLS verified, the network's proxy rules (`throughProxy`), `redirect: "error"`, a 5 s time limit, at most
|
|
163
|
+
1 MB per request, and no cookie.
|
|
164
|
+
- A bounded queue (2,000 spans). When it is full the oldest are dropped and counted. Spans are sent in batches every
|
|
165
|
+
5 s, and flushed for at most 2 s when ForgeQE exits.
|
|
166
|
+
- On failure it backs off (5 s, 30 s, 2 min, then pauses until the next session). It says so once in the session log,
|
|
167
|
+
and shows the status on the Settings page as text: "last sent 12:04, 0 dropped" or "collector not reachable since
|
|
168
|
+
11:50". The collector's answer is read as untrusted, and only its status code is kept.
|
|
169
|
+
- Unattended runs and schedules export like any other session, and never wait on the collector.
|
|
170
|
+
|
|
171
|
+
## Where it hooks in
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
logEvent(kind, data) ─┐ ┌─ spans ──┐
|
|
175
|
+
recordCall(record) ──┼─► telemetry.observe ──┤ ├─► queue ─► OTLP/HTTP JSON ─► collector
|
|
176
|
+
sessionHealth(...) ──┘ (allowlist: spanFor) └─ metrics ─┘
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
- `observe` is a no-op unless the export is on for this project, so the cost when off is one boolean check.
|
|
180
|
+
- It runs after redaction and clipping, on the same data the session log keeps, and then keeps only the allowlist.
|
|
181
|
+
Redaction is a second line of defence, not the reason nothing leaks.
|
|
182
|
+
- The Python engine and the agent runtime are not changed: their events already reach `logEvent` through the bridge.
|
|
183
|
+
`withoutTelemetry` stays as it is for every child process.
|
|
184
|
+
- No `traceparent` is put into the application under test or its requests: ForgeQE's tracing must not change what is
|
|
185
|
+
being tested. Linking to the app's own traces could be a separate, later opt-in.
|
|
186
|
+
|
|
187
|
+
## Settings and CLI
|
|
188
|
+
|
|
189
|
+
- **Settings › Observability**: on/off, endpoint, header and variable name, level, the projects that export. Before it
|
|
190
|
+
turns on, the page shows a sample: the real JSON of the last session's spans as they would be sent. Turning it on
|
|
191
|
+
needs the endpoint's host typed. Also a "Send a test span" button and the status line. `tests/settings-coverage.test.ts`
|
|
192
|
+
keeps every field covered.
|
|
193
|
+
- **CLI**: `forgeqe telemetry status`, `forgeqe telemetry test`, `forgeqe telemetry approve <host>` (typed at a terminal),
|
|
194
|
+
`forgeqe telemetry off`.
|
|
195
|
+
- **Evidence**: pointing the export at `forgeqe evidence receive` on 127.0.0.1 lets Evidence judge ForgeQE's own runs.
|
|
196
|
+
This is a recipe in the docs, not a special path.
|
|
197
|
+
|
|
198
|
+
## Tests
|
|
199
|
+
|
|
200
|
+
Each of these feeds a hostile input and checks it is refused, or that it never reaches the wire:
|
|
201
|
+
|
|
202
|
+
- An endpoint of `http://collector.example`, `javascript:alert(1)`, `https://user:pw@host`, `https://host/?q=1`, or a
|
|
203
|
+
redirect to another host. Each is refused or not followed.
|
|
204
|
+
- `telemetry: { endpoint: ... }` in a project's `forgeqe.yaml`, and `OTEL_EXPORTER_OTLP_ENDPOINT` in a `.env` or the
|
|
205
|
+
shell. Each is ignored and reported, and nothing is sent.
|
|
206
|
+
- A run whose prompt, reply, tool arguments and page text hold a planted secret, `../.env`, `; rm -rf ~` and a URL. A
|
|
207
|
+
captured payload contains none of them. The test compares every attribute key with the allowlist and every value with
|
|
208
|
+
its shape.
|
|
209
|
+
- A header variable named `PATH` or `NODE_OPTIONS` is refused. A token's value never appears in a response or a log.
|
|
210
|
+
- A collector that hangs, answers 500 or answers with 10 MB. The run's duration and result are unchanged, and the
|
|
211
|
+
queue stays bounded.
|
|
212
|
+
- With the export off, no request is made at all.
|
|
213
|
+
- A child process's environment still has `OTEL_SDK_DISABLED` and no `OTEL_EXPORTER_OTLP_*` (`privacy.ts` unchanged).
|
|
214
|
+
|
|
215
|
+
## Phases
|
|
216
|
+
|
|
217
|
+
| Phase | What | Done when |
|
|
218
|
+
|---|---|---|
|
|
219
|
+
| T1 (done) | Settings file, approval, exporter, traces for sessions, turns, runs, model calls and tools | The hostile tests above pass, and a local collector shows a run's trace with only allowlisted attributes |
|
|
220
|
+
| T2 (done) | Metrics: runs, tokens, cost, tools, health, dropped | Grafana or Prometheus via a collector shows cost by area per day matching the usage ledger |
|
|
221
|
+
| T3 (done) | Settings › Observability page with sample, test span and status | A person can turn it on, see what will be sent, and turn it off from the page |
|
|
222
|
+
| T4 (done) | Protobuf bodies; error-level log records without text | Both off unless asked for; protobuf checked against opentelemetry-proto's field numbers and the Evidence decoder |
|
|
223
|
+
|
|
224
|
+
## Open questions
|
|
225
|
+
|
|
226
|
+
1. **Home only, or also an organisation file?** A team may want one endpoint for everybody. That could be an
|
|
227
|
+
administrator-installed file outside every repository, with the same approval.
|
|
228
|
+
2. **Case ids and test names.** Case keys (`CASE_KEY`'s shape) help a dashboard and are in the allowlist. Should test
|
|
229
|
+
file names be too? They are paths, so this design leaves them out.
|
|
230
|
+
3. **Cost in the export.** Cost is useful in a shared dashboard, but some teams treat model spend as sensitive. It could
|
|
231
|
+
go behind its own switch.
|
|
232
|
+
4. **Sampling.** Every session is sent. Large suites may want a ratio, applied per session so a trace is never half
|
|
233
|
+
sent.
|
package/docs/user-guide.html
CHANGED
|
@@ -405,7 +405,7 @@ forgeqe docs --copy ./docs # copy the guide, the architecture page, the refere
|
|
|
405
405
|
<div class="area"><a class="area-name" href="#area-setup"><span class="mono">Setup</span></a><ul class="tiles"><li><a class="tile" href="#cap-test-apps"><b>Test environments and their apps</b><span>Place an order in the shop, then check its invoice in Billing, in UAT</span></a></li><li><a class="tile" href="#cap-generated-code"><b>What ForgeQE wrote</b><span>How much of the code ForgeQE wrote is still there?</span></a></li><li><a class="tile" href="#cap-forgeqe-commands"><b>Every forgeqe command from the shell</b><span>Show me the context budget</span></a></li><li><a class="tile" href="#cap-product-knowledge"><b>Product knowledge from the product's repositories</b><span>How does the product cancel an order? Show the endpoints and tables involved</span></a></li><li><a class="tile" href="#cap-knowledge-agent"><b>Librarian: what ForgeQE understood, and your corrections</b><span>What do you know about refunds?</span></a></li><li><a class="tile" href="#cap-document-search"><b>Search the project's documents, without vectors</b><span>What does the payments spec say about refund limits?</span></a></li><li><a class="tile" href="#cap-web-search"><b>Search the web</b><span>Search the web for the latest Playwright release</span></a></li><li><a class="tile" href="#cap-setup-help"><b>Setup, skills, and documentation</b><span>What can you do?</span></a></li></ul></div>
|
|
406
406
|
<div class="area"><a class="area-name" href="#area-desktop"><span class="mono">Desktop</span></a><ul class="tiles"><li><a class="tile" href="#cap-desktop-apps"><b>Automate Windows desktop apps</b><span>Create an invoice for Contoso in the Billing app and save it as a test</span></a></li></ul></div>
|
|
407
407
|
<div class="area"><a class="area-name" href="#area-mobile"><span class="mono">Mobile</span></a><ul class="tiles"><li><a class="tile" href="#cap-mobile-apps"><b>Automate Android and iOS apps</b><span>Sign in to the courier app and accept the first delivery, and save it as a test</span></a></li></ul></div>
|
|
408
|
-
<div class="area"><a class="area-name" href="#area-operations"><span class="mono">Operations</span></a><ul class="tiles"><li><a class="tile" href="#cap-containers"><b>Services, mocks, workspace and browser in Docker or Podman</b><span>Start the database and the queue in Docker</span></a></li><li><a class="tile" href="#cap-production-errors"><b>Production errors and the tests that cover them</b><span>Which production errors have no test?</span></a></li><li><a class="tile" href="#cap-model-cost"><b>Model cost and usage</b><span>What did ForgeQE cost this month?</span></a></li><li><a class="tile" href="#cap-monitoring"><b>Scheduled monitoring with alerts</b><span>Check the login flow every 15 minutes and alert Teams</span></a></li><li><a class="tile" href="#cap-jobs"><b>Background jobs on a schedule</b><span>Run the release-2.3 pack every weekday at 2am in the background</span></a></li><li><a class="tile" href="#cap-custom-agents"><b>Your team's custom agents</b><span>Ask our custom agent checkout-guard to check the basket on QA</span></a></li><li><a class="tile" href="#cap-notifications"><b>Teams and email notifications</b><span>Post the results to the QA channel</span></a></li><li><a class="tile" href="#cap-pipelines"><b>CI pipelines</b><span>Add a GitHub Actions workflow that runs tests/cases.yaml on every PR, and make it green</span></a></li></ul></div>
|
|
408
|
+
<div class="area"><a class="area-name" href="#area-operations"><span class="mono">Operations</span></a><ul class="tiles"><li><a class="tile" href="#cap-containers"><b>Services, mocks, workspace and browser in Docker or Podman</b><span>Start the database and the queue in Docker</span></a></li><li><a class="tile" href="#cap-production-errors"><b>Production errors and the tests that cover them</b><span>Which production errors have no test?</span></a></li><li><a class="tile" href="#cap-model-cost"><b>Model cost and usage</b><span>What did ForgeQE cost this month?</span></a></li><li><a class="tile" href="#cap-forgeqe-health"><b>ForgeQE's own health</b><span>How has ForgeQE been doing this week?</span></a></li><li><a class="tile" href="#cap-monitoring"><b>Scheduled monitoring with alerts</b><span>Check the login flow every 15 minutes and alert Teams</span></a></li><li><a class="tile" href="#cap-jobs"><b>Background jobs on a schedule</b><span>Run the release-2.3 pack every weekday at 2am in the background</span></a></li><li><a class="tile" href="#cap-custom-agents"><b>Your team's custom agents</b><span>Ask our custom agent checkout-guard to check the basket on QA</span></a></li><li><a class="tile" href="#cap-notifications"><b>Teams and email notifications</b><span>Post the results to the QA channel</span></a></li><li><a class="tile" href="#cap-pipelines"><b>CI pipelines</b><span>Add a GitHub Actions workflow that runs tests/cases.yaml on every PR, and make it green</span></a></li></ul></div>
|
|
409
409
|
<div class="area"><a class="area-name" href="#area-data"><span class="mono">Data</span></a><ul class="tiles"><li><a class="tile" href="#cap-databases"><b>Ask a database in plain language</b><span>Which customers in India have paid orders? Ask the orders database</span></a></li><li><a class="tile" href="#cap-test-data"><b>Test data on demand</b><span>Generate test data: 20 customers with 1 to 3 orders each in the shop database</span></a></li><li><a class="tile" href="#cap-data-flows"><b>Data flows between systems</b><span>Check that customers from the digital database reach the CRM correctly</span></a></li></ul></div>
|
|
410
410
|
<div class="area"><a class="area-name" href="#area-automated-tests"><span class="mono">Automated tests</span></a><ul class="tiles"><li><a class="tile" href="#cap-write-tests"><b>Turn a passed run into an automated test</b><span>Write a Playwright test for that run in ../app</span></a></li><li><a class="tile" href="#cap-heal-tests"><b>Heal failing tests</b><span>Heal the failing tests in ../app</span></a></li><li><a class="tile" href="#cap-migrate-tests"><b>Migrate a test suite</b><span>Migrate the Selenium tests in tests/ to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-tosca-convert"><b>Convert Tosca test cases</b><span>Convert the Tosca export tosca/checkout.tsu to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-find-run-tests"><b>Find and run existing tests</b><span>Run the checkout tests</span></a></li><li><a class="tile" href="#cap-regression-packs"><b>Regression packs for a release</b><span>Build a regression pack for sprint 12 and run it on TestMu</span></a></li><li><a class="tile" href="#cap-flaky-tests"><b>Flaky test detection and quarantine</b><span>Which tests are flaky?</span></a></li><li><a class="tile" href="#cap-run-diff"><b>Compare two runs step by step</b><span>It passed yesterday and fails today: why?</span></a></li><li><a class="tile" href="#cap-test-debt"><b>Test debt and coverage gaps</b><span>What has no test?</span></a></li><li><a class="tile" href="#cap-test-management"><b>Test management</b><span>Show the test inventory</span></a></li></ul></div>
|
|
411
411
|
<div class="area"><a class="area-name" href="#area-pull-requests"><span class="mono">Pull requests</span></a><ul class="tiles"><li><a class="tile" href="#cap-pr-review"><b>Review pull requests</b><span>Review PR 42 and focus on error handling</span></a></li><li><a class="tile" href="#cap-pr-impact"><b>Pull request impact and test selection</b><span>What does PR 42 impact?</span></a></li></ul></div>
|
|
@@ -748,7 +748,7 @@ keeps the authorization until you revoke <strong>GitHub Copilot CLI</strong> at
|
|
|
748
748
|
<p><strong>The Copilot model in <code>llms.json</code>.</strong> The sign-in writes a profile like this one:</p>
|
|
749
749
|
<pre><code class="language-json">"copilot": {
|
|
750
750
|
"provider": "github_copilot",
|
|
751
|
-
"model": "
|
|
751
|
+
"model": "auto"
|
|
752
752
|
}
|
|
753
753
|
</code></pre>
|
|
754
754
|
<div class="tbl"><table>
|
|
@@ -756,12 +756,28 @@ keeps the authorization until you revoke <strong>GitHub Copilot CLI</strong> at
|
|
|
756
756
|
<tr><th>Field</th><th>What it is</th></tr>
|
|
757
757
|
</thead>
|
|
758
758
|
<tbody>
|
|
759
|
-
<tr><td><code>model</code></td><td>
|
|
759
|
+
<tr><td><code>model</code></td><td><code>auto</code> (recommended, and what the sign-in suggests), or a Copilot model as Copilot names it (<code>gpt-4.1</code>, <code>claude-sonnet-4.6</code>) that takes screenshots. With <code>auto</code>, Copilot picks the model for each request, and the browser's screenshot steps go to your seat's cheapest model that takes images. The sign-in lists your seat's models and which of them take images.</td></tr>
|
|
760
760
|
<tr><td><code>engine_model</code></td><td>Optional. Another Copilot model for the browser and the desktop agent.</td></tr>
|
|
761
761
|
<tr><td><code>reasoning_effort</code></td><td>Optional. How hard a reasoning model thinks: <code>low</code>, <code>medium</code>, <code>high</code>, <code>xhigh</code> or <code>max</code>. Sent only to a model your seat says takes one; unset, the model's default.</td></tr>
|
|
762
762
|
<tr><td><code>api_key_env</code></td><td>Optional. A variable that must hold the GitHub token for this profile. Without it, ForgeQE uses <code>COPILOT_GITHUB_TOKEN</code>, then a token <code>forgeqe auth login copilot</code> saved, then the browser sign-in.</td></tr>
|
|
763
763
|
</tbody>
|
|
764
764
|
</table></div>
|
|
765
|
+
<p><strong>When a model stops working.</strong> A Copilot model can stop answering on your seat from one day to the next, with nothing
|
|
766
|
+
changed on your computer. ForgeQE notices by itself: when Copilot does not answer a model's request in time, or answers
|
|
767
|
+
with an error about the model, that model is left alone for an hour and its requests go to another of your seat's models
|
|
768
|
+
(one that takes screenshots when the request has one, allowed by your seat, and costing no more premium requests per
|
|
769
|
+
call than the failing one, or than 1). A request that failed quickly is sent again to the other model at once; after a
|
|
770
|
+
slow failure, the next request goes there, and the chat or browser step says which model took over. ForgeQE remembers
|
|
771
|
+
this for an hour in <code>~/.forgeqe/copilot/model-health.json</code>, so a new chat does not wait on the failing model again. A sign-in
|
|
772
|
+
refused, a rate limit or a used-up allowance never moves to another model. <code>~/.forgeqe/logs/copilot-gateway.log</code> says
|
|
773
|
+
what Copilot answered and which model took over.</p>
|
|
774
|
+
<p><strong>Copilot's versions.</strong> ForgeQE pins GitHub's Copilot SDK and the Copilot runtime it runs, so a GitHub release never
|
|
775
|
+
changes your setup by itself; a newer ForgeQE brings newer ones (<code>forgeqe update</code>, then <code>forgeqe setup</code>). <code>forgeqe doctor</code>
|
|
776
|
+
shows the versions in use. If GitHub ever stops accepting them, the chat or run says so and asks you to update ForgeQE,
|
|
777
|
+
rather than trying another model.</p>
|
|
778
|
+
<p><strong>Behind a company proxy.</strong> ForgeQE reaches Copilot over plain HTTPS. Copilot can use WebSockets for some models, which
|
|
779
|
+
many company proxies break, leaving requests unanswered; ForgeQE turns them off, as each request is a new Copilot
|
|
780
|
+
session anyway. To turn them on, set <code>FORGEQE_COPILOT_WEBSOCKETS=1</code>.</p>
|
|
765
781
|
<p><strong>Choosing the model.</strong> Your seat's models each show whether they take screenshots, their premium requests per call (0
|
|
766
782
|
is included in your plan) and the profiles that use them.</p>
|
|
767
783
|
<p><strong>Web app</strong></p>
|
|
@@ -3607,7 +3623,7 @@ Signing in stays <code>/auth</code> and <code>forgeqe login</code>; <code>forgeq
|
|
|
3607
3623
|
<tr><td><code>forgeqe pr-tests [pr] [--base BRANCH] [--run] [--post]</code></td><td>The tests a pull request can break; <code>--run</code> makes it a CI gate (see <a href="#doc-how_to_use-tests-for-a-pull-request">Tests for a pull request</a>)</td></tr>
|
|
3608
3624
|
<tr><td><code>forgeqe impact <repo> <base> <head> | <repo> --pr LINK [--gate] [--post] [--json] [--quick]</code></td><td>What a change in a product repository reaches, and whether it is ready; <code>--gate</code> exits 1 when it is blocked</td></tr>
|
|
3609
3625
|
<tr><td><code>forgeqe report <file|folder>... [--title T] [--out DIR]</code>, <code>forgeqe report setup [--repo DIR]</code></td><td>report.html from JUnit XML or TRX run outside ForgeQE (see <a href="#doc-how_to_use-reports-for-tests-run-outside-forgeqe">Reports for tests run outside ForgeQE</a>)</td></tr>
|
|
3610
|
-
<tr><td><code>forgeqe a11y "<goal>" --persona a,b [--url URL]</code>, <code>forgeqe a11y personas</code></td><td>Accessibility testing as personas (see <a href="#doc-how_to_use-accessibility-testing-with-personas">Accessibility testing with personas</a>)</td></tr>
|
|
3626
|
+
<tr><td><code>forgeqe a11y "<goal>" --persona a,b [--url URL] [--engine E] [--standard S] [--best-practice]</code>, <code>forgeqe a11y personas</code></td><td>Accessibility testing as personas (see <a href="#doc-how_to_use-accessibility-testing-with-personas">Accessibility testing with personas</a>)</td></tr>
|
|
3611
3627
|
<tr><td><code>forgeqe persona [list] | show | create | export | import</code></td><td>Business personas (see <a href="#doc-how_to_use-business-personas">Business personas</a>)</td></tr>
|
|
3612
3628
|
<tr><td><code>forgeqe flags list [--env NAME]</code>, <code>forgeqe flags run <pack> <flag=v1,v2> --env NAME</code></td><td>A regression pack once per feature-flag combination (see <a href="#doc-how_to_use-feature-flag-matrix">Feature-flag matrix</a>)</td></tr>
|
|
3613
3629
|
<tr><td><code>forgeqe defects [--folder DIR]</code>, <code>forgeqe defects predict [--repo DIR] [--base REF] [--head REF]</code></td><td>Defect trends, and where a change is likely to cause defects</td></tr>
|
|
@@ -6693,6 +6709,29 @@ part, or when tokens priced in another currency were left out.</p>
|
|
|
6693
6709
|
</section>
|
|
6694
6710
|
</div>
|
|
6695
6711
|
</article>
|
|
6712
|
+
<article class="spec feat" id="cap-forgeqe-health">
|
|
6713
|
+
<div class="hd"><span class="mono">Operations</span><h3>ForgeQE's own health</h3></div>
|
|
6714
|
+
<p class="ds">Counts how ForgeQE's own sessions, runs, turns, tool and model calls went on this computer, with the session-health signatures and the latest problems: the numbers the opt-in OpenTelemetry export sends.</p>
|
|
6715
|
+
<div class="facts">
|
|
6716
|
+
<div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>How has ForgeQE been doing this week?</li><li>Which tools fail most often?</li></ul></div>
|
|
6717
|
+
<div class="fact"><span class="mono">What it needs</span><p class="muted">Nothing beyond ForgeQE itself.</p></div>
|
|
6718
|
+
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>forgeqe_health</code></p></div>
|
|
6719
|
+
</div>
|
|
6720
|
+
<div class="detail"><span class="mono">In detail</span>
|
|
6721
|
+
<section class="doc" id="doc-how_to_use-forgeqes-own-health">
|
|
6722
|
+
<h4>ForgeQE's own health</h4>
|
|
6723
|
+
<div class="prose"><p><strong>AI Assurance › Governance › Observability</strong> shows how ForgeQE's own work went on this computer over the last 7, 30 or
|
|
6724
|
+
90 days: sessions a day and the ones with an error, sessions by command, browser runs by how they ended, turn times,
|
|
6725
|
+
tool calls and errors by tool, the session-health signatures (turns that ended with nothing said, the same plan written
|
|
6726
|
+
again and again, …), model calls by model with their speed and cost, and the latest problems. It reads the session
|
|
6727
|
+
logs and this project's calls in the usage ledger, and counts what the opt-in OpenTelemetry export would send, whether
|
|
6728
|
+
the export is on or not: a problem is in ForgeQE's own words, never what the model, the page or a person wrote. To send
|
|
6729
|
+
the same numbers to your own collector (Grafana, Datadog, Honeycomb, …), see <strong>Settings › Observability</strong> and
|
|
6730
|
+
<code>forgeqe telemetry</code> (<code>docs/OBSERVABILITY.md</code>). In a chat, ask "how has ForgeQE been doing this week?".</p>
|
|
6731
|
+
</div>
|
|
6732
|
+
</section>
|
|
6733
|
+
</div>
|
|
6734
|
+
</article>
|
|
6696
6735
|
<article class="spec feat" id="cap-monitoring">
|
|
6697
6736
|
<div class="hd"><span class="mono">Operations</span><h3>Scheduled monitoring with alerts</h3></div>
|
|
6698
6737
|
<p class="ds">Runs checks on a schedule and alerts Teams or email when one keeps failing, and again when it recovers.</p>
|
|
@@ -10272,6 +10311,7 @@ in <strong>Settings › Settings as text</strong>.</li>
|
|
|
10272
10311
|
accessibility:
|
|
10273
10312
|
standard: wcag21aa # wcag2a, wcag21aa (default), wcag22aa, wcag21aaa, section508, en301549, best-practice
|
|
10274
10313
|
best_practice: false # also the best-practice rules
|
|
10314
|
+
engine: axe # axe (axe-core, default), ibm (IBM Equal Access), basic (ForgeQE's own checks)
|
|
10275
10315
|
budgets:
|
|
10276
10316
|
accessibility: # most violations per page by impact; unset impacts have no limit (or: accessibility: true for 0 critical, 0 serious)
|
|
10277
10317
|
critical: 0
|
|
@@ -10285,6 +10325,13 @@ in <strong>Settings › Settings as text</strong>.</li>
|
|
|
10285
10325
|
pages: # by path prefix; the longest match wins
|
|
10286
10326
|
/search: { lcp_ms: 4000 }
|
|
10287
10327
|
</code></pre>
|
|
10328
|
+
<p><strong>Rule engine.</strong> <code>engine: ibm</code> checks each page with IBM Equal Access (accessibility-checker-engine, shipped with
|
|
10329
|
+
ForgeQE) instead of axe-core: the standard picks its ruleset (WCAG 2.0, 2.1 or 2.2 at A or AA; Section 508 as WCAG 2.0
|
|
10330
|
+
AA; EN 301 549 as WCAG 2.1 AA; best practice as IBM's own ruleset with its recommendations). IBM's rules stop at AA, so a
|
|
10331
|
+
<code>wcag21aaa</code> standard is checked at AA with it and the run says so. Impact comes from IBM's toolkit level (1 critical,
|
|
10332
|
+
2 serious, 3 moderate, 4 minor; a recommendation is minor), and rule ids are IBM's (<code>img_alt_valid</code>), so budgets'
|
|
10333
|
+
<code>rules</code> and <code>ignore</code> name IBM's ids when it is the engine. The two engines find different things: run both on a page
|
|
10334
|
+
that matters. The engine runs inside a function on the page, so a page's own <code>window.ace</code> (the Ace editor) is left alone.</p>
|
|
10288
10335
|
<p><strong>Over time.</strong> Every run adds each page's violations and timings to <code>.forgeqe/reports/quality-history.json</code> (keep it between CI runs as a cache). Ask "did accessibility regress?" or "is checkout getting slower?". The trends show each page's violations over the last runs, the rules that newly fail or were fixed since the previous run, and each timing against its usual value (the median of the last 10 runs; slower or faster only beyond noise).</p>
|
|
10289
10336
|
<p><strong>Web app</strong></p>
|
|
10290
10337
|
<ol>
|
|
@@ -10334,13 +10381,19 @@ forgeqe quality trends shop.test # per page over time; exits 1 when a page go
|
|
|
10334
10381
|
<p><strong>Web app</strong></p>
|
|
10335
10382
|
<ol>
|
|
10336
10383
|
<li>Open <strong>Accessibility</strong> (Quality Engineering › Specialised testing), on its <strong>Agent</strong> tab.</li>
|
|
10337
|
-
<li>Say what the person should try to do, and who tries it ("act as a blind person and use the website to find accessibility issues", "can a keyboard-only user check out?")
|
|
10338
|
-
|
|
10384
|
+
<li>Say what the person should try to do, and who tries it ("act as a blind person and use the website to find accessibility issues", "can a keyboard-only user check out?").
|
|
10385
|
+
Under the persona chips, <strong>Checked with</strong> picks this session's rule engine (axe-core, IBM Equal Access or the
|
|
10386
|
+
built-in checks) and standard; left on the project's, quality.accessibility decides.</li>
|
|
10387
|
+
<li>Agree to the plan the agent shows, which says the rule checks it will use. Each session's result is on the <strong>Results</strong> tab, and the personas on the <strong>Personas</strong> tab.</li>
|
|
10339
10388
|
</ol>
|
|
10340
10389
|
<p><strong>Terminal</strong></p>
|
|
10341
10390
|
<pre><code class="language-bash">forgeqe a11y "find running shoes and add a pair to the basket" --persona blind,keyboard-only --url https://shop.test
|
|
10391
|
+
forgeqe a11y "check out" --persona blind --engine ibm --standard wcag22aa --best-practice # this session's rule checks
|
|
10342
10392
|
forgeqe a11y personas # the personas: built in, and the project's own
|
|
10343
10393
|
</code></pre>
|
|
10394
|
+
<p><code>--engine</code> (axe, ibm, basic), <code>--standard</code> (wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549,
|
|
10395
|
+
best-practice) and <code>--best-practice</code> choose the session's automated rule checks over <code>quality.accessibility</code>; a value off
|
|
10396
|
+
its list is refused before anything runs. The report and the Results tab say which were used.</p>
|
|
10344
10397
|
<p><strong>How each persona uses the page.</strong> Each persona is one browser run. The agent works the way the person does:</p>
|
|
10345
10398
|
<div class="tbl"><table>
|
|
10346
10399
|
<thead>
|
package/forgeqe.example.yaml
CHANGED
|
@@ -610,11 +610,12 @@ suite:
|
|
|
610
610
|
# top_k: 5
|
|
611
611
|
# timeout_seconds: 20
|
|
612
612
|
|
|
613
|
-
# Accessibility (axe-core, WCAG) and performance (Core Web Vitals) of every page a run visits. Without budgets they
|
|
613
|
+
# Accessibility (axe-core or IBM Equal Access, WCAG) and performance (Core Web Vitals) of every page a run visits. Without budgets they
|
|
614
614
|
# are reported and tracked over time; a run fails on them only when a budget below is exceeded.
|
|
615
615
|
# quality:
|
|
616
616
|
# accessibility:
|
|
617
617
|
# standard: wcag21aa # wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549, best-practice
|
|
618
|
+
# engine: axe # axe (axe-core), ibm (IBM Equal Access: up to AA, no AAA rules), basic (ForgeQE's own)
|
|
618
619
|
# ask_before_run: true # false: a persona session runs its browser runs without asking first
|
|
619
620
|
# visual: # each page compared with its approved screenshot (.forgeqe/visual-baselines)
|
|
620
621
|
# mask: [".clock", "#ad-slot"] # hidden before capture
|
|
@@ -643,6 +644,9 @@ suite:
|
|
|
643
644
|
# client_secret_env: SHOP_API_CLIENT_SECRET
|
|
644
645
|
# scope: orders.read orders.write
|
|
645
646
|
# audience: https://api.shop.example
|
|
647
|
+
# auth: # sign-ins an API description declares for some operations only: each sent only to those calls
|
|
648
|
+
# basic: { user_env: SHOP_API_USER, password_env: SHOP_API_PASSWORD } # HTTP Basic, in place of the Authorization above
|
|
649
|
+
# query: { api_key: SHOP_API_KEY } # an API key in the query: parameter name → the variable that holds it
|
|
646
650
|
# tls: # a client certificate (mutual TLS) and the authorities trusted; keep the key out of the repository
|
|
647
651
|
# cert: ~/.certs/shop-client.pem
|
|
648
652
|
# key: ~/.certs/shop-client-key.pem
|
package/llms.example.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"copilot": {
|
|
52
52
|
"provider": "github_copilot",
|
|
53
|
-
"model": "
|
|
53
|
+
"model": "auto",
|
|
54
54
|
"description": "GitHub Copilot seat for the browser engine, through GitHub's Copilot SDK (forgeqe auth login copilot: sign in with GitHub in the browser, or a fine-grained token with Copilot Requests)"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"@types/pngjs": "^6.0.5",
|
|
95
95
|
"@types/react": "^19.3.0",
|
|
96
96
|
"@vscode/tree-sitter-wasm": "0.3.1",
|
|
97
|
+
"accessibility-checker-engine": "4.0.34",
|
|
97
98
|
"axe-core": "4.14.0",
|
|
98
99
|
"fast-xml-parser": "^5.11.1",
|
|
99
100
|
"neo4j-driver": "6.2.0",
|
|
@@ -11,4 +11,4 @@ This run is accessibility testing, not functional testing. You act as the person
|
|
|
11
11
|
- You MUST set `wcag` to the WCAG success criterion the barrier fails, such as 1.1.1 or 2.4.7, when one applies.
|
|
12
12
|
- You MUST set `severity`: critical when it stops the person from reaching the goal, serious when they get past it only with a lot of effort or help, moderate when it slows or confuses them, minor for an annoyance.
|
|
13
13
|
- When a barrier stops you, you MUST NOT go around it in a way this person could not, such as a mouse click for a keyboard user. Record it, then try another way this person has, such as another link or the browser's back.
|
|
14
|
-
- You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you.
|
|
14
|
+
- You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you. You MUST call done in a step of its own, with no other action: a done that follows another action in the same step, such as record_accessibility_issue, is not carried out. Record the last barrier, then call done in the next step.
|
|
@@ -15,9 +15,9 @@ import queue
|
|
|
15
15
|
import sys
|
|
16
16
|
import threading
|
|
17
17
|
import time
|
|
18
|
-
from typing import Any, Callable, Dict, List, Optional, Set
|
|
18
|
+
from typing import Any, Callable, Dict, List, Mapping, Optional, Set
|
|
19
19
|
|
|
20
|
-
from .handrecord import Element, HandRecorder
|
|
20
|
+
from .handrecord import PlayRefused, Element, HandRecorder
|
|
21
21
|
|
|
22
22
|
VK_NAMES: Dict[int, str] = {
|
|
23
23
|
0x0D: "enter", 0x09: "tab", 0x1B: "esc", 0x08: "backspace", 0x2E: "delete", 0x2D: "insert", 0x24: "home",
|
|
@@ -72,6 +72,11 @@ class _Hooks:
|
|
|
72
72
|
self.thread_id = 0
|
|
73
73
|
self.ready = threading.Event()
|
|
74
74
|
self.error: Optional[str] = None
|
|
75
|
+
# While a block plays, the clicks and keys it sends are the block's steps, not the tester's: not queued, not held.
|
|
76
|
+
self.paused = threading.Event()
|
|
77
|
+
# Until when the tester's own mouse and keys are kept from the app while it plays (a stray click would break
|
|
78
|
+
# it); after that they reach the app again, so a block that hangs never takes the computer away.
|
|
79
|
+
self.block_until = 0.0
|
|
75
80
|
|
|
76
81
|
def start(self) -> None:
|
|
77
82
|
self.thread = threading.Thread(target=self._run, name="forgeqe-hand-hooks", daemon=True)
|
|
@@ -105,7 +110,9 @@ class _Hooks:
|
|
|
105
110
|
down = lambda vk: bool(user32.GetAsyncKeyState(vk) & 0x8000) # noqa: E731
|
|
106
111
|
|
|
107
112
|
def on_mouse(code: int, wparam: int, lparam: int) -> int:
|
|
108
|
-
if code >= 0 and
|
|
113
|
+
if code >= 0 and swallow(self.paused.is_set(), self.block_until, bool(ctypes.cast(lparam, ctypes.POINTER(MSLL)).contents.flags & 0x01), False, time.time()):
|
|
114
|
+
return 1 # the tester's own mouse, while a block plays: kept from the app
|
|
115
|
+
if code >= 0 and wparam == 0x0201 and not self.paused.is_set(): # WM_LBUTTONDOWN
|
|
109
116
|
info = ctypes.cast(lparam, ctypes.POINTER(MSLL)).contents
|
|
110
117
|
handled = threading.Event()
|
|
111
118
|
self.events.put(("click", int(info.pt.x), int(info.pt.y), time.time(), handled))
|
|
@@ -116,7 +123,14 @@ class _Hooks:
|
|
|
116
123
|
def on_key(code: int, wparam: int, lparam: int) -> int:
|
|
117
124
|
if code >= 0 and wparam in (0x0100, 0x0104): # WM_KEYDOWN, WM_SYSKEYDOWN
|
|
118
125
|
info = ctypes.cast(lparam, ctypes.POINTER(KBDLL)).contents
|
|
119
|
-
|
|
126
|
+
ev = ("key", int(info.vkCode), down(0x11), down(0x10), down(0x12), time.time())
|
|
127
|
+
injected = bool(info.flags & 0x10)
|
|
128
|
+
# While a block plays, only the tester's own hotkeys (stop, check) get through: never a key the block
|
|
129
|
+
# sends (LLKHF_INJECTED), which could be the same chord.
|
|
130
|
+
if not self.paused.is_set() or (not injected and is_hotkey(ev)):
|
|
131
|
+
self.events.put(ev)
|
|
132
|
+
if swallow(self.paused.is_set(), self.block_until, injected, is_hotkey(ev), time.time()):
|
|
133
|
+
return 1 # the tester's own keys, while a block plays: kept from the app
|
|
120
134
|
return user32.CallNextHookEx(None, code, wparam, lparam)
|
|
121
135
|
|
|
122
136
|
# The callbacks must outlive the hooks.
|
|
@@ -321,6 +335,80 @@ class ShotQueue:
|
|
|
321
335
|
return out
|
|
322
336
|
|
|
323
337
|
|
|
338
|
+
#: The longest the tester's own mouse and keys are kept from the app while a block plays.
|
|
339
|
+
PLAY_INPUT_BLOCK_SECONDS = 120.0
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def swallow(paused: bool, until: float, injected: bool, hotkey: bool, now: float) -> bool:
|
|
343
|
+
"""
|
|
344
|
+
Whether a mouse or key event is kept from the app: only while a block plays and not longer than its limit, only the
|
|
345
|
+
tester's own (never one the block sends, which is injected), and never the tester's stop or check hotkey.
|
|
346
|
+
"""
|
|
347
|
+
return paused and not injected and not hotkey and now < until
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def is_hotkey(ev: tuple) -> bool:
|
|
351
|
+
"""The stop or check hotkey, pressed by the tester."""
|
|
352
|
+
if not ev or ev[0] != "key" or len(ev) < 5:
|
|
353
|
+
return False
|
|
354
|
+
meaning = key_event(ev[1], ev[2], ev[3], ev[4])
|
|
355
|
+
return meaning is not None and meaning["kind"] in ("stop", "check")
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def drain(events: "queue.Queue[tuple]") -> int:
|
|
359
|
+
"""Drops what the hooks queued (a click held for its answer is let go), but the tester's hotkeys; how many dropped."""
|
|
360
|
+
n = 0
|
|
361
|
+
kept: List[tuple] = []
|
|
362
|
+
while True:
|
|
363
|
+
try:
|
|
364
|
+
ev = events.get_nowait()
|
|
365
|
+
except queue.Empty:
|
|
366
|
+
break
|
|
367
|
+
if is_hotkey(ev):
|
|
368
|
+
kept.append(ev)
|
|
369
|
+
continue
|
|
370
|
+
if ev and ev[0] == "click" and len(ev) > 4 and ev[4] is not None:
|
|
371
|
+
ev[4].set()
|
|
372
|
+
n += 1
|
|
373
|
+
for ev in kept:
|
|
374
|
+
events.put(ev)
|
|
375
|
+
return n
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
PLAY_SETTLE = 0.5
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def play_now(cmd: Mapping[str, Any], driver: Any, spec: Any, recorder: HandRecorder, hooks: Any, events: "queue.Queue[tuple]", log: Callable[[str], None], on_played: Callable[[Dict[str, Any]], None], sleep: Callable[[float], None] = time.sleep) -> None:
|
|
382
|
+
"""
|
|
383
|
+
A block played in the recording: the hooks paused while it runs (what it clicks and types is the block's, not the
|
|
384
|
+
tester's), what they queued before and just after dropped, then recording again. Said to the page as `played`.
|
|
385
|
+
"""
|
|
386
|
+
if cmd.get("cmd") != "play":
|
|
387
|
+
return
|
|
388
|
+
hooks.paused.set()
|
|
389
|
+
hooks.block_until = time.time() + PLAY_INPUT_BLOCK_SECONDS
|
|
390
|
+
try:
|
|
391
|
+
drain(events)
|
|
392
|
+
try:
|
|
393
|
+
out = recorder.play(cmd, driver, spec)
|
|
394
|
+
except PlayRefused as e:
|
|
395
|
+
log(str(e))
|
|
396
|
+
on_played({"name": str(cmd.get("name") or "the block")[:80], "done": 0, "total": 0, "error": str(e)[:300]})
|
|
397
|
+
return
|
|
398
|
+
except Exception as e: # noqa: BLE001 - the app said no: the block stops, the recording goes on
|
|
399
|
+
why = f"the block stopped with an error: {type(e).__name__}: {e}"[:300]
|
|
400
|
+
log(why)
|
|
401
|
+
on_played({"name": str(cmd.get("name") or "the block")[:80], "done": 0, "total": 0, "error": why})
|
|
402
|
+
return
|
|
403
|
+
sleep(PLAY_SETTLE)
|
|
404
|
+
drain(events)
|
|
405
|
+
log(f"{out['name']} is done ({out['total']} steps): carry on." if out["done"] == out["total"] else f"{out['name']} stopped at step {out['done'] + 1} of {out['total']}: {out.get('error', '')}. Do the rest by hand.")
|
|
406
|
+
on_played(out)
|
|
407
|
+
finally:
|
|
408
|
+
hooks.block_until = 0.0
|
|
409
|
+
hooks.paused.clear()
|
|
410
|
+
|
|
411
|
+
|
|
324
412
|
def record_by_hand(
|
|
325
413
|
driver: Any,
|
|
326
414
|
spec: Any,
|
|
@@ -330,6 +418,8 @@ def record_by_hand(
|
|
|
330
418
|
on_change: Callable[[Dict[str, Any]], None] = lambda e: None,
|
|
331
419
|
max_seconds: float = 3 * 3600,
|
|
332
420
|
on_shot: Optional[Callable[[int], None]] = None,
|
|
421
|
+
commands: Optional["queue.Queue[Mapping[str, Any]]"] = None,
|
|
422
|
+
on_played: Callable[[Dict[str, Any]], None] = lambda e: None,
|
|
333
423
|
) -> str:
|
|
334
424
|
"""Start the app, record until the hotkey, the app closing, ``stop``, or ``max_seconds``; why it stopped."""
|
|
335
425
|
if sys.platform != "win32":
|
|
@@ -360,6 +450,18 @@ def record_by_hand(
|
|
|
360
450
|
if time.time() - started > max_seconds:
|
|
361
451
|
reason = "time limit"
|
|
362
452
|
break
|
|
453
|
+
cmd = None
|
|
454
|
+
if commands is not None:
|
|
455
|
+
try:
|
|
456
|
+
cmd = commands.get_nowait()
|
|
457
|
+
except queue.Empty:
|
|
458
|
+
cmd = None
|
|
459
|
+
if cmd is not None:
|
|
460
|
+
play_now(cmd, driver, spec, recorder, hooks, events, log, on_played)
|
|
461
|
+
for change in changed_steps(recorder.steps, sent):
|
|
462
|
+
on_change(change)
|
|
463
|
+
shots.add(change["index"], time.time())
|
|
464
|
+
continue
|
|
363
465
|
try:
|
|
364
466
|
ev = events.get(timeout=0.25)
|
|
365
467
|
except queue.Empty:
|