Make Human Gates first-class in mobile queues and Prepare Today #1418
|
|
@ -163,6 +163,7 @@
|
|||
}
|
||||
const mobileQueueLauncher = createMobileQueueLauncher({
|
||||
openDelivery: () => mobileDeliveryRecovery.open(),
|
||||
openHumanGates: () => openHumanGates(),
|
||||
openToday: () => mobileWorkEntry.open(),
|
||||
openAgenda: openAgendaSession,
|
||||
openUpdates: openUpdateTriage,
|
||||
|
|
@ -642,6 +643,14 @@
|
|||
isOnline:()=>navigator.onLine,
|
||||
location:window.location,
|
||||
fetchJson:fetchReviewJson,
|
||||
onChange:(snapshot, state)=>{
|
||||
queueCounts.gate = snapshot.pending_count;
|
||||
queueCounts.gateUnavailable = state.available === false;
|
||||
preparationItems.gate = snapshot.items;
|
||||
mobileTaskDock.updateQueues(queueCounts);
|
||||
if (state.authoritative) mobileStartDay.reconcile({authoritative:true, authoritativePhases:['gate']});
|
||||
mobileStartDay.render();
|
||||
},
|
||||
nodes:{
|
||||
count:qs('#human-gates-count'), list:qs('#human-gates-list'),
|
||||
status:qs('#human-gates-status'), panel:qs('#human-gates'),
|
||||
|
|
@ -3490,8 +3499,11 @@
|
|||
counts.later = laterMyWork.length;
|
||||
counts.draft = lastDrafts.length;
|
||||
counts.delivery = draftInbox.partition(lastDrafts).actionable;
|
||||
counts.gate = queueCounts.gate;
|
||||
counts.gateUnavailable = queueCounts.gateUnavailable;
|
||||
preparationItems = {
|
||||
delivery:draftInbox.partition(lastDrafts).deliveries,
|
||||
gate:preparationItems.gate || [],
|
||||
agenda:agendaMyWork(activeMyWork),
|
||||
attention:activeMyWork.filter(item => item.needs_attention),
|
||||
update:activeMyWork.filter(item => item.has_update),
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ function createHumanGates(options = {}) {
|
|||
const cacheKey = () => 'stackchain.human-gates.v1:' + String(getAccountKey() || '').trim().toLowerCase();
|
||||
const setText = (node, value) => { if (node) node.textContent = value; };
|
||||
const setHtml = (node, value) => { if (node) node.innerHTML = value; };
|
||||
const publish = state => options.onChange?.(JSON.parse(JSON.stringify(queue)), state);
|
||||
|
||||
function validSnapshot(value) {
|
||||
return value && Number.isInteger(value.pending_count) && Array.isArray(value.items) ? value : null;
|
||||
|
|
@ -91,7 +92,11 @@ function createHumanGates(options = {}) {
|
|||
render();
|
||||
}
|
||||
const cached = restore();
|
||||
if (cached) { queue = cached; render(); }
|
||||
if (cached) {
|
||||
queue = cached;
|
||||
render();
|
||||
publish({available:true, authoritative:false, cached:true});
|
||||
}
|
||||
try {
|
||||
const live = validSnapshot(await fetchJson('api/v1/human-gates'));
|
||||
if (epoch !== loadEpoch || accountKey !== loadedAccountKey) return queue;
|
||||
|
|
@ -99,10 +104,14 @@ function createHumanGates(options = {}) {
|
|||
queue = { pending_count: live.pending_count, items: live.items.slice() };
|
||||
save(queue);
|
||||
render();
|
||||
publish({available:true, authoritative:true});
|
||||
return queue;
|
||||
} catch (error) {
|
||||
if (epoch !== loadEpoch || accountKey !== loadedAccountKey) return queue;
|
||||
if (!cached) throw error;
|
||||
if (!cached) {
|
||||
publish({available:false, authoritative:false});
|
||||
throw error;
|
||||
}
|
||||
setText(nodes.status, 'Offline cached gate list · reconnect before deciding.');
|
||||
return queue;
|
||||
}
|
||||
|
|
@ -175,6 +184,7 @@ function createHumanGates(options = {}) {
|
|||
queue.items = queue.items.filter(candidate => candidate.id !== item.id);
|
||||
queue.pending_count = Math.max(0, queue.pending_count - 1);
|
||||
save(queue); render();
|
||||
publish({available:true, authoritative:true, decision:true});
|
||||
reviewIndex += 1;
|
||||
const next = current();
|
||||
if (next) reviewNext(); else renderDetail(null);
|
||||
|
|
|
|||
|
|
@ -2180,6 +2180,7 @@
|
|||
<button data-mobile-queue="week" type="button"><span><strong>Week Ahead</strong><small id="mobile-week-summary" aria-live="polite">Nothing planned</small></span></button>
|
||||
<button data-mobile-queue="agenda" type="button"><span><strong>Agenda</strong><small>Upcoming deadlines</small></span><span data-mobile-queue-count="agenda">0</span></button>
|
||||
<button data-mobile-queue="delivery" type="button"><span><strong>Delivery</strong><small>Needs recovery</small></span><span data-mobile-queue-count="delivery">0</span></button>
|
||||
<button data-mobile-queue="gate" type="button"><span><strong>Human Gates</strong><small>Release decisions</small></span><span data-mobile-queue-count="gate">0</span></button>
|
||||
<button data-mobile-queue="attention" type="button"><span><strong>Attention</strong><small>Needs a response</small></span><span data-mobile-queue-count="attention">0</span></button>
|
||||
<button data-mobile-queue="update" type="button" aria-label="Updates, 0 unread conversations"><span><strong>Updates</strong><small>Unread conversations</small></span><span data-mobile-queue-count="update">0</span></button>
|
||||
<button data-mobile-queue="following" type="button" aria-label="Following, 0 unseen changes"><span><strong>Following</strong><small>Issues and pull requests you watch</small></span><span data-mobile-queue-count="following">0</span></button>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
};
|
||||
const continuation = [
|
||||
['delivery', 'Recover Delivery'],
|
||||
['gate', 'Review Human Gates'],
|
||||
['attention', 'Start Attention'],
|
||||
['today', 'Continue Today'],
|
||||
['update', 'Resume Updates'],
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
|
||||
function open(name) {
|
||||
if (name === 'delivery' && options.openDelivery) return options.openDelivery();
|
||||
if (name === 'gate' && options.openHumanGates) return options.openHumanGates();
|
||||
if (name === 'today') return options.openToday();
|
||||
if (name === 'agenda') return options.openAgenda();
|
||||
if (name === 'update' && options.openUpdates) return options.openUpdates();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
const storage = options.storage || (typeof localStorage !== 'undefined' ? localStorage : null);
|
||||
const reviewOrder = [
|
||||
['delivery', 'Delivery recovery'],
|
||||
['gate', 'Human Gates'],
|
||||
['agenda', 'Agenda'],
|
||||
['attention', 'Attention'],
|
||||
['update', 'Updates'],
|
||||
|
|
@ -104,6 +105,12 @@
|
|||
function briefing() {
|
||||
const counts = options.getCounts ? options.getCounts() : {};
|
||||
let phases = reviewPhases(counts);
|
||||
const gateUnavailable = counts.gateUnavailable === true;
|
||||
if (gateUnavailable) {
|
||||
phases = phases.filter(phase => phase.name !== 'gate');
|
||||
const afterDelivery = phases[0]?.name === 'delivery' ? 1 : 0;
|
||||
phases.splice(afterDelivery, 0, {name:'gate', label:'Human Gates unavailable · retry', count:count(counts.gate)});
|
||||
}
|
||||
const followingUnavailable = counts.followingUnavailable === true;
|
||||
if (followingUnavailable) {
|
||||
phases = phases.filter(phase => phase.name !== 'following');
|
||||
|
|
@ -115,14 +122,17 @@
|
|||
const other = total - delivery;
|
||||
const next = phases.length ? phases[0].name : (today ? 'today' : 'find');
|
||||
const nextLabel = next === 'delivery' ? 'Review Delivery' :
|
||||
(next === 'gate' && gateUnavailable ? 'Retry Human Gates' :
|
||||
(next === 'following' && followingUnavailable ? 'Retry Following' :
|
||||
(phases.length ? 'Review ' + phases[0].label : (today ? 'Continue Today' : 'Find Work')));
|
||||
(phases.length ? 'Review ' + phases[0].label : (today ? 'Continue Today' : 'Find Work'))));
|
||||
const gateRetry = next === 'gate' && gateUnavailable;
|
||||
const followingRetry = next === 'following' && followingUnavailable;
|
||||
return {
|
||||
total,
|
||||
next,
|
||||
label: nextLabel,
|
||||
summary: followingRetry ? 'Following needs retry before Today · ' + today + ' planned' :
|
||||
summary: gateRetry ? 'Human Gates need retry before Today · ' + today + ' planned' :
|
||||
followingRetry ? 'Following needs retry before Today · ' + today + ' planned' :
|
||||
delivery ? delivery + (delivery === 1 ? ' delivery needs' : ' deliveries need') +
|
||||
' action before Today' + (other ? ' · ' + other + ' other ' + (other === 1 ? 'item' : 'items') : '') +
|
||||
' · ' + today + ' planned' :
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@
|
|||
}
|
||||
|
||||
function updateQueues(counts) {
|
||||
const names = 'today agenda delivery attention update filed later draft'.split(' ');
|
||||
const names = 'today agenda delivery gate attention update filed later draft'.split(' ');
|
||||
const normalized = Object.fromEntries(names.map(name => [name, Math.max(0, Number(counts?.[name]) || 0)]));
|
||||
const actionableNames = ['today', 'delivery', 'attention', 'update', 'filed', 'later', 'draft'];
|
||||
const actionableNames = ['today', 'delivery', 'gate', 'attention', 'update', 'filed', 'later', 'draft'];
|
||||
const active = actionableNames.reduce((total, name) => total + (normalized[name] > 0 ? 1 : 0), 0);
|
||||
Object.entries(options.queueCounts || {}).forEach(([name, element]) => {
|
||||
element.textContent = String(normalized[name] || 0);
|
||||
|
|
@ -124,6 +124,7 @@
|
|||
: 'Queues: Today ' + normalized.today
|
||||
+ ', Agenda ' + normalized.agenda + ' due'
|
||||
+ ', Delivery ' + normalized.delivery
|
||||
+ ', Human Gates ' + normalized.gate
|
||||
+ ', Attention ' + normalized.attention
|
||||
+ ', Updates ' + normalized.update
|
||||
+ ', Filed ' + normalized.filed
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const BASE = new URL('./', self.location.href).pathname;
|
||||
importScripts(BASE + 'static/private-data-registry.js');
|
||||
importScripts(BASE + 'static/background-issue-sync.js');
|
||||
const CACHE = 'stackchain-dashboard-shell-v139';
|
||||
const CACHE = 'stackchain-dashboard-shell-v140';
|
||||
const OFFLINE_LEASE_URL = new URL(BASE + '__offline-session-lease', self.location.origin).href;
|
||||
const OUTAGE_STATUSES = new Set([500, 502, 503, 504]);
|
||||
const NAVIGATION_TIMEOUT_MS = self.__STACKCHAIN_NAVIGATION_TIMEOUT_MS || 4000;
|
||||
|
|
|
|||
|
|
@ -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-v139" in worker
|
||||
assert "stackchain-dashboard-shell-v140" in worker
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ process.stdout.write(JSON.stringify({{
|
|||
assert ".following-disposition-mode" in css
|
||||
assert "if (searchPreviewReturnKind === 'following')" in dashboard
|
||||
assert "e.key === 'Escape' && searchPreviewReturnKind === 'following'" in dashboard
|
||||
assert "stackchain-dashboard-shell-v139" in service_worker
|
||||
assert "stackchain-dashboard-shell-v140" in service_worker
|
||||
|
||||
|
||||
def test_prepare_today_lazily_refreshes_and_directly_reviews_following():
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from pathlib import Path
|
|||
MODULE = Path(__file__).parents[1] / "frontend" / "human-gates.js"
|
||||
INDEX = Path(__file__).parents[1] / "frontend" / "index.html"
|
||||
DASHBOARD = Path(__file__).parents[1] / "frontend" / "dashboard.js"
|
||||
WORKER = Path(__file__).parents[1] / "frontend" / "service-worker.js"
|
||||
|
||||
|
||||
def run_node(body):
|
||||
|
|
@ -29,6 +30,42 @@ const gates=createHumanGates({storage,getLogin:()=> 'timmy',isOnline:()=>true,no
|
|||
assert "Inbox zero" in output["zero"]["html"]
|
||||
|
||||
|
||||
def test_queue_changes_publish_mobile_counts_and_authoritative_decision_completion():
|
||||
output = run_node(r"""
|
||||
const changes=[];
|
||||
const item={id:'g1',title:'Candidate',candidate_hash:'abc123',revision:1,checks:[]};
|
||||
const gates=createHumanGates({
|
||||
storage:{getItem:()=>null,setItem(){}}, getLogin:()=> 'timmy', isOnline:()=>true,
|
||||
nodes:{count:{},list:{},status:{},panel:{},detail:{}}, location:{hash:''},
|
||||
onChange:(snapshot, state)=>changes.push({count:snapshot.pending_count,...state}),
|
||||
fetchJson:async(path, options={})=>options.method==='POST' ? {receipt_id:'r1'} : {pending_count:1,items:[item]},
|
||||
});
|
||||
(async()=>{await gates.load();gates.reviewNext();await gates.decideAndNext('release',{checklist:{exact_hash:true,artifacts_reviewed:true,provenance_reviewed:true}});process.stdout.write(JSON.stringify(changes));})();
|
||||
""")
|
||||
assert output == [
|
||||
{"count": 1, "available": True, "authoritative": True},
|
||||
{"count": 0, "available": True, "authoritative": True, "decision": True},
|
||||
]
|
||||
|
||||
|
||||
def test_queue_load_failure_distinguishes_cached_read_only_data_from_unavailable():
|
||||
output = run_node(r"""
|
||||
const cached={pending_count:1,items:[{id:'g1',title:'Cached',candidate_hash:'abc'}]};
|
||||
const changes=[];
|
||||
const make=(value,label)=>createHumanGates({
|
||||
storage:{getItem:()=>value ? JSON.stringify(value) : null,setItem(){}},
|
||||
getLogin:()=> 'timmy', isOnline:()=>false, nodes:{count:{},list:{},status:{},panel:{}}, location:{hash:''},
|
||||
onChange:(snapshot,state)=>changes.push({label,count:snapshot.pending_count,...state}),
|
||||
fetchJson:async()=>{throw new Error('network')},
|
||||
});
|
||||
(async()=>{await make(cached,'cached').load();try{await make(null,'empty').load()}catch(_){}process.stdout.write(JSON.stringify(changes));})();
|
||||
""")
|
||||
assert output == [
|
||||
{"label": "cached", "count": 1, "available": True, "authoritative": False, "cached": True},
|
||||
{"label": "empty", "count": 0, "available": False, "authoritative": False},
|
||||
]
|
||||
|
||||
|
||||
def test_review_next_is_a_fixed_snapshot_and_decision_and_next_advances_without_new_arrivals():
|
||||
output = run_node(r"""
|
||||
const calls=[]; const nodes={count:{textContent:''},list:{innerHTML:''},status:{textContent:''},panel:{hidden:true},detail:{innerHTML:''}};
|
||||
|
|
@ -155,3 +192,13 @@ def test_human_gate_mobile_shell_and_deep_route_are_wired():
|
|||
assert "#/my-work/human-gates" in dashboard
|
||||
assert "createHumanGates" in dashboard
|
||||
assert "planningOwnerAccountKey = confirmedOwnerLogin && saved.user?.id" in dashboard
|
||||
assert 'data-mobile-queue="gate"' in index
|
||||
assert 'data-mobile-queue-count="gate"' in index
|
||||
assert "openHumanGates: () => openHumanGates()" in dashboard
|
||||
assert "onChange:(snapshot, state)=>" in dashboard
|
||||
assert "queueCounts.gate = snapshot.pending_count" in dashboard
|
||||
assert "preparationItems.gate = snapshot.items" in dashboard
|
||||
assert "mobileStartDay.reconcile({authoritative:true, authoritativePhases:['gate']})" in dashboard
|
||||
assert "counts.gate = queueCounts.gate" in dashboard
|
||||
assert "gate:preparationItems.gate || []" in dashboard
|
||||
assert "stackchain-dashboard-shell-v140" in WORKER.read_text()
|
||||
|
|
|
|||
|
|
@ -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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in worker
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in worker
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in worker
|
||||
assert "stackchain-dashboard-shell-v140" in worker
|
||||
assert ".device-setup-panel" in css
|
||||
assert ".device-readiness-card" in css
|
||||
assert "overflow-x:hidden" in css
|
||||
|
|
|
|||
|
|
@ -274,5 +274,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-v139" in worker
|
||||
assert "stackchain-dashboard-shell-v140" in worker
|
||||
assert "BASE + 'static/mobile-insights.js'" in worker
|
||||
|
|
|
|||
|
|
@ -110,6 +110,61 @@ process.stdout.write(JSON.stringify({{blocked, handed, opened, handoffs}}));
|
|||
assert output["handoffs"] == ["agenda"]
|
||||
|
||||
|
||||
def test_prepare_today_reviews_human_gates_after_delivery_before_agenda():
|
||||
script = f"""
|
||||
const createStartDay = require({json.dumps(str(START_DAY))});
|
||||
const opened = [];
|
||||
const controller = createStartDay({{
|
||||
getCounts: () => ({{delivery:1, gate:2, agenda:1, today:4}}),
|
||||
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": 4,
|
||||
"next": "delivery",
|
||||
"label": "Review Delivery",
|
||||
"summary": "1 delivery needs action before Today · 3 other items · 4 planned",
|
||||
"phases": [
|
||||
{"name": "delivery", "label": "Delivery recovery", "count": 1},
|
||||
{"name": "gate", "label": "Human Gates", "count": 2},
|
||||
{"name": "agenda", "label": "Agenda", "count": 1},
|
||||
],
|
||||
},
|
||||
"opened": ["delivery"],
|
||||
}
|
||||
|
||||
|
||||
def test_prepare_today_keeps_unavailable_human_gates_retryable_before_today():
|
||||
script = f"""
|
||||
const createStartDay = require({json.dumps(str(START_DAY))});
|
||||
const opened = [];
|
||||
const controller = createStartDay({{
|
||||
getCounts: () => ({{gateUnavailable:true, today:2}}),
|
||||
openQueue: name => opened.push(name),
|
||||
}});
|
||||
const briefing = controller.briefing();
|
||||
controller.startNext();
|
||||
process.stdout.write(JSON.stringify({{briefing, opened}}));
|
||||
"""
|
||||
|
||||
assert run_node(script) == {
|
||||
"briefing": {
|
||||
"total": 0,
|
||||
"next": "gate",
|
||||
"label": "Retry Human Gates",
|
||||
"summary": "Human Gates need retry before Today · 2 planned",
|
||||
"phases": [{"name": "gate", "label": "Human Gates unavailable · retry", "count": 0}],
|
||||
},
|
||||
"opened": ["gate"],
|
||||
}
|
||||
|
||||
|
||||
def test_prepare_today_counts_each_work_identity_in_only_its_highest_priority_phase():
|
||||
script = f"""
|
||||
const createStartDay = require({json.dumps(str(START_DAY))});
|
||||
|
|
@ -414,7 +469,7 @@ async def test_dashboard_wires_thumb_safe_start_day_briefing_into_offline_mobile
|
|||
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-v139" in service_worker
|
||||
assert "stackchain-dashboard-shell-v140" in service_worker
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ sheet.close = function () {{ this.open = false; this.listeners.close?.(); }};
|
|||
const close = new FakeElement();
|
||||
const badge = new FakeElement();
|
||||
const deadline = new FakeElement();
|
||||
const rows = Object.fromEntries(['today','agenda','delivery','attention','update','filed','later','draft','recaps'].map(name => [name, new FakeElement()]));
|
||||
const rows = Object.fromEntries(['today','agenda','delivery','gate','attention','update','filed','later','draft','recaps'].map(name => [name, new FakeElement()]));
|
||||
const counts = Object.fromEntries(Object.keys(rows).map(name => [name, new FakeElement()]));
|
||||
const selected = [];
|
||||
const utilities = [];
|
||||
|
|
@ -480,7 +480,7 @@ const dock = createDock({{
|
|||
observe() {{}},
|
||||
}});
|
||||
dock.start();
|
||||
dock.updateQueues({{today:2, agenda:5, delivery:1, attention:1, update:5, filed:2, later:3, draft:4}});
|
||||
dock.updateQueues({{today:2, agenda:5, delivery:1, gate:2, attention:1, update:5, filed:2, later:3, draft:4}});
|
||||
queues.click();
|
||||
const opened = sheet.open;
|
||||
rows.update.click();
|
||||
|
|
@ -525,9 +525,9 @@ process.stdout.write(JSON.stringify({{
|
|||
"utilities": ["recaps:trigger"],
|
||||
"badge": "0 active",
|
||||
"populated": {
|
||||
"badge": "7 active",
|
||||
"badge": "8 active",
|
||||
"badgeHidden": False,
|
||||
"badgeLabel": "Queues: Today 2, Agenda 5 due, Delivery 1, Attention 1, Updates 5, Filed 2, Later 3, Drafts 4; 7 active queues",
|
||||
"badgeLabel": "Queues: Today 2, Agenda 5 due, Delivery 1, Human Gates 2, Attention 1, Updates 5, Filed 2, Later 3, Drafts 4; 8 active queues",
|
||||
"deadline": "5 due",
|
||||
"deadlineHidden": False,
|
||||
"agendaDue": "true",
|
||||
|
|
@ -536,13 +536,13 @@ process.stdout.write(JSON.stringify({{
|
|||
"badge": "1 active",
|
||||
"badgeHidden": False,
|
||||
"deadlineHidden": True,
|
||||
"badgeLabel": "Queues: Today 0, Agenda 0 due, Delivery 0, Attention 0, Updates 7, Filed 0, Later 0, Drafts 0; 1 active queue",
|
||||
"badgeLabel": "Queues: Today 0, Agenda 0 due, Delivery 0, Human Gates 0, Attention 0, Updates 7, Filed 0, Later 0, Drafts 0; 1 active queue",
|
||||
},
|
||||
"clearedBadgeHidden": True,
|
||||
"clearedDeadlineHidden": True,
|
||||
"clearedAgendaDue": None,
|
||||
"clearedBadgeLabel": "Queues: no active queues; no upcoming deadlines",
|
||||
"counts": {"today": "0", "agenda": "0", "delivery": "0", "attention": "0", "update": "0", "filed": "0", "later": "0", "draft": "0", "recaps": "0"},
|
||||
"counts": {"today": "0", "agenda": "0", "delivery": "0", "gate": "0", "attention": "0", "update": "0", "filed": "0", "later": "0", "draft": "0", "recaps": "0"},
|
||||
"updateLabel": "Updates, 0 unread conversations",
|
||||
"queueFocuses": 3,
|
||||
"columnState": None,
|
||||
|
|
@ -599,6 +599,27 @@ process.stdout.write(JSON.stringify({{result, calls}}));
|
|||
}
|
||||
|
||||
|
||||
def test_mobile_queue_launcher_uses_existing_human_gate_review_flow():
|
||||
script = f"""
|
||||
const createLauncher = require({json.dumps(str(QUEUE_LAUNCHER))});
|
||||
const calls = [];
|
||||
const launcher = createLauncher({{
|
||||
openHumanGates: () => {{ calls.push('human-gates'); return 'opened-gates'; }},
|
||||
selectFilter: name => calls.push('generic-filter:' + name),
|
||||
firstAction: () => {{ throw new Error('generic card launch must not run'); }},
|
||||
announce: message => calls.push('announce:' + message),
|
||||
}});
|
||||
process.stdout.write(JSON.stringify({{result:launcher.open('gate'), calls}}));
|
||||
"""
|
||||
result = subprocess.run(["node", "-e", script], capture_output=True, text=True)
|
||||
|
||||
assert result.returncode == 0, result.stderr
|
||||
assert json.loads(result.stdout) == {
|
||||
"result": "opened-gates",
|
||||
"calls": ["human-gates"],
|
||||
}
|
||||
|
||||
|
||||
def test_mobile_queue_launcher_uses_dedicated_delivery_recovery_flow():
|
||||
script = f"""
|
||||
const createLauncher = require({json.dumps(str(QUEUE_LAUNCHER))});
|
||||
|
|
@ -621,7 +642,7 @@ def test_mobile_work_prioritizes_and_revalidates_actionable_delivery_recovery():
|
|||
script = f"""
|
||||
const createLauncher = require({json.dumps(str(QUEUE_LAUNCHER))});
|
||||
const calls = [];
|
||||
let counts = {{delivery:2, attention:3, today:1, update:4}};
|
||||
let counts = {{delivery:2, gate:1, attention:3, today:1, update:4}};
|
||||
const launcher = createLauncher({{
|
||||
getCounts: () => counts,
|
||||
openDelivery: () => {{ calls.push('delivery-recovery'); return 'opened-delivery'; }},
|
||||
|
|
@ -633,7 +654,7 @@ const launcher = createLauncher({{
|
|||
}});
|
||||
const delivery = launcher.recommend();
|
||||
const opened = launcher.continueWork();
|
||||
counts = {{delivery:0, attention:0, today:0, update:4}};
|
||||
counts = {{delivery:0, gate:1, attention:0, today:0, update:4}};
|
||||
const afterRecovery = launcher.recommend();
|
||||
process.stdout.write(JSON.stringify({{delivery, opened, afterRecovery, calls}}));
|
||||
"""
|
||||
|
|
@ -643,7 +664,7 @@ process.stdout.write(JSON.stringify({{delivery, opened, afterRecovery, calls}}))
|
|||
assert json.loads(result.stdout) == {
|
||||
"delivery": {"name": "delivery", "count": 2, "label": "Recover Delivery (2)"},
|
||||
"opened": "opened-delivery",
|
||||
"afterRecovery": {"name": "update", "count": 4, "label": "Resume Updates (4)"},
|
||||
"afterRecovery": {"name": "gate", "count": 1, "label": "Review Human Gates (1)"},
|
||||
"calls": ["delivery-recovery"],
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ async function dispatchPush(payload) {{
|
|||
def test_week_unplan_undo_rolls_the_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/week-plan.js'" in source
|
||||
assert "BASE + 'static/dashboard.css'" in source
|
||||
|
||||
|
|
@ -197,20 +197,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
|
||||
|
||||
def test_per_day_week_conflict_ui_rolls_the_offline_shell():
|
||||
source = WORKER.read_text()
|
||||
|
||||
assert "stackchain-dashboard-shell-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/my-work.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
assert "BASE + 'static/dashboard.css'" in source
|
||||
|
|
@ -219,7 +219,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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
|
||||
|
|
@ -228,7 +228,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/issue-evidence-review.js'" in source
|
||||
assert "BASE + 'static/issue-attachment.js'" in source
|
||||
|
||||
|
|
@ -236,14 +236,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/today-completion.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
|
||||
|
|
@ -251,7 +251,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/create-issue-sheet.js'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
|
||||
|
|
@ -259,7 +259,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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
|
||||
|
|
@ -269,14 +269,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/dashboard.css'" in source
|
||||
assert "BASE + 'static/dashboard.js'" in source
|
||||
assert "BASE + 'static/install-app.js'" in source
|
||||
|
|
@ -285,21 +285,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/update-ownership.js'" in source
|
||||
|
||||
|
||||
|
|
@ -1354,7 +1354,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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" 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-v139';" in service_worker
|
||||
assert "const CACHE = 'stackchain-dashboard-shell-v140';" 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-v139" in source
|
||||
assert "stackchain-dashboard-shell-v140" in source
|
||||
assert "BASE + 'static/today-sync.js'" in source
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user