Skip to content

feat(settings): typed persistent preferences and readiness - #919

Merged
apotema merged 1 commit into
mainfrom
feat/persistent-settings
Oct 29, 2026
Merged

apotema merged 1 commit into
mainfrom
feat/persistent-settings

Conversation

@apotema

@apotema apotema commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Add engine.settings.Settings(T, Codec, max_bytes) over the existing storage Store. Games retain their serialized formats and platform providers while sharing async readiness, safe load/edit ordering, snapshot saves, coalesced writes and in-memory fallback. This supports FP language restoration before translated UI and migrates its existing sound settings without changing stored JSON.

Prepares stable 4.1.1. FP currently consumes 4.2.0-rc.1; the settings addition will also be carried onto that release-candidate line without merging unrelated navigation work into stable.

Validation: five lifecycle regression tests pass on Windows; public read/write lifecycle compiles for wasm32-emscripten and aarch64-linux-android. Both checks are in CI. See docs/settings.md for ownership, startup gating and error semantics.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T04:25:27.380624Z — PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 291a85b9-ab81-4dd8-bcb9-bfa7f89eeb2e
Commits

Reviewing files that changed from the base of the PR and between 236ec1e and 20b7f09.

Files selected for processing: 7
  • .github/workflows/ci.yml
  • build.zig
  • build.zig.zon
  • docs/settings.md
  • src/root.zig
  • src/settings.zig
  • test/settings_compile.zig

Included review availability: This review used your included allowance. 9 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

Walkthrough

The change adds a typed settings wrapper over storage.Store, exposes it through the root module, and adds lifecycle tests. Build and CI steps run the tests and compile-check the settings test root for WebAssembly Emscripten and Android targets.

Changes: Persistent Settings

Layer / File(s) Summary
Settings lifecycle and API
src/settings.zig, src/root.zig, docs/settings.md, build.zig.zon
Settings(T, Codec, max_bytes) tracks live and queued values and manages asynchronous reads and writes. Tests cover readiness, edits, save snapshots, read and write failures, and disabling. The root module exports settings. The guide documents the lifecycle and constraints. The package version changes to 4.1.1, and the package paths include the guide.
Build and CI checks
build.zig, test/settings_compile.zig, .github/workflows/ci.yml
The general test step and a separate test-settings step run the settings tests. A compile-check exercises the settings API. CI also compiles the settings test root for WebAssembly Emscripten and Android without emitting binaries.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant Settings
  participant Store as storage.Store
  participant Codec
  Caller->>Settings: pump(store)
  Settings->>Store: start bounded read
  Store-->>Settings: read result
  Settings->>Codec: decode stored data
  Settings->>Store: write queued snapshot after loading
Loading
Merge Risk: Minimal · up to 20b7f

No actionable issue is identified that would prevent merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding typed persistent settings with readiness handling.
Description check Passed The description directly explains the new Settings API, persistence behavior, supported use cases, versioning, and validation results.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (7 skipped: 7 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@apotema
apotema merged commit fe662e9 into main Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant