abullard1 commited on
Commit
c9ad0a2
·
verified ·
1 Parent(s): b2ac46e

Deploy conversion @ d4fa750-space

Browse files
Files changed (3) hide show
  1. app.js +35 -4
  2. config.js +1 -1
  3. index.html +6 -6
app.js CHANGED
@@ -24,7 +24,7 @@ import { oauthLoginUrl, oauthHandleRedirectIfPresent, uploadFiles, downloadFile,
24
  // the ?v= stamp — an unversioned nested import could load a stale module.
25
  import { keyOf, latestByKey, mergeEvents, orderItems, firstUngraded as
26
  firstUngradedPure, countComplete, stampClass, nextEpoch,
27
- standsDownTo } from "./logic.mjs?v=4150fff-space";
28
 
29
  // Test seam: Playwright installs window.__testHub (an in-memory hub) before
30
  // any page script runs; production never defines it, so this is one inert
@@ -577,7 +577,27 @@ window.addEventListener("pagehide", () => {
577
  });
578
 
579
  // ── boot ─────────────────────────────────────────────────────────────────────
 
 
 
 
 
 
580
  async function boot() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
  $("#task-title").textContent = CONFIG.title;
582
  document.title = CONFIG.title; // three distinguishable tabs
583
  $("#banner").setAttribute("aria-live", "assertive");
@@ -649,8 +669,10 @@ async function boot() {
649
  if (!state.hbTimer) startHeartbeat();
650
 
651
  try {
652
- const blob = await hub().downloadFile({ repo: ITEMS_REPO, path: CONFIG.itemsPath,
653
- accessToken: state.auth.accessToken });
 
 
654
  if (blob === null) throw new Error("items file missing from localgate/audit-items");
655
  state.items = JSON.parse(await blob.text());
656
  } catch (err) {
@@ -661,7 +683,16 @@ async function boot() {
661
  return;
662
  }
663
 
664
- await ensureResultsRepo();
 
 
 
 
 
 
 
 
 
665
 
666
  // Ordering gate: a task can require another task's completion first (the
667
  // conversion fidelity pass must not open before the blind verdict pass,
 
24
  // the ?v= stamp — an unversioned nested import could load a stale module.
25
  import { keyOf, latestByKey, mergeEvents, orderItems, firstUngraded as
26
  firstUngradedPure, countComplete, stampClass, nextEpoch,
27
+ standsDownTo } from "./logic.mjs?v=d4fa750-space";
28
 
29
  // Test seam: Playwright installs window.__testHub (an in-memory hub) before
30
  // any page script runs; production never defines it, so this is one inert
 
577
  });
578
 
579
  // ── boot ─────────────────────────────────────────────────────────────────────
580
+ const withTimeout = (promise, seconds, label) => Promise.race([
581
+ promise,
582
+ new Promise((_, reject) => setTimeout(
583
+ () => reject(new Error(`${label} timed out after ${seconds}s`)), seconds * 1000)),
584
+ ]);
585
+
586
  async function boot() {
587
+ // Watchdog: if nothing has replaced the shell after 30s, the network
588
+ // stalled mid-boot (common on phones) — offer a reload instead of an
589
+ // eternal "Loading...".
590
+ setTimeout(() => {
591
+ const main = $("#main");
592
+ if (main && main.textContent.includes("Loading")) {
593
+ main.replaceChildren(el("p", null,
594
+ "Loading stalled — the connection may have dropped mid-request. "
595
+ + "Nothing is lost."));
596
+ const retry = el("button", "signin", "Reload");
597
+ retry.addEventListener("click", () => location.reload());
598
+ main.append(retry);
599
+ }
600
+ }, 30000);
601
  $("#task-title").textContent = CONFIG.title;
602
  document.title = CONFIG.title; // three distinguishable tabs
603
  $("#banner").setAttribute("aria-live", "assertive");
 
669
  if (!state.hbTimer) startHeartbeat();
670
 
671
  try {
672
+ const blob = await withTimeout(
673
+ hub().downloadFile({ repo: ITEMS_REPO, path: CONFIG.itemsPath,
674
+ accessToken: state.auth.accessToken }),
675
+ 60, "loading the items");
676
  if (blob === null) throw new Error("items file missing from localgate/audit-items");
677
  state.items = JSON.parse(await blob.text());
678
  } catch (err) {
 
683
  return;
684
  }
685
 
686
+ try {
687
+ await withTimeout(ensureResultsRepo(), 60, "preparing your results dataset");
688
+ } catch (err) {
689
+ $("#main").replaceChildren(el("p", null,
690
+ `Could not prepare your results dataset: ${String(err).slice(0, 140)}`));
691
+ const retry = el("button", "signin", "Retry");
692
+ retry.addEventListener("click", () => location.reload());
693
+ $("#main").append(retry);
694
+ return;
695
+ }
696
 
697
  // Ordering gate: a task can require another task's completion first (the
698
  // conversion fidelity pass must not open before the blind verdict pass,
config.js CHANGED
@@ -2,7 +2,7 @@ window.CONFIG = {
2
  task: "conversion",
3
  title: "Pass 2 · rewrite fidelity — 152 items",
4
  itemsPath: "conversion_items.json",
5
- build: "4150fff-space",
6
  landing: "You will judge whether each rewritten exam question still asks the same "
7
  + "question as the original, and whether it stands on its own without the answer "
8
  + "options. 152 items plus 3 discussable warm-ups; expect roughly 1.5–2 hours, "
 
2
  task: "conversion",
3
  title: "Pass 2 · rewrite fidelity — 152 items",
4
  itemsPath: "conversion_items.json",
5
+ build: "d4fa750-space",
6
  landing: "You will judge whether each rewritten exam question still asks the same "
7
  + "question as the original, and whether it stands on its own without the answer "
8
  + "options. 152 items plus 3 discussable warm-ups; expect roughly 1.5–2 hours, "
index.html CHANGED
@@ -5,8 +5,8 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; style-src-attr 'unsafe-inline'; font-src 'self'; connect-src https://huggingface.co https://*.hf.co; img-src 'self' data:; base-uri 'none'; form-action 'none'">
7
  <title>LocalGate audit</title>
8
- <link rel="stylesheet" href="style.css?v=4150fff-space">
9
- <link rel="stylesheet" href="katex/katex.min.css?v=4150fff-space">
10
  </head>
11
  <body>
12
  <header>
@@ -22,9 +22,9 @@
22
  <pre id="rubric-body"></pre></details>
23
  </div>
24
  <div id="controls" hidden></div>
25
- <script src="katex/katex.min.js?v=4150fff-space"></script>
26
- <script src="katex/auto-render.min.js?v=4150fff-space"></script>
27
- <script src="config.js?v=4150fff-space"></script>
28
- <script type="module" src="app.js?v=4150fff-space"></script>
29
  </body>
30
  </html>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; style-src-attr 'unsafe-inline'; font-src 'self'; connect-src https://huggingface.co https://*.hf.co; img-src 'self' data:; base-uri 'none'; form-action 'none'">
7
  <title>LocalGate audit</title>
8
+ <link rel="stylesheet" href="style.css?v=d4fa750-space">
9
+ <link rel="stylesheet" href="katex/katex.min.css?v=d4fa750-space">
10
  </head>
11
  <body>
12
  <header>
 
22
  <pre id="rubric-body"></pre></details>
23
  </div>
24
  <div id="controls" hidden></div>
25
+ <script src="katex/katex.min.js?v=d4fa750-space"></script>
26
+ <script src="katex/auto-render.min.js?v=d4fa750-space"></script>
27
+ <script src="config.js?v=d4fa750-space"></script>
28
+ <script type="module" src="app.js?v=d4fa750-space"></script>
29
  </body>
30
  </html>