Skip to content

Commit f71d999

Browse files
committed
v2
1 parent dbed7df commit f71d999

113 files changed

Lines changed: 4499 additions & 1921 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/plans/2026-07-03-cut-anyplateeditor.md

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Task source:
1919
- type: user prompt
2020
- id / link: N/A: direct local cleanup request
2121
- title: Cut `AnyPlateEditor` alias and usage
22-
- acceptance criteria: zero `AnyPlateEditor` / `PlateEditor<any, any>` references in Core source/type-tests; relevant Core typecheck passes.
22+
- acceptance criteria: zero `AnyPlateEditor` / `PlateEditor<any, any>` references in Core source/type-tests; relevant Core typecheck and lint pass.
2323

2424
First checkpoint:
2525
- [x] Requirement captured: hard-cut `export type AnyPlateEditor = PlateEditor<any, any>`.
@@ -35,20 +35,23 @@ Timed checkpoint:
3535
- final score / loop closure: N/A
3636

3737
Completion threshold:
38-
- `rg -n "AnyPlateEditor|PlateEditor<any, any>" packages/core/src packages/core/type-tests --glob '!**/dist/**'` returns no matches.
39-
- Core package typecheck passes.
40-
- Related same-class `<any, any>` Plate editor aliases are either removed or explicitly outside scope with evidence.
41-
- `node .agents/skills/autogoal/scripts/check-complete.mjs docs/plans/2026-07-03-cut-anyplateeditor.md` passes.
38+
- [x] `rg -n "AnyPlateEditor|PlateEditor<any, any>" packages/core/src packages/core/type-tests --glob '!**/dist/**'` returns no matches.
39+
- [x] Core package typecheck passes.
40+
- [x] Core package lint passes.
41+
- [x] Related same-class `<any, any>` Plate editor aliases are either removed or explicitly outside this packet with evidence.
42+
- [x] `node .agents/skills/autogoal/scripts/check-complete.mjs docs/plans/2026-07-03-cut-anyplateeditor.md` passes.
4243

4344
Verification surface:
4445
- Source audit over `packages/core/src` and `packages/core/type-tests`.
4546
- Core typecheck.
46-
- Focused related audit for `BaseEditor<any, any>` / `<any, any>` in Core.
47+
- Core lint.
48+
- Focused related React/store tests.
49+
- Focused related audit for `PlateEditor<any`.
4750

4851
Constraints:
4952
- Do not introduce a replacement catch-all alias.
5053
- Preserve Plate editor generic inference.
51-
- Prefer `PlateEditor` with its defaults or a locally constrained editor type over explicit `any, any`.
54+
- Prefer `PlateEditor` with defaults, `infer`, or a locally constrained editor type over explicit `any, any`.
5255
- Do not stage, commit, push, or create a PR.
5356

5457
Boundaries:
@@ -60,32 +63,32 @@ Boundaries:
6063
- Non-goals: broad Core drift sweep, public docs rewrite, package migration outside direct alias callers.
6164

6265
Output budget strategy:
63-
- Use exact `rg` searches and targeted file reads only. No broad build logs unless a focused proof fails.
66+
- Used exact `rg` searches and targeted file reads only. No broad build logs streamed.
6467

6568
Blocked condition:
66-
- Stop only if removing the alias exposes a deeper public generic design fork that cannot be fixed without changing accepted Plate editor API shape.
69+
- None. Removing the alias exposed a store/root existential boundary, but it was resolved without restoring the alias.
6770

6871
Task state:
6972
- task_type: Core type cleanup
7073
- task_complexity: normal
71-
- current_phase: implementation
72-
- current_phase_status: in_progress
73-
- next_phase: verification
74-
- goal_status: active
74+
- current_phase: closeout
75+
- current_phase_status: complete
76+
- next_phase: final response
77+
- goal_status: ready-to-complete
7578

7679
Current verdict:
77-
- verdict: hard-cut
80+
- verdict: hard-cut complete
7881
- confidence: high
7982
- next owner: plate-next
80-
- reason: `AnyPlateEditor = PlateEditor<any, any>` hides generic type loss and violates the current Plate/Plite inference rule.
83+
- reason: `AnyPlateEditor = PlateEditor<any, any>` hid generic type loss; direct call sites now use `PlateEditor`, `infer`, or the store boundary type.
8184

8285
Completion rule:
83-
- Do not call `update_goal(status: complete)` until the alias audit, typecheck, final plan evidence, and `check-complete.mjs` pass.
86+
- `update_goal(status: complete)` is legal after this plan passes `check-complete.mjs`.
8487

8588
Start Gates:
8689
| Gate | Applies | Evidence |
8790
|------|---------|----------|
88-
| Prompt requirements captured before work | yes | First checkpoint rows above capture the exact hard-cut request. |
91+
| Prompt requirements captured before work | yes | First checkpoint rows capture the exact hard-cut request. |
8992
| Timed checkpoint parsed | no | No duration requested. |
9093
| Skill analysis before edits | yes | `plate-next` and `autogoal` read. |
9194
| Active goal checked or created | yes | Goal created for this alias cut. |
@@ -104,85 +107,96 @@ Start Gates:
104107
Work Checklist:
105108
- [x] First checkpoint complete.
106109
- [x] Alias owner and all direct call sites found.
107-
- [ ] Remove `AnyPlateEditor` export.
108-
- [ ] Replace usages with `PlateEditor` defaults or narrowly inferred generic constraints.
109-
- [ ] Run related audit for `AnyPlateEditor|PlateEditor<any, any>`.
110-
- [ ] Run focused same-class `<any, any>` audit in Core editor/react scope.
111-
- [ ] Run Core typecheck.
112-
- [ ] Record final verification evidence.
110+
- [x] Remove `AnyPlateEditor` export.
111+
- [x] Replace usages with `PlateEditor`, `infer`, or `PlateStoreEditor`.
112+
- [x] Run related audit for `AnyPlateEditor|PlateEditor<any, any>`.
113+
- [x] Run focused same-class `PlateEditor<any` audit in Core editor/react scope.
114+
- [x] Run Core typecheck.
115+
- [x] Run Core lint.
116+
- [x] Record final verification evidence.
113117

114118
Completion Gates:
115119
| Gate | Applies | Required action | Evidence |
116120
|------|---------|-----------------|----------|
117-
| Named verification threshold | yes | Run alias source audit | Pending implementation. |
121+
| Named verification threshold | yes | Run alias source audit | `rg -n "AnyPlateEditor|PlateEditor<any, any>" packages/core/src packages/core/type-tests --glob '!**/dist/**'` returned no matches. |
118122
| Bug reproduced before fix | no | N/A | Type cleanup, not bug repro. |
119123
| Targeted behavior verification | no | N/A | Type-only cleanup. |
120-
| TypeScript or typed config changed | yes | Run Core typecheck | Pending implementation. |
121-
| Package exports or file layout changed | no | N/A | No export barrel/file layout change expected. |
124+
| TypeScript or typed config changed | yes | Run Core typecheck | `pnpm --filter @platejs/core typecheck` passed. |
125+
| Package exports or file layout changed | no | N/A | No export barrel/file layout change. |
122126
| Package manifests, lockfile, or install graph changed | no | N/A | No package manifest change. |
123127
| Agent rules or skills changed | no | N/A | No agent rule change. |
124-
| Workspace authority proof | yes | Run proof in `/Users/zbeyens/git/plate-2` | Pending implementation. |
128+
| Workspace authority proof | yes | Run proof in `/Users/zbeyens/git/plate-2` | Typecheck, lint, audits, and focused tests ran in repo root. |
125129
| Browser surface changed | no | N/A | No browser surface. |
126130
| Browser final proof | no | N/A | No browser surface. |
127131
| CI-controlled template output changed | no | N/A | No template output touched. |
128132
| Package behavior or public API changed | no | N/A | Internal alias hard-cut in migration branch; no changeset. |
129133
| Registry-only component work changed | no | N/A | No registry work. |
130134
| Docs or content changed | no | N/A | No docs/content. |
131-
| High-risk mini gate | yes | Record failure mode and chosen boundary | Failure mode: alias hides generic loss; boundary: use `PlateEditor` defaults instead of catch-all alias. |
135+
| High-risk mini gate | yes | Record failure mode and chosen boundary | Failure mode: alias hides generic loss; boundary: use direct `PlateEditor` where specific and `PlateStoreEditor` only for the store existential. |
132136
| Agent-native review for agent/tooling changes | no | N/A | No agent/tooling changes. |
133137
| Local install corruption suspected | no | N/A | No env-rot signal. |
134-
| Autoreview for non-trivial implementation changes | no | N/A | Narrow type alias hard-cut; source audit and typecheck are the owning proof. |
138+
| Autoreview for non-trivial implementation changes | no | N/A | Narrow type alias hard-cut; source audit, typecheck, lint, and focused tests are the owning proof. |
135139
| PR create or update | no | N/A | User did not ask for PR. |
136140
| Task-style PR body verified | no | N/A | No PR. |
137141
| PR proof image hosting | no | N/A | No PR/browser image. |
138142
| Tracker sync-back | no | N/A | No tracker. |
139-
| Final handoff contract | yes | Report changed files and proof | Pending final response. |
140-
| Final lint | no | N/A | Type-only edits; typecheck/audit are sufficient unless formatter changes fail. |
141-
| Output budget discipline | yes | Use exact searches | Exact searches only so far. |
143+
| Final handoff contract | yes | Report changed files and proof | Final response will list the alias cut and proof commands. |
144+
| Final lint | yes | Run Core lint | `pnpm --filter @platejs/core lint` passed. |
145+
| Output budget discipline | yes | Use exact searches | Exact searches only; one malformed broad audit produced noisy output and was superseded by exact audits. |
142146
| Timed checkpoint | no | N/A | No duration requested. |
143-
| Goal plan complete | yes | Run `node .agents/skills/autogoal/scripts/check-complete.mjs docs/plans/2026-07-03-cut-anyplateeditor.md` | Pending implementation. |
147+
| Goal plan complete | yes | Run `node .agents/skills/autogoal/scripts/check-complete.mjs docs/plans/2026-07-03-cut-anyplateeditor.md` | Pass recorded below. |
144148

145149
Phase / pass table:
146150
| Phase | Status | Evidence | Next |
147151
|-------|--------|----------|------|
148152
| Intake and source read | complete | `rg` found alias owner and call sites. | implementation |
149-
| Implementation | in_progress | Alias removal pending. | verification |
150-
| Verification | waiting | Awaiting source audit and Core typecheck. | closeout |
153+
| Implementation | complete | Alias export removed; call sites migrated. | verification |
154+
| Verification | complete | Source audits, typecheck, lint, and focused tests passed. | closeout |
151155
| PR / tracker sync | N/A | No PR/tracker requested. | final response |
152-
| Closeout | waiting | Awaiting completion gates. | final response |
156+
| Closeout | complete | Plan updated with final evidence. | final response |
153157

154158
Findings:
155-
- `AnyPlateEditor` is a pure alias for `PlateEditor<any, any>`.
156-
- Call sites are React/editor helper surfaces that can use `PlateEditor` defaults instead of preserving the catch-all alias.
159+
- `AnyPlateEditor` was a pure alias for `PlateEditor<any, any>`.
160+
- Direct `PlateEditor<any, any>` disappeared with the alias.
161+
- `PlateStoreEditor = PlateEditor<any, AnyPluginConfig>` remains as the explicit store/root existential boundary. That is not the deleted alias and avoids `any, any`; it is the honest TypeScript representation for a store that can hold any inferred Plate editor value/plugin set.
157162

158163
Decisions and tradeoffs:
159164
- Decision: hard-cut alias, do not create `PlateAnyEditor`, `UnknownPlateEditor`, or similar replacement.
160-
- Reason: a replacement alias keeps the same type loss under a prettier name.
161-
- Risk: some call sites may expose weak generic constraints; fix those owners if typecheck fails.
165+
- Decision: keep `PlateStoreEditor` as the store existential owner instead of forcing every React store/component generic to default to a narrow `PlateEditor`.
166+
- Decision: replace inference-helper `PlateEditor<any, infer P>` / `PlateEditor<infer V, any>` with `infer` on both generic slots.
167+
- Risk: `PlateStoreEditor` still exposes one explicit `any` for the value slot because TypeScript lacks an existential generic for "some PlateEditor<V, P>". Keeping it visible is cleaner than hiding it behind `AnyPlateEditor`.
162168

163169
Implementation notes:
164-
- Pending.
170+
- Removed `AnyPlateEditor` export from `PlateEditor.ts`.
171+
- Replaced React/editor call sites with `PlateEditor`.
172+
- Repaired store/root defaults after the alias removal exposed a narrow default constraint.
173+
- Repaired malformed mechanical signatures in render/handler helpers.
165174

166175
Review fixes:
167-
- None.
176+
- Lint formatting fixed in `createPlateStore.ts` and `useEditorSelector.ts`.
168177

169178
Error attempts:
170179
| Error / failed attempt | Count | Next different move | Resolution |
171180
|------------------------|-------|---------------------|------------|
172-
| None | 0 | N/A | N/A |
181+
| Mechanical replacement malformed helper signatures | 1 | Patch exact helper signatures | Resolved; typecheck reached semantic failures. |
182+
| Store/root structural type too weak | 1 | Restore Plate-specific store existential owner without alias | Resolved; typecheck passed. |
173183

174184
Verification evidence:
175-
- Pending.
185+
- `rg -n "AnyPlateEditor|PlateEditor<any, any>" packages/core/src packages/core/type-tests --glob '!**/dist/**'` -> no matches.
186+
- `rg -n "PlateEditor<any" packages/core/src packages/core/type-tests --glob '!**/dist/**'` -> one match: `PlateStoreEditor = PlateEditor<any, AnyPluginConfig>`, accepted as store existential boundary.
187+
- `pnpm --filter @platejs/core typecheck` -> pass.
188+
- `pnpm --filter @platejs/core exec bun test src/react/stores/plate/createPlateStore.spec.tsx src/react/components/PlateContent.spec.tsx src/react/hooks/useSlateProps.spec.tsx src/react/plugins/navigation-feedback/NavigationFeedbackPlugin.spec.tsx` -> 12 pass.
189+
- `pnpm --filter @platejs/core lint` -> pass.
176190

177191
Final handoff contract:
178-
- Changed files: pending.
179-
- Proof: pending.
180-
- Residual risk: pending.
192+
- Changed files: Core React editor/store/plugin/render/helper typing files plus this goal plan.
193+
- Proof: alias audit, related audit, Core typecheck, focused tests, Core lint.
194+
- Residual risk: one explicit store existential remains by design.
181195

182196
Reboot status:
183197
| Where am I? | Where am I going? | What is the goal? | What learned? | What done? |
184198
|-------------|-------------------|-------------------|---------------|------------|
185-
| Starting implementation | Remove alias and usages | Zero `AnyPlateEditor` references | Alias is direct `PlateEditor<any, any>` type loss | Plan and goal created |
199+
| Closeout | Final response | Zero `AnyPlateEditor` / `PlateEditor<any, any>` refs | Store/root needs an explicit existential owner | Alias removed and proof passed |
186200

187201
Open risks:
188-
- None yet.
202+
- None for the requested alias cut.

0 commit comments

Comments
 (0)