my-frontend-observer 0.1.0 → 0.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.
@@ -1,7 +1,34 @@
1
1
  import type { Diagnostic } from '../domain/diagnostics.js';
2
+ export type TargetLocator = {
3
+ kind: 'role';
4
+ role: string;
5
+ name?: string;
6
+ } | {
7
+ kind: 'id';
8
+ value: string;
9
+ } | {
10
+ kind: 'data-attribute';
11
+ attribute: string;
12
+ value: string;
13
+ } | {
14
+ kind: 'semantic-element';
15
+ tag: string;
16
+ } | {
17
+ kind: 'css';
18
+ selector: string;
19
+ } | {
20
+ kind: 'text';
21
+ text: string;
22
+ };
2
23
  export interface NamedTarget {
3
24
  name: string;
4
- selector: string;
25
+ locators: TargetLocator[];
26
+ }
27
+ /** Raw, not-yet-validated target shape as it may appear in a RawObservationRequest. Exactly one of `selector` (legacy) or `locators` (canonical) may be present, never both. */
28
+ export interface RawNamedTarget {
29
+ name?: unknown;
30
+ selector?: unknown;
31
+ locators?: unknown;
5
32
  }
6
33
  export interface Viewport {
7
34
  width: number;
@@ -14,12 +14,140 @@ const READINESS_TIMEOUT_MIN_MS = 500;
14
14
  const MAX_TARGETS = 20;
15
15
  const TARGET_NAME_RE = /^[A-Za-z0-9_-]{1,64}$/;
16
16
  const MAX_SELECTOR_LENGTH = 500;
17
+ const MAX_LOCATORS_PER_TARGET = 5;
18
+ const MAX_ROLE_LENGTH = 64;
19
+ const MAX_ACCESSIBLE_NAME_LENGTH = 200;
20
+ const MAX_ID_VALUE_LENGTH = 200;
21
+ const DATA_ATTRIBUTE_NAME_RE = /^data-[a-z0-9-]{1,64}$/;
22
+ const MAX_DATA_ATTRIBUTE_VALUE_LENGTH = 500;
23
+ const MAX_TEXT_LENGTH = 200;
24
+ const SUPPORTED_SEMANTIC_ELEMENT_TAGS = new Set([
25
+ 'header',
26
+ 'nav',
27
+ 'main',
28
+ 'footer',
29
+ 'article',
30
+ 'section',
31
+ 'aside',
32
+ 'form',
33
+ 'dialog',
34
+ ]);
35
+ const SUPPORTED_LOCATOR_KINDS = new Set(['role', 'id', 'data-attribute', 'semantic-element', 'css', 'text']);
17
36
  function isPlainObject(value) {
18
37
  return typeof value === 'object' && value !== null && !Array.isArray(value);
19
38
  }
20
39
  function isInRange(value, min, max) {
21
40
  return Number.isInteger(value) && value >= min && value <= max;
22
41
  }
42
+ function isBoundedString(value, min, max) {
43
+ return typeof value === 'string' && value.length >= min && value.length <= max;
44
+ }
45
+ /** Validates one raw locator object against the frozen v0.2 locator-kind contract. Total: always returns either a valid TargetLocator or a list of every problem found (never throws, never short-circuits). */
46
+ function validateLocator(raw, targetName, index) {
47
+ if (!isPlainObject(raw)) {
48
+ return {
49
+ ok: false,
50
+ diagnostics: [{ code: 'invalid-request', severity: 'error', message: `locator at index ${index} must be an object`, targetName }],
51
+ };
52
+ }
53
+ const kind = raw.kind;
54
+ if (typeof kind !== 'string' || !SUPPORTED_LOCATOR_KINDS.has(kind)) {
55
+ return {
56
+ ok: false,
57
+ diagnostics: [{ code: 'invalid-request', severity: 'error', message: `locator at index ${index} has an unsupported kind`, targetName }],
58
+ };
59
+ }
60
+ switch (kind) {
61
+ case 'css': {
62
+ if (!isBoundedString(raw.selector, 1, MAX_SELECTOR_LENGTH)) {
63
+ return {
64
+ ok: false,
65
+ diagnostics: [
66
+ { code: 'invalid-request', severity: 'error', message: `css locator at index ${index} must have a selector 1-${MAX_SELECTOR_LENGTH} characters`, targetName },
67
+ ],
68
+ };
69
+ }
70
+ return { ok: true, locator: { kind: 'css', selector: raw.selector } };
71
+ }
72
+ case 'role': {
73
+ if (!isBoundedString(raw.role, 1, MAX_ROLE_LENGTH)) {
74
+ return {
75
+ ok: false,
76
+ diagnostics: [{ code: 'invalid-request', severity: 'error', message: `role locator at index ${index} must have a role 1-${MAX_ROLE_LENGTH} characters`, targetName }],
77
+ };
78
+ }
79
+ if (raw.name !== undefined && !isBoundedString(raw.name, 0, MAX_ACCESSIBLE_NAME_LENGTH)) {
80
+ return {
81
+ ok: false,
82
+ diagnostics: [
83
+ { code: 'invalid-request', severity: 'error', message: `role locator at index ${index} name must be at most ${MAX_ACCESSIBLE_NAME_LENGTH} characters`, targetName },
84
+ ],
85
+ };
86
+ }
87
+ return { ok: true, locator: raw.name === undefined ? { kind: 'role', role: raw.role } : { kind: 'role', role: raw.role, name: raw.name } };
88
+ }
89
+ case 'id': {
90
+ if (!isBoundedString(raw.value, 1, MAX_ID_VALUE_LENGTH)) {
91
+ return {
92
+ ok: false,
93
+ diagnostics: [{ code: 'invalid-request', severity: 'error', message: `id locator at index ${index} must have a value 1-${MAX_ID_VALUE_LENGTH} characters`, targetName }],
94
+ };
95
+ }
96
+ return { ok: true, locator: { kind: 'id', value: raw.value } };
97
+ }
98
+ case 'data-attribute': {
99
+ if (typeof raw.attribute !== 'string' || !DATA_ATTRIBUTE_NAME_RE.test(raw.attribute)) {
100
+ return {
101
+ ok: false,
102
+ diagnostics: [
103
+ { code: 'invalid-request', severity: 'error', message: `data-attribute locator at index ${index} must have an attribute matching ^data-[a-z0-9-]{1,64}$`, targetName },
104
+ ],
105
+ };
106
+ }
107
+ if (!isBoundedString(raw.value, 1, MAX_DATA_ATTRIBUTE_VALUE_LENGTH)) {
108
+ return {
109
+ ok: false,
110
+ diagnostics: [
111
+ {
112
+ code: 'invalid-request',
113
+ severity: 'error',
114
+ message: `data-attribute locator at index ${index} must have a value 1-${MAX_DATA_ATTRIBUTE_VALUE_LENGTH} characters`,
115
+ targetName,
116
+ },
117
+ ],
118
+ };
119
+ }
120
+ return { ok: true, locator: { kind: 'data-attribute', attribute: raw.attribute, value: raw.value } };
121
+ }
122
+ case 'semantic-element': {
123
+ if (typeof raw.tag !== 'string' || !SUPPORTED_SEMANTIC_ELEMENT_TAGS.has(raw.tag)) {
124
+ return {
125
+ ok: false,
126
+ diagnostics: [
127
+ {
128
+ code: 'invalid-request',
129
+ severity: 'error',
130
+ message: `semantic-element locator at index ${index} must have a tag in {${[...SUPPORTED_SEMANTIC_ELEMENT_TAGS].join(', ')}}`,
131
+ targetName,
132
+ },
133
+ ],
134
+ };
135
+ }
136
+ return { ok: true, locator: { kind: 'semantic-element', tag: raw.tag } };
137
+ }
138
+ case 'text': {
139
+ if (!isBoundedString(raw.text, 1, MAX_TEXT_LENGTH)) {
140
+ return {
141
+ ok: false,
142
+ diagnostics: [{ code: 'invalid-request', severity: 'error', message: `text locator at index ${index} must have text 1-${MAX_TEXT_LENGTH} characters`, targetName }],
143
+ };
144
+ }
145
+ return { ok: true, locator: { kind: 'text', text: raw.text } };
146
+ }
147
+ default:
148
+ return { ok: false, diagnostics: [{ code: 'invalid-request', severity: 'error', message: `locator at index ${index} has an unsupported kind`, targetName }] };
149
+ }
150
+ }
23
151
  /**
24
152
  * Total, never throws. Collects every applicable diagnostic before returning
25
153
  * (does not short-circuit on the first violation) so callers see every
@@ -65,24 +193,16 @@ export function normalizeRequest(raw) {
65
193
  }
66
194
  else {
67
195
  const seenNames = new Set();
68
- for (const rawTarget of raw.targets) {
69
- if (!isPlainObject(rawTarget) || typeof rawTarget.name !== 'string' || typeof rawTarget.selector !== 'string') {
70
- diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'each target requires a string name and string selector' });
196
+ for (const rawTargetUnknown of raw.targets) {
197
+ if (!isPlainObject(rawTargetUnknown) || typeof rawTargetUnknown.name !== 'string') {
198
+ diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'each target requires a string name and either a string selector or a locators array' });
71
199
  continue;
72
200
  }
73
- const name = rawTarget.name;
74
- const selector = rawTarget.selector;
201
+ const rawTarget = rawTargetUnknown;
202
+ const name = rawTargetUnknown.name;
75
203
  if (!TARGET_NAME_RE.test(name)) {
76
204
  diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'target name must match ^[A-Za-z0-9_-]{1,64}$', targetName: name });
77
205
  }
78
- if (selector.length === 0 || selector.length > MAX_SELECTOR_LENGTH) {
79
- diagnostics.push({
80
- code: 'invalid-request',
81
- severity: 'error',
82
- message: `target selector must be 1-${MAX_SELECTOR_LENGTH} characters`,
83
- targetName: name,
84
- });
85
- }
86
206
  const normalizedName = name.toLowerCase();
87
207
  if (seenNames.has(normalizedName)) {
88
208
  diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'duplicate target name', targetName: name });
@@ -90,7 +210,57 @@ export function normalizeRequest(raw) {
90
210
  else {
91
211
  seenNames.add(normalizedName);
92
212
  }
93
- targets.push({ name, selector });
213
+ const hasSelector = rawTarget.selector !== undefined;
214
+ const hasLocators = rawTarget.locators !== undefined;
215
+ if (hasSelector && hasLocators) {
216
+ diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'target must not specify both selector and locators', targetName: name });
217
+ continue;
218
+ }
219
+ if (hasSelector) {
220
+ if (typeof rawTarget.selector !== 'string' || rawTarget.selector.length === 0 || rawTarget.selector.length > MAX_SELECTOR_LENGTH) {
221
+ diagnostics.push({
222
+ code: 'invalid-request',
223
+ severity: 'error',
224
+ message: `target selector must be 1-${MAX_SELECTOR_LENGTH} characters`,
225
+ targetName: name,
226
+ });
227
+ continue;
228
+ }
229
+ targets.push({ name, locators: [{ kind: 'css', selector: rawTarget.selector }] });
230
+ continue;
231
+ }
232
+ if (hasLocators) {
233
+ if (!Array.isArray(rawTarget.locators) || rawTarget.locators.length === 0) {
234
+ diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'target locators must be a non-empty array', targetName: name });
235
+ continue;
236
+ }
237
+ if (rawTarget.locators.length > MAX_LOCATORS_PER_TARGET) {
238
+ diagnostics.push({
239
+ code: 'invalid-request',
240
+ severity: 'error',
241
+ message: `target locators must contain at most ${MAX_LOCATORS_PER_TARGET} entries`,
242
+ targetName: name,
243
+ });
244
+ continue;
245
+ }
246
+ const locators = [];
247
+ let anyInvalid = false;
248
+ rawTarget.locators.forEach((rawLocator, index) => {
249
+ const validated = validateLocator(rawLocator, name, index);
250
+ if (validated.ok) {
251
+ locators.push(validated.locator);
252
+ }
253
+ else {
254
+ anyInvalid = true;
255
+ diagnostics.push(...validated.diagnostics);
256
+ }
257
+ });
258
+ if (!anyInvalid) {
259
+ targets.push({ name, locators });
260
+ }
261
+ continue;
262
+ }
263
+ diagnostics.push({ code: 'invalid-request', severity: 'error', message: 'each target requires either a selector or a locators array', targetName: name });
94
264
  }
95
265
  }
96
266
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAuCrD,MAAM,gBAAgB,GAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAChE,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,2BAA2B,GAAuB,MAAM,CAAC;AAC/D,MAAM,4BAA4B,GAAG,KAAK,CAAC;AAC3C,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAE/C,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAC/C,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACxD,OAAO,MAAM,CAAC,SAAS,CA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kB,GAAG,YAAY,CAAC,SAAS,CAAC;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,cAAc,GAAG,uBAAuB,CAAC;IAC7C,IAAI,GAAG,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,OAAO,GAAG,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YAC3C,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC,CAAC;QAC/G,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC3D,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;gBACd,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;IACnE,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,OAAO,EAAE;YACP,SAAS;YACT,QAAQ;YACR,OAAO;YACP,cAAc;YACd,SAAS;YACT,SAAS,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,kBAAkB,EAAE;SAC5E;KACF,CAAC;AACJ,CAAC"}
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## Current scaffold architecture
4
4
 
5
- The current repository is one private TypeScript ESM package:
5
+ The current repository is one published TypeScript ESM package
6
+ (`my-frontend-observer@0.1.0`):
6
7
 
7
8
  - `src/cli.ts` is the real, thin `observe` command entry point (argument
8
9
  parsing/output only).
@@ -47,6 +48,33 @@ packed npm tarball end to end in a clean consumer environment, independent
47
48
  of the source checkout. There is still no controlled-scroll/comparison
48
49
  behavior.
49
50
 
51
+ ## Current v0.2 architecture (implemented on the current branch, not yet released)
52
+
53
+ v0.2 extends the same architecture rather than adding a parallel one.
54
+ `src/request/request.ts` now owns a canonical `{name, locators}` target
55
+ model (`TargetLocator`, six frozen kinds) in place of the old CSS-only
56
+ shape; the legacy `{name, selector}` input still normalizes into it. The one
57
+ existing browser-side target resolver/measurement module,
58
+ `src/browser/evidenceCapture.ts`, was extended - not replaced - to resolve
59
+ all six locator kinds against the live page through a single Playwright
60
+ `Locator` per attempt, honor the frozen ordered-fallback/ambiguity/
61
+ unavailable-no-fallback contract, and converge every kind on the same
62
+ measurement path (`captureResolvedTargetRecord`); it additionally computes
63
+ bounded semantic state, derived landmark identity, and configured-target-
64
+ only DOM containment from the same already-resolved elements in the same
65
+ capture pass - no second browser/page, no second resolution algorithm.
66
+ `src/domain/schema.ts` extends `TargetEvidenceRecord`/`TargetResolution`
67
+ additively for schema `1.1.0`, with matching structural validation in
68
+ `isValidObservationArtifact`. `src/cli.ts` gained one CLI/input-boundary-
69
+ only addition, `--targets-file`: it reads and validates only the JSON root
70
+ wrapper (via the already-imported `node:fs`, never `node:fs/promises`) and
71
+ hands the parsed `targets` value into the existing `RawObservationRequest`/
72
+ `normalizeRequest()` path unchanged - there is no second application
73
+ observation use case, and Playwright objects still never leave
74
+ `src/browser/`. The artifact writer, application observation use case, and
75
+ overall boundary chain (`CLI → normalizeRequest → observe() →
76
+ runBrowserCapture → artifact writer`) are unchanged from v0.1.
77
+
50
78
  ## Planned v0.1 architecture constraints
51
79
 
52
80
  v0.1 planning must preserve these approved boundaries without treating module
package/docs/CI_CD.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  A GitHub Actions pre-release readiness workflow exists at
4
4
  `.github/workflows/pre-release-readiness.yml` (triggered manually via
5
- `workflow_dispatch` or by pushing a `validation/**` branch). It has two
6
- phases:
5
+ `workflow_dispatch`, by pushing a `validation/**` or `release/**` branch, or
6
+ by a pull request into `master`). It has two phases:
7
7
 
8
8
  1. **candidate** (Linux, Node 24): `npm ci`, install Chromium, typecheck,
9
9
  lint, `npm test`, `npm run test:browser`, `npm run test:security`,
@@ -16,13 +16,27 @@ phases:
16
16
  ever builds its own tarball), installs Chromium via the installed
17
17
  package's own Playwright dependency, and runs
18
18
  `scripts/ci/runPackedObservationSmoke.mjs` against the installed
19
- tarball: a real Chromium observation against a disposable local HTTP
20
- target, with artifact/schema/screenshot/target-immutability assertions.
19
+ tarball: real Chromium observations against a disposable local HTTP
20
+ target, covering both the legacy `--target` CSS shorthand and the
21
+ structured `--targets-file` semantic-target path (`role`+accessible-name
22
+ and `text` locators, schema `1.1.0`, landmark evidence,
23
+ targets-file-path privacy, and target immutability).
21
24
 
22
25
  This proves the same packaged candidate installs and performs a real
23
- observation on Windows, Linux, and macOS, not just in the source checkout.
26
+ observation - CSS-shorthand and semantic alike - on Windows, Linux, and
27
+ macOS, not just in the source checkout.
24
28
 
25
29
  There is no automated npm publication and no automated GitHub Release
26
- creation - this workflow is readiness validation only, run from a
27
- `validation/**` branch, never from a release branch or tag. Package
28
- publication remains a separate, later, explicit release decision.
30
+ creation - this workflow is readiness validation only. Package publication
31
+ remains a separate, later, explicit release decision.
32
+
33
+ ## v0.2 readiness coverage
34
+
35
+ The packed-candidate readiness gap that previously existed for
36
+ `--targets-file` has been closed: `scripts/ci/runPackedObservationSmoke.mjs`
37
+ now exercises both the legacy CSS-shorthand path and the structured
38
+ semantic `--targets-file` path in the same run, on every platform in the
39
+ matrix. This was proven on `validation/v0.2-pre-release`
40
+ (`2a0718c37cfe6988fc5d9852db455b99aa8238af`), GitHub Actions run
41
+ `31537578062`, which passed on Windows, Linux, and macOS using one
42
+ hash-verified candidate tarball.
package/docs/COMMANDS.md CHANGED
@@ -21,10 +21,14 @@ Options:
21
21
  - `--viewport <WIDTHxHEIGHT>` — e.g. `1280x720`. Malformed syntax (missing
22
22
  `x`, non-numeric, empty side) is rejected before any browser launches;
23
23
  in-range bounds are enforced by the existing request validator.
24
- - `--target <id=css-selector>` — an explicit observation target. Repeatable;
25
- order is preserved. Parsed on the *first* `=` only, so a selector
26
- containing `=` survives intact, e.g.
27
- `--target action=button[data-state="active"]`.
24
+ - `--target <id=css-selector>` — an explicit CSS-shorthand observation
25
+ target. Repeatable; order is preserved. Parsed on the *first* `=` only, so
26
+ a selector containing `=` survives intact, e.g.
27
+ `--target action=button[data-state="active"]`. Cannot be combined with
28
+ `--targets-file`.
29
+ - `--targets-file <json-file>` — loads structured semantic observation
30
+ targets from a local JSON file instead of `--target`. Cannot be combined
31
+ with `--target`. See "Structured semantic targets" below.
28
32
  - `--output <directory>` — portable, relative output location for the
29
33
  observation artifact (same contract as the request's `outputLocation`; no
30
34
  drive letter, no leading `/`, no `..` segments).
@@ -53,6 +57,73 @@ capture. CLI-syntax errors (e.g. a missing `--url`) print as `error:
53
57
  <message>` followed by `observe` usage; request/capture/persistence
54
58
  diagnostics print one per line as `[code] message`.
55
59
 
60
+ ### Structured semantic targets (`--targets-file`)
61
+
62
+ **Current status: shipped as part of the published `my-frontend-observer@0.2.0`
63
+ package.** `--target` (CSS shorthand) remains fully supported alongside it.
64
+
65
+ `--targets-file <json-file>` is the public entry point to the v0.2 canonical
66
+ target/locator model established in `src/request/request.ts`. It supplies
67
+ the same `targets` collection that `--target` supplies, just in structured
68
+ form; both converge on the same `normalizeRequest()` validation and the same
69
+ downstream browser resolver - there is no separate semantic observation path.
70
+
71
+ File format (the exact, first frozen structure - the root object supports
72
+ only the `targets` field; any other top-level field is rejected):
73
+
74
+ ```json
75
+ {
76
+ "targets": [
77
+ {
78
+ "name": "primary-navigation",
79
+ "locators": [
80
+ { "kind": "role", "role": "navigation", "name": "Primary" },
81
+ { "kind": "id", "value": "nav" }
82
+ ]
83
+ },
84
+ {
85
+ "name": "workspace",
86
+ "locators": [
87
+ { "kind": "data-attribute", "attribute": "data-region", "value": "workspace" }
88
+ ]
89
+ }
90
+ ]
91
+ }
92
+ ```
93
+
94
+ Each target has a stable `name` and an ordered `locators` array (1-5
95
+ entries; order is the fallback order - the first locator that resolves
96
+ uniquely wins, an ambiguous or unevaluable locator stops immediately without
97
+ trying the next one). Each locator is one of the six frozen kinds:
98
+
99
+ - `{ "kind": "role", "role": "<string>", "name"?: "<string>" }`
100
+ - `{ "kind": "id", "value": "<string>" }`
101
+ - `{ "kind": "data-attribute", "attribute": "data-*", "value": "<string>" }`
102
+ - `{ "kind": "semantic-element", "tag": "<one of the frozen structural tags>" }`
103
+ - `{ "kind": "css", "selector": "<string>" }`
104
+ - `{ "kind": "text", "text": "<exact string>" }`
105
+
106
+ `--targets-file` itself only validates that the file is readable, is valid
107
+ JSON, and has an object root containing exactly a `targets` field - every
108
+ target/locator-internal rule (bounds, per-kind required fields, supported
109
+ values) is enforced by the same `normalizeRequest()` validator `--target`
110
+ already goes through, so both input modes produce identical diagnostics for
111
+ equivalent mistakes.
112
+
113
+ The path may be relative (resolved from the current working directory) or
114
+ absolute; it is operational input only - it never affects the observation's
115
+ request identity and is never written into `manifest.json`.
116
+
117
+ Example:
118
+
119
+ ```powershell
120
+ my-frontend-observer observe `
121
+ --url http://localhost:3000/ `
122
+ --viewport 1280x720 `
123
+ --targets-file .\targets.json `
124
+ --output observations
125
+ ```
126
+
56
127
  ## Foundation commands
57
128
 
58
129
  - `npm install` — install dependencies (includes the `playwright` runtime
package/docs/CONTRACTS.md CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  ## Current contracts
4
4
 
5
- The v0.1 observation artifact contract is implemented (`src/domain/schema.ts`)
6
- and proven both from the source checkout and from the packed npm tarball:
5
+ The observation artifact contract is published as `my-frontend-observer@0.2.0`
6
+ and proven both from the source checkout and from the packed npm tarball,
7
+ on Windows, Linux, and macOS. The observation schema is `1.1.0` (see "v0.2
8
+ target contract" below, shipped as part of this release):
7
9
 
8
- - artifact kind `my-frontend-observer/observation`, schema version `1.0.0`
9
- (independent of the package version, currently `0.1.0`);
10
+ - artifact kind `my-frontend-observer/observation`, schema version `1.1.0`
11
+ (independent of the package version);
10
12
  - one artifact root per observation, `<outputLocation>/<observationId>/`,
11
13
  containing exactly `manifest.json` (the full `ObservationArtifact`, with
12
14
  page/target evidence embedded inline) and `screenshot.png` - there is no
@@ -26,8 +28,62 @@ and proven both from the source checkout and from the packed npm tarball:
26
28
  - observation/request identity, producer/package identity, and browser
27
29
  provenance are all present in every persisted manifest.
28
30
 
29
- This contract is implemented; it is not yet published as a package, and no
30
- public programmatic-API compatibility promise has been made.
31
+ This contract is implemented and published; no public programmatic-API
32
+ compatibility promise has been made.
33
+
34
+ ## v0.2 target contract (shipped as part of this release)
35
+
36
+ v0.2 introduces a canonical target-configuration model: each configured target has a stable
37
+ observer-level `name` plus an ordered array of bounded `locators`
38
+ (`role`, `id`, `data-attribute`, `semantic-element`, `css`, `text`). This
39
+ identity is distinct from both the browser locator definition that resolves
40
+ it and any source-code identity. The legacy `{name, selector}` shape remains
41
+ accepted and normalizes to a one-item `css` locator, so every published
42
+ `0.1.0` CLI invocation continues to work unchanged. Locator precedence is the
43
+ configured array order; resolution stops on the first unique match, on any
44
+ ambiguous match (never falling through to a later locator), or on an
45
+ unevaluable locator - never silently. All six frozen locator kinds are now
46
+ resolved against a real Chromium page (`role` via Playwright's accessibility-
47
+ role/name locator with exact name matching, `id`/`data-attribute` via exact
48
+ CSS attribute-equals matching that never reinterprets the configured value as
49
+ selector syntax, `semantic-element` via the frozen tag set, `css` via the
50
+ existing v0.1 behavior, `text` via exact-text matching only); every kind
51
+ converges on the same measurement path, so locator strategy never changes the
52
+ resulting target evidence shape.
53
+
54
+ Each resolved target's evidence record additionally carries three bounded
55
+ fields: `semanticState` (a first family of `disabled`/`expanded`/
56
+ `checked`/`selected`/`pressed`/`current` values read from the element's own
57
+ native form-control properties and explicit `aria-*` attributes - a key is
58
+ present only when the browser exposes that state as applicable to this
59
+ element, so an explicit `false` is always distinguishable from "not
60
+ applicable"; `not-applicable` when no supported state applies at all);
61
+ `landmark` (derived only from the already-captured browser-exposed
62
+ role - never from locator kind or HTML tag - against the standard landmark
63
+ role set `banner`/`navigation`/`main`/`complementary`/`contentinfo`/`form`/
64
+ `region`/`search`); and `containment` (bounded DOM containment checked only
65
+ among the other explicitly configured targets in the same observation, in
66
+ configured order, never a layout/relationship graph - `available` when every
67
+ other configured target was itself resolved and checked, `partial` when one
68
+ or more could not be, `unavailable` when the target itself never resolved).
69
+ Stable observer target identity is proven, not just declared: the same
70
+ target configuration produces the same `requestId` across repeated
71
+ observations (with a fresh `observationId` each time); changing a target's
72
+ locator strategy while keeping its stable name changes `requestId` but not
73
+ the `targetEvidence` key; and actual runtime disappearance of a
74
+ still-configured target changes only its resolution status, never the
75
+ `requestId`.
76
+
77
+ The full canonical semantic target model above is reachable through the
78
+ real public CLI: `my-frontend-observer observe --targets-file <json-file>`
79
+ supplies the structured `{ "targets": [...] }` collection (see
80
+ `docs/COMMANDS.md` "Structured semantic targets") as an alternative to the
81
+ existing `--target id=css-selector` shorthand - the two are mutually
82
+ exclusive per invocation, and both converge on the same
83
+ `normalizeRequest()`/browser-resolver/artifact path, so a semantic
84
+ observation produces exactly the same `manifest.json` shape (schema `1.1.0`)
85
+ as a CSS-shorthand one. `--targets-file`'s local input path is never part of
86
+ the persisted request identity or artifact.
31
87
 
32
88
  ## Approved v0.1 design inputs
33
89