🐛 Keep initial slicing conflicts visible and repair live rework feedback
Slice-phase quick edits with pending actions were canceled before history recording because conflict rendering and teardown were annotation-only. Preserve the actions and use the existing atomic application and restoration flow in both editing phases. Compare complete live editor drafts without derived completion status, and keep discarded-slice evidence and opinions visible.
This commit is contained in:
parent
4d12d8cb02
commit
867ca69835
12
.scratch/cheng-feedback-20261021/spec.md
Normal file
12
.scratch/cheng-feedback-20261021/spec.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Repair initial slicing and rework feedback
|
||||
Status: resolved
|
||||
|
||||
Base: local rework boundary repair 4d12d8cb, based on deployed fab5be57.
|
||||
|
||||
- Initial slice quick conflicts must be visible and confirmable/cancellable by the same keys and buttons as annotation conflicts. Preserve pending, described and invalid records; no customer migration.
|
||||
- Successful C split, drag and delete must survive save/reload and support same-session undo/redo, respecting the existing one-second acceptance window and stage boundaries.
|
||||
- Live complete editor drafts update feedback immediately, preserving classification fields. Derived slice status alone must not clear opinions.
|
||||
- Discarded slices retain evidence and a right-side opinion rail without an action editor. Explicit whole-action invalidation shows its impact.
|
||||
- Review remains read-only; E remains annotation-only. No production mutation or deployment in this task.
|
||||
|
||||
Evidence: [verification](../../docs/verification/cheng-feedback-20261021.md).
|
||||
@ -22,6 +22,14 @@
|
||||
- 复审新增“本轮改动”清单,覆盖全部切片与动作,包括原先没有退回意见的位置。它比较本轮冻结基线与当前实际送检修订,展示净改动及前后内容;不使用客户端操作日志、不把自动保存草稿混入正式结果,不修改冻结基线和正式审查记录。标注员侧显示当前工作区的同一比较结果。
|
||||
- 缺少旧基线快照或匹配的送检修订时显示“无法确认全部改动”,不以空数组推断全部删除或没有改动。无需数据库迁移;旧结构计数摘要和旧格式退回兼容路径保留。
|
||||
|
||||
## 2026-10-21:实时草稿与派生状态比较修正
|
||||
|
||||
标注员侧强调层合入区间完整的编辑器草稿,保留分类与左右手等业务字段;未完成终点选择不参与比较,自动保存载荷的字段清洗不用于展示比较。撤回到原文恢复未修改状态。
|
||||
|
||||
切片 `annotationStatus` 是派生完成状态,单独变化不代表已按意见修改;旧记录省略用途与显式 keep 等价。名称、分类、边界、用途、舍弃原因及片内动作仍参与比较。灰态继续只表示已修改待复审,不替代正式判定。
|
||||
|
||||
选择舍弃切片时仍显示只读舍弃证据与返工意见栏;不提供直接修改归档动作的编辑器。上述均为展示修正,不迁移冻结基线、正式审查记录或客户工作区。
|
||||
|
||||
## 背景
|
||||
|
||||
B02 上线的返工模式给标注员两个新面板:意见列表上方的"处理反馈"文字编辑器(每条意见写回应,8 秒空闲自动保存)与"上下对比"面板。客户实测后提出三点不满:
|
||||
|
||||
@ -25,6 +25,12 @@
|
||||
- Enter 和按钮均等待权威保存结果;保存中禁用重复应用、处置选择及取消,错误在清单内显示并保留选择。响应丢失时通过原应用编号回读确认。成功后清理已合入保存的编辑器草稿,避免用旧几何覆盖新工作区。
|
||||
- 不批量修改已保存、送检或交付数据;现有权限、阶段锁、历史数据恢复接口保持有效。
|
||||
|
||||
## 2026-10-21:初始切片快捷冲突兼容
|
||||
|
||||
初始切片阶段保存、恢复的工作区可能已有连续待标注动作。切分、拖边和删除遇到这些动作时,与逐片标注阶段一样显示冲突清单,Enter/按钮确认或 Esc 取消;不再因阶段不为 annotate 静默取消。E 重设面板仍限定逐片标注,质检、验收、只读及后台处理阶段不开放编辑。
|
||||
|
||||
不按描述为空删除动作,也不批量改写历史草稿。既有自动补齐、空白动作、分类、舍弃证据与版本校验保持原义。成功操作按原子应用记录撤销,失败保留选择及明确错误;原有会话、阶段边界和一秒防重复规则保留。
|
||||
|
||||
## 背景
|
||||
|
||||
返修中要改切片结构只能"重新切片":清空全部动作标注、整单退回切片阶段,代价高且不可审计(旧文案"请先返回重新切片"即两把阶段锁的报错)。同时旧 D2 规则在拖动边界穿过动作时自动拆两段标"待核对"——该状态不在服务端白名单(pending/described/invalid)内,不处置则保存被堵死。本决策来自 24 项已拍板裁决(Q1:a–Q8:a、R2-Q1–Q8、R3-1–R3-4)。
|
||||
|
||||
19
docs/verification/cheng-feedback-20261021.md
Normal file
19
docs/verification/cheng-feedback-20261021.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Platform feedback repairs — 2026-10-21
|
||||
|
||||
Local branch `codex/rework-boundary-20261021`, based on deployed `fab5be57` plus local boundary repair `4d12d8cb`. No push, PR, cluster deployment or customer data writes.
|
||||
|
||||
## Cause and compatibility
|
||||
|
||||
Initial slicing can recover saved pending actions. The quick edit planner correctly detects action conflicts, but Workbench previously rendered and accepted those conflicts only in annotation phase and silently canceled them in slice phase. Thus attempted edits never entered history. Preserve all existing action records and make the stage contract consistent; keep the server's archive, CAS and restoration paths. No schema, workflow, formal decision or delivery format changes.
|
||||
|
||||
Feedback previously omitted complete editor drafts and compared derived slice annotationStatus. It now includes those drafts while preserving display classification/handedness, excludes incomplete end selections, ignores derived slice status and normalizes implicit keep. Discarded slices retain evidence and the opinion rail in the right sidebar. Selecting whole-action invalidation explicitly warns that both sides are affected.
|
||||
|
||||
## Regression evidence
|
||||
|
||||
- Red before repair: `TestSlicePhaseBrowserReplica` failed `pending actions must show a visible conflict` (0 vs 1); the derived-status unit regression failed uncleared count (1 vs 2).
|
||||
- `REWORK_BOUNDARY_BROWSER_TEST=1 go test ./internal/api -run '^TestSlicePhaseBrowserReplica$' -count=1 -v`: real AnnotationOperations page, real HTTP handlers, isolated MemoryStore and synthetic H.264 media. Covers empty control, saved pending actions and a newer owner-matched autosave draft over an empty confirmed workspace, C/Enter/save/undo/redo/reload, pending drag/delete undo/redo, actual draft editing and reversal, false-gray prevention, discarded evidence/opinions and sidebar geometry.
|
||||
- `REWORK_BOUNDARY_BROWSER_TEST=1 go test ./internal/api -run '^TestReworkBoundaryBrowserReplica$' -count=1 -v`: existing discard-boundary, Enter/button, failure/retry, lost-response reconciliation, busy/cancel and persisted undo/redo scenarios remain passing.
|
||||
- 66 targeted frontend tests and targeted Go slice application, restoration, rework and draft tests pass; TypeScript and web build pass. Production bundle boot has no runtime errors.
|
||||
- Full frontend gate: 13 existing failures, all in the unchanged known baseline; no new failures. Four source-shape assertions were updated for the new phase contract while retaining review permission assertions. Baseline entries were not edited.
|
||||
|
||||
Browser is local Edge/Chromium, not a claim of testing the customer's exact Chrome installation. No production browser/client acceptance or historical result repair is claimed. Old mistaken invalidation results require individual evidence review; they are not guessed or overwritten. Source diagnosis evidence remains under untracked `local-data/diagnostics/chengxiaoming-feedback-20261021/` in the working root.
|
||||
154
internal/api/slice_phase_browser_test.go
Normal file
154
internal/api/slice_phase_browser_test.go
Normal file
@ -0,0 +1,154 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"droboticflow/internal/config"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"droboticflow/internal/domain"
|
||||
"droboticflow/internal/store"
|
||||
)
|
||||
|
||||
// Actual page -> actual HTTP handler -> isolated memory store. Neither a
|
||||
// production endpoint nor the local snapshot database is reachable here.
|
||||
func TestSlicePhaseBrowserReplica(t *testing.T) {
|
||||
if os.Getenv("REWORK_BOUNDARY_BROWSER_TEST") != "1" {
|
||||
t.Skip("local browser opt-in")
|
||||
}
|
||||
f := continuousFixture(t)
|
||||
reason := dispositionFixturePayload(t, f)
|
||||
if err := f.store.UpsertOrganizationPlugin(f.ctx, domain.OrganizationPluginRecord{OrganizationID: domain.DefaultOrganizationID, PluginID: "annotation-qa", Enabled: true, Config: defaultAnnotationPluginConfig()}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
reset := func(status, shape string) error {
|
||||
before := []domain.SliceSegment{{ID: "first", Start: 0, End: 10}}
|
||||
item := f.item
|
||||
item.ReviewRound = 0
|
||||
actions := []domain.AnnotationSegment{{ID: "pending-first", Start: 0, End: 10, Status: "pending"}}
|
||||
if status == "empty" {
|
||||
actions = []domain.AnnotationSegment{}
|
||||
}
|
||||
item.Subject.Payload = map[string]any{"sliceWorkflow": map[string]any{"status": "editing", "phase": "slice"}, "annotationWorkspace": map[string]any{"userId": f.annotator.ID, "savedAt": nowISO(), "sliceSegments": before, "segments": actions, "statuses": map[string]string{"first": "pending"}}}
|
||||
if status == "draft" {
|
||||
item.Subject.Payload["annotationDraft"] = map[string]any{"userId": f.annotator.ID, "savedAt": time.Now().Add(time.Second).UTC().Format(time.RFC3339Nano), "savedVersion": item.Version, "sliceSegments": before, "segments": actions, "statuses": map[string]string{"first": "pending"}}
|
||||
item.Subject.Payload["annotationWorkspace"].(map[string]any)["segments"] = []domain.AnnotationSegment{}
|
||||
}
|
||||
|
||||
if shape == "two" {
|
||||
before = []domain.SliceSegment{{ID: "first", Name: "测试切片", Start: 0, End: 0.2}, {ID: "second", Start: 0.2, End: 10}}
|
||||
actions = []domain.AnnotationSegment{{ID: "a", Start: 0, End: 0.2, Status: "pending"}, {ID: "b", Start: 0.2, End: 10, Status: "pending"}}
|
||||
item.Subject.Payload["annotationWorkspace"].(map[string]any)["sliceSegments"] = before
|
||||
item.Subject.Payload["annotationWorkspace"].(map[string]any)["segments"] = actions
|
||||
}
|
||||
if shape == "rework" {
|
||||
before = []domain.SliceSegment{{ID: "first", Name: "测试切片", Start: 0, End: 5, AnnotationStatus: "pending"}, {ID: "discard", Start: 5, End: 10, DeliveryDisposition: "discard", DiscardReason: "相机被遮挡", DiscardReasonLabelID: reason.ReasonLabelID, DiscardReasonVersion: reason.ReasonVersion}}
|
||||
actions = []domain.AnnotationSegment{{ID: "a", Start: 0, End: 5, Status: "described", Description: "原描述"}}
|
||||
item.ReviewRound = 1
|
||||
item.Subject.Payload["sliceWorkflow"] = map[string]any{"status": "completed", "phase": "annotate"}
|
||||
item.Subject.Payload["annotationWorkspace"].(map[string]any)["sliceSegments"] = before
|
||||
item.Subject.Payload["annotationWorkspace"].(map[string]any)["segments"] = actions
|
||||
frozen := append([]domain.SliceSegment(nil), before...)
|
||||
frozen[0].AnnotationStatus = "labeled"
|
||||
if err := f.store.UpsertReworkBaseline(f.ctx, domain.ReworkBaselineRecord{ID: store.ReworkBaselineID(item.ID, 1), OrganizationID: item.OrganizationID, ProjectID: item.ProjectID, ItemID: item.ID, Round: 1, StageID: domain.FanyuV58StageAnnotationCombined, Slices: frozen, Actions: actions, Problems: []domain.ReviewProblem{{ID: "p-slice", Scope: "slice", SliceID: "first", Text: "核对切片"}, {ID: "p-action", Scope: "action", SliceID: "first", ActionID: "a", Text: "核对描述"}}}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return f.store.UpsertHumanItem(f.ctx, item)
|
||||
}
|
||||
root := t.TempDir()
|
||||
f.task.SourceVideo = "/api/runs/" + f.task.RunID + "/artifacts/left-video/content"
|
||||
f.task.RightSourceVideo = "/api/runs/" + f.task.RunID + "/artifacts/right-video/content"
|
||||
f.task.NodeID = "human"
|
||||
f.task.ArtifactID = "left-video"
|
||||
f.task.RightArtifactID = "right-video"
|
||||
f.task.SourceIsFullVideo = true
|
||||
f.task.SourceDurationSeconds = 10
|
||||
f.task.CoverageEndSecond = 10
|
||||
pts := "timestamp_us\n"
|
||||
for i := 0; i < 100; i++ {
|
||||
pts += fmt.Sprintf("%d\n", 1000000+i*100000)
|
||||
}
|
||||
bindings := []domain.NodeInputBinding{}
|
||||
for _, side := range []string{"left", "right"} {
|
||||
video := filepath.Join(root, side+".mp4")
|
||||
if out, err := exec.Command("ffmpeg", "-v", "error", "-y", "-f", "lavfi", "-i", "color=c=navy:s=160x90:r=10:d=10", "-c:v", "libx264", "-pix_fmt", "yuv420p", video).CombinedOutput(); err != nil {
|
||||
t.Fatalf("video: %v: %s", err, out)
|
||||
}
|
||||
timestamps := filepath.Join(root, side+"_pts.csv")
|
||||
if err := os.WriteFile(timestamps, []byte(pts), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
port := "fullLeftVideos"
|
||||
if side == "right" {
|
||||
port = "fullRightVideos"
|
||||
}
|
||||
bindings = append(bindings, domain.NodeInputBinding{TargetPortID: port, Artifacts: []domain.ExecutionArtifact{{ID: side + "-video", Name: side + ".mp4", Path: video, Data: map[string]any{"collectionId": "capture"}}}}, domain.NodeInputBinding{TargetPortID: side + "Timestamps", Artifacts: []domain.ExecutionArtifact{{ID: side + "-pts", Name: side + "_pts.csv", Path: timestamps, Data: map[string]any{"collectionId": "capture"}}}})
|
||||
}
|
||||
imu := "timestamp_us,x,y,z,type\n"
|
||||
for i := 0; i < 100; i++ {
|
||||
stamp := 1000000 + i*100000
|
||||
imu += fmt.Sprintf("%d,1,2,3,accel\n%d,4,5,6,gyro\n", stamp, stamp)
|
||||
}
|
||||
imuPath := filepath.Join(root, "imu.csv")
|
||||
if err := os.WriteFile(imuPath, []byte(imu), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
bindings = append(bindings, domain.NodeInputBinding{TargetPortID: "imu", Artifacts: []domain.ExecutionArtifact{{ID: "imu", Name: "imu.csv", Path: imuPath, Data: map[string]any{"collectionId": "capture"}}}})
|
||||
if err := f.store.UpsertRun(f.ctx, domain.RunRecord{ID: f.task.RunID, OrganizationID: f.task.OrganizationID, ProjectID: f.task.ProjectID, WorkflowID: f.task.WorkflowID, NodeExecutions: []domain.NodeExecutionRecord{{NodeID: f.task.NodeID, InputBindings: bindings}}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := f.store.UpsertAnnotationTask(f.ctx, f.task); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := reset("pending", ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
handler := NewHandlerWithConfig(f.store, nil, config.AppConfig{WorkspaceMountPath: root})
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/api/auth/me" {
|
||||
renderJSON(w, 200, map[string]any{"user": sanitizeUser(&f.annotator), "organization": domain.OrganizationRecord{ID: domain.DefaultOrganizationID, Status: domain.OrganizationStatusActive}})
|
||||
return
|
||||
}
|
||||
if r.URL.Path == "/__boundary/reset" {
|
||||
if err := reset(r.URL.Query().Get("status"), r.URL.Query().Get("shape")); err != nil {
|
||||
renderError(w, 500, err)
|
||||
return
|
||||
}
|
||||
renderJSON(w, 200, map[string]any{"ok": true})
|
||||
return
|
||||
}
|
||||
if r.URL.Path == "/__boundary/state" {
|
||||
item, _ := f.store.GetHumanItem(r.Context(), f.item.ID)
|
||||
renderJSON(w, 200, item)
|
||||
return
|
||||
}
|
||||
if r.Method != "GET" && r.Method != "HEAD" && !strings.HasSuffix(r.URL.Path, "/slice-edit-applications") && !strings.HasSuffix(r.URL.Path, "/slice-edit-restorations") && !strings.HasSuffix(r.URL.Path, "/drafts") {
|
||||
renderJSON(w, 403, map[string]string{"error": "fixture write not permitted"})
|
||||
return
|
||||
}
|
||||
r.AddCookie(&http.Cookie{Name: csrfCookieName, Value: "boundary-local-csrf"})
|
||||
r.Header.Set(csrfHeaderName, "boundary-local-csrf")
|
||||
r = r.WithContext(context.WithValue(r.Context(), authContextKey{}, &authenticatedPrincipal{User: f.annotator, Organization: domain.OrganizationRecord{ID: domain.DefaultOrganizationID, Status: domain.OrganizationStatusActive}}))
|
||||
handler.ServeHTTP(w, r)
|
||||
}))
|
||||
defer server.Close()
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 3*time.Minute)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, "node", "tests/browser/slice-phase-replica.mjs")
|
||||
cmd.Dir = "../.."
|
||||
cmd.Env = append(os.Environ(), "REWORK_BOUNDARY_API="+server.URL)
|
||||
out, err := cmd.CombinedOutput()
|
||||
t.Log(string(out))
|
||||
if err != nil {
|
||||
t.Fatal(fmt.Errorf("browser: %w", err))
|
||||
}
|
||||
}
|
||||
@ -745,24 +745,26 @@ export function CaptureAnnotationWorkbench({
|
||||
setDispositionError("");
|
||||
}
|
||||
}, [selectedSlice?.id, dispositionOpen, dispositionDraft.sliceId]);
|
||||
// 切片重设面板只在 annotate 相的可编辑工作台内存在;阶段流转/只读化时整体取消
|
||||
// (预览本就不落库,丢弃即回退)。不随 slices.length < 2 退出:面板内合并到单切片
|
||||
// 合法(拆分可再补回),守卫只在进入时拦。
|
||||
// E-panel belongs to annotation; quick structural edits are supported in
|
||||
// both editing phases. Never silently cancel a slice-phase conflict.
|
||||
const conflictPhaseAllowed = phase === "annotate" || (phase === "slice" && sliceEditConflictList?.source === "quick");
|
||||
const showSliceEditConflict = Boolean(
|
||||
sliceEditConflictList && conflictPhaseAllowed && !readOnly && !isQualityReview && !mediaOnly,
|
||||
);
|
||||
useEffect(() => {
|
||||
if (
|
||||
(sliceEditPanel || sliceEditConflictList) &&
|
||||
(phase !== "annotate" || readOnly || isQualityReview || mediaOnly)
|
||||
) {
|
||||
// 票 05:快路径清单随阶段/只读化一并取消——页面回退拖动几何(或丢弃未落库
|
||||
// 改动),不留悬空待决结构。
|
||||
if (sliceEditConflictList?.source === "quick") onSliceEditQuickConflictCancel?.();
|
||||
const unavailable = readOnly || isQualityReview || mediaOnly;
|
||||
if (sliceEditPanel && (phase !== "annotate" || unavailable)) {
|
||||
setSliceEditPanel(null);
|
||||
setSliceEditConflictList(null);
|
||||
setSliceEditDiscardDraft(null);
|
||||
}
|
||||
if (sliceEditConflictList && (!conflictPhaseAllowed || unavailable)) {
|
||||
if (sliceEditConflictList.source === "quick") onSliceEditQuickConflictCancel?.();
|
||||
setSliceEditConflictList(null);
|
||||
}
|
||||
}, [
|
||||
sliceEditPanel,
|
||||
sliceEditConflictList,
|
||||
conflictPhaseAllowed,
|
||||
phase,
|
||||
readOnly,
|
||||
isQualityReview,
|
||||
@ -795,8 +797,7 @@ export function CaptureAnnotationWorkbench({
|
||||
const playheadSliceIndex = sliceIndexAtPlayhead(slices, currentTime);
|
||||
const playheadSlice = playheadSliceIndex >= 0 ? slices[playheadSliceIndex] : null;
|
||||
const selectedDiscarded = selectedSlice.deliveryDisposition === "discard";
|
||||
const showDispositionPanel =
|
||||
(phase === "slice" || readOnly || isQualityReview || dispositionOpen) && (selectedDiscarded || dispositionOpen);
|
||||
const showDispositionPanel = selectedDiscarded || dispositionOpen;
|
||||
const canEditDisposition = phase === "slice" && !readOnly && !isQualityReview && !!onSliceDispositionChange;
|
||||
const sliceNameIssue = sliceDictionaryNameIssue(
|
||||
slices,
|
||||
@ -3131,7 +3132,7 @@ export function CaptureAnnotationWorkbench({
|
||||
// 冲突清单(票 04,R2-Q2):清单开着时全权接管——↑/↓ 条目、1/2/3 处置、
|
||||
// Enter 按默认应用、Esc 取消整个待应用改动集;播放族 "pass" 放行给全局表
|
||||
// (视频是参照物),J/K "locked" 给提示,其余键整体吞掉(面板键不生效)。
|
||||
if (sliceEditConflictList && phase === "annotate") {
|
||||
if (sliceEditConflictList && showSliceEditConflict) {
|
||||
if (saving || quickConflictApplyingRef.current) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
@ -3639,7 +3640,7 @@ export function CaptureAnnotationWorkbench({
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{sliceEditConflictList && phase === "annotate" ? (
|
||||
{sliceEditConflictList && showSliceEditConflict ? (
|
||||
<tr className="border-t border-amber-300 bg-amber-50/60 dark:border-amber-700 dark:bg-amber-950/30">
|
||||
<td colSpan={2} className="py-2 text-xs font-semibold text-amber-700 dark:text-amber-300">
|
||||
冲突清单已打开 · 以下为清单键位,Enter 应用或 Esc 取消后恢复全局键位
|
||||
@ -3652,7 +3653,7 @@ export function CaptureAnnotationWorkbench({
|
||||
</td>
|
||||
</tr>
|
||||
) : null}
|
||||
{(sliceEditConflictList && phase === "annotate"
|
||||
{(sliceEditConflictList && showSliceEditConflict
|
||||
? sliceEditConflictListShortcutHelp
|
||||
: sliceEditPanel && phase === "annotate"
|
||||
? sliceEditPanelShortcutHelp
|
||||
@ -5194,6 +5195,11 @@ export function CaptureAnnotationWorkbench({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{!mediaOnly && phase === "annotate" && selectedDiscarded && reworkRail ? (
|
||||
<div className="capture-annotation-stage px-5 py-4" data-testid="discard-review-sidebar">
|
||||
{reworkRail}
|
||||
</div>
|
||||
) : null}
|
||||
{!mediaOnly && phase === "annotate" && !selectedDiscarded ? (
|
||||
<div className="capture-annotation-stage px-5 py-4">
|
||||
<div className="capture-annotation-heading mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||
@ -6627,7 +6633,7 @@ export function CaptureAnnotationWorkbench({
|
||||
);
|
||||
})()
|
||||
: null}
|
||||
{sliceEditConflictList && phase === "annotate" ? (
|
||||
{sliceEditConflictList && showSliceEditConflict ? (
|
||||
<SliceEditConflictList
|
||||
entries={sliceEditConflictList.entries}
|
||||
saving={saving || quickConflictApplying}
|
||||
|
||||
@ -75,6 +75,7 @@ export function SliceEditConflictList({
|
||||
const undecided = entries.filter((entry) => !(entry.actionId in decisions)).length;
|
||||
const autoFollowHint = conflictAutoFollowHint(autoFollows);
|
||||
const changes = sliceEditChangeSummary(beforeSlices, afterSlices);
|
||||
const invalidating = entries.filter((entry) => decisions[entry.actionId] === "invalidate").length;
|
||||
return (
|
||||
<div
|
||||
data-testid="slice-edit-conflict-list"
|
||||
@ -99,6 +100,11 @@ export function SliceEditConflictList({
|
||||
默认截断保留两侧描述;进入舍弃区的部分归档。判无效会将该动作两侧全部改为无效,可撤销。
|
||||
</p>
|
||||
</div>
|
||||
{invalidating > 0 ? (
|
||||
<p role="note" className="mx-2 mt-2 rounded border border-amber-300 bg-amber-50 p-2 text-xs text-amber-900">
|
||||
已选择将 {invalidating} 个动作整体判无效,包含新边界两侧;如需保留正常侧描述,请选择“截断”。应用后可撤销。
|
||||
</p>
|
||||
) : null}
|
||||
{autoFollowHint ? (
|
||||
<div
|
||||
data-testid="slice-edit-auto-follow-hint"
|
||||
|
||||
@ -67,8 +67,8 @@ export function segmentForDraftPayload(segment) {
|
||||
* 仅并入区间完整的草稿(start<end);正在选终点、区间不完整的草稿跳过——
|
||||
* 其文本仍由编辑器持有,待区间确定后由下一触发点覆盖。
|
||||
*/
|
||||
export function autosaveSegmentsWithDrafts(segments = [], drafts = []) {
|
||||
const merged = (Array.isArray(segments) ? segments : []).map(segmentForDraftPayload);
|
||||
function mergeDrafts(segments, drafts, prepare) {
|
||||
const merged = (Array.isArray(segments) ? segments : []).map(prepare);
|
||||
const positions = new Map();
|
||||
merged.forEach((segment, index) => {
|
||||
if (typeof segment.id === "string" && segment.id) positions.set(segment.id, index);
|
||||
@ -78,7 +78,7 @@ export function autosaveSegmentsWithDrafts(segments = [], drafts = []) {
|
||||
if (!annotation) continue;
|
||||
const { start, end } = annotation;
|
||||
if (typeof start !== "number" || typeof end !== "number" || !(end > start)) continue;
|
||||
const value = segmentForDraftPayload(annotation);
|
||||
const value = prepare(annotation);
|
||||
// Existing editors and newly split actions both retain the action ID.
|
||||
// Appending would duplicate the ID and overlap the entire original interval.
|
||||
const index = positions.get(annotation.id);
|
||||
@ -91,10 +91,14 @@ export function autosaveSegmentsWithDrafts(segments = [], drafts = []) {
|
||||
return merged;
|
||||
}
|
||||
|
||||
export function autosaveSegmentsWithDrafts(segments = [], drafts = []) {
|
||||
return mergeDrafts(segments, drafts, segmentForDraftPayload);
|
||||
}
|
||||
|
||||
/** Freeze complete editor drafts into the same workspace transaction as a
|
||||
* slice edit. Incomplete end-point selections remain owned by their editor.
|
||||
* This does not submit the task or create a formal annotation revision. */
|
||||
export function sliceEditActionsWithDrafts(segments = [], drafts = []) {
|
||||
function completeActionsWithDrafts(segments, drafts, prepare) {
|
||||
const unresolved = [];
|
||||
const complete = [];
|
||||
for (const draft of drafts) {
|
||||
@ -116,5 +120,15 @@ export function sliceEditActionsWithDrafts(segments = [], drafts = []) {
|
||||
annotation: { ...action, description, status: invalid ? "invalid" : description ? "described" : "pending" },
|
||||
});
|
||||
}
|
||||
return { actions: autosaveSegmentsWithDrafts(segments, complete), unresolved };
|
||||
return { actions: mergeDrafts(segments, complete, prepare), unresolved };
|
||||
}
|
||||
|
||||
export function sliceEditActionsWithDrafts(segments = [], drafts = []) {
|
||||
return completeActionsWithDrafts(segments, drafts, segmentForDraftPayload);
|
||||
}
|
||||
|
||||
// Feedback compares business content, including classification and handedness.
|
||||
// Payload serialization intentionally strips display fields; a live view must not.
|
||||
export function reworkActionsWithDrafts(segments = [], drafts = []) {
|
||||
return completeActionsWithDrafts(segments, drafts, (action) => ({ ...action }));
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
//
|
||||
// 判定规则(与用户确认的设计一致):
|
||||
// - 红(未处理):意见目标在当前工作区里仍与退回基线一致(未改动)。
|
||||
// - 灰(已处理):目标被改动(切片名称/分类标签/边界/弃用状态/标注状态、动作
|
||||
// - 灰(已处理):目标被改动(切片名称/分类标签/边界/弃用状态、动作
|
||||
// 文字/类别/左右手/边界/状态任一变化),或目标被合并/删除后找不到承接块;
|
||||
// 或标注员一键标记"不改了"(skipped,单独状态,复审可见)。
|
||||
// - 跟块(reattach)扩展到切片结构变化(票 04,spec §3.3 / Q5:a):
|
||||
@ -30,9 +30,11 @@ function sliceKey(slice) {
|
||||
round3(slice.start),
|
||||
round3(slice.end),
|
||||
slice.taskLabelId || "",
|
||||
slice.deliveryDisposition || "",
|
||||
slice.discardReason || slice.discardReasonLabelId || "",
|
||||
slice.annotationStatus || "",
|
||||
slice.deliveryDisposition || "keep",
|
||||
slice.discardReason || "",
|
||||
slice.discardReasonLabelId || "",
|
||||
slice.discardReasonVersion || 0,
|
||||
slice.discardReasonNote || "",
|
||||
].join("|");
|
||||
}
|
||||
|
||||
|
||||
@ -152,6 +152,7 @@ import {
|
||||
autosaveSegmentsWithDrafts,
|
||||
sliceEditSessionFlushEdge,
|
||||
workbenchDraftsFingerprint,
|
||||
reworkActionsWithDrafts,
|
||||
sliceEditActionsWithDrafts,
|
||||
} from "../lib/annotation-autosave.js";
|
||||
import { useAnnotationAutosave } from "../hooks/useAnnotationAutosave";
|
||||
@ -2246,7 +2247,7 @@ export default function AnnotationOperations({ workPage = false }: { workPage?:
|
||||
};
|
||||
const [reworkSeekRequest, setReworkSeekRequest] = useState<{ time: number; revision: number } | null>(null);
|
||||
const reworkSeekRevisionRef = useRef(0);
|
||||
// 返工强调层:标注员返工视图按"退回基线 vs 已保存工作区"计算红/灰(多轮,最新轮红)。
|
||||
// 返工强调层包含区间完整的编辑器草稿;未完成终点选择不推定已修改。
|
||||
const reworkEmphasisEligible = Boolean(
|
||||
detail?.humanItem &&
|
||||
detail.humanItem.currentStageId === "annotation_combined" &&
|
||||
@ -2255,12 +2256,16 @@ export default function AnnotationOperations({ workPage = false }: { workPage?:
|
||||
["claimed", "rework", "in_progress"].includes(detail.humanItem.status) &&
|
||||
workspaceMode === "annotate",
|
||||
);
|
||||
const reworkLiveActions = useMemo(
|
||||
() => reworkActionsWithDrafts(segments, workbenchDrafts).actions,
|
||||
[segments, workbenchDrafts],
|
||||
);
|
||||
const reworkEmphasisData = useReworkEmphasis(
|
||||
detail?.humanItem?.id || "",
|
||||
detail?.humanItem?.reviewRound || 0,
|
||||
reworkEmphasisEligible,
|
||||
sliceSegments,
|
||||
segments,
|
||||
reworkLiveActions,
|
||||
);
|
||||
const reworkEmphasis = reworkEmphasisEligible ? reworkEmphasisData.emphasis : null;
|
||||
// QC 返修接收视图(票 08/09):强调层输入 = 已保存工作区(ADR 0006:31),与标注员侧
|
||||
|
||||
189
tests/browser/slice-phase-replica.mjs
Normal file
189
tests/browser/slice-phase-replica.mjs
Normal file
@ -0,0 +1,189 @@
|
||||
import fs from "node:fs";
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
const source = process.cwd();
|
||||
const require = createRequire(source + "/package.json"),
|
||||
{ createServer } = require("vite"),
|
||||
{ chromium } = require("playwright");
|
||||
const api = process.env.REWORK_BOUNDARY_API,
|
||||
root = new URL("../../local-data/verification/slice-phase/", import.meta.url),
|
||||
report = { cases: [], errors: [], keys: [], writes: [] };
|
||||
assert.match(api, /^http:\/\/127\.0\.0\.1:\d+$/);
|
||||
fs.mkdirSync(root, { recursive: true });
|
||||
const server = await createServer({
|
||||
root: source,
|
||||
server: { host: "127.0.0.1", port: 5204, strictPort: true, proxy: { "/api": { target: api, changeOrigin: true } } },
|
||||
});
|
||||
let browser, page;
|
||||
try {
|
||||
await server.listen();
|
||||
browser = await chromium.launch({
|
||||
executablePath: "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
||||
headless: true,
|
||||
args: ["--no-proxy-server"],
|
||||
});
|
||||
page = await browser.newPage({ viewport: { width: 1600, height: 1100 } });
|
||||
page.setDefaultTimeout(10000);
|
||||
page.on("pageerror", (e) => report.errors.push(e.message));
|
||||
page.on("request", (r) => {
|
||||
if (!["GET", "HEAD"].includes(r.method())) report.writes.push(new URL(r.url()).pathname);
|
||||
});
|
||||
await page.route("**/*", (r) => {
|
||||
const u = new URL(r.request().url());
|
||||
if (u.hostname !== "127.0.0.1") return r.abort();
|
||||
if (u.pathname.includes("/worker-api/")) return r.fulfill({ json: { status: "ok" } });
|
||||
return r.continue();
|
||||
});
|
||||
for (const status of ["empty", "pending", "draft"]) {
|
||||
await fetch(api + "/__boundary/reset?status=" + status);
|
||||
await page.goto(
|
||||
"http://127.0.0.1:5204/plugins/annotation-qa/workflows/all/work?projectId=draft-project&taskId=draft-task",
|
||||
);
|
||||
await page.getByRole("button", { name: "继续工作", exact: true }).click();
|
||||
const bench = page.getByTestId("capture-annotation-workbench"),
|
||||
del = bench.getByRole("button", { name: "删除切片", exact: true });
|
||||
await del.first().waitFor();
|
||||
assert.equal(await del.count(), 1);
|
||||
await page.evaluate(() => {
|
||||
window.keyProbe = [];
|
||||
document.addEventListener("keydown", (e) =>
|
||||
setTimeout(
|
||||
() =>
|
||||
window.keyProbe.push({
|
||||
key: e.key,
|
||||
code: e.code,
|
||||
isComposing: e.isComposing,
|
||||
defaultPrevented: e.defaultPrevented,
|
||||
}),
|
||||
0,
|
||||
),
|
||||
);
|
||||
});
|
||||
const slider = bench.locator("input[type=range]").first(),
|
||||
box = await slider.boundingBox();
|
||||
await page.mouse.click(box.x + box.width * 0.15, box.y + box.height / 2);
|
||||
await page.waitForTimeout(300);
|
||||
await bench.focus();
|
||||
await page.keyboard.press("c");
|
||||
await page.waitForTimeout(500);
|
||||
const result = {
|
||||
status,
|
||||
afterC: await del.count(),
|
||||
visibleConflictLists: await page.getByTestId("slice-edit-conflict-list").count(),
|
||||
receivedKeys: await page.evaluate(() => window.keyProbe),
|
||||
text: await bench.innerText(),
|
||||
};
|
||||
report.cases.push({ ...result, text: undefined });
|
||||
if (status === "empty") assert.equal(result.afterC, 2, "no actions: C must split");
|
||||
else {
|
||||
assert.equal(result.visibleConflictLists, 1, "pending actions must show a visible conflict");
|
||||
await bench.focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await del.nth(1).waitFor();
|
||||
assert.equal(await del.count(), 2);
|
||||
await page.getByRole("button", { name: "撤销", exact: true }).click();
|
||||
await page.waitForTimeout(500);
|
||||
assert.equal(await del.count(), 1);
|
||||
await page.waitForTimeout(1100);
|
||||
await page.getByRole("button", { name: "重做", exact: true }).click();
|
||||
await del.nth(1).waitFor();
|
||||
assert.equal(await del.count(), 2);
|
||||
await page.reload();
|
||||
await page.getByRole("button", { name: "继续工作", exact: true }).click();
|
||||
await del.nth(1).waitFor();
|
||||
assert.equal(await del.count(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
const taskURL =
|
||||
"http://127.0.0.1:5204/plugins/annotation-qa/workflows/all/work?projectId=draft-project&taskId=draft-task";
|
||||
const state = async () => (await (await fetch(api + "/__boundary/state")).json()).subject.payload.annotationWorkspace;
|
||||
const load = async (shape) => {
|
||||
await fetch(api + "/__boundary/reset?status=pending&shape=" + shape);
|
||||
await page.goto(taskURL);
|
||||
await page.getByRole("button", { name: "继续工作", exact: true }).click();
|
||||
await page.getByTestId("capture-annotation-workbench").waitFor();
|
||||
};
|
||||
const bench = page.getByTestId("capture-annotation-workbench");
|
||||
const labels = () => bench.getByRole("combobox").first().locator("option").allTextContents();
|
||||
const settle = async () => {
|
||||
const list = page.getByTestId("slice-edit-conflict-list");
|
||||
if (await list.count()) await list.getByRole("button", { name: /Enter 应用/ }).click();
|
||||
await page.waitForTimeout(500);
|
||||
};
|
||||
await load("two");
|
||||
await bench.getByRole("button", { name: "拖动切片边界", exact: true }).first().waitFor();
|
||||
const before = await labels();
|
||||
const handle = await bench.getByRole("button", { name: "拖动切片边界", exact: true }).first().boundingBox();
|
||||
await page.mouse.move(handle.x + handle.width / 2, handle.y + handle.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(handle.x + handle.width / 2 + 100, handle.y + handle.height / 2, { steps: 8 });
|
||||
await page.mouse.up();
|
||||
await page.waitForTimeout(200);
|
||||
await settle();
|
||||
const after = await labels();
|
||||
assert.notDeepEqual(after, before, "pending actions: drag must apply after confirmation");
|
||||
await page.getByRole("button", { name: "撤销", exact: true }).click();
|
||||
await page.waitForTimeout(500);
|
||||
assert.deepEqual(await labels(), before);
|
||||
await page.waitForTimeout(1100);
|
||||
await page.getByRole("button", { name: "重做", exact: true }).click();
|
||||
await page.waitForTimeout(500);
|
||||
assert.deepEqual(await labels(), after);
|
||||
assert.equal((await state()).segments.length >= 2, true);
|
||||
report.cases.push({ scenario: "pending-drag-undo-redo" });
|
||||
await page.waitForTimeout(1100);
|
||||
await bench.getByRole("button", { name: "删除切片", exact: true }).first().click();
|
||||
await page.waitForTimeout(200);
|
||||
await settle();
|
||||
assert.equal(await bench.getByRole("button", { name: "删除切片", exact: true }).count(), 1);
|
||||
await page.getByRole("button", { name: "撤销", exact: true }).click();
|
||||
await page.waitForTimeout(500);
|
||||
assert.deepEqual(await labels(), after);
|
||||
await page.waitForTimeout(1100);
|
||||
await page.getByRole("button", { name: "重做", exact: true }).click();
|
||||
await page.waitForTimeout(500);
|
||||
assert.equal(await bench.getByRole("button", { name: "删除切片", exact: true }).count(), 1);
|
||||
report.cases.push({ scenario: "pending-delete-undo-redo" });
|
||||
await load("rework");
|
||||
const rail = page.getByTestId("rework-opinion-rail");
|
||||
await rail.waitFor();
|
||||
assert.equal(
|
||||
await rail.locator('[data-rework-state="red"]').count(),
|
||||
2,
|
||||
"derived slice status must stay red on load",
|
||||
);
|
||||
const block = bench.locator("[data-annotation-block]").first();
|
||||
await block.click();
|
||||
const editor = bench.getByRole("textbox", { name: "动作描述", exact: true });
|
||||
await editor.waitFor();
|
||||
await editor.fill("更正描述");
|
||||
await page.waitForTimeout(300);
|
||||
assert.equal(
|
||||
await rail.locator('[data-rework-state="gray"]').count(),
|
||||
2,
|
||||
"unsaved editor draft updates opinions immediately",
|
||||
);
|
||||
await editor.fill("原描述");
|
||||
await page.waitForTimeout(300);
|
||||
assert.equal(await rail.locator('[data-rework-state="red"]').count(), 2, "reverted editor draft restores red");
|
||||
await bench.getByRole("combobox").first().selectOption("discard");
|
||||
await page.getByTestId("slice-disposition-panel").waitFor();
|
||||
assert.equal(await rail.count(), 1);
|
||||
assert.equal(await page.getByTestId("discard-review-sidebar").count(), 1);
|
||||
assert.equal(await page.getByTestId("annotation-description-editor").count(), 0);
|
||||
const side = await page.getByTestId("discard-review-sidebar").boundingBox();
|
||||
const video = await page.getByTestId("capture-video-panel").boundingBox();
|
||||
assert.ok(side.x >= video.x + video.width - 2, "discard opinions remain in right sidebar");
|
||||
report.cases.push({ scenario: "live-draft-status-and-discard-evidence" });
|
||||
assert.deepEqual(report.errors, []);
|
||||
console.log(JSON.stringify(report));
|
||||
} catch (e) {
|
||||
report.failure = e.message;
|
||||
if (page) fs.writeFileSync(new URL("failure.txt", root), await page.locator("body").innerText());
|
||||
throw e;
|
||||
} finally {
|
||||
fs.writeFileSync(new URL("c-page-report.json", root), JSON.stringify(report, null, 2));
|
||||
await browser?.close();
|
||||
await server.close();
|
||||
}
|
||||
@ -189,7 +189,7 @@ test("slice reconfig panel: E opens the preview panel with Enter/Esc, locks bypa
|
||||
// rua 04(D6):J/K 在面板打开期间放行给返工跳转分支——面板分支不再有 locked
|
||||
// 处理;冲突清单分支保留 locked + 提示(动过开始/结束时间必须先决断)。
|
||||
const conflictDispatch = workbench.slice(
|
||||
workbench.indexOf('if (sliceEditConflictList && phase === "annotate") {'),
|
||||
workbench.indexOf("if (sliceEditConflictList && showSliceEditConflict) {"),
|
||||
workbench.indexOf('else if (sliceEditPanel && phase === "annotate") {'),
|
||||
);
|
||||
assert.match(conflictDispatch, /command === "locked"[\s\S]{0,80}notifySliceEditLocked/, "冲突清单 J/K 锁定有提示");
|
||||
@ -296,7 +296,7 @@ test("drag quick path: releases route through the 03 engine into the 04 conflict
|
||||
assert.match(seed, /list\?\.source === "quick" \? null : list/, "条目清空只收 quick 来源");
|
||||
assert.match(
|
||||
workbench,
|
||||
/sliceEditConflictList\?\.source === "quick"\) onSliceEditQuickConflictCancel\?\.\(\)/,
|
||||
/sliceEditConflictList\.source === "quick"\) onSliceEditQuickConflictCancel\?\.\(\)/,
|
||||
"阶段/只读化经页面回退",
|
||||
);
|
||||
const dispatchApply = workbench.slice(
|
||||
|
||||
@ -30,7 +30,7 @@ const collapsePanel = workbench.slice(
|
||||
workbench.indexOf("const sliceEditPanelOpen ="),
|
||||
);
|
||||
const conflictDispatch = workbench.slice(
|
||||
workbench.indexOf('if (sliceEditConflictList && phase === "annotate") {'),
|
||||
workbench.indexOf("if (sliceEditConflictList && showSliceEditConflict) {"),
|
||||
workbench.indexOf('else if (sliceEditPanel && phase === "annotate") {'),
|
||||
);
|
||||
const panelDispatch = workbench.slice(
|
||||
|
||||
55
tests/frontend/rework-live-feedback.test.mjs
Normal file
55
tests/frontend/rework-live-feedback.test.mjs
Normal file
@ -0,0 +1,55 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { computeReworkEmphasis } from "../../src/lib/rework-emphasis.js";
|
||||
import { reworkActionsWithDrafts } from "../../src/lib/annotation-autosave.js";
|
||||
const slices = [{ id: "s", name: "清洗清洁", start: 0, end: 10, annotationStatus: "labeled" }];
|
||||
const actions = [{ id: "a", start: 0, end: 10, description: "原描述", status: "described", labelId: "category" }];
|
||||
const baseline = {
|
||||
round: 1,
|
||||
slices,
|
||||
actions,
|
||||
problems: [
|
||||
{ id: "slice", scope: "slice", sliceId: "s", text: "核对" },
|
||||
{ id: "action", scope: "action", sliceId: "s", actionId: "a", text: "修改描述" },
|
||||
],
|
||||
};
|
||||
const emphasis = (currentSlices = slices, currentActions = actions) =>
|
||||
computeReworkEmphasis({ baselines: [baseline], currentSlices, currentActions });
|
||||
test("derived slice status and legacy keep defaults never imply a business edit", () => {
|
||||
const result = emphasis([{ ...slices[0], annotationStatus: "pending", deliveryDisposition: "keep" }]);
|
||||
assert.equal(result.unclearedCount, 2);
|
||||
assert.equal(result.clearedCount, 0);
|
||||
assert.equal(result.changes.items.length, 0);
|
||||
});
|
||||
test("complete editor drafts update both action and slice feedback; reverting restores red", () => {
|
||||
const draft = { sliceId: "s", annotation: { ...actions[0], description: "更正描述" }, selectingEnd: false };
|
||||
const live = reworkActionsWithDrafts(actions, [draft]).actions;
|
||||
const changed = emphasis(slices, live);
|
||||
assert.equal(changed.clearedCount, 2);
|
||||
assert.equal(emphasis().unclearedCount, 2);
|
||||
const incomplete = reworkActionsWithDrafts(actions, [{ ...draft, selectingEnd: true }]).actions;
|
||||
assert.equal(emphasis(slices, incomplete).unclearedCount, 2);
|
||||
});
|
||||
test("dictionary changes and explicit discard remain business edits", () => {
|
||||
const discarded = {
|
||||
...slices[0],
|
||||
deliveryDisposition: "discard",
|
||||
discardReason: "遮挡",
|
||||
discardReasonLabelId: "r",
|
||||
discardReasonVersion: 1,
|
||||
discardReasonNote: "旧备注",
|
||||
};
|
||||
const result = emphasis([{ ...slices[0], taskLabelId: "new-category" }]);
|
||||
assert.equal(result.sliceStates.get("s").gray.length, 1);
|
||||
assert.equal(emphasis([discarded]).sliceStates.get("s").gray.length, 2);
|
||||
});
|
||||
|
||||
test("live comparison preserves classification display fields without drafts", () => {
|
||||
const decorated = actions.map((a) => ({ ...a, handedness: "left", label: "动作类别" }));
|
||||
assert.deepEqual(reworkActionsWithDrafts(decorated, []).actions, decorated);
|
||||
const live = reworkActionsWithDrafts(decorated, [
|
||||
{ annotation: { ...decorated[0], description: "更正" }, selectingEnd: false },
|
||||
]).actions;
|
||||
assert.equal(live[0].handedness, "left");
|
||||
assert.equal(live[0].label, "动作类别");
|
||||
});
|
||||
@ -54,9 +54,19 @@ test("spec §5: QC review stays read-only (no E panel, no boundary-drag entry)",
|
||||
const workbench = read("src/components/CaptureAnnotationWorkbench.tsx");
|
||||
assert.match(
|
||||
workbench,
|
||||
/\(sliceEditPanel \|\| sliceEditConflictList\) &&\s*\(phase !== "annotate" \|\| readOnly \|\| isQualityReview/,
|
||||
/const unavailable = readOnly \|\| isQualityReview \|\| mediaOnly;[\s\S]*?sliceEditPanel && \(phase !== "annotate" \|\| unavailable\)/,
|
||||
"E 面板在质检视图禁用(票 06 后经面板 teardown 效应)",
|
||||
);
|
||||
assert.match(
|
||||
workbench,
|
||||
/sliceEditConflictList && \(!conflictPhaseAllowed \|\| unavailable\)/,
|
||||
"review also tears down quick conflicts",
|
||||
);
|
||||
assert.match(
|
||||
workbench,
|
||||
/conflictPhaseAllowed && !readOnly && !isQualityReview && !mediaOnly/,
|
||||
"review cannot render or dispatch a structural conflict",
|
||||
);
|
||||
assert.match(
|
||||
workbench,
|
||||
/selectedBoundary && phase === "slice" && !readOnly && !isQualityReview/,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user