Extract document-session workflow prompt helper

This commit is contained in:
2026-06-15 22:06:21 +02:00
parent eaa8a2fced
commit c37451e959
4 changed files with 72 additions and 18 deletions

View File

@@ -18,6 +18,12 @@ agent or engineer to remove them without reconstructing context from chat.
## Recent Reductions ## Recent Reductions
- 2026-06-15: `DEBT-0040` was narrowed again. The retained save-before-
continue workflow prompt wiring in `src/legacy_document_session_services.cpp`
now routes through a focused helper instead of living inline in
`prompt_save_before_continue()`; the remaining document-session bridge debt
stays concentrated in close prompts, native close requests, save-version
routing, app document field mutation, and keyboard/dialog cleanup.
- 2026-06-15: `DEBT-0040`/`DEBT-0041`/`DEBT-0042` were narrowed again. The - 2026-06-15: `DEBT-0040`/`DEBT-0041`/`DEBT-0042` were narrowed again. The
retained overwrite-prompt wiring in `src/legacy_document_session_services.cpp` retained overwrite-prompt wiring in `src/legacy_document_session_services.cpp`
now routes through a focused helper instead of living inline in the new now routes through a focused helper instead of living inline in the new

View File

@@ -1410,6 +1410,11 @@ The retained new-document and Save As overwrite prompt wiring in
helper, so the remaining document-session bridge debt is further concentrated helper, so the remaining document-session bridge debt is further concentrated
on close prompts, native close requests, save-version routing, app document on close prompts, native close requests, save-version routing, app document
field mutation, and keyboard/dialog cleanup. field mutation, and keyboard/dialog cleanup.
The retained save-before-continue workflow prompt wiring in
`src/legacy_document_session_services.*` now also routes through a focused
helper, so the remaining document-session bridge debt is further concentrated
on close prompts, native close requests, save-version routing, app document
field mutation, and keyboard/dialog cleanup.
`App::dialog_newdoc` now routes accepted new-document plans through the `App::dialog_newdoc` now routes accepted new-document plans through the
app-core new-document executor and `src/legacy_document_session_services.*`, app-core new-document executor and `src/legacy_document_session_services.*`,
preserving target overwrite prompts, legacy canvas resize/layer setup, history preserving target overwrite prompts, legacy canvas resize/layer setup, history

View File

@@ -1452,6 +1452,42 @@ Completed Task Log:
| --- | --- | ---: | --- | --- | | --- | --- | ---: | --- | --- |
| 2026-06-15 | ADP-038 | no score movement | `powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt"` | `93846763` | | 2026-06-15 | ADP-038 | no score movement | `powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt"` | `93846763` |
### ADP-039 - Extract Document-Session Workflow Prompt Helper
Status: Done
Score: no score movement
Debt: `DEBT-0040`
Scope: `src/legacy_document_session_services.cpp` only
Closeout: `93846763`
Goal:
Reduce the inline retained save-before-continue workflow prompt surface by
extracting the button wiring from `prompt_save_before_continue()` into a
focused helper while preserving current behavior.
Done Checks:
- The retained save-before-continue workflow prompt wiring no longer lives
inline in `prompt_save_before_continue()`.
- The retained workflow prompt path now routes through a focused helper in
`src/legacy_document_session_services.cpp`.
- `DEBT-0040` and the roadmap note the reduced remaining document-session
bridge surface.
Validation:
```powershell
powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt"
```
Completed Task Log:
| Date | Task | Score | Validation | Commit |
| --- | --- | ---: | --- | --- |
| 2026-06-15 | ADP-039 | no score movement | `powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt"` | `93846763` |
### RND-001 - Make Pure Equirectangular Export The Primary Success Path ### RND-001 - Make Pure Equirectangular Export The Primary Success Path
Status: Done Status: Done

View File

@@ -348,6 +348,30 @@ private:
App& app_; App& app_;
}; };
void wire_prompt_save_before_continue_buttons(
App& app,
const std::shared_ptr<NodeMessageBox>& dialog,
std::function<void()> action)
{
auto* app_ptr = &app;
dialog->btn_ok->on_click = [app_ptr, dialog, action](Node*) {
project_save_after_snapshot(*app_ptr, [app_ptr, dialog, action](bool success) {
if (success)
action();
else {
const auto plan = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::document_save_error);
app_ptr->message_box(plan.title, plan.message, plan.show_cancel);
}
});
pp::panopainter::close_legacy_dialog_node(*dialog);
};
dialog->btn_cancel->on_click = [dialog, action](Node*) {
action();
pp::panopainter::close_legacy_dialog_node(*dialog);
};
}
class LegacyDocumentWorkflowServices final : public pp::app::DocumentWorkflowServices { class LegacyDocumentWorkflowServices final : public pp::app::DocumentWorkflowServices {
public: public:
LegacyDocumentWorkflowServices(App& app, std::function<void()> action) noexcept LegacyDocumentWorkflowServices(App& app, std::function<void()> action) noexcept
@@ -379,24 +403,7 @@ public:
app_, app_,
pp::app::plan_document_session_prompt( pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::save_before_workflow_continue)); pp::app::DocumentSessionPromptKind::save_before_workflow_continue));
auto* app = &app_; wire_prompt_save_before_continue_buttons(app_, m, action_);
auto action = action_;
m->btn_ok->on_click = [app, m, action](Node*) {
project_save_after_snapshot(*app, [app, m, action](bool success) {
if (success)
action();
else {
const auto plan = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::document_save_error);
app->message_box(plan.title, plan.message, plan.show_cancel);
}
});
pp::panopainter::close_legacy_dialog_node(*m);
};
m->btn_cancel->on_click = [m, action](Node*) {
action();
pp::panopainter::close_legacy_dialog_node(*m);
};
} }
private: private: