refactor(playground): give generation one application owner - #109
Merged
Conversation
|
Visit the preview URL for this PR (updated for commit d895a86): https://superdeck-dev--pr109-refactor-generation-ti7tupz3.web.app (expires Thu, 08 Oct 2026 19:24:30 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bd68fc230762285849207e7e120aaf87cd4ca2f9 |
leoafarias
force-pushed
the
refactor/generation-lifecycle
branch
from
September 8, 2026 19:00
b9ca8ec to
20c0008
Compare
Wizard generation, editor generation, and the debug generation lab each applied their results differently. Route all three through GeneratedDeckResultApplier, and give the lab its own document store so its experiments cannot publish into the editor's document. The applier now takes a required application guard, serializes application per host, and reports whether publication happened. It removes the artwork one abandoned attempt staged while keeping every asset the committed deck still uses. After a successful publication it reports a failed cleanup of replaced artwork separately, so the deck no longer counts as a failed generation. DeckDocumentStore and DeckFileSession expose read-only revisions. Editor generation captures both when it starts, so editing the document or switching decks — including a switch between files with identical content — discards the generated deck. The editor header shows that non-blocking notice, because the generation panel can be closed before the deck arrives. Wizard timing and result application now respect the current operation identifier, and the four generation entry points share one model-client setup, prompt load, and disposal path.
The applier tests checked the document and the artwork but not the theme or the preview. Assert all four states together for a published result, and assert that an invalidated result leaves the committed theme in place.
leoafarias
force-pushed
the
refactor/generation-lifecycle
branch
from
September 8, 2026 19:19
20c0008 to
d895a86
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Wizard generation, editor generation, and the debug generation lab each applied their results differently, and a slow generation could overwrite newer editor work.
This PR follows #108 and targets
main. Its incremental diff contains the generation lifecycle changes.Changes
One application owner — all three hosts now use
GeneratedDeckResultApplier. The lab gets its ownDeckDocumentStore, so its experiments cannot publish into the editor's document.Application guard and asset lifetime —
applytakes a required guard, serializes application per host, and returnsGeneratedDeckApplication(published, cleanupError). It checks the guard before staging artwork and again after that asynchronous work, immediately before publishing. An abandoned attempt removes only the artwork it staged, keeping every asset the committed deck still uses. After a successful publication, a failed cleanup of replaced artwork is reported separately, so the deck no longer counts as a failed generation.Protecting newer work —
DeckDocumentStore.revisionandDeckFileSession.bindingRevisionare read-only. Editor generation captures both when it starts and takes an injected binding-revision reader. Editing the document or switching decks invalidates the run, including a switch between two files with identical content, which the document revision alone cannot detect. The invalidated result is discarded and the editor header shows a non-blocking notice, because the generation panel can be closed before the deck arrives.clearResult()no longer erases that notice. Long notices wrap within the editor pane, including enlarged text, and the dismiss control has an accessibility label.Wizard lifecycle — timing and result application respect the current operation identifier. A superseded run no longer adds its duration to, or stops the clock of, the run that replaced it.
Shared service setup — the four generation entry points share
_withModelSessionfor model-client creation, executor construction, prompt loading, and disposal. Request budgets, retries, partial results, and tracing are unchanged. The configured models, thinking settings, prompts, and generation strategy are untouched.Impacted packages
packages/playgroundTests
generated_deck_result_applier_test.dart— staged-asset removal on an invalidated application, committed artwork preserved when reused, cleanup failure reported after publishing, serialized queued applications, and recovery after an asset write throws. Cancellation also preserves a distinct committed theme and emits no preview update.editor_header_test.dart— 600px layout, accessible dismissal, and normal/150% text size. Both layout cases fail on the original header and pass with the fix.generate_deck_command_test.dart— discard on a document edit, discard on a deck switch with identical content, publication when nothing replaced the run, and notice survival acrossclearResult().wizard_generation_controller_test.dart— the applier guard blocks a late application, a cleanup failure does not fail the generation, and a superseded run does not stop the current run clock.deck_document_store_test.dartanddeck_file_session_test.dart— revision counting and a binding change for identical content.Commands run
Plus the deterministic 10-slide generation checkpoint, which passed with
qualityReport.passedand 10/10 slides captured.Generation and UI verification
The live 10-slide smoke test passed on September 8 with three artworks, all ten slides replayed and captured, and 18.778 seconds of generation time. Its quality report passed with one non-blocking commitment-grounding diagnostic. This is one latency sample. No generation models, prompts, or thinking settings changed in the follow-up.
The actual editor header was also checked in an isolated macOS harness at 600px and 150% text size, using fake file storage. The notice wrapped and clicking dismiss removed it, with attached Flutter logs showing no runtime errors. Before/after screenshots are retained with the local review evidence; media is not attached to this PR. The full interactive Wizard/editor race walkthrough remains incomplete.
The follow-up also passed code generation,
melos run fix, contract schema checks, and workflow lint, with no generated-file changes.