Repository navigation
Keep notes and bookmarks on replayed games - #5
Conversation
A study document per saved game id, bound to the canonical record digest and entry index. Writes compare the loaded revision under a per-study advisory lock and replace the file atomically; loading never writes. A different record, a newer or damaged document and unfinished games are refused without touching the file. Notes are bounded to 8 KiB of UTF-8 and documents to 1 MiB.
m bookmarks the entry on screen and e edits its one-line note; both are kept per entry, not per ply, and marked in the entry list. A save overtaken by another window is refused with both versions kept, and is only replaced once the stored version has been shown whole. Refusals reach the status line when there is no panel.
A study file left at the highest revision loads, but the next save would wrap to a negative revision that Load refuses, losing every note while reporting success. Set now refuses it as damaged before anything is written.
# Conflicts: # .github/scripts/test-windows.ps1 # .github/workflows/ci.yml # CHANGELOG.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8a31a2e59
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dec := json.NewDecoder(bytes.NewReader(data)) | ||
| dec.DisallowUnknownFields() | ||
| var s Study | ||
| if err := dec.Decode(&s); err != nil { |
There was a problem hiding this comment.
Reject missing or duplicated study fields
When a study file is hand-edited or partially generated with a missing, null, or duplicated entries field, DisallowUnknownFields does not reject it: a missing/null field becomes an empty slice, while a duplicated field silently keeps the last value. Load therefore treats the damaged document as valid, and the next note or bookmark save rewrites it, potentially discarding marks from the omitted or earlier field despite the stated guarantee that damaged study files are preserved. Track required field presence and reject duplicate object keys before accepting the document.
Useful? React with 👍 / 👎.
Summary
Delivers RM-01.b on top of v0.7.0.
internal/study: one versioned document per saved game id instudy/under the configuration directory, bound to the canonical record digest and the entry index. Writes hold a per-study advisory lock across re-read, revision compare and atomic replacement (Windows throughinternal/winfs); loading never writes. A different record, a newer or damaged document, an exhausted revision and unfinished games are refused without touching the file. Notes are bounded to 8 KiB of UTF-8 and documents to 1 MiB.mbookmarks the entry on screen andeedits its one-line note; both are kept per entry, not per ply, shown in the panel and marked*/#in the entry list. Stored text is drawn inert.Scope and compatibility
Canonical records and
game exportare unchanged; deleting a saved game leaves its study file in place. No CLI command, cascade or portable bundle. Study format 1 only.Verification
-raceoninternal/app,internal/cliandinternal/study(added to the CI race job).TestStudyNoteSurvivesLeavingAndResizing: menu → finished game → jump → note → bookmark → leave → reopen → the note and bookmark are on the same entry, survive resize, and the saved game's bytes are unchanged. Required on native Windows.