Skip to content

Commit 260686c

Browse files
fix: silence successful file content copies
1 parent 2a8831b commit 260686c

6 files changed

Lines changed: 95 additions & 12 deletions

File tree

‎App/FileMint/FileContentCopyController.swift‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ final class FileContentCopyController: NSObject, ObservableObject, NSWindowDeleg
8383
try token.check(); try validatePolicy(selection)
8484
try FileContentClipboard.write(payload, to: pasteboard, expectedChangeCount: expectedChangeCount)
8585
didCopy = true
86-
message = text("File contents copied", "已拷贝文件内容")
87-
showPanel()
88-
Task {
89-
try? await Task.sleep(for: .seconds(2))
90-
guard generation == current, !isWorking else { return }
91-
panel?.close(); panel = nil
92-
}
86+
panel?.close(); panel = nil
9387
} catch {
9488
if error is CancellationError || (error as? FileInfoError) == .cancelled {
9589
closeRequested = true

‎docs/ACCEPTANCE.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
Checked on 2026-09-14, macOS 26.6.2, Apple silicon. Minimum deployment target:
44
macOS 13. Release bundles contain arm64 and x86_64 executables.
55

6+
## Silent file-content copy success — 2026-10-29
7+
8+
Primary `2a8831b` plus the uncommitted feedback change passed `make verify`
9+
(370 Core, 23 image tests), unsigned App/Finder Release compilation and the fresh
10+
signed `file-info` native fixture `run.p1WKjx` on arm64 macOS 27.2 / Xcode 27.1 /
11+
Swift 6.4. Successful text/RTF copies have no feedback panel; delayed progress
12+
cannot appear after completion, visible progress closes immediately on success,
13+
failures remain dismissible and cancellation waits for cleanup without a result
14+
prompt. Existing clipboard, source-preservation and RTF receiver checks passed.
15+
Installed Finder and older-macOS runtime were not re-tested; the installed app
16+
was not replaced. See the [follow-up evidence](tasks/2026-10-21-copy-file-contents.md#silent-success-feedback).
17+
618
## FileMint 0.8.1 release — 2026-10-29
719

820
Source `052e35cb25efa61236083189f0769f4f9976de16` / `v0.8.1`, build 30,

‎docs/tasks/2026-10-21-copy-file-contents.md‎

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Task: Copy file contents
22

3-
Status: complete — 2026-10-22 review fixes verified
4-
Next action: None for the requested corrections. Installed Finder acceptance
3+
Status: complete — 2026-10-29 silent success feedback verified
4+
Next action: None for the requested changes. Installed Finder acceptance
55
remains a separately recorded runtime boundary.
66

77
## Objective and scope
@@ -109,3 +109,34 @@ is retained separately from the final pass. The native scope is `file-info`
109109
because decoding/publication changed while Finder delivery, authorization and
110110
operation coordination did not. Installed Finder/external grants, third-party
111111
editors, provider volumes and older macOS runtime remain unverified.
112+
113+
## Silent success feedback
114+
115+
2026-10-29: the user accepted silent success, actionable failures and progress
116+
only for slower work. Updated the owning SPEC before changing the controller.
117+
Removed the success panel and its two-second dismissal task. A successful copy
118+
now immediately closes any existing progress panel. The 350 ms progress delay,
119+
failure messages, cancellation cleanup, authorization and clipboard rules remain
120+
unchanged. Cancellation closes the panel after the worker finishes cleanup.
121+
122+
Extended the existing production-controller native checks with silent text/RTF
123+
success, no delayed panel after completion, a gated slow read whose visible
124+
progress panel closes immediately on success, dismissible failures and silent
125+
cancellation. Tests use isolated files/preferences and a private pasteboard.
126+
127+
Tested primary worktree `2a8831ba8a9b4bfa50e2251b71e00f24929ac85f` plus these
128+
uncommitted changes, on arm64 macOS 27.2 (26B123), Xcode 27.1 (27A9275), Swift 6.4.
129+
The website commit made during verification did not change App/Core/build inputs.
130+
Only evidence and verification documentation changed after the native run.
131+
132+
| Check / command | Status | Observed result / evidence |
133+
| --- | --- | --- |
134+
| `make verify` | passed | 370 Core and 23 image tests, JSON/CLI and required offline/restricted checks; [log](../../build/copy-contents-feedback.noindex/verify.log) |
135+
| `CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO make build` | passed | Main app and embedded Finder extension executables exist as arm64; [log](../../build/copy-contents-feedback.noindex/build.log) |
136+
| `NATIVE_QA_SUITES=file-info make verify-native-affected` | passed | Fresh signed fixture `run.p1WKjx` covers the feedback changes and existing content/cleanup regressions; [report](../../build/native-checks.noindex/run.coyutvc9/report.json), [native log](../../build/native-checks.noindex/run.coyutvc9/file-info.log) |
137+
| Installed Finder / older macOS runtime | not-run | The changed controller behavior is covered by the isolated native fixture; installation and release were not performed. |
138+
139+
The native scope is `file-info` because only copy feedback changed. Finder
140+
delivery and external-folder authorization did not change. On 2026-10-29 the user
141+
authorized committing and pushing this change to `origin/main`. Installation and
142+
release are outside this Git delivery.

‎scripts/file_content_copy_checks.swift‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,44 @@ func runFileContentCopyChecks(in root: URL) async throws {
128128
try contentCheck(coordinator.isBusy, "Copy intake reserves the operation guard synchronously")
129129
try await wait("copy completion") { !coordinator.isBusy }
130130
try contentCheck(coordinator.contentCopyController.didCopy, "Production ticket/controller copied")
131+
try contentCheck(coordinator.contentCopyController.panel == nil, "Successful copy leaves no feedback panel")
131132
try contentCheck(board.string(forType: .string).map { Data($0.utf8) } == original, "Exact source content including CRLF and combining mark")
132133
try contentCheck(board.data(forType: .fileURL) == nil && board.data(forType: .rtf) == nil, "Plain text has no file or rich representation")
133134
try contentCheck(try tickets.consume(ticket) == nil, "Copy ticket cannot replay")
134135
try contentCheck(try Data(contentsOf: source) == original, "Source bytes unchanged")
135136
try contentCheck(try Data(contentsOf: prefsURL) == prefsData, "Preferences not changed by copy")
137+
try await Task.sleep(for: .milliseconds(400))
138+
try contentCheck(coordinator.contentCopyController.panel == nil, "Completed copy cannot show a delayed progress panel")
136139
coordinator.contentCopyController.requestClose()
137140

141+
let successGate = ContentReadGate()
142+
let slowCopy = FileContentCopyController(preferencesFile: prefsURL, pasteboard: board, reader: { selection, token in
143+
let contents = try FileContentRead.read(selection, cancellation: token)
144+
successGate.block()
145+
try token.check()
146+
return contents
147+
})
148+
seed(); let slowCounter = board.changeCount
149+
let slowSelection = try FileInfoSelection.capture([source])
150+
let slowTask = Task { await slowCopy.copy(slowSelection, expectedChangeCount: slowCounter) }
151+
do {
152+
try await wait("slow copy progress") { successGate.hasStarted && slowCopy.panel?.isVisible == true }
153+
let progressPanel = slowCopy.panel
154+
try contentCheck(slowCopy.isWorking && !slowCopy.didCopy && board.changeCount == slowCounter,
155+
"Slow work shows progress before publishing the clipboard")
156+
successGate.allow()
157+
await slowTask.value
158+
try contentCheck(slowCopy.didCopy && !slowCopy.isWorking, "Slow copy completes successfully")
159+
try contentCheck(slowCopy.panel == nil && progressPanel?.isVisible == false,
160+
"Success closes the existing progress panel immediately")
161+
try contentCheck(board.string(forType: .string).map { Data($0.utf8) } == original,
162+
"Silent slow success copies the complete original text")
163+
} catch {
164+
successGate.allow(); await slowCopy.cancelAndWait(); await slowTask.value
165+
slowCopy.requestClose()
166+
throw error
167+
}
168+
138169
let controller = FileContentCopyController(preferencesFile: prefsURL, pasteboard: board)
139170
defer { controller.requestClose(); coordinator.contentCopyController.requestClose() }
140171
let bomFile = directory.appendingPathComponent("leading-feff.txt")
@@ -143,6 +174,7 @@ func runFileContentCopyChecks(in root: URL) async throws {
143174
await controller.copy(try FileInfoSelection.capture([bomFile]), expectedChangeCount: board.changeCount)
144175
try contentCheck(controller.didCopy && board.string(forType: .string).map { Data($0.utf8) } == Data("\u{FEFF}A".utf8),
145176
"Production text copy removes only the encoding BOM")
177+
try contentCheck(controller.panel == nil, "Plain-text success stays silent")
146178
for isRich in [true, false] {
147179
let receiver = NSTextView(frame: NSRect(x: 0, y: 0, width: 500, height: 180))
148180
receiver.isRichText = isRich
@@ -155,14 +187,17 @@ func runFileContentCopyChecks(in root: URL) async throws {
155187
seed(); let counter = board.changeCount
156188
await controller.copy(try FileInfoSelection.capture([file]), expectedChangeCount: counter)
157189
try contentCheck(!controller.didCopy && board.changeCount == counter, "Invalid input preserves board: \(name)")
190+
try contentCheck(controller.panel?.isVisible == true, "Copy failures retain a visible explanation: \(name)")
158191
controller.requestClose()
192+
try contentCheck(controller.panel == nil, "Failure feedback can be dismissed")
159193
}
160194
let richFile = directory.appendingPathComponent("sample.rtf")
161195
try rtf.write(to: richFile)
162196
try contentCheck(FileContentCopyPolicy.supportsMenuSelection([richFile]), "Validated RTF has a Finder menu candidate")
163197
seed()
164198
await controller.copy(try FileInfoSelection.capture([richFile]), expectedChangeCount: board.changeCount)
165199
try contentCheck(controller.didCopy && board.data(forType: .rtf) == rtf, "Admitted RTF traverses production reader/controller")
200+
try contentCheck(controller.panel == nil, "RTF success stays silent after an earlier failure")
166201
controller.requestClose()
167202
let rejectedRTF: [(String, String)] = [
168203
("truncated", #"{\rtf1 lost"#),
@@ -232,8 +267,14 @@ func runFileContentCopyChecks(in root: URL) async throws {
232267
try contentCheck(!gated.contentCopyController.didCopy, "No publication after \(scenario) change")
233268
try contentCheck(board.string(forType: .string) == (scenario == "clipboard" ? "newer content during read" : "keep previous clipboard"), "Clipboard preserved after \(scenario)")
234269
try contentCheck(!FileManager.default.fileExists(atPath: pending.path), "Busy move was never prepared")
270+
if scenario == "cancel" {
271+
try contentCheck(gated.contentCopyController.panel == nil, "Cancellation closes progress without feedback")
272+
} else {
273+
try contentCheck(gated.contentCopyController.panel?.isVisible == true, "Read failures keep their explanation visible")
274+
}
235275
gated.contentCopyController.requestClose()
236276
} catch { gate.allow(); await gated.cancelActiveReadsAndWait(); throw error }
237277
}
278+
print("PASS file contents feedback: silent text/RTF success; no delayed panel; slow progress closes immediately; failures stay visible; cancellation stays silent")
238279
print("PASS file contents: exact production text copy; failures preserve clipboard; change detection; revoked policy; cancellation cleanup; busy tickets consumed")
239280
}

‎specs/domains/file-tools.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ Load for: Optional Finder file/folder actions, batch rename, selection snapshots
117117
untouched; report a final pasteboard-write failure without claiming restoration.
118118
- Serialize active work with other file operations. Consume/reject busy tickets
119119
promptly. Cancel/close and quit/update restart cancel and wait for worker cleanup
120-
before releasing grants or the busy guard. Show a compact cancellable progress
121-
panel only for slower work, concise success feedback and actionable failures;
122-
never open settings or require an additional Run/Copy step after the menu click.
120+
before releasing grants or the busy guard. Successful copies are silent: do not
121+
show a success panel or notification. Show a compact cancellable progress panel
122+
only for slower work and close it as soon as the operation succeeds or finishes
123+
cancelling. Keep actionable failures visible until dismissed; never open settings
124+
or require an additional Run/Copy step after the menu click.
123125

124126
## File information and checksums
125127

‎specs/verification/finder.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ signed `file-info` fixture also runs `file_content_copy_checks.swift`: real priv
3737
pasteboard writes, exact Unicode/whitespace text, unchanged RTF bytes, rich/plain
3838
`NSTextView` paste and font/color/paragraph attributes, source changes, clipboard
3939
changes, revoked policy, cancellation cleanup and busy request consumption.
40+
It also verifies silent text/RTF success, no delayed panel after completion,
41+
immediate progress-panel closure on success, dismissible failure feedback and
42+
silent cancellation after worker cleanup.
4043
These receivers do not establish compatibility with every third-party editor.
4144

4245
`make verify-batch-rename-capture` runs the production click-time capture and

0 commit comments

Comments
 (0)