146 lines
10 KiB
Markdown
146 lines
10 KiB
Markdown
# Context Intent task 67: implementation checkpoint
|
|
|
|
Status: partial implementation, not ready for acceptance. No task-67 migration,
|
|
database change or deployment has been performed. The task remains incomplete.
|
|
The former schema-release blocker is resolved: use the installed controller route
|
|
and `Docs/Deployment/AutomaticDevelopment.md` under standing Development authority.
|
|
Do not request individual routine Development SQL approval.
|
|
|
|
## Implemented preparation
|
|
|
|
`PlotLine/Services/Context/ContextIntentText.cs` is a pure shared server utility:
|
|
|
|
- Paste preparation accepts ordinary lines, bullets, numbered lists and checked or
|
|
unchecked Markdown checkboxes. It preserves order and repeated objectives, rejects
|
|
oversized input without truncation, and returns editable-preview data. A pasted
|
|
check is a requested manual state for preview, never persisted completion.
|
|
- Palette preparation merges appearances by supplied identity key, unions names,
|
|
aliases and provenance, and keeps different identities with the same label apart.
|
|
- Matching examines only the supplied changed passage, uses exact case-insensitive
|
|
names/aliases with Unicode word boundaries, prefers the longest overlapping
|
|
phrase and returns all identities for shared spellings. It neither confirms a
|
|
candidate nor creates facts, knowledge, relationships, events or completion.
|
|
- Offsets describe the exact supplied passage in UTF-16; they are not Word positions.
|
|
Callers must supply authorised identities and encode text when rendering.
|
|
|
|
The regression harness includes `ContextIntentTextTests`, also available with
|
|
`dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --context-intent-text`.
|
|
The existing `NameTextMatcher` is a different, normalised manuscript-wide name
|
|
verification search: it does not preserve exact original passage offsets or select
|
|
longest overlapping multi-entity matches. Intent preparation does not invoke that
|
|
paid verification workflow or change its contracts.
|
|
|
|
There is no Context endpoint, palette data loader, UI or persistence wired to this
|
|
utility yet. Passing these tests does not establish feature acceptance.
|
|
|
|
## Shared draft editing preparation (2 December 2026)
|
|
|
|
`ContextIntentDraft` implements unsaved author operations for reuse by Context and
|
|
Writer. It is not registered with an endpoint or presented as a working feature.
|
|
It supports atomic reviewed-paste addition, explicit manual completion without
|
|
prose, editing/changed flag/notes, stable-key reorder/removal, identity-selected
|
|
entity links and independent covered state, and scoped quote evidence with an
|
|
explicit completion choice. It never calls matching, facts, relationship/event
|
|
creation, AI, manuscript navigation, sync or candidate acceptance.
|
|
|
|
Snapshots defensively copy attachment collections. Invalid edits, paste batches
|
|
and evidence leave existing work intact. Bounds cover items, text, notes, links
|
|
and evidence. Evidence is restricted to the draft book/chapter and optional scene;
|
|
accepted revision and paragraph identities remain opaque optional source labels.
|
|
The persistence/editor adapter still must verify those labels and canonical scope
|
|
against accepted server data rather than trusting a client submission. A palette
|
|
passed to `LinkEntity` must already be authorised; persistence must independently
|
|
revalidate every identity. No authorisation is implied by this pure helper.
|
|
|
|
`ContextIntentDraftTests` exercises state transitions including ambiguous names,
|
|
link/coverage/completion separation, scope rejection, invalid-batch atomicity,
|
|
reorder identity, attachment bounds and defensive copies. Focused invocation:
|
|
`dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --context-intent-draft`.
|
|
The full harness includes it as well.
|
|
|
|
## Concrete storage proposal for the remaining implementation
|
|
|
|
Keep `ChapterGoals` and existing scene purpose/outcome fields authoritative. Keep
|
|
the existing `SceneChecklistItems` identities for scene objectives; do not copy them
|
|
into an independent Intent document. Extend that checklist to support chapter items:
|
|
|
|
| Concern | Proposed contract |
|
|
| --- | --- |
|
|
| Scope | Nullable `SceneID` plus nullable `ChapterID`, exactly one populated. Existing scene rows remain unchanged. Chapter rows reference the canonical chapter. |
|
|
| Text/order/completion | Reuse `ItemText` (300 characters), `SortOrder`, `IsCompleted` and the existing item identity. Preserve author order across completion changes. |
|
|
| Change/notes | Add an explicit changed flag and optional author notes. Changing an item never silently completes it. |
|
|
| Entity links | Separate child rows keyed by item, entity kind and canonical/candidate identity, with explicit covered state. Link and covered are distinct from item completion. Validate each identity in the authorised project/book at save time. |
|
|
| Passage evidence | Separate child rows containing source book/chapter/scene, accepted revision/paragraph identity when available and the quoted passage. Retain evidence as author evidence if a later manuscript revision changes it; do not reinterpret it as a fact. |
|
|
| Concurrency | Atomic stored-procedure saves with a scope/row fingerprint that also detects changes by existing Writer and scene editors. Stale saves retain the local draft and require reconciliation. |
|
|
| Permissions | Reuse book/project access and `ContextEditPolicy`; independently validate scope and edit permission in stored procedures. All mutations require antiforgery. |
|
|
| Lifecycle | Item children delete with the item. Chapter/book/project deletion and restore explicitly include chapter items; no orphaned metadata. Entity archival/merge must retain meaningful author evidence and resolve current identity through canonical references. |
|
|
|
|
This is a proposed schema contract, not a qualified SQL migration. Routine
|
|
Development implementation/qualification/deployment has standing owner authority.
|
|
Recheck the next migration number when implementing (339 was the latest numeric
|
|
prefix at discovery). Never edit existing numbered scripts.
|
|
|
|
Required source integration before qualification:
|
|
|
|
- Update checklist read/write projections and preserve compatibility with existing
|
|
`SceneChecklist_ListByScene`, `SceneChecklist_Save` and scene/Writer callers.
|
|
- Extend `ProjectBackupStoredFieldContract.Schema.cs` and
|
|
`ProjectBackupGraphValidation.cs`. Current backups require a scene link for every
|
|
checklist row; merely making `SceneID` nullable would lose chapter items.
|
|
- Add forward-only replacements for affected backup/export/restore and scoped
|
|
deletion procedures. Current explicit checklist export projection is visible in
|
|
migration 215; graph restore evolves through 229, 236 and 241. Trace the effective
|
|
procedures rather than replaying those historical scripts. Include entity link
|
|
and evidence remapping in portable backups and book recovery.
|
|
- Qualify existing scene checklist compatibility, chapter-only scope, project
|
|
isolation, stale concurrent saves, archival/deletion and backup/restore round trips
|
|
with synthetic data in disposable databases. Existing author records must survive.
|
|
|
|
## Remaining application and acceptance work
|
|
|
|
Implement one shared partial/component in the Context tool registry and docked
|
|
Writer sidebar, using the same saved data. Default to chapter scope; optional scene
|
|
scope must work without prose or Word. Reuse existing goal editors. Add paste preview,
|
|
manual add/edit/check/change/notes, drag and keyboard reorder, explicit entity
|
|
link/covered actions, and evidence drop contracts for future project 12 integration.
|
|
Do not implement a native editor or a separate Intent window.
|
|
|
|
Build the palette from authorised canonical references and persisted candidates
|
|
only; do not reconstruct raw Scene Intelligence JSON or trigger analysis. Use typed
|
|
identity keys, canonical aliases and provenance; default to current chapter/scene
|
|
associations with wider story search. Include characters, locations, assets, threads
|
|
and relevant plotlines. Matching remains reference suggestions only.
|
|
|
|
Register the component with the existing Context lifecycle, dirty/busy refresh
|
|
guards and saved-data invalidation. Extend the invalidation category map for all
|
|
palette categories. Refresh newly captured entities while held without retargeting
|
|
the held chapter/scene; preserve focus and drafts across panes/windows. Handle
|
|
accepted Word manuscript updates through the existing accepted-source contract.
|
|
Use theme controls, collapsible/resizable palette and `PlotDirector.toast`.
|
|
|
|
Run the solution build, regression harness, focused UI/concurrency tests and schema
|
|
qualification. After an automatically qualified schema release to Development, verify the full
|
|
deployed commit and use the registered ordinary browser fixture for real manual
|
|
checklist/entity-link/evidence persistence after reload and fresh login, held-scope
|
|
SignalR refresh, chapter-only/no-prose use and cleanup. Record receipts, feature URL,
|
|
actual outcomes and limitations in CYJ. Production is excluded.
|
|
|
|
## Resolved deployment prerequisite and continuation
|
|
|
|
Assistance stage 125 is resolved. The installed permanent Development schema route
|
|
now qualifies pending migrations on disposable restored copies, maintains backup
|
|
and migration history, and activates through the existing controller boundary.
|
|
Use the installed `deployment-request` / `deployment-result` commands for
|
|
`application-development`; no worker sudo, signing access or per-release routine
|
|
SQL approval. Read `Docs/Codex/Deployment.md`,
|
|
`Docs/Deployment/AutomaticDevelopment.md` and the installed toolkit `DEPLOYMENT.md`
|
|
before requesting a release. Reconcile any uncertain receipt before retrying.
|
|
|
|
The resumed source branch is `feature/context-intent-67-resume`, based on
|
|
`9a3f4fbb` and including the original preparation commit `5bee47e6`. No task-67
|
|
external write or deployment has occurred to reconcile. Do not treat preparation
|
|
helpers or passing pure tests as feature acceptance. Required endpoint/persistence,
|
|
shared UI, palette loading/search, accepted Word updates, Hold/Follow refresh,
|
|
backup/restore/deletion integration, schema qualification, Development deployment
|
|
and genuine browser persistence/reload acceptance all remain outstanding.
|