Closed tomtseng closed 3 weeks ago
Name | Link |
---|---|
Latest commit | |
Latest deploy log | https://app.netlify.com/sites/goattack/deploys/6664f7d228a7e0548846b3a3 |
Deploy Preview | https://deploy-preview-119--goattack.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
Lighthouse |
1 paths audited Performance: 95 (no change from production) Accessibility: 95 (🔴 down 2 from production) Best Practices: 100 (no change from production) SEO: 100 (🟢 up 8 from production) PWA: - View the detailed breakdown and full score reports |
To edit notification comments on pull requests, go to your Netlify site configuration.
netlify deploy preview currently pointing at wrong commit from 2 hours ago https://github.com/AlignmentResearch/KataGoVisualizer/commit/4c59fc07f13e1dd0d33c15a71002df2a73194175 instead of 1341f2a, so deploy preview isn't showing changes yet
I also just noticed that the highlighted row in the table doesn't update when you click on the move link.
If you're looking at the deploy preview, you'll need to re-trigger the netlify deploy (which I don't think I have the permissions to do) — it's stuck on the wrong commit, not sure why
The Netlify build is failing:
7:59:16 PM: Netlify Build
7:59:16 PM: ────────────────────────────────────────────────────────────────
7:59:16 PM:
7:59:16 PM: ❯ Version
7:59:16 PM: @netlify/build 29.46.5
7:59:16 PM:
7:59:16 PM: ❯ Flags
7:59:16 PM: baseRelDir: true
7:59:16 PM: buildId: 6663c8ddfd81e46e40d74883
7:59:16 PM: deployId: 6663c8ddfd81e46e40d74885
7:59:16 PM:
7:59:16 PM: ❯ Current directory
7:59:16 PM: /opt/build/repo/sgf-viewer
7:59:16 PM:
7:59:16 PM: ❯ Config file
7:59:16 PM: /opt/build/repo/sgf-viewer/netlify.toml
7:59:16 PM:
7:59:16 PM: ❯ Context
7:59:16 PM: deploy-preview
7:59:16 PM:
7:59:16 PM: ❯ Loading plugins
7:59:16 PM: - @netlify/plugin-lighthouse@4.1.1 from Netlify app
7:59:16 PM:
7:59:16 PM: ❯ Outdated plugins
7:59:16 PM: - @netlify/plugin-lighthouse@4.1.1: latest version is 6.0.0
7:59:16 PM: To upgrade this plugin, please uninstall and re-install it from the Netlify plugins directory (https://app.netlify.com/plugins)
7:59:18 PM:
7:59:18 PM: build.command from netlify.toml
7:59:18 PM: ────────────────────────────────────────────────────────────────
7:59:18 PM:
7:59:18 PM: $ npm run build
7:59:18 PM: > sgf-viewer-2@0.0.0 build
7:59:18 PM: > vite build
7:59:19 PM: vite v3.2.7 building for production...
7:59:19 PM: transforming...
7:59:20 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
7:59:20 PM: 2:59:20 AM [vite-plugin-svelte] /opt/build/repo/sgf-viewer/src/components/Citation.svelte:13:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
7:59:20 PM: 11: <hr />
7:59:20 PM: 12: <h4 class="toc-exclude">Citation Info</h4>
7:59:20 PM: 13: <code on:click={tdFocus}>
7:59:20 PM: ^
7:59:20 PM: 14: <pre>{`@inproceedings{wang2023adversarial,
15: title={Adversarial Policies Beat Superhuman Go {AI}s},
2:59:20 AM [vite-plugin-svelte] /opt/build/repo/sgf-viewer/src/components/Citation.svelte:21:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
19: }`}</pre>
7:59:20 PM: 20: </code>
7:59:20 PM: 21: <code on:click={tdFocus}>
7:59:20 PM: ^
7:59:20 PM: 22: <pre>{`@misc{tseng2024challenges,
23: title={Can Go {AI}s be adversarially robust?},
✓ 11 modules transformed.
7:59:20 PM: Could not resolve './components/Navbar.svelte' from src/App.svelte
7:59:20 PM: error during build:
7:59:20 PM: Error: Could not resolve './components/Navbar.svelte' from src/App.svelte
7:59:20 PM: at error (file:///opt/build/repo/sgf-viewer/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
7:59:20 PM: at ModuleLoader.handleResolveId (file:///opt/build/repo/sgf-viewer/node_modules/rollup/dist/es/shared/rollup.js:22156:24)
7:59:20 PM: at file:///opt/build/repo/sgf-viewer/node_modules/rollup/dist/es/shared/rollup.js:22119:26
7:59:20 PM:
7:59:20 PM: "build.command" failed
7:59:20 PM: ────────────────────────────────────────────────────────────────
7:59:20 PM:
7:59:20 PM: Error message
7:59:20 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
7:59:20 PM:
7:59:20 PM: Error location
7:59:20 PM: In build.command from netlify.toml:
7:59:20 PM: npm run build
7:59:20 PM:
7:59:20 PM: Resolved config
7:59:20 PM: build:
7:59:20 PM: base: /opt/build/repo/sgf-viewer
7:59:20 PM: command: npm run build
7:59:20 PM: commandOrigin: config
7:59:20 PM: environment:
7:59:20 PM: - REVIEW_ID
7:59:20 PM: publish: /opt/build/repo/sgf-viewer/dist
7:59:20 PM: publishOrigin: config
7:59:20 PM: plugins:
7:59:20 PM: - inputs: {}
7:59:20 PM: origin: ui
7:59:20 PM: package: '@netlify/plugin-lighthouse'
7:59:20 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:59:20 PM: Failing build: Failed to build site
7:59:20 PM: Finished processing build request in 26.416s
I've invited you to Netlify so you can debug directly.
fixed and re-deployed
Nice, works great now, will merge.
Fixes #116 Issue:
This PR makes move links jump to the first game (other games can be specified, but we aren't currently specifying any other games). In
content.ts
, instead of writingwe write
where
game=game_number
is optional (defaults togame=0
)Notes on rationale for implementation
communicating state changes
We previously modified move numbers by exposing a function
window.setMove
at global scope that modifies each section's Go playerwgoPlayer
. For this PR, we want move links to not only modifywgoPlayer
state but to also modify Svelte state —selectedRow
in<GameList>
.Strictly speaking I think we could still solve this by similarly having every
<GameList>
save theirselectedRow
in a global object and then exposing a globalwindow
function to modify eachselectedRow
, but this isn't how you're "supposed" to communicate Svelte state. So part 1 of this PR is just refactoring so as to not communicate via global state:setContext
in a component defines variables visible to its child components. We add this in<Section>
to define variables shared between child components<GameList>
+<GameBoard>
SectionDescription
which parses the descriptions incontent.ts
to insert new component<GameMoveLink>
that also uses the shared variables in order to communicate with<GameList>
and<GameBoard>
.this involves some wacky regex parsing — if we'd prefer to just pass around globally scoped variables instead of weird regex I can revert this part
implementing the state change
After the refactor, how do we actually implement updating the game and move, i.e., what is
<GameMoveLink>
'sonClick
function?selectedRow
, which reactively triggerswgoPlayer.loadSgfFromFile(sgf)
, and then callwgoPlayer.goTo(move)
. This doesn't work becausewgoPlayer.loadSgfFromFile()
is async and might not be done by the timewgoPlayer.goTo()
is called. Even if it weren't async, it would cause some flickering as we first loaded the SGF and afterwards jumped to the move.wgoPlayer.loadSgfFromFile(sgf, move)
, but if the SGF doesn't change, then we want to still callwgoPlayer.goTo(move)
(we could callwgoPlayer.loadSgfFromFile(sgf, move)
every time but it incurs a little extra latency due to re-parsing the SGF). This is complex enough that it's messy to just rely onselectedRow
reactively triggering updateswgoPlayer
. Instead we write a new functionupdateGame()
and explicitly call it everywhere we want to update the game state, which means we need to make a few modifications throughout<GameList>
.An alternative implementation I tried: instead of giving
MoveGameLink
the callbackupdateGame()
, let it modify a shared tuple[selectedRow, moveNumber]
and then reactively updatewgoPlayer
based on that state. This doesn't work because we can't actually syncmoveNumber
withwgoPlayer
(i.e., say we click a move link to changemoveNumber
to 1, then we manually use thewgoPlayer
UI to change the move number to 4, then click the move link again —moveNumber
was 1 the whole time so no reactive update will be triggered)(We could've based this branch on
main
instead oftomtseng/defense-site
, but basing ontomtseng/defense-site
saves us the annoyance of having to deal withcontent.ts
merge conflicts when both this PR and PR #99 merge. Also, issue #116 is only relevant ontomtseng/defense-site
anyway —main
currently doesn't have any multi-game sections with move links, which is what causes #116.)