Regalia v1.1.2 #38
YDW99
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What's Changed
Full Changelog: v1.1.1...v1.1.2
♟️ Regalia v1.1.2 ♔
1.1.2(versionCode = 112)arm64-v8a-dotprodarm64-v8aonly📦 Download
Regalia-v1.1.2-release.apkRegalia-v1.1.2-manual-zh.htmlRegalia-v1.1.2-manual-en.html🎯 What's New in v1.1.2
v1.1.2 is a maintenance release that keeps the version number (
versionCode = 112) unchanged while delivering 6 same-version revision phases (Phase 67 → 72). Each phase was driven by user feedback, first-principles code review, or security hardening — no new features were added, but the app is now significantly more reliable.Phase Overview
[%eval]root-cause fix + code review report_pgnCacheShowPartialEvalDialog(3 options)[%eval]loss fix +console.logcleanup'unsafe-inline'+ Chess960 0-distance castling + concurrency fixes🐛 Bug Fixes (User-Reported)
1. Stats Page Move Selection Was Broken (Phase 71)
Symptom: Clicking a PGN move (e.g.
1. e4) in the 📊 Statistics page did nothing — no highlight, no board switch.Root cause: The
stats.htmlContent-Security-Policy used a SHA-256-hash-basedscript-srcpolicy. CSP Level 2+ silently blocked all 23 inlineonclickevent handlers because the policy didn't include'unsafe-inline'or'unsafe-hashes'. The<script>block ran fine (hash matched), but everyonclick="selectMove(0)"was silently dropped.Fix: Switched
script-srcfrom'sha256-<hash>' blob:to'unsafe-inline' blob:. This is safe becausestats.htmlis a local asset (file:///android_asset/) with no externally injected content and all JavaScript is inlined. Bonus: removing the hash eliminates the recurring "CSP hash mismatch" bug class (Phase 69 Bug 4 was the same root cause).2. Review "Analyze All" Falsely Reported Completion After Long-Press Priority (Phase 72)
Symptom: During an "Analyze All" batch, long-pressing an uncached move to prioritize it would sometimes cause the batch to report "all analysis complete" — even though earlier steps remained un-analyzed.
Root cause: The
_reviewAnalyzeAdvance()completion check only walked forward from_reviewAnalyzeStep+1. When a priority eval jumped ahead (e.g., user long-pressed step 50 during a batch at step 5) and subsequent steps were cached, the forward walk reached_lastStepand the completion branch fired — even though steps 5–49 were still uncached.Fix: When the forward walk finds nothing, scan the entire range
[0.._lastStep]for the lowest uncached step and resume the batch from there. The forward-only fast-path is preserved for the common (no-priority) case to avoid an O(n) full scan on every step.3. PGN Cache Save Lost
[%eval]Annotations (Phase 67 + 69 + 70)Symptom: After running "Analyze All" in review mode, saving the game to the PGN cache would sometimes produce a PGN missing
[%eval]annotations.Root cause (three layers, fixed across three phases):
!_useOriginal, but_useOriginalis almost alwaystruefor imported PGNs (becauseimportPGNsetstime:null). The check never ran, so the partial-eval dialog never appeared._pgnCacheOpInProgressguard.[%eval]because the force-rebuild was gated on_inReview(nowfalse). Fix: check_reviewEvalCache.size > 0directly.Fix: A new 3-option dialog (
💾 Some steps not yet analyzed) appears when coverage is incomplete:4. Chess960 0-Distance Castling Nulled the King (Phase 71)
Symptom: For Chess960 SP-IDs where the king starts on its castling target square (e.g. king on g1, kingside rook on h1 → UCI
g1h1), castling would silently remove the king from the board.Root cause:
uciToCoordsrewrote the destination to col 6, producing a 0-distance "move"g1g1. The_castleSidedistance heuristic rejected it (0 < minDist), castling wasn't detected, andmakeMvranboard[to] = board[from]; board[from] = null— self-copy then clear = king nulled.Fix (defense-in-depth, 4 files):
ai-bridge.js uciToCoords— attachcastle='kingside'/'queenside'toresult.toui.js executeMove— checkto.castleas primary source (covers AI moves wherelegalMvsis empty)game-logic.js _castleSide— explicit 0-distance branchstats.html— mirror all three fixes in its independent code🔒 Security & Robustness Hardening
XSS Hardening on Stats Page (Phase 71)
The CSP relaxation to
'unsafe-inline'(required for the onclick fix above) introduced a theoretical XSS vector: therenderPGNTextmovetext-walk fallback appended unrecognized characters raw to the HTML string. A malicious PGN like1. e4 <img src=x onerror="..."> e5 *could execute.Fix: All unrecognized movetext/variation/notation characters now route through
_escFEN()(escapes `& < > " ' ``) before HTML insertion. Applied to:renderPGNTextmovetext-walk fallbackfirstMovesopening-plies list (defense-in-depth — notation is engine-generated)Concurrency Fixes in
StockfishNative.java(Phase 71)readyOkLatchHolder_readyOkLockserializes all readyOk set+wait operationsengineStopTOCTOU on_discardingPonderBestmove_discardFlagLockmakes check-and-clear atomicimportSettingscap bypassStatsActivity.javaRobustness (Phase 71)shouldOverrideUrlLoading(WebView, String)overload — on API 21–23, only this overload fires; without it, external URLs would load into the WebView instead of the system browser.onRenderProcessGonehandler — a render crash on the stats page now finishes the activity instead of leaving a blank WebView.Low-Risk Defense-in-Depth Patches (Phase 71)
game-logic.jssecureRandomIntcrypto-undefined guard;moveAlgsetupModetypeofguard; en-passantcrinB()bounds checkchess960.jstoShredderCastlingnull-board guardpgn-standard.jssevenTagRoster/composePGNnull-params guardworker-pool.js⚙️ UCI Parameter Optimization (Phase 69)
Per the Stockfish 18 UCI optimization guide, the engine parameter caps were tightened from spec ceilings to practical best-practice values:
trueduring eval,falseduring gameplay✨ User-Facing Improvements (Phase 68)
Long-Press to Prioritize a Step During Analyze All
During an active "Analyze All" batch, long-press any uncached move in the move list to jump its evaluation to the front of the queue:
engineStop()Analyze All Performance (Issue 30)
_reviewAnalyzeAdvance()now callsrender()only every 10 steps (was: every step), using lightweight_refreshEvalTrendChart()+_updateReviewAnalyzeBtn()for intermediate updates — fixes WebView memory pressure on 100+ step games._requestBatchEvalwrapped insetTimeout(0)to yield the main thread between batch steps (prevents ANR on aggressive OEM ROMs).UI Polish
flex: 1 1 0(uniform full-width).rmv-blockCSS:user-select: none+-webkit-touch-callout: none+touch-action: manipulation(prevents text selection during long-press)📋 Phase 67→72 Verification (Phase 72)
As part of Phase 72, all Phase 67→71 changes were re-verified to be correctly implemented. The full checklist (40+ items) passed with no corrections needed:
✅ Phase 67 (10 items)
nativeRenicesetpriority error check +PRIO_MIN/PRIO_MAXclamp ✓makeMvinB(to.row, to.col)bounds check ✓onHintMovebounds check ✓Long.parseLongtry-catch ✓MainActivity.onDestroyWebViewstopLoading()✓LICENSEfile at project root ✓gradle.propertiescross-platform (no hardcoded Ubuntu path) ✓build-chess.pytry/except +__main__guard ✓_pgnCacheShowPartialEvalDialog(3 options) ✓✅ Phase 68 (9 items)
_reviewAnalyzeAdvancerender every 10 steps ✓_refreshEvalTrendChart+_updateReviewAnalyzeBtnintermediate updates ✓setTimeout(0)main-thread yield ✓_prioritizeReviewSteplong-press handler +_reviewAnalyzePriorityQueue✓.rmv-blockoncontextmenu✓flex: 1 1 0✓_pgnPartialEvalDialogActiveback-button support ✓.rmv-blockCSSuser-select: none+touch-action: manipulation✓priority_eval_toast/already_cached/not_in_review) ✓✅ Phase 69 (10 items)
_pgnCacheBuildSaveContextdecoupled coverage check from_useOriginal✓_reviewEvalCache.size > 0force rebuild ✓_pgnCacheOpInProgressguard (33 occurrences across all PGN cache ops) ✓stats.htmlCSP hash auto-update bybuild-chess.py✓worker-pool.jsonmessageerrorhandler ✓UCI_AnalyseModeauto-toggle ✓✅ Phase 70 (4 items)
_pgnCacheBuildSaveContextforce-rebuild checks_reviewEvalCache.size > 0(not_inReview) ✓makeMvInPlaceinB(to.row, to.col)check ✓console.logcleanup inai-bridge.js(8 remaining are all in removal-documentation comments) ✓console.logcleanup ineco-data.js(1 remaining is in removal comment) ✓✅ Phase 71 (12 items)
stats.htmlCSP'unsafe-inline'✓renderPGNText/ variation /firstMoves_escFENhardening ✓uciToCoordscastle flag attachment ✓executeMoveto.castleprimary source ✓_castleSide0-distance branch ✓stats.html0-distance castling mirror ✓readyOkLatchHolder_readyOkLock✓engineStopTOCTOU_discardFlagLock✓importSettingsPhase 69 cap formulas inline ✓StatsActivitydeprecatedshouldOverrideUrlLoadingoverload ✓StatsActivityonRenderProcessGone✓🏗️ Build & Install
Prerequisites
arm64-v8a-dotprod(download)build-chess.py)Build Steps
Install
📚 Documentation
README.mdBUILDING.mdPRIVACY.mdNOTICEUBIQUITOUS_LANGUAGE.mdRegalia-v1.1.2-manual-zh.htmlRegalia-v1.1.2-manual-en.html📜 License
Regalia is free software licensed under the AGPL v3 (application code) with components under GPL v3 (DroidFish-derived PGN parsing + engine integration) and Apache v2.0 (Gradle).
MainActivity,ChessApp, etc.)StockfishNative,game-logic.js,pgn-standard.js,stats.html)See
LICENSE,LICENSE-AGPL v3,LICENSE-GPL v3,LICENSE-Apache v2.0for full text.🙏 Acknowledgments
📝 Full Changelog (Phase 67 → 72)
🔍 Click to expand the full same-version revision history
Phase 72 (2026-07-12) — Review Analyze-All "False Completion" Fix
_reviewAnalyzeAdvancecompletion check now scans the entire[0.._lastStep]range when the forward walk finds nothing, preventing false "all analysis complete" reports after a long-press priority eval jumped ahead.Phase 71 (2026-07-11) — Stats-Page Move-Selection Bug Fix + Full Code Review
stats.htmlCSP switched from'sha256-<hash>'to'unsafe-inline'(unblocked 23 inline onclick handlers).renderPGNText/ variation /firstMovesroute through_escFEN.readyOkLatchHolderrace (_readyOkLock),engineStopTOCTOU (_discardFlagLock),importSettingscap bypass.shouldOverrideUrlLoadingoverload +onRenderProcessGone.Phase 70 (2026-07-10) — First-Principles Code Review Cleanup
_pgnCacheBuildSaveContextforce-rebuild now checks_reviewEvalCache.size > 0(not_inReview), so[%eval]survives exiting review mode before save.makeMvInPlaceinB(to.row, to.col)bounds check (matches Phase 67makeMv).console.logremoved fromai-bridge.js+ 1 fromeco-data.js.Phase 69 (2026-07-09) — 4 Bug Fixes + Web Worker Robustness + UCI Optimization
[%eval]lost after reload — decoupled coverage check from_useOriginal; force rebuild when_reviewEvalCache.size > 0._pgnCacheOpInProgressguard on all ops.stats.htmlCSP SHA-256 hash mismatch —build-chess.pynow auto-updates the hash.worker-pool.jsonmessageerrorhandler.UCI_AnalyseModeauto-toggle.Phase 68 (2026-07-08) — Analyze All Optimization + Long-Press Priority + UI Polish
render()every 10 steps +setTimeout(0)yield..rmv-blockoncontextmenu→_prioritizeReviewStep+_reviewAnalyzePriorityQueue.flex: 1 1 0(uniform full-width)..rmv-blockCSS:user-select: none+touch-action: manipulation.Phase 67 (2026-07-07) — Version Bump + PGN Cache
[%eval]Root-Cause Fix + Code Review ReportversionCode111 → 112,versionName"1.1.1" → "1.1.2".[%eval]root-cause fix: New_pgnCacheShowPartialEvalDialog(3 options: Analyze All first / Save anyway / Cancel).nativeRenicesetpriority check, P1makeMvinB(to), P2onHintMovebounds +Long.parseLongtry-catch +MainActivitystopLoading, GOV-1 standardLICENSEfile, GOV-2gradle.propertiescross-platform, MED-3build-chess.pyerror handling.arm64-v8aonly — no x86/ARMv7 builds (modern devices are all arm64; older 32-bit devices are not supported).arm64-v8a-dotprodseparately (seeBUILDING.md).'unsafe-inline'— safe for a local asset with no external content, but means inline event handlers are allowed. All user-pasted PGN content is HTML-escaped via_escFENbefore insertion intoinnerHTML.♟️ Regalia v1.1.2 — Built for chess enthusiasts, by chess enthusiasts. ♟️
Report Issue · Read the Manual · Privacy Policy
AI-GEN
This discussion was created from the release Regalia v1.1.2.
All reactions