@dailephd/my-frontend-observer 0.10.0 → 0.10.1
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/CHANGELOG.md +490 -479
- package/LICENSE +21 -21
- package/README.md +375 -365
- package/dist/application/projectCheckService.d.ts +6 -0
- package/dist/application/projectCheckService.js +8 -1
- package/dist/application/projectCheckService.js.map +1 -1
- package/dist/application/projectWorkflowService.d.ts +7 -2
- package/dist/application/projectWorkflowService.js +10 -3
- package/dist/application/projectWorkflowService.js.map +1 -1
- package/dist/cli.js +510 -510
- package/dist/viewer/index.html +13 -13
- package/dist/viewer/sw.js +1 -1
- package/docs/ARCHITECTURE.md +1394 -1385
- package/docs/CI_CD.md +349 -338
- package/docs/COMMANDS.md +1035 -1026
- package/docs/CONTRACTS.md +1971 -1960
- package/docs/CURRENT_STATE.md +1277 -1252
- package/docs/DEVELOPMENT.md +240 -237
- package/docs/DOCUMENTATION_PRESERVATION_POLICY.md +50 -50
- package/docs/PROJECT_DESCRIPTION.md +2248 -2224
- package/docs/PROJECT_MILESTONES.md +2681 -2558
- package/docs/PROJECT_OVERVIEW.md +200 -196
- package/docs/QUICKSTART.md +100 -100
- package/docs/RELEASE.md +37 -36
- package/docs/ROADMAP.md +1105 -1034
- package/docs/SECURITY.md +297 -297
- package/docs/WORKFLOWS.md +806 -796
- package/docs/plans/v0.10-implementation-plan.md +1509 -1509
- package/docs/plans/v0.8-implementation-plan.md +655 -655
- package/docs/plans/v0.8.1-cli-usability-patch-plan.md +505 -505
- package/docs/plans/v0.9-implementation-plan.md +1529 -1529
- package/docs/plans/v0.9.1-implementation-plan.md +468 -468
- package/docs/reports/v0.10-batch1-visual-change-workflow-foundation.md +102 -102
- package/docs/reports/v0.10-batch2-project-composition-check-recording.md +103 -103
- package/docs/reports/v0.10-batch3-viewer-visual-change-workspace.md +93 -93
- package/docs/reports/v0.10-batch4-actual-frontend-entry.md +59 -59
- package/docs/reports/v0.10-batch5-reference-driven-entry.md +238 -238
- package/docs/reports/v0.10-batch6-coding-agent-handoff.md +85 -85
- package/docs/reports/v0.10-batch7-correction-review-acceptance.md +145 -145
- package/docs/reports/v0.10-batch8-integrated-acceptance.md +109 -109
- package/docs/reports/v0.10-implementation-completeness-documentation-reconciliation.md +344 -344
- package/docs/reports/v0.10-pre-release-readiness.md +120 -120
- package/docs/reports/v0.10-release-preparation.md +70 -70
- package/docs/reports/v0.10.1-project-check-baseline-context-implementation.md +86 -0
- package/docs/reports/v0.7-bounded-fidelity-context-prompt7.md +243 -243
- package/docs/reports/v0.7-implementation-completeness-documentation-reconciliation.md +497 -497
- package/docs/reports/v0.7-pre-release-readiness.md +337 -337
- package/docs/reports/v0.7-reference-binding-prompt5.md +223 -223
- package/docs/reports/v0.7-reference-compatibility-prompt4.md +234 -234
- package/docs/reports/v0.7-reference-correction-workflow-prompt8.md +222 -222
- package/docs/reports/v0.7-reference-fidelity-prompt6.md +216 -216
- package/docs/reports/v0.7-reference-foundation-prompt1.md +151 -151
- package/docs/reports/v0.7-reference-regions-prompt2.md +195 -195
- package/docs/reports/v0.7-reference-requirements-prompt3.md +217 -217
- package/docs/reports/v0.7-release-prep.md +423 -423
- package/docs/reports/v0.8-binding-fidelity-interaction-batch6.md +279 -279
- package/docs/reports/v0.8-bounded-context-correlation-batch7.md +233 -233
- package/docs/reports/v0.8-comparison-contract-inspection-batch4.md +279 -279
- package/docs/reports/v0.8-evidence-index-readers-batch2.md +247 -247
- package/docs/reports/v0.8-implementation-completeness-documentation-reconciliation.md +741 -741
- package/docs/reports/v0.8-integrated-viewer-acceptance-batch8.md +128 -128
- package/docs/reports/v0.8-observation-svg-inspection-batch3.md +223 -223
- package/docs/reports/v0.8-prerelease-readiness-cross-platform-security-code-rot.md +687 -687
- package/docs/reports/v0.8-reference-candidate-inspection-batch5.md +232 -232
- package/docs/reports/v0.8-viewer-runtime-pwa-batch1.md +278 -278
- package/docs/reports/v0.8.1-implementation-completeness-documentation-reconciliation.md +114 -114
- package/docs/reports/v0.8.1-prerelease-readiness-cross-platform-security-code-rot.md +170 -170
- package/docs/reports/v0.9-architecture-retrieval.md +14 -37
- package/docs/reports/v0.9-final-pre-release-readiness.md +209 -209
- package/docs/reports/v0.9-final-readiness-corrections.md +530 -530
- package/docs/reports/v0.9-pre-release-readiness.md +169 -169
- package/docs/reports/v0.9.1-batch1-pwa-hard-gate-isolation.md +359 -359
- package/docs/reports/v0.9.1-batch2-hard-gate-validation-integration.md +262 -262
- package/docs/reports/v0.9.1-pre-release-readiness.md +206 -206
- package/package.json +59 -59
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
# v0.7 Prompt 5 — Explicit Reference-Region ↔ Runtime-Target Binding
|
|
2
|
-
|
|
3
|
-
**VERDICT: PASS_V0_7_REFERENCE_BINDING_PROMPT5**
|
|
4
|
-
|
|
5
|
-
## Repository / branch / heads
|
|
6
|
-
|
|
7
|
-
- Repository: `my-frontend-observer` (path: `Z:\Users\newuser\Projects\my-frontend-observer`)
|
|
8
|
-
- Branch: `implementation/v0.7-reference-binding`, branched from the exact completed Prompt 4 HEAD
|
|
9
|
-
- Starting HEAD (this prompt's branch point): `023feccac2b4255a119282d359782691b4734bce` (Prompt 4 report commit)
|
|
10
|
-
- Prompt 4 base HEAD confirmed to contain both required commits: `4da60be` (implementation) and `023fecc` (report) — verified via `git log --oneline` before branching.
|
|
11
|
-
- Implementation commit (this prompt): `74cc148f6b4ccda1c2a394634a8e9d5de26285dd` — "Add v0.7 Prompt 5 explicit reference-region <-> runtime-target binding"
|
|
12
|
-
- Ending HEAD (after this report is committed): the report commit that follows this file's commit.
|
|
13
|
-
|
|
14
|
-
## Git status
|
|
15
|
-
|
|
16
|
-
Preflight (`git status --short`) showed a clean working tree on `implementation/v0.7-reference-compatibility` at the exact Prompt 4 report HEAD; `git stash list` showed exactly the one preserved Prompt 1 stray-fork-writes entry. The branch was created from that HEAD with `git checkout -b implementation/v0.7-reference-binding` and ancestry verified with `git merge-base --is-ancestor 023fecc HEAD`. No unrelated dirty state was present at any point; no reset/clean/discard operation was used; the Prompt 1 stash was neither applied nor dropped. Post-implementation `git status --short` is clean except for this report file (staged and committed separately, per convention).
|
|
17
|
-
|
|
18
|
-
## Tooling
|
|
19
|
-
|
|
20
|
-
- Resolved latest published `@dailephd/my-dev-kit`: `1.12.3` (via `npm view @dailephd/my-dev-kit version`), pinned exactly via `npx -y @dailephd/my-dev-kit@1.12.3`.
|
|
21
|
-
- Fresh Prompt 5 repository index built under a repository-local root (per this prompt's "project-contained workflow state" requirement, not `C:\`): `.my-dev-kit-context/index-prompt5/` (`manifest.json`, `symbol-index.json`, `code-graph.json`, `call-graph.json`; 56 files, 851 symbols indexed). This index was not reused from Prompt 1–4's indexes — a fresh retrieval was performed at execution start.
|
|
22
|
-
- `.gitignore` extended with `.my-dev-kit-context/` and `.my-dev-kit-workflow/` (alongside the pre-existing `.my-dev-kit/`/`.my-dev-kit-orchestrator/` entries) so this and future prompts' workflow-owned state never appears as stageable.
|
|
23
|
-
|
|
24
|
-
## Prompt 1–4 contracts verified
|
|
25
|
-
|
|
26
|
-
Read directly (source, not the fresh index's summaries alone) before writing any code:
|
|
27
|
-
|
|
28
|
-
- `src/domain/externalReference.ts` / `externalReferenceIdentity.ts` — confirmed `ExternalReferenceArtifact`'s `regions?`/`requirements?`/`applicability?` shape, both lifecycle variants, and `isValidExternalReferenceArtifact`'s existing structural gate (reused directly, not reimplemented).
|
|
29
|
-
- `src/domain/externalReferenceRegions.ts` — confirmed `ReferenceRegion.id` (Prompt 2's region identity: no separate identity-hashing function exists for regions, just the authored `id` string with `REFERENCE_REGION_ID_PATTERN` and case-insensitive uniqueness) — reused verbatim as the reference-side half of a binding declaration.
|
|
30
|
-
- `src/domain/externalReferenceRequirements.ts` — confirmed the exact precedent for "a reference to an unknown region id is a structural validation failure at authoring time, not a per-item unavailable result" (`regionIds`/`byId` lowercase-keyed lookups, `isValidReferenceRequirements` rejecting the whole collection on an unknown region reference), and the "no two requirements may share the same structural subject" duplicate/conflict rule — both reused as direct design precedent for binding-declaration validation.
|
|
31
|
-
- `src/domain/externalReferenceCompatibility.ts` (Prompt 4) — confirmed `evaluateReferenceCandidateCompatibility`'s exact signature and `ReferenceCandidateCompatibilityResult` shape; reused verbatim as this prompt's compatibility gate.
|
|
32
|
-
- `src/domain/comparisonEngine.ts` (v0.4) — confirmed the module-private `targetPresence(record): 'matched'|'not-found'|'ambiguous'|'unavailable'` helper, already the canonical rule v0.4's own before/after target comparison uses to read a `TargetEvidenceRecord`'s resolution outcome.
|
|
33
|
-
- `src/domain/schema.ts` (v0.1/v0.2) — confirmed `TargetSelectionStatus = 'matched'|'not-found'|'ambiguous'|'unavailable'`, `TargetResolution`, `TargetEvidenceRecord` (keyed by exact configured target name in `ObservationArtifact.targetEvidence`), and `TargetVisibility` (a wholly separate concept from `TargetSelectionStatus` — visibility is never one of the four resolution states).
|
|
34
|
-
- `src/request/request.ts` (v0.1/v0.2) — confirmed `NamedTarget { name, locators }` as the stable observer-owned runtime target identity, `TARGET_NAME_RE = /^[A-Za-z0-9_-]{1,64}$/` (private, mirrored independently rather than imported), and the case-insensitive target-name-resolution convention already used for `target-scroll-by`.
|
|
35
|
-
- `src/domain/boundedAgentContextCorrelation.ts` (v0.6) — read in full; confirmed the uncertainty-handling discipline (never hide competing candidates, never guess through ambiguity, deterministic candidate/target ordering by sorted id rather than input order, count-based status derivation: zero candidates → `unavailable`, one → `correlated`, more than one → `ambiguous`) reused as *architectural discipline* only — v0.6's own `correlated`/`ambiguous`/`unavailable` correlation-status vocabulary was deliberately **not** reused verbatim, since it describes a different evidence boundary (ranking static candidates for one runtime target) than binding (resolving one runtime target's own existence for one declared region correspondence).
|
|
36
|
-
|
|
37
|
-
## v0.2 runtime-target precedent
|
|
38
|
-
|
|
39
|
-
The stable runtime target identity is `NamedTarget.name` (a bounded `^[A-Za-z0-9_-]{1,64}$` label), matched against `ObservationArtifact.requestConfig.targets` and used to key `ObservationArtifact.targetEvidence`. This prompt binds only to that name — never to a CSS selector, a Playwright locator, a DOM node handle, a source file, a React component name, or a my-dev-kit node id. Target-name matching in `evaluateReferenceRuntimeBindings` is case-insensitive, mirroring the exact convention already used for `target-scroll-by` target resolution in `request/request.ts`; the exact configured `name` (original case) is then used to index `targetEvidence`, matching how that record is actually keyed by `src/browser/evidenceCapture.ts`.
|
|
40
|
-
|
|
41
|
-
## v0.6 uncertainty precedent
|
|
42
|
-
|
|
43
|
-
Reused as architectural discipline (never guess through ambiguity, never silently prefer a "first" candidate/result, deterministic ordering by declared/sorted identity rather than input order, explicit unavailable-vs-ambiguous distinction) — not as a literal status-vocabulary reuse. `evaluateReferenceRuntimeBindings` never collapses an ambiguous v0.2 target resolution into `bound`, and never fabricates a binding when the underlying evidence is missing.
|
|
44
|
-
|
|
45
|
-
## Binding model
|
|
46
|
-
|
|
47
|
-
One new pure domain module: `src/domain/externalReferenceRuntimeBinding.ts`.
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
interface ReferenceRuntimeBindingDeclaration {
|
|
51
|
-
referenceRegion: string; // Prompt 2 ReferenceRegion.id
|
|
52
|
-
runtimeTarget: string; // v0.2 NamedTarget.name
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function isValidReferenceRuntimeBindingDeclarations(
|
|
56
|
-
value: unknown,
|
|
57
|
-
reference: ExternalReferenceArtifact,
|
|
58
|
-
): { valid: true } | { valid: false; reason: string };
|
|
59
|
-
|
|
60
|
-
function evaluateReferenceRuntimeBindings(
|
|
61
|
-
reference: ExternalReferenceArtifact,
|
|
62
|
-
candidate: ObservationArtifact,
|
|
63
|
-
declarations: readonly ReferenceRuntimeBindingDeclaration[],
|
|
64
|
-
): { ok: true; evaluation: ReferenceRuntimeBindingEvaluation } | { ok: false; reason: string };
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
The binding declaration is explicit user/configuration input at every point — the module contains no code path that derives a correspondence from geometry, pixel content, matching name strings, matching text, or source code. A reference region id and a runtime target name that happen to share the same string value bind to each other only when an explicit declaration says so (verified directly by a dedicated test comparing the same observation/reference pair with and without the declaration).
|
|
68
|
-
|
|
69
|
-
## Exact status vocabulary
|
|
70
|
-
|
|
71
|
-
`REFERENCE_RUNTIME_BINDING_STATUSES = ['bound', 'ambiguous', 'unavailable'] as const`. No fourth "incompatible" status was added — per the task's own guidance (§14), Prompt 4's compatibility is represented separately (see below), never folded into a binding-local status enum.
|
|
72
|
-
|
|
73
|
-
Reason codes (present only when `status !== 'bound'`): `runtime-target-not-configured`, `runtime-target-not-found`, `runtime-target-ambiguous`, `runtime-target-evidence-unavailable`.
|
|
74
|
-
|
|
75
|
-
## Compatibility-gating behavior
|
|
76
|
-
|
|
77
|
-
`evaluateReferenceRuntimeBindings` calls `evaluateReferenceCandidateCompatibility(reference, candidate)` exactly once, before evaluating any individual declaration. If the returned `compatibility.state === 'incomparable'`, the function returns `ok: true` with `bindings: []` and the full `compatibility` result embedded in `ReferenceRuntimeBindingEvaluation.compatibility` — the caller reads the blocker from that field. No per-declaration result is fabricated in this case (verified by behavior-F test: an incompatible viewport pair produces zero bindings, never a bound result). When `compatibility.state` is `comparable` or `comparable-with-warnings`, every declaration is evaluated normally. Compatibility rules (viewport/theme/application-state/authenticated-state comparison) are never recomputed or duplicated inside this module.
|
|
78
|
-
|
|
79
|
-
## Reference-region identity behavior
|
|
80
|
-
|
|
81
|
-
Reused exactly as Prompt 2 defined it: `ReferenceRegion.id`, matched case-insensitively (mirroring the existing region-uniqueness/requirement-region-reference convention). No new reference-region identity system was created. A declaration naming a `referenceRegion` not present in `reference.regions` (or a reference with no `regions` field at all) fails the **entire** evaluation closed at the structural-validation stage — `evaluateReferenceRuntimeBindings` returns `ok: false` before a candidate observation is even consulted, mirroring Prompt 3's exact "unknown region reference is a structural authoring-time failure" precedent for requirements.
|
|
82
|
-
|
|
83
|
-
## Runtime-target identity behavior
|
|
84
|
-
|
|
85
|
-
Reused exactly as v0.2 defined it: `NamedTarget.name`, matched case-insensitively against `candidate.requestConfig.targets`, then the exact configured name is used to index `candidate.targetEvidence`. Runtime-target *availability* (as opposed to reference-region *existence*) is evaluated per-candidate, inside `evaluateReferenceRuntimeBindings` itself, not during the candidate-independent structural validation pass — the same declaration can legitimately be `bound` against one candidate and `unavailable` against another.
|
|
86
|
-
|
|
87
|
-
## Target-resolution-state handling
|
|
88
|
-
|
|
89
|
-
`targetPresence` (v0.4 `comparisonEngine.ts`, additively exported this prompt alongside the already-exported `assessOptionalComparabilityDimension`) is the single reused rule for reading a `TargetEvidenceRecord`'s resolution:
|
|
90
|
-
|
|
91
|
-
| `targetPresence` outcome | Binding status | Reason code |
|
|
92
|
-
|---|---|---|
|
|
93
|
-
| `matched` | `bound` | — |
|
|
94
|
-
| `ambiguous` | `ambiguous` | `runtime-target-ambiguous` |
|
|
95
|
-
| `not-found` | `unavailable` | `runtime-target-not-found` |
|
|
96
|
-
| `unavailable` (no usable resolution evidence, or no record at all) | `unavailable` | `runtime-target-evidence-unavailable` |
|
|
97
|
-
|
|
98
|
-
A fifth situation exists only at the binding-evaluation boundary itself, not inside `targetPresence`: a declared `runtimeTarget` that was never part of the candidate's own `requestConfig.targets` at all → `unavailable` / `runtime-target-not-configured`, resolved without ever dynamically searching the page (the evaluator consumes only the already-captured `ObservationArtifact`).
|
|
99
|
-
|
|
100
|
-
## Hidden-target decision
|
|
101
|
-
|
|
102
|
-
A uniquely resolved (`matched`) but hidden target (`TargetVisibility.visible === false`) is still reported `bound` — visibility is carried only as provenance (`targetVisible`) and never changes `status`. Rationale, documented in the module and in `docs/CONTRACTS.md`: binding identity ("does a stable correspondence exist") and fidelity evaluability ("can this evidence actually be used to check the design") are distinct questions; this prompt answers only the former, leaving the latter to Prompt 6. Verified by a dedicated test (`Q: a hidden but uniquely resolved runtime target is still reported bound, with targetVisible: false as provenance`).
|
|
103
|
-
|
|
104
|
-
## Duplicate/conflicting binding behavior
|
|
105
|
-
|
|
106
|
-
No two declarations may name the same `referenceRegion` (case-insensitively), whether their `runtimeTarget` values agree (an exact duplicate) or disagree (a conflict) — both fail the whole batch identically at structural-validation time, `ok: false`, never silently resolved by keeping the first declaration. This mirrors Prompt 3's "no two requirements may share the same structural subject, regardless of category" rule exactly. Verified by dedicated tests for both the exact-duplicate case (I) and the conflicting-target case (J).
|
|
107
|
-
|
|
108
|
-
## Multiple-regions-to-one-target decision
|
|
109
|
-
|
|
110
|
-
**Allowed, deliberately.** Several distinct reference regions may each declare a binding to the same `runtimeTarget` (e.g. two design sub-regions, such as a header's logo area and its nav area, both corresponding conceptually to one runtime container element). This is documented as a legitimate correspondence, unlike the reverse (one region needing several runtime targets), which is prohibited because it would be inherently ambiguous which target represents that region — the "one region, one explicit primary target" rule from §13. Verified by a dedicated test (K).
|
|
111
|
-
|
|
112
|
-
## Bounds
|
|
113
|
-
|
|
114
|
-
`MAX_REFERENCE_RUNTIME_BINDINGS = 20`, mirroring `MAX_REFERENCE_REGIONS`'s existing bound — a binding-declaration collection is authoring input over the same region set, so the same cap applies. Independently owned (not imported), consistent with the repository's established "coincidentally equal, independently owned bound" convention (e.g. `MAX_REFERENCE_REGIONS`/`MAX_TARGETS` already share the value 20 without being structurally coupled). Verified: exactly 20 declarations accepted, 21 rejected.
|
|
115
|
-
|
|
116
|
-
## Deterministic ordering
|
|
117
|
-
|
|
118
|
-
`bindings` in the evaluation result preserves the authored order of the `declarations` array passed in — never a sort by any derived key, mirroring the "authored order is semantic" convention already established for regions (Prompt 2) and requirements (Prompt 3). Verified by a dedicated test asserting result order matches declaration order even when it does not match the reference's own region-authoring order.
|
|
119
|
-
|
|
120
|
-
## Identity decision
|
|
121
|
-
|
|
122
|
-
**No new identity-hashing function was introduced.** Unlike `buildRequestIdentity`/`buildExternalReferenceRequestIdentity`, no deterministic content-hash identity is computed for a binding declaration or its evaluated result. This mirrors Prompt 4's own `ReferenceCandidateCompatibilityResult`, which took the identical approach: provenance is carried as plain, already-deterministic fields (`referenceId`, `referenceRequestId`, `candidateObservationId`, `candidateRequestId`, plus each result's own `referenceRegion`/`runtimeTarget`) rather than a fifth hashing convention for a value this prompt never persists and never looks up by id. Because no identity function exists, path-independence (test L in the task's behavior model) holds trivially — there is no file-loading code in this prompt at all (see CLI decision below), so no path could ever reach identity even indirectly.
|
|
123
|
-
|
|
124
|
-
## Persistence decision
|
|
125
|
-
|
|
126
|
-
**No persisted artifact family was introduced.** `evaluateReferenceRuntimeBindings` is a pure, synchronous, on-demand function over an already-persisted `ExternalReferenceArtifact`, an already-persisted `ObservationArtifact`, and an in-memory declaration collection — it produces no `ExternalReferenceBindingArtifact` or equivalent. Rationale (same reasoning Prompt 4 already applied to its own compatibility result): the result is cheap to recompute deterministically from its three inputs, and persisting it would invite drift (a re-imported reference or re-observed candidate could silently disagree with a stale persisted binding record) with no corresponding benefit at this stage. This decision may be revisited only if Prompt 6's architecture proves persistence necessary — not assumed here.
|
|
127
|
-
|
|
128
|
-
## Reference / observation artifact immutability
|
|
129
|
-
|
|
130
|
-
Neither `ExternalReferenceArtifact` nor `ObservationArtifact` gained any new field in this prompt, and `evaluateReferenceRuntimeBindings` never mutates either input (verified by a dedicated deep-equality-snapshot test, N, covering the reference, the candidate, and the declaration input array all three). A design reference remains evaluable against multiple future candidates; a candidate observation remains evaluable against multiple future references — binding results are kept as downstream, candidate-specific, reference-specific derived evidence, never embedded back into either source artifact.
|
|
131
|
-
|
|
132
|
-
## Public / programmatic interface
|
|
133
|
-
|
|
134
|
-
Exported from `src/index.ts` (additive):
|
|
135
|
-
- Types: `ReferenceRuntimeBindingStatus`, `ReferenceRuntimeBindingReasonCode`, `ReferenceRuntimeBindingDeclaration`, `ReferenceRuntimeBindingValidationResult`, `ReferenceRuntimeBindingResult`, `ReferenceRuntimeBindingEvaluation`, `EvaluateReferenceRuntimeBindingsResult`.
|
|
136
|
-
- Values: `RUNTIME_TARGET_NAME_PATTERN`, `MAX_REFERENCE_RUNTIME_BINDINGS`, `REFERENCE_RUNTIME_BINDING_STATUSES`, `REFERENCE_RUNTIME_BINDING_REASON_CODES`, `isValidReferenceRuntimeBindingDeclarations`, `evaluateReferenceRuntimeBindings`.
|
|
137
|
-
- Additionally, `TargetPresence`/`targetPresence` (previously module-private in `comparisonEngine.ts`) are now additively exported, since this new module reuses that exact function rather than duplicating its logic.
|
|
138
|
-
|
|
139
|
-
No internal helper clutter is exported (`findConfiguredTargetName`, `evaluateOneBinding`, `isValidBindingDeclarationShape` all remain module-private).
|
|
140
|
-
|
|
141
|
-
## CLI changes
|
|
142
|
-
|
|
143
|
-
**None.** Per the task's explicit guidance (§37: "Do not add a standalone CLI command merely for symmetry... Prompt 6 may become the first public consumer"), no CLI command or config-file loader was added this prompt. The full capability is exposed only through the programmatic API above. `docs/COMMANDS.md` was therefore not touched.
|
|
144
|
-
|
|
145
|
-
## Files changed
|
|
146
|
-
|
|
147
|
-
New:
|
|
148
|
-
- `src/domain/externalReferenceRuntimeBinding.ts`
|
|
149
|
-
- `tests/unit/externalReferenceRuntimeBinding.test.ts`
|
|
150
|
-
|
|
151
|
-
Modified:
|
|
152
|
-
- `src/domain/comparisonEngine.ts` (additively exported `targetPresence`/`TargetPresence`, previously module-private; zero behavior change)
|
|
153
|
-
- `src/index.ts` (public export surface for the above)
|
|
154
|
-
- `docs/ARCHITECTURE.md`, `docs/CONTRACTS.md`, `docs/WORKFLOWS.md`
|
|
155
|
-
- `.gitignore` (added `.my-dev-kit-context/`, `.my-dev-kit-workflow/`)
|
|
156
|
-
|
|
157
|
-
## Tests
|
|
158
|
-
|
|
159
|
-
889 unit tests total (857 pre-existing + 32 new), all pure domain-level tests — zero Chromium launches for binding evaluation itself, per the task's explicit requirement. New coverage in `tests/unit/externalReferenceRuntimeBinding.test.ts` includes:
|
|
160
|
-
|
|
161
|
-
- `isValidReferenceRuntimeBindingDeclarations`: valid single/empty declaration, non-array rejection, exact-bound acceptance (20) and one-over-bound rejection (21), malformed shape rejection (missing field/wrong type/unknown field), unknown reference region (behavior B), reference with no regions at all (behavior O), exact-duplicate rejection (behavior I), conflicting-target rejection (behavior J), multiple-regions-to-one-target acceptance (behavior K), unused-region tolerance (behavior P), case-insensitive region matching.
|
|
162
|
-
- `evaluateReferenceRuntimeBindings`: valid binding with differing ids (behaviors A/H), same-string-ids-require-explicit-declaration (behavior G, both with and without the declaration), unknown-region whole-batch failure (behavior B), unknown/not-configured runtime target (behavior C), ambiguous runtime target (behavior D), not-found vs. evidence-unavailable distinction, incompatible reference/candidate blocks all bindings (behavior F), matching compatibility permits evaluation, hidden-target bound-with-provenance (behavior Q), deterministic authored-order preservation and pure-function repeatability (behavior M), full three-input immutability (behavior N), case-insensitive runtime-target-name resolution, full provenance carry-through, fail-closed on a structurally invalid reference or candidate artifact, and absence of any source-ownership-style field in the result (`sourceOwner`/`sourceFile`/`component`/`symbol`/`causedBy`).
|
|
163
|
-
|
|
164
|
-
## Validation results
|
|
165
|
-
|
|
166
|
-
All commands run from the repository root, after the implementation commit:
|
|
167
|
-
|
|
168
|
-
- `npm run typecheck` — pass, zero errors.
|
|
169
|
-
- `npm run lint` — pass, zero errors/warnings.
|
|
170
|
-
- `npm test` — 46 test files, 889 tests, all pass.
|
|
171
|
-
- `npm run build` — pass, clean `tsc` compile.
|
|
172
|
-
- `npm run check:docs` — pass (17 required files present, `ROADMAP.md` format intact — no implementation batches added).
|
|
173
|
-
- `git diff --check` — exit 0, no whitespace errors.
|
|
174
|
-
- `npm pack --dry-run` — pass; `dist/domain/externalReferenceRuntimeBinding.{js,d.ts,js.map}` confirmed present in the tarball listing (public exports changed, so this was run per the task's requirement).
|
|
175
|
-
- `npm run test:security` — pass (5 + 63 = 68 tests: `policy.test.ts` + real-Chromium `chromiumAdapter.test.ts`), run because a new public input surface (`ReferenceRuntimeBindingDeclaration`) was added.
|
|
176
|
-
- `npm run test:browser` — pass (9 files, 120 tests, real Chromium), run as full regression confirmation per established repository policy, even though Prompt 5 itself has no Chromium dependency.
|
|
177
|
-
|
|
178
|
-
## Regression results
|
|
179
|
-
|
|
180
|
-
- Prompt 1 artifact/lifecycle: unaffected — `externalReference.ts` untouched this prompt.
|
|
181
|
-
- Prompt 2 regions/relationships: unaffected — `externalReferenceRegions.ts`/`externalReferenceRegionRelationships.ts` untouched; `REFERENCE_REGION_ID_PATTERN` only imported, never modified.
|
|
182
|
-
- Prompt 3 requirements/adequacy: unaffected — `externalReferenceRequirements.ts` untouched.
|
|
183
|
-
- Prompt 4 state/compatibility: unaffected — `externalReferenceCompatibility.ts`, `explicitState.ts`, `externalReferenceApplicability.ts` untouched; `evaluateReferenceCandidateCompatibility` called, never modified.
|
|
184
|
-
- v0.2 runtime target identity/resolution: unaffected — `request/request.ts`, `schema.ts`, `browser/evidenceCapture.ts` untouched.
|
|
185
|
-
- v0.4 comparison: unaffected in behavior — `comparisonEngine.ts`'s only change is exporting a previously-private function (`targetPresence`) verbatim; every existing caller and every existing test of `evaluateComparability`/`compareObservations`/`compareTargetConfiguration` continues to pass unchanged.
|
|
186
|
-
- v0.5 contracts: unaffected — no file in `frontendContracts*.ts` touched.
|
|
187
|
-
- v0.6 runtime/static correlation: unaffected — `boundedAgentContext*.ts` untouched; its status vocabulary/discipline was read for precedent only, never imported or modified.
|
|
188
|
-
- Full unit (889/889), browser (120/120), and security (68/68) suites all pass with zero regressions.
|
|
189
|
-
|
|
190
|
-
## Security impact
|
|
191
|
-
|
|
192
|
-
- No new external input surface beyond an in-memory, caller-supplied declaration array (no file, no CLI flag, no network call in this prompt) — the smallest possible surface, since no CLI/config-file loader was added.
|
|
193
|
-
- `evaluateReferenceRuntimeBindings` performs no filesystem access, no network access, and no browser/Chromium invocation of any kind.
|
|
194
|
-
- `test:security` (policy + real-Chromium adapter tests) re-run and passing, confirming no regression to the existing safety/navigation policy surface (untouched by this prompt).
|
|
195
|
-
|
|
196
|
-
## Documentation changes
|
|
197
|
-
|
|
198
|
-
- `docs/CONTRACTS.md` — new "v0.7 Prompt 5 explicit reference-region ↔ runtime-target binding" section (full type shapes, key rules, status-mapping table equivalent in prose, hidden-target/duplicate/multiple-regions decisions, persistence/identity decisions, CLI-surface decision).
|
|
199
|
-
- `docs/ARCHITECTURE.md` — new paragraph in the "Planned v0.7–v0.10" section describing the Prompt 5 module addition, its reuse of Prompt 4's compatibility gate and v0.4's `targetPresence`, and its architectural-discipline-only (not vocabulary) reuse of v0.6's uncertainty handling.
|
|
200
|
-
- `docs/WORKFLOWS.md` — "Current external-reference foundation workflow" retitled to "Prompts 1-5" and extended with a paragraph describing `evaluateReferenceRuntimeBindings`.
|
|
201
|
-
- `docs/COMMANDS.md` — not touched (no CLI surface change this prompt).
|
|
202
|
-
|
|
203
|
-
## Tooling incidents
|
|
204
|
-
|
|
205
|
-
None. No orchestrator was invoked (direct-implementation mode used throughout, consistent with Prompts 2–5); no background/speculative subagent writes occurred; the Prompt 1 stray-fork-writes stash remains untouched, unapplied, and unmined as precedent.
|
|
206
|
-
|
|
207
|
-
## Out-of-scope confirmation
|
|
208
|
-
|
|
209
|
-
This prompt implements no automatic target matching, no computer vision, no screenshot segmentation, no OCR, no fuzzy matching, no geometry-based matching, no source-correlation changes, no source ownership, no reference/candidate geometry delta, no spacing delta, no relationship fidelity evaluation, no selected-requirement evaluation, no fidelity PASS/FAIL, no style fidelity, no image similarity, no bounded correction packet, no coding-agent context changes or invocation, no source edits, no correction loop, no viewer, and no annotation. `evaluateReferenceRuntimeBindings` reads only `reference.regions` (for structural validation), `reference.applicability` (via the reused compatibility gate), and `candidate.requestConfig.targets`/`candidate.targetEvidence` — it never reads `reference.requirements`, never compares geometry, and never touches source code or my-dev-kit retrieval of any kind.
|
|
210
|
-
|
|
211
|
-
## Known limitations
|
|
212
|
-
|
|
213
|
-
- A binding declaration supports exactly one `runtimeTarget` per `referenceRegion` — there is no "candidate alternatives" mechanism (deliberately; the task's own guidance treats this as the smallest, cleanest representation, and any future need for ranked/multiple candidate targets per region is left to a later prompt to design explicitly, not improvised here).
|
|
214
|
-
- No CLI/config-file surface exists yet for authoring binding declarations outside of direct programmatic use — deferred to Prompt 6 per the task's own guidance.
|
|
215
|
-
- `targetVisible` provenance is populated only when the underlying `TargetVisibility` evidence is itself available; a `bound` result for a target whose visibility evidence is unavailable simply omits the field rather than guessing a value.
|
|
216
|
-
|
|
217
|
-
## Remaining risks
|
|
218
|
-
|
|
219
|
-
- None identified that block this prompt's own scope. The primary forward consideration for Prompt 6 (structured fidelity evaluation) is how it will consume `ReferenceRuntimeBindingEvaluation.bindings` together with Prompt 3's per-requirement expectations to determine which selected requirements have sufficient bound evidence for evaluation — flagged for that prompt's own precedent review, not preempted here.
|
|
220
|
-
|
|
221
|
-
## Exact next action
|
|
222
|
-
|
|
223
|
-
v0.7 Prompt 6 — structured reference-vs-candidate fidelity evaluation.
|
|
1
|
+
# v0.7 Prompt 5 — Explicit Reference-Region ↔ Runtime-Target Binding
|
|
2
|
+
|
|
3
|
+
**VERDICT: PASS_V0_7_REFERENCE_BINDING_PROMPT5**
|
|
4
|
+
|
|
5
|
+
## Repository / branch / heads
|
|
6
|
+
|
|
7
|
+
- Repository: `my-frontend-observer` (path: `Z:\Users\newuser\Projects\my-frontend-observer`)
|
|
8
|
+
- Branch: `implementation/v0.7-reference-binding`, branched from the exact completed Prompt 4 HEAD
|
|
9
|
+
- Starting HEAD (this prompt's branch point): `023feccac2b4255a119282d359782691b4734bce` (Prompt 4 report commit)
|
|
10
|
+
- Prompt 4 base HEAD confirmed to contain both required commits: `4da60be` (implementation) and `023fecc` (report) — verified via `git log --oneline` before branching.
|
|
11
|
+
- Implementation commit (this prompt): `74cc148f6b4ccda1c2a394634a8e9d5de26285dd` — "Add v0.7 Prompt 5 explicit reference-region <-> runtime-target binding"
|
|
12
|
+
- Ending HEAD (after this report is committed): the report commit that follows this file's commit.
|
|
13
|
+
|
|
14
|
+
## Git status
|
|
15
|
+
|
|
16
|
+
Preflight (`git status --short`) showed a clean working tree on `implementation/v0.7-reference-compatibility` at the exact Prompt 4 report HEAD; `git stash list` showed exactly the one preserved Prompt 1 stray-fork-writes entry. The branch was created from that HEAD with `git checkout -b implementation/v0.7-reference-binding` and ancestry verified with `git merge-base --is-ancestor 023fecc HEAD`. No unrelated dirty state was present at any point; no reset/clean/discard operation was used; the Prompt 1 stash was neither applied nor dropped. Post-implementation `git status --short` is clean except for this report file (staged and committed separately, per convention).
|
|
17
|
+
|
|
18
|
+
## Tooling
|
|
19
|
+
|
|
20
|
+
- Resolved latest published `@dailephd/my-dev-kit`: `1.12.3` (via `npm view @dailephd/my-dev-kit version`), pinned exactly via `npx -y @dailephd/my-dev-kit@1.12.3`.
|
|
21
|
+
- Fresh Prompt 5 repository index built under a repository-local root (per this prompt's "project-contained workflow state" requirement, not `C:\`): `.my-dev-kit-context/index-prompt5/` (`manifest.json`, `symbol-index.json`, `code-graph.json`, `call-graph.json`; 56 files, 851 symbols indexed). This index was not reused from Prompt 1–4's indexes — a fresh retrieval was performed at execution start.
|
|
22
|
+
- `.gitignore` extended with `.my-dev-kit-context/` and `.my-dev-kit-workflow/` (alongside the pre-existing `.my-dev-kit/`/`.my-dev-kit-orchestrator/` entries) so this and future prompts' workflow-owned state never appears as stageable.
|
|
23
|
+
|
|
24
|
+
## Prompt 1–4 contracts verified
|
|
25
|
+
|
|
26
|
+
Read directly (source, not the fresh index's summaries alone) before writing any code:
|
|
27
|
+
|
|
28
|
+
- `src/domain/externalReference.ts` / `externalReferenceIdentity.ts` — confirmed `ExternalReferenceArtifact`'s `regions?`/`requirements?`/`applicability?` shape, both lifecycle variants, and `isValidExternalReferenceArtifact`'s existing structural gate (reused directly, not reimplemented).
|
|
29
|
+
- `src/domain/externalReferenceRegions.ts` — confirmed `ReferenceRegion.id` (Prompt 2's region identity: no separate identity-hashing function exists for regions, just the authored `id` string with `REFERENCE_REGION_ID_PATTERN` and case-insensitive uniqueness) — reused verbatim as the reference-side half of a binding declaration.
|
|
30
|
+
- `src/domain/externalReferenceRequirements.ts` — confirmed the exact precedent for "a reference to an unknown region id is a structural validation failure at authoring time, not a per-item unavailable result" (`regionIds`/`byId` lowercase-keyed lookups, `isValidReferenceRequirements` rejecting the whole collection on an unknown region reference), and the "no two requirements may share the same structural subject" duplicate/conflict rule — both reused as direct design precedent for binding-declaration validation.
|
|
31
|
+
- `src/domain/externalReferenceCompatibility.ts` (Prompt 4) — confirmed `evaluateReferenceCandidateCompatibility`'s exact signature and `ReferenceCandidateCompatibilityResult` shape; reused verbatim as this prompt's compatibility gate.
|
|
32
|
+
- `src/domain/comparisonEngine.ts` (v0.4) — confirmed the module-private `targetPresence(record): 'matched'|'not-found'|'ambiguous'|'unavailable'` helper, already the canonical rule v0.4's own before/after target comparison uses to read a `TargetEvidenceRecord`'s resolution outcome.
|
|
33
|
+
- `src/domain/schema.ts` (v0.1/v0.2) — confirmed `TargetSelectionStatus = 'matched'|'not-found'|'ambiguous'|'unavailable'`, `TargetResolution`, `TargetEvidenceRecord` (keyed by exact configured target name in `ObservationArtifact.targetEvidence`), and `TargetVisibility` (a wholly separate concept from `TargetSelectionStatus` — visibility is never one of the four resolution states).
|
|
34
|
+
- `src/request/request.ts` (v0.1/v0.2) — confirmed `NamedTarget { name, locators }` as the stable observer-owned runtime target identity, `TARGET_NAME_RE = /^[A-Za-z0-9_-]{1,64}$/` (private, mirrored independently rather than imported), and the case-insensitive target-name-resolution convention already used for `target-scroll-by`.
|
|
35
|
+
- `src/domain/boundedAgentContextCorrelation.ts` (v0.6) — read in full; confirmed the uncertainty-handling discipline (never hide competing candidates, never guess through ambiguity, deterministic candidate/target ordering by sorted id rather than input order, count-based status derivation: zero candidates → `unavailable`, one → `correlated`, more than one → `ambiguous`) reused as *architectural discipline* only — v0.6's own `correlated`/`ambiguous`/`unavailable` correlation-status vocabulary was deliberately **not** reused verbatim, since it describes a different evidence boundary (ranking static candidates for one runtime target) than binding (resolving one runtime target's own existence for one declared region correspondence).
|
|
36
|
+
|
|
37
|
+
## v0.2 runtime-target precedent
|
|
38
|
+
|
|
39
|
+
The stable runtime target identity is `NamedTarget.name` (a bounded `^[A-Za-z0-9_-]{1,64}$` label), matched against `ObservationArtifact.requestConfig.targets` and used to key `ObservationArtifact.targetEvidence`. This prompt binds only to that name — never to a CSS selector, a Playwright locator, a DOM node handle, a source file, a React component name, or a my-dev-kit node id. Target-name matching in `evaluateReferenceRuntimeBindings` is case-insensitive, mirroring the exact convention already used for `target-scroll-by` target resolution in `request/request.ts`; the exact configured `name` (original case) is then used to index `targetEvidence`, matching how that record is actually keyed by `src/browser/evidenceCapture.ts`.
|
|
40
|
+
|
|
41
|
+
## v0.6 uncertainty precedent
|
|
42
|
+
|
|
43
|
+
Reused as architectural discipline (never guess through ambiguity, never silently prefer a "first" candidate/result, deterministic ordering by declared/sorted identity rather than input order, explicit unavailable-vs-ambiguous distinction) — not as a literal status-vocabulary reuse. `evaluateReferenceRuntimeBindings` never collapses an ambiguous v0.2 target resolution into `bound`, and never fabricates a binding when the underlying evidence is missing.
|
|
44
|
+
|
|
45
|
+
## Binding model
|
|
46
|
+
|
|
47
|
+
One new pure domain module: `src/domain/externalReferenceRuntimeBinding.ts`.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
interface ReferenceRuntimeBindingDeclaration {
|
|
51
|
+
referenceRegion: string; // Prompt 2 ReferenceRegion.id
|
|
52
|
+
runtimeTarget: string; // v0.2 NamedTarget.name
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isValidReferenceRuntimeBindingDeclarations(
|
|
56
|
+
value: unknown,
|
|
57
|
+
reference: ExternalReferenceArtifact,
|
|
58
|
+
): { valid: true } | { valid: false; reason: string };
|
|
59
|
+
|
|
60
|
+
function evaluateReferenceRuntimeBindings(
|
|
61
|
+
reference: ExternalReferenceArtifact,
|
|
62
|
+
candidate: ObservationArtifact,
|
|
63
|
+
declarations: readonly ReferenceRuntimeBindingDeclaration[],
|
|
64
|
+
): { ok: true; evaluation: ReferenceRuntimeBindingEvaluation } | { ok: false; reason: string };
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The binding declaration is explicit user/configuration input at every point — the module contains no code path that derives a correspondence from geometry, pixel content, matching name strings, matching text, or source code. A reference region id and a runtime target name that happen to share the same string value bind to each other only when an explicit declaration says so (verified directly by a dedicated test comparing the same observation/reference pair with and without the declaration).
|
|
68
|
+
|
|
69
|
+
## Exact status vocabulary
|
|
70
|
+
|
|
71
|
+
`REFERENCE_RUNTIME_BINDING_STATUSES = ['bound', 'ambiguous', 'unavailable'] as const`. No fourth "incompatible" status was added — per the task's own guidance (§14), Prompt 4's compatibility is represented separately (see below), never folded into a binding-local status enum.
|
|
72
|
+
|
|
73
|
+
Reason codes (present only when `status !== 'bound'`): `runtime-target-not-configured`, `runtime-target-not-found`, `runtime-target-ambiguous`, `runtime-target-evidence-unavailable`.
|
|
74
|
+
|
|
75
|
+
## Compatibility-gating behavior
|
|
76
|
+
|
|
77
|
+
`evaluateReferenceRuntimeBindings` calls `evaluateReferenceCandidateCompatibility(reference, candidate)` exactly once, before evaluating any individual declaration. If the returned `compatibility.state === 'incomparable'`, the function returns `ok: true` with `bindings: []` and the full `compatibility` result embedded in `ReferenceRuntimeBindingEvaluation.compatibility` — the caller reads the blocker from that field. No per-declaration result is fabricated in this case (verified by behavior-F test: an incompatible viewport pair produces zero bindings, never a bound result). When `compatibility.state` is `comparable` or `comparable-with-warnings`, every declaration is evaluated normally. Compatibility rules (viewport/theme/application-state/authenticated-state comparison) are never recomputed or duplicated inside this module.
|
|
78
|
+
|
|
79
|
+
## Reference-region identity behavior
|
|
80
|
+
|
|
81
|
+
Reused exactly as Prompt 2 defined it: `ReferenceRegion.id`, matched case-insensitively (mirroring the existing region-uniqueness/requirement-region-reference convention). No new reference-region identity system was created. A declaration naming a `referenceRegion` not present in `reference.regions` (or a reference with no `regions` field at all) fails the **entire** evaluation closed at the structural-validation stage — `evaluateReferenceRuntimeBindings` returns `ok: false` before a candidate observation is even consulted, mirroring Prompt 3's exact "unknown region reference is a structural authoring-time failure" precedent for requirements.
|
|
82
|
+
|
|
83
|
+
## Runtime-target identity behavior
|
|
84
|
+
|
|
85
|
+
Reused exactly as v0.2 defined it: `NamedTarget.name`, matched case-insensitively against `candidate.requestConfig.targets`, then the exact configured name is used to index `candidate.targetEvidence`. Runtime-target *availability* (as opposed to reference-region *existence*) is evaluated per-candidate, inside `evaluateReferenceRuntimeBindings` itself, not during the candidate-independent structural validation pass — the same declaration can legitimately be `bound` against one candidate and `unavailable` against another.
|
|
86
|
+
|
|
87
|
+
## Target-resolution-state handling
|
|
88
|
+
|
|
89
|
+
`targetPresence` (v0.4 `comparisonEngine.ts`, additively exported this prompt alongside the already-exported `assessOptionalComparabilityDimension`) is the single reused rule for reading a `TargetEvidenceRecord`'s resolution:
|
|
90
|
+
|
|
91
|
+
| `targetPresence` outcome | Binding status | Reason code |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| `matched` | `bound` | — |
|
|
94
|
+
| `ambiguous` | `ambiguous` | `runtime-target-ambiguous` |
|
|
95
|
+
| `not-found` | `unavailable` | `runtime-target-not-found` |
|
|
96
|
+
| `unavailable` (no usable resolution evidence, or no record at all) | `unavailable` | `runtime-target-evidence-unavailable` |
|
|
97
|
+
|
|
98
|
+
A fifth situation exists only at the binding-evaluation boundary itself, not inside `targetPresence`: a declared `runtimeTarget` that was never part of the candidate's own `requestConfig.targets` at all → `unavailable` / `runtime-target-not-configured`, resolved without ever dynamically searching the page (the evaluator consumes only the already-captured `ObservationArtifact`).
|
|
99
|
+
|
|
100
|
+
## Hidden-target decision
|
|
101
|
+
|
|
102
|
+
A uniquely resolved (`matched`) but hidden target (`TargetVisibility.visible === false`) is still reported `bound` — visibility is carried only as provenance (`targetVisible`) and never changes `status`. Rationale, documented in the module and in `docs/CONTRACTS.md`: binding identity ("does a stable correspondence exist") and fidelity evaluability ("can this evidence actually be used to check the design") are distinct questions; this prompt answers only the former, leaving the latter to Prompt 6. Verified by a dedicated test (`Q: a hidden but uniquely resolved runtime target is still reported bound, with targetVisible: false as provenance`).
|
|
103
|
+
|
|
104
|
+
## Duplicate/conflicting binding behavior
|
|
105
|
+
|
|
106
|
+
No two declarations may name the same `referenceRegion` (case-insensitively), whether their `runtimeTarget` values agree (an exact duplicate) or disagree (a conflict) — both fail the whole batch identically at structural-validation time, `ok: false`, never silently resolved by keeping the first declaration. This mirrors Prompt 3's "no two requirements may share the same structural subject, regardless of category" rule exactly. Verified by dedicated tests for both the exact-duplicate case (I) and the conflicting-target case (J).
|
|
107
|
+
|
|
108
|
+
## Multiple-regions-to-one-target decision
|
|
109
|
+
|
|
110
|
+
**Allowed, deliberately.** Several distinct reference regions may each declare a binding to the same `runtimeTarget` (e.g. two design sub-regions, such as a header's logo area and its nav area, both corresponding conceptually to one runtime container element). This is documented as a legitimate correspondence, unlike the reverse (one region needing several runtime targets), which is prohibited because it would be inherently ambiguous which target represents that region — the "one region, one explicit primary target" rule from §13. Verified by a dedicated test (K).
|
|
111
|
+
|
|
112
|
+
## Bounds
|
|
113
|
+
|
|
114
|
+
`MAX_REFERENCE_RUNTIME_BINDINGS = 20`, mirroring `MAX_REFERENCE_REGIONS`'s existing bound — a binding-declaration collection is authoring input over the same region set, so the same cap applies. Independently owned (not imported), consistent with the repository's established "coincidentally equal, independently owned bound" convention (e.g. `MAX_REFERENCE_REGIONS`/`MAX_TARGETS` already share the value 20 without being structurally coupled). Verified: exactly 20 declarations accepted, 21 rejected.
|
|
115
|
+
|
|
116
|
+
## Deterministic ordering
|
|
117
|
+
|
|
118
|
+
`bindings` in the evaluation result preserves the authored order of the `declarations` array passed in — never a sort by any derived key, mirroring the "authored order is semantic" convention already established for regions (Prompt 2) and requirements (Prompt 3). Verified by a dedicated test asserting result order matches declaration order even when it does not match the reference's own region-authoring order.
|
|
119
|
+
|
|
120
|
+
## Identity decision
|
|
121
|
+
|
|
122
|
+
**No new identity-hashing function was introduced.** Unlike `buildRequestIdentity`/`buildExternalReferenceRequestIdentity`, no deterministic content-hash identity is computed for a binding declaration or its evaluated result. This mirrors Prompt 4's own `ReferenceCandidateCompatibilityResult`, which took the identical approach: provenance is carried as plain, already-deterministic fields (`referenceId`, `referenceRequestId`, `candidateObservationId`, `candidateRequestId`, plus each result's own `referenceRegion`/`runtimeTarget`) rather than a fifth hashing convention for a value this prompt never persists and never looks up by id. Because no identity function exists, path-independence (test L in the task's behavior model) holds trivially — there is no file-loading code in this prompt at all (see CLI decision below), so no path could ever reach identity even indirectly.
|
|
123
|
+
|
|
124
|
+
## Persistence decision
|
|
125
|
+
|
|
126
|
+
**No persisted artifact family was introduced.** `evaluateReferenceRuntimeBindings` is a pure, synchronous, on-demand function over an already-persisted `ExternalReferenceArtifact`, an already-persisted `ObservationArtifact`, and an in-memory declaration collection — it produces no `ExternalReferenceBindingArtifact` or equivalent. Rationale (same reasoning Prompt 4 already applied to its own compatibility result): the result is cheap to recompute deterministically from its three inputs, and persisting it would invite drift (a re-imported reference or re-observed candidate could silently disagree with a stale persisted binding record) with no corresponding benefit at this stage. This decision may be revisited only if Prompt 6's architecture proves persistence necessary — not assumed here.
|
|
127
|
+
|
|
128
|
+
## Reference / observation artifact immutability
|
|
129
|
+
|
|
130
|
+
Neither `ExternalReferenceArtifact` nor `ObservationArtifact` gained any new field in this prompt, and `evaluateReferenceRuntimeBindings` never mutates either input (verified by a dedicated deep-equality-snapshot test, N, covering the reference, the candidate, and the declaration input array all three). A design reference remains evaluable against multiple future candidates; a candidate observation remains evaluable against multiple future references — binding results are kept as downstream, candidate-specific, reference-specific derived evidence, never embedded back into either source artifact.
|
|
131
|
+
|
|
132
|
+
## Public / programmatic interface
|
|
133
|
+
|
|
134
|
+
Exported from `src/index.ts` (additive):
|
|
135
|
+
- Types: `ReferenceRuntimeBindingStatus`, `ReferenceRuntimeBindingReasonCode`, `ReferenceRuntimeBindingDeclaration`, `ReferenceRuntimeBindingValidationResult`, `ReferenceRuntimeBindingResult`, `ReferenceRuntimeBindingEvaluation`, `EvaluateReferenceRuntimeBindingsResult`.
|
|
136
|
+
- Values: `RUNTIME_TARGET_NAME_PATTERN`, `MAX_REFERENCE_RUNTIME_BINDINGS`, `REFERENCE_RUNTIME_BINDING_STATUSES`, `REFERENCE_RUNTIME_BINDING_REASON_CODES`, `isValidReferenceRuntimeBindingDeclarations`, `evaluateReferenceRuntimeBindings`.
|
|
137
|
+
- Additionally, `TargetPresence`/`targetPresence` (previously module-private in `comparisonEngine.ts`) are now additively exported, since this new module reuses that exact function rather than duplicating its logic.
|
|
138
|
+
|
|
139
|
+
No internal helper clutter is exported (`findConfiguredTargetName`, `evaluateOneBinding`, `isValidBindingDeclarationShape` all remain module-private).
|
|
140
|
+
|
|
141
|
+
## CLI changes
|
|
142
|
+
|
|
143
|
+
**None.** Per the task's explicit guidance (§37: "Do not add a standalone CLI command merely for symmetry... Prompt 6 may become the first public consumer"), no CLI command or config-file loader was added this prompt. The full capability is exposed only through the programmatic API above. `docs/COMMANDS.md` was therefore not touched.
|
|
144
|
+
|
|
145
|
+
## Files changed
|
|
146
|
+
|
|
147
|
+
New:
|
|
148
|
+
- `src/domain/externalReferenceRuntimeBinding.ts`
|
|
149
|
+
- `tests/unit/externalReferenceRuntimeBinding.test.ts`
|
|
150
|
+
|
|
151
|
+
Modified:
|
|
152
|
+
- `src/domain/comparisonEngine.ts` (additively exported `targetPresence`/`TargetPresence`, previously module-private; zero behavior change)
|
|
153
|
+
- `src/index.ts` (public export surface for the above)
|
|
154
|
+
- `docs/ARCHITECTURE.md`, `docs/CONTRACTS.md`, `docs/WORKFLOWS.md`
|
|
155
|
+
- `.gitignore` (added `.my-dev-kit-context/`, `.my-dev-kit-workflow/`)
|
|
156
|
+
|
|
157
|
+
## Tests
|
|
158
|
+
|
|
159
|
+
889 unit tests total (857 pre-existing + 32 new), all pure domain-level tests — zero Chromium launches for binding evaluation itself, per the task's explicit requirement. New coverage in `tests/unit/externalReferenceRuntimeBinding.test.ts` includes:
|
|
160
|
+
|
|
161
|
+
- `isValidReferenceRuntimeBindingDeclarations`: valid single/empty declaration, non-array rejection, exact-bound acceptance (20) and one-over-bound rejection (21), malformed shape rejection (missing field/wrong type/unknown field), unknown reference region (behavior B), reference with no regions at all (behavior O), exact-duplicate rejection (behavior I), conflicting-target rejection (behavior J), multiple-regions-to-one-target acceptance (behavior K), unused-region tolerance (behavior P), case-insensitive region matching.
|
|
162
|
+
- `evaluateReferenceRuntimeBindings`: valid binding with differing ids (behaviors A/H), same-string-ids-require-explicit-declaration (behavior G, both with and without the declaration), unknown-region whole-batch failure (behavior B), unknown/not-configured runtime target (behavior C), ambiguous runtime target (behavior D), not-found vs. evidence-unavailable distinction, incompatible reference/candidate blocks all bindings (behavior F), matching compatibility permits evaluation, hidden-target bound-with-provenance (behavior Q), deterministic authored-order preservation and pure-function repeatability (behavior M), full three-input immutability (behavior N), case-insensitive runtime-target-name resolution, full provenance carry-through, fail-closed on a structurally invalid reference or candidate artifact, and absence of any source-ownership-style field in the result (`sourceOwner`/`sourceFile`/`component`/`symbol`/`causedBy`).
|
|
163
|
+
|
|
164
|
+
## Validation results
|
|
165
|
+
|
|
166
|
+
All commands run from the repository root, after the implementation commit:
|
|
167
|
+
|
|
168
|
+
- `npm run typecheck` — pass, zero errors.
|
|
169
|
+
- `npm run lint` — pass, zero errors/warnings.
|
|
170
|
+
- `npm test` — 46 test files, 889 tests, all pass.
|
|
171
|
+
- `npm run build` — pass, clean `tsc` compile.
|
|
172
|
+
- `npm run check:docs` — pass (17 required files present, `ROADMAP.md` format intact — no implementation batches added).
|
|
173
|
+
- `git diff --check` — exit 0, no whitespace errors.
|
|
174
|
+
- `npm pack --dry-run` — pass; `dist/domain/externalReferenceRuntimeBinding.{js,d.ts,js.map}` confirmed present in the tarball listing (public exports changed, so this was run per the task's requirement).
|
|
175
|
+
- `npm run test:security` — pass (5 + 63 = 68 tests: `policy.test.ts` + real-Chromium `chromiumAdapter.test.ts`), run because a new public input surface (`ReferenceRuntimeBindingDeclaration`) was added.
|
|
176
|
+
- `npm run test:browser` — pass (9 files, 120 tests, real Chromium), run as full regression confirmation per established repository policy, even though Prompt 5 itself has no Chromium dependency.
|
|
177
|
+
|
|
178
|
+
## Regression results
|
|
179
|
+
|
|
180
|
+
- Prompt 1 artifact/lifecycle: unaffected — `externalReference.ts` untouched this prompt.
|
|
181
|
+
- Prompt 2 regions/relationships: unaffected — `externalReferenceRegions.ts`/`externalReferenceRegionRelationships.ts` untouched; `REFERENCE_REGION_ID_PATTERN` only imported, never modified.
|
|
182
|
+
- Prompt 3 requirements/adequacy: unaffected — `externalReferenceRequirements.ts` untouched.
|
|
183
|
+
- Prompt 4 state/compatibility: unaffected — `externalReferenceCompatibility.ts`, `explicitState.ts`, `externalReferenceApplicability.ts` untouched; `evaluateReferenceCandidateCompatibility` called, never modified.
|
|
184
|
+
- v0.2 runtime target identity/resolution: unaffected — `request/request.ts`, `schema.ts`, `browser/evidenceCapture.ts` untouched.
|
|
185
|
+
- v0.4 comparison: unaffected in behavior — `comparisonEngine.ts`'s only change is exporting a previously-private function (`targetPresence`) verbatim; every existing caller and every existing test of `evaluateComparability`/`compareObservations`/`compareTargetConfiguration` continues to pass unchanged.
|
|
186
|
+
- v0.5 contracts: unaffected — no file in `frontendContracts*.ts` touched.
|
|
187
|
+
- v0.6 runtime/static correlation: unaffected — `boundedAgentContext*.ts` untouched; its status vocabulary/discipline was read for precedent only, never imported or modified.
|
|
188
|
+
- Full unit (889/889), browser (120/120), and security (68/68) suites all pass with zero regressions.
|
|
189
|
+
|
|
190
|
+
## Security impact
|
|
191
|
+
|
|
192
|
+
- No new external input surface beyond an in-memory, caller-supplied declaration array (no file, no CLI flag, no network call in this prompt) — the smallest possible surface, since no CLI/config-file loader was added.
|
|
193
|
+
- `evaluateReferenceRuntimeBindings` performs no filesystem access, no network access, and no browser/Chromium invocation of any kind.
|
|
194
|
+
- `test:security` (policy + real-Chromium adapter tests) re-run and passing, confirming no regression to the existing safety/navigation policy surface (untouched by this prompt).
|
|
195
|
+
|
|
196
|
+
## Documentation changes
|
|
197
|
+
|
|
198
|
+
- `docs/CONTRACTS.md` — new "v0.7 Prompt 5 explicit reference-region ↔ runtime-target binding" section (full type shapes, key rules, status-mapping table equivalent in prose, hidden-target/duplicate/multiple-regions decisions, persistence/identity decisions, CLI-surface decision).
|
|
199
|
+
- `docs/ARCHITECTURE.md` — new paragraph in the "Planned v0.7–v0.10" section describing the Prompt 5 module addition, its reuse of Prompt 4's compatibility gate and v0.4's `targetPresence`, and its architectural-discipline-only (not vocabulary) reuse of v0.6's uncertainty handling.
|
|
200
|
+
- `docs/WORKFLOWS.md` — "Current external-reference foundation workflow" retitled to "Prompts 1-5" and extended with a paragraph describing `evaluateReferenceRuntimeBindings`.
|
|
201
|
+
- `docs/COMMANDS.md` — not touched (no CLI surface change this prompt).
|
|
202
|
+
|
|
203
|
+
## Tooling incidents
|
|
204
|
+
|
|
205
|
+
None. No orchestrator was invoked (direct-implementation mode used throughout, consistent with Prompts 2–5); no background/speculative subagent writes occurred; the Prompt 1 stray-fork-writes stash remains untouched, unapplied, and unmined as precedent.
|
|
206
|
+
|
|
207
|
+
## Out-of-scope confirmation
|
|
208
|
+
|
|
209
|
+
This prompt implements no automatic target matching, no computer vision, no screenshot segmentation, no OCR, no fuzzy matching, no geometry-based matching, no source-correlation changes, no source ownership, no reference/candidate geometry delta, no spacing delta, no relationship fidelity evaluation, no selected-requirement evaluation, no fidelity PASS/FAIL, no style fidelity, no image similarity, no bounded correction packet, no coding-agent context changes or invocation, no source edits, no correction loop, no viewer, and no annotation. `evaluateReferenceRuntimeBindings` reads only `reference.regions` (for structural validation), `reference.applicability` (via the reused compatibility gate), and `candidate.requestConfig.targets`/`candidate.targetEvidence` — it never reads `reference.requirements`, never compares geometry, and never touches source code or my-dev-kit retrieval of any kind.
|
|
210
|
+
|
|
211
|
+
## Known limitations
|
|
212
|
+
|
|
213
|
+
- A binding declaration supports exactly one `runtimeTarget` per `referenceRegion` — there is no "candidate alternatives" mechanism (deliberately; the task's own guidance treats this as the smallest, cleanest representation, and any future need for ranked/multiple candidate targets per region is left to a later prompt to design explicitly, not improvised here).
|
|
214
|
+
- No CLI/config-file surface exists yet for authoring binding declarations outside of direct programmatic use — deferred to Prompt 6 per the task's own guidance.
|
|
215
|
+
- `targetVisible` provenance is populated only when the underlying `TargetVisibility` evidence is itself available; a `bound` result for a target whose visibility evidence is unavailable simply omits the field rather than guessing a value.
|
|
216
|
+
|
|
217
|
+
## Remaining risks
|
|
218
|
+
|
|
219
|
+
- None identified that block this prompt's own scope. The primary forward consideration for Prompt 6 (structured fidelity evaluation) is how it will consume `ReferenceRuntimeBindingEvaluation.bindings` together with Prompt 3's per-requirement expectations to determine which selected requirements have sufficient bound evidence for evaluation — flagged for that prompt's own precedent review, not preempted here.
|
|
220
|
+
|
|
221
|
+
## Exact next action
|
|
222
|
+
|
|
223
|
+
v0.7 Prompt 6 — structured reference-vs-candidate fidelity evaluation.
|