feat: review Following during Prepare Today (Closes #1301)
This commit is contained in:
1 parent
875ec45928
commit
12c0e18dfe
19 files changed
+189
-42
No files matched your search
@@ -303,4 +303,4 @@ async def test_unread_update_offers_reply_mark_read_and_next_independent_of_toda
|
||||
assert '.update-reply-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr));' in html
|
||||
assert '.update-reply-actions button { min-height:44px;' in html
|
||||
worker = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text()
|
||||
assert "stackchain-dashboard-shell-v131" in worker
|
||||
assert "stackchain-dashboard-shell-v132" in worker
|
||||
@@ -166,6 +166,36 @@ const feature = createFollowing({{
|
||||
assert result["renders"][-1]["reviewSummary"] == {"reviewed": 2, "remaining": 0}
|
||||
|
||||
|
||||
def test_following_review_notifies_prepare_today_when_final_revision_is_loaded():
|
||||
script = f"""
|
||||
const createFollowing = require({json.dumps(str(MODULE))});
|
||||
const completed = [];
|
||||
const items=[
|
||||
{{repository:'stackchain/api',number:42,title:'First',updated_at:'2026-08-23T06:00:00Z',has_unseen_change:true}},
|
||||
{{repository:'stackchain/web',number:9,title:'Second',updated_at:'2026-08-23T05:00:00Z',has_unseen_change:true}}
|
||||
];
|
||||
const feature = createFollowing({{
|
||||
fetchJson:async () => ({{revision:7,items}}),
|
||||
onOpen:async () => {{}},
|
||||
onAcknowledge:async () => {{}},
|
||||
onReviewComplete:() => completed.push('following'),
|
||||
}});
|
||||
(async () => {{
|
||||
await feature.load();
|
||||
await feature.startReview();
|
||||
await feature.previewLoaded(feature.session().items[1]);
|
||||
const beforeFinish = completed.slice();
|
||||
feature.finishReview();
|
||||
feature.finishReview();
|
||||
process.stdout.write(JSON.stringify({{beforeFinish, completed}}));
|
||||
}})().catch(error => {{ console.error(error); process.exit(1); }});
|
||||
"""
|
||||
|
||||
assert json.loads(subprocess.run(
|
||||
["node", "-e", script], text=True, capture_output=True, check=True
|
||||
).stdout) == {"beforeFinish": [], "completed": ["following"]}
|
||||
|
||||
|
||||
def test_following_review_never_clears_activity_newer_than_the_loaded_preview():
|
||||
script = f"""
|
||||
const createFollowing = require({json.dumps(str(MODULE))});
|
||||
@@ -224,4 +254,23 @@ def test_following_review_controls_are_wired_into_the_phone_preview_flow():
|
||||
assert "'Back to Following'" in dashboard
|
||||
assert "if (searchPreviewReturnKind === 'following')" in dashboard
|
||||
assert "e.key === 'Escape' && searchPreviewReturnKind === 'following'" in dashboard
|
||||
assert "stackchain-dashboard-shell-v131" in service_worker
|
||||
assert "stackchain-dashboard-shell-v132" in service_worker
|
||||
|
||||
|
||||
def test_prepare_today_lazily_refreshes_and_directly_reviews_following():
|
||||
following = MODULE.read_text()
|
||||
dashboard = (ROOT / "frontend" / "dashboard.js").read_text()
|
||||
|
||||
assert "function attachFollowing(onOpen, hooks = {})" in following
|
||||
assert "hooks.onCount?.(count, feature.items())" in following
|
||||
assert "hooks.onStatus?.(state.status)" in following
|
||||
assert "onReviewComplete:hooks.onReviewComplete" in following
|
||||
assert "review:feature.startReview" in following
|
||||
assert "const completed = feature.finishReview()" in following
|
||||
assert "if (completed) return 'completed-following'" in following
|
||||
assert "followingQueue.load().catch(() => {})" in dashboard
|
||||
assert "mobileQueueCounts.following = count" in dashboard
|
||||
assert "mobileQueueCounts.followingUnavailable = status === 'error'" in dashboard
|
||||
assert "mobilePreparationItems.following = items.filter" in dashboard
|
||||
assert "mobileQueueCounts.followingUnavailable ? followingQueue.open()" in dashboard
|
||||
assert "mobileStartDay.completePhase('following')" in dashboard
|
||||
@@ -435,5 +435,5 @@ async def test_dashboard_syncs_every_later_change_and_exposes_account_status():
|
||||
def test_later_sync_ships_atomically_in_the_offline_shell():
|
||||
source = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/later-sync.js'" in source
|
||||
@@ -256,4 +256,4 @@ def test_markdown_work_bodies_are_mobile_safe_block_containers():
|
||||
assert ".markdown-content { min-width:0; max-width:100%; overflow-wrap:anywhere;" in css
|
||||
assert ".markdown-content pre { max-width:100%; overflow-x:auto;" in css
|
||||
assert ".markdown-content a { min-height:44px;" in css
|
||||
assert "stackchain-dashboard-shell-v131" in worker
|
||||
assert "stackchain-dashboard-shell-v132" in worker
|
||||
@@ -45,7 +45,7 @@ def test_offline_shell_contains_every_local_dashboard_runtime_asset():
|
||||
shell_assets = set(re.findall(r"BASE \+ '([^']+)'", worker.split("async function sessionCsrf", 1)[0]))
|
||||
|
||||
assert local_assets <= shell_assets, f"Offline shell is missing: {sorted(local_assets - shell_assets)}"
|
||||
assert "stackchain-dashboard-shell-v131" in worker
|
||||
assert "stackchain-dashboard-shell-v132" in worker
|
||||
|
||||
|
||||
def test_all_conversation_composers_offer_accessible_mobile_mentions():
|
||||
|
||||
@@ -383,7 +383,7 @@ def test_mobile_dashboard_mounts_phone_safe_device_setup_flow():
|
||||
assert "controller.recoverPermission('deadline')" in dashboard
|
||||
assert "pushControllerReady.then(ensureDeviceSetup)" in dashboard
|
||||
assert "BASE + 'static/mobile-device-setup.js'" in worker
|
||||
assert "stackchain-dashboard-shell-v131" in worker
|
||||
assert "stackchain-dashboard-shell-v132" in worker
|
||||
assert ".device-setup-panel" in css
|
||||
assert ".device-readiness-card" in css
|
||||
assert "overflow-x:hidden" in css
|
||||
|
||||
@@ -243,5 +243,5 @@ async def test_mobile_home_progressively_discloses_secondary_panels_as_insights(
|
||||
def test_mobile_insights_rolls_into_the_offline_shell():
|
||||
worker = (CONTROLLER.parent / "service-worker.js").read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in worker
|
||||
assert "stackchain-dashboard-shell-v132" in worker
|
||||
assert "BASE + 'static/mobile-insights.js'" in worker
|
||||
@@ -146,6 +146,61 @@ process.stdout.write(JSON.stringify(controller.briefing()));
|
||||
}
|
||||
|
||||
|
||||
def test_prepare_today_reviews_unseen_following_after_filed_before_today():
|
||||
script = f"""
|
||||
const createStartDay = require({json.dumps(str(START_DAY))});
|
||||
const opened = [];
|
||||
const controller = createStartDay({{
|
||||
getCounts: () => ({{filed:1, following:2, today:3}}),
|
||||
openQueue: name => opened.push(name),
|
||||
}});
|
||||
const briefing = controller.briefing();
|
||||
controller.startNext();
|
||||
process.stdout.write(JSON.stringify({{briefing, opened}}));
|
||||
"""
|
||||
|
||||
output = run_node(script)
|
||||
assert output == {
|
||||
"briefing": {
|
||||
"total": 3,
|
||||
"next": "filed",
|
||||
"label": "Review Filed",
|
||||
"summary": "3 items before Today · 3 planned",
|
||||
"phases": [
|
||||
{"name": "filed", "label": "Filed", "count": 1},
|
||||
{"name": "following", "label": "Following", "count": 2},
|
||||
],
|
||||
},
|
||||
"opened": ["filed"],
|
||||
}
|
||||
|
||||
|
||||
def test_prepare_today_keeps_failed_following_refresh_retryable_before_today():
|
||||
script = f"""
|
||||
const createStartDay = require({json.dumps(str(START_DAY))});
|
||||
const opened = [];
|
||||
const controller = createStartDay({{
|
||||
getCounts: () => ({{followingUnavailable:true, today:2}}),
|
||||
openQueue: name => opened.push(name),
|
||||
}});
|
||||
const briefing = controller.briefing();
|
||||
controller.startNext();
|
||||
process.stdout.write(JSON.stringify({{briefing, opened}}));
|
||||
"""
|
||||
|
||||
output = run_node(script)
|
||||
assert output == {
|
||||
"briefing": {
|
||||
"total": 0,
|
||||
"next": "following",
|
||||
"label": "Retry Following",
|
||||
"summary": "Following needs retry before Today · 2 planned",
|
||||
"phases": [{"name": "following", "label": "Following unavailable", "count": 0}],
|
||||
},
|
||||
"opened": ["following"],
|
||||
}
|
||||
|
||||
|
||||
def test_start_day_view_renders_refreshed_phases_and_launches_primary_action():
|
||||
script = f"""
|
||||
const createStartDay = require({json.dumps(str(START_DAY))});
|
||||
@@ -352,13 +407,14 @@ async def test_dashboard_wires_thumb_safe_start_day_briefing_into_offline_mobile
|
||||
assert "mobileStartDay.finish()" in html
|
||||
assert "openQueue: name =>" in html
|
||||
assert "if (sheet.open) sheet.close();" in html
|
||||
assert "name === 'find' ? qs('#find-work').click() : mobileQueueLauncher.open(name)" in html
|
||||
assert "mobileQueueCounts.followingUnavailable ? followingQueue.open()" in html
|
||||
assert "Checking Agenda, Attention, Updates, Filed, and Following" in html
|
||||
assert "mobileStartDay.render();" in html
|
||||
assert ".mobile-start-day-action { width:100%; min-height:48px;" in html
|
||||
assert ".mobile-start-day-finish { min-height:44px;" in html
|
||||
assert "max-width:100%; overflow-wrap:anywhere;" in html
|
||||
assert "BASE + 'static/mobile-start-day.js'" in service_worker
|
||||
assert "stackchain-dashboard-shell-v131" in service_worker
|
||||
assert "stackchain-dashboard-shell-v132" in service_worker
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
||||
@@ -834,7 +834,8 @@ async def test_dashboard_renders_and_wires_mobile_queue_switcher():
|
||||
assert '<script src="static/mobile-queue-launcher.js"></script>' in html
|
||||
assert "const mobileQueueLauncher = createMobileQueueLauncher({" in html
|
||||
assert "firstAction: name => qs('#my-work-list .my-work-card-main, #my-work-list .draft-resume, #my-work-list .draft-continue, #my-work-list .draft-edit')" in html
|
||||
assert "name === 'find' ? qs('#find-work').click() : mobileQueueLauncher.open(name)" in html
|
||||
assert "name === 'find' ? qs('#find-work').click() :" in html
|
||||
assert "mobileQueueCounts.followingUnavailable ? followingQueue.open()" in html
|
||||
assert '.mobile-queue-sheet' in html
|
||||
assert '.my-work-actions { display:none;' in html
|
||||
assert 'padding-bottom:calc(16px + env(safe-area-inset-bottom))' in html
|
||||
@@ -893,7 +894,8 @@ async def test_dashboard_renders_and_wires_phone_safe_task_dock():
|
||||
assert '<script src="static/mobile-task-dock.js"></script>' in html
|
||||
assert "createMobileTaskDock({" in html
|
||||
assert "work: () => mobileWorkEntry.open()" in html
|
||||
assert "name === 'find' ? qs('#find-work').click() : mobileQueueLauncher.open(name)" in html
|
||||
assert "name === 'find' ? qs('#find-work').click() :" in html
|
||||
assert "mobileQueueCounts.followingUnavailable ? followingQueue.open()" in html
|
||||
assert "qs('[data-work-filter=\"' + name + '\"]').click()" in html
|
||||
assert "find: () => qs('#find-work').click()" in html
|
||||
assert "new: () => qs('#new-issue').click()" in html
|
||||
|
||||
@@ -418,7 +418,7 @@ async def test_starting_saved_today_work_closes_a_concurrent_rollover_planner():
|
||||
def test_plan_today_controller_is_available_in_the_offline_shell():
|
||||
source = SERVICE_WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/plan-today.js'" in source
|
||||
assert "BASE + 'static/plan-today-readiness.js'" in source
|
||||
assert "BASE + 'static/plan-today-preview.js'" in source
|
||||
@@ -186,7 +186,7 @@ async function dispatchPush(payload) {{
|
||||
def test_week_unplan_undo_rolls_the_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/week-plan.js'" in source
|
||||
assert "BASE + 'static/dashboard.css'" in source
|
||||
|
||||
@@ -194,20 +194,20 @@ def test_week_unplan_undo_rolls_the_offline_shell():
|
||||
def test_private_today_action_mailbox_rolls_the_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
|
||||
|
||||
def test_per_day_week_conflict_ui_rolls_the_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/week-plan.js'" in source
|
||||
|
||||
|
||||
def test_resumable_today_session_ships_in_a_new_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/my-work.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
assert "BASE + 'static/dashboard.css'" in source
|
||||
@@ -216,7 +216,7 @@ def test_resumable_today_session_ships_in_a_new_offline_shell():
|
||||
def test_mobile_conversation_photo_bundles_roll_the_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
assert "BASE + 'static/authored-outbox.js'" in source
|
||||
assert "BASE + 'static/background-issue-sync.js'" in source
|
||||
@@ -225,7 +225,7 @@ def test_mobile_conversation_photo_bundles_roll_the_offline_shell():
|
||||
def test_photo_metadata_sanitizer_rolls_the_cached_optimizer_atomically():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/issue-evidence-review.js'" in source
|
||||
assert "BASE + 'static/issue-attachment.js'" in source
|
||||
|
||||
@@ -233,14 +233,14 @@ def test_photo_metadata_sanitizer_rolls_the_cached_optimizer_atomically():
|
||||
def test_ownership_exit_runtime_rolls_the_offline_shell_cache():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
|
||||
|
||||
def test_offline_review_next_ships_today_completion_atomically():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/today-completion.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
|
||||
@@ -248,7 +248,7 @@ def test_offline_review_next_ships_today_completion_atomically():
|
||||
def test_duplicate_aware_capture_ships_in_a_new_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/create-issue-sheet.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
|
||||
@@ -256,7 +256,7 @@ def test_duplicate_aware_capture_ships_in_a_new_offline_shell():
|
||||
def test_inline_checklist_step_flow_rolls_the_offline_shell_atomically():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/issue-sheet.js'" in source
|
||||
assert "BASE + 'static/checklist-conflict.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
@@ -266,14 +266,14 @@ def test_inline_checklist_step_flow_rolls_the_offline_shell_atomically():
|
||||
def test_exact_later_picker_ships_atomically_in_a_new_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/later-picker.js'" in source
|
||||
|
||||
|
||||
def test_navigation_deadline_ships_in_a_new_shell_cache():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/dashboard.css'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
assert "BASE + 'static/install-app.js'" in source
|
||||
@@ -282,21 +282,21 @@ def test_navigation_deadline_ships_in_a_new_shell_cache():
|
||||
def test_today_convergence_ships_in_a_new_shell_cache():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/today-sync.js'" in source
|
||||
|
||||
|
||||
def test_mobile_search_viewport_ships_in_a_new_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/mobile-search-viewport.js'" in source
|
||||
|
||||
|
||||
def test_update_ownership_flow_ships_atomically_in_a_new_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/update-ownership.js'" in source
|
||||
|
||||
|
||||
@@ -1302,7 +1302,7 @@ def test_one_session_bound_csrf_proof_is_reused_for_a_background_drain():
|
||||
def test_queue_today_ships_atomically_in_a_new_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/queue-today.js'" in source
|
||||
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ async def test_today_blocker_opens_existing_preview_and_preserves_readiness_gate
|
||||
def test_readiness_runtime_is_available_in_offline_shell():
|
||||
service_worker = SERVICE_WORKER.read_text()
|
||||
|
||||
assert "const CACHE = 'stackchain-dashboard-shell-v131';" in service_worker
|
||||
assert "const CACHE = 'stackchain-dashboard-shell-v132';" in service_worker
|
||||
assert "BASE + 'static/today-readiness.js'" in service_worker
|
||||
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ listeners['stackchain:first-task-complete']();
|
||||
def test_inflight_today_drain_ships_in_a_new_offline_shell():
|
||||
source = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v131" in source
|
||||
assert "stackchain-dashboard-shell-v132" in source
|
||||
assert "BASE + 'static/today-sync.js'" in source
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user