Skip to content

Document persistence model and add gf-persistent flag#175

Merged
IanMayo merged 1 commit into
mainfrom
claude/jolly-goodall-u8l9n0
Jun 25, 2026
Merged

Document persistence model and add gf-persistent flag#175
IanMayo merged 1 commit into
mainfrom
claude/jolly-goodall-u8l9n0

Conversation

@IanMayo

@IanMayo IanMayo commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Annotations are persisted to browser storage with two different models depending on context: trainer pages use localStorage (permanent), student pages use sessionStorage (cleared on session close). Until now the only way to select trainer persistence was an <a> anchor with exact text ANALYSIS, and this behaviour was completely undocumented.

This PR:

  • Adds a second, explicit trigger — an element with id="gf-persistent" anywhere on the page now also selects trainer (localStorage) persistence, alongside the existing ANALYSIS-anchor detection. This gives integrators a clear, intentional opt-in that doesn't depend on incidental link text.
  • Documents both detection criteria and the trainer/student storage model in the README (new "Annotation Persistence" section).
  • Adds tests — a new persistent-flag-page.html fixture plus two tests verifying that a page carrying #gf-persistent writes to localStorage (not sessionStorage) and that annotations survive a reload.

Detection logic (src/core/storage.js)

A page is treated as trainer context if either:

  1. An element with id="gf-persistent" exists, or
  2. An anchor whose exact trimmed text is ANALYSIS exists.

Otherwise it is student context. The #gf-persistent check runs first; existing behaviour is unchanged.

Testing

All 16 tests in tests/storage.spec.js pass, including the 2 new gf-persistent tests.

🤖 Generated with Claude Code


Generated by Claude Code

Trainer pages use localStorage (permanent); student pages use
sessionStorage (per-session). Previously the only way to opt into
trainer persistence was an anchor with exact text "ANALYSIS", and the
behaviour was undocumented.

- Add a second, explicit trigger: an element with id "gf-persistent"
  anywhere on the page now also selects trainer (localStorage)
  persistence, alongside the existing ANALYSIS-anchor detection.
- Document both detection criteria and the trainer/student storage
  model in the README.
- Add a persistent-flag fixture and tests covering the new flag.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183n3qwA6ssJ8m6UJVUwhid
@github-actions

Copy link
Copy Markdown
Contributor

PR Preview

Preview deployment is ready! View Preview

Last updated: 2026-06-25T15:53:56.214Z

@IanMayo IanMayo merged commit 4ed185d into main Jun 25, 2026
3 checks passed
@IanMayo IanMayo deleted the claude/jolly-goodall-u8l9n0 branch June 25, 2026 16:11
github-actions Bot added a commit that referenced this pull request Jun 25, 2026
@IanMayo IanMayo mentioned this pull request Jun 25, 2026
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.

2 participants