Back to notes
The Tesseract MemoryTechnical note

Making sure a background result still belongs on screen

Moving a scan away from the main actor also requires deciding whether its result is still current when it returns.

Topics

Capture the work before leaving the main actor

Omitto's view model owns the source text, review controls and displayed output on the main actor. A scan captures the input and policy, advances a generation number and marks processing active before starting a detached task.

The task builds the line map and calls RedactionCore. When it returns, the main actor checks that its generation is still current, the input still equals the captured text and the task is not cancelled. Only then are the result and review metadata assigned together.

An edit invalidates the review as well as the output

Changing the source does more than cancel pending work. The view model clears the old output, findings, report, line map and per-finding Keep choices. Those values were derived from the previous text, so they cannot remain the current review after an edit.

Copy stays disabled during processing. Together, invalidation and the publication checks prevent an old analysis from quietly replacing or standing in for the text now being reviewed. This is a source-to-result consistency rule, not a claim that the detector found every secret.

Cancellation and stopping computation are different

RedactionCore exposes a synchronous operation and does not poll Swift task cancellation inside the detector. An obsolete scan may continue computing until it returns; the app's checks then reject its result.

The recorded June change supports moving the work out of the main-actor method and adding generation checks. The current code also checks input equality. Neither source inspection nor the historical record supplies a measured responsiveness gain or a fresh concurrency result, so those remain checks to run.

Background redaction result ownership

Computation may finish late; only the current generation is allowed to publish.

Direct callAsync taskResponse / returnBlocked / denied
Main actor
Background work
Review and export

Scroll or drag the background to move. Use the zoom buttons to resize.Arrow keys move between components. Enter selects.

Choose a component to explore

Select a numbered component on the map or use the component menu. Its details and connections will appear here.

No component selected.

All connections (8)
  1. 01 · Current input02 · Captured scan requeststart current scan · Direct call
  2. 02 · Captured scan request03 · Synchronous redactioncaptured inputs · Async task
  3. 03 · Synchronous redaction04 · Publication checkscomputed result · Response / return
  4. 01 · Current input04 · Publication checkscurrent generation · Direct call
  5. 04 · Publication checks05 · Obsolete resultstale or cancelled · Blocked / denied
  6. 04 · Publication checks06 · Current output and findingscurrent result · Direct call
  7. 06 · Current output and findings07 · Explicit copy actionreviewed output · Direct call
  8. 07 · Explicit copy action08 · System pasteboarduser copy · Direct call