Referrals: align localStorage key spec with implementation (R4 drift) #85
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#85
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
QA/spec documentation treats referral browser storage as a single key (
yieldomega.ref.v1). The implementation correctly uses two concepts:?ref=/ path capture)yieldomega.ref.v1in localStorage + sessionStoragefrontend/src/lib/referralStorage.ts(REF_STORAGE)registerCode)yieldomega.myrefcode.v1.<walletLowercase>MY_REF_KEY_PREFIX)Functional behavior is correct; the gap is naming/documentation so checklists and humans do not assume one key covers both flows.
Recommended solution
Prefer updating the spec/docs to match the source of truth (implemented keys). Renaming runtime keys would break existing users’ cached pending codes / stored plaintext unless a migration is added — unnecessary for a documentation-only mismatch.
Optional hardening (only if product wants strict naming): document a migration strategy if keys ever change; out of scope unless we deliberately rename.
Acceptance criteria
docs/product/referrals.mdexplicitly lists both keys and their payloads (pending: JSON withcode+ts; my-code: per-wallet JSON with normalizedcode+ts).docs/testing/invariants-and-business-logic.md(referrals / #64 rows) distinguishes pending capture vs post-register wallet cache keys so R4/R7 rows cannot be misread.skills/verify-yo-referrals-surface/SKILL.mdrow R4 references themyrefcodekey pattern (wallet-suffix), not onlyyieldomega.ref.v1.frontend/e2e/referrals-surface.spec.ts/referral-path.spec.tscomments or assertions remain accurate (pending key checks stay onyieldomega.ref.v1; add a short comment if Anvil register tests assert share links without asserting my-code key).ReferralsPage.tsxlede (if expanded) stays consistent — still not implying a single opaque “stable key” without naming shapes.Cross-link: GitLab #64 referrals surface.
Labels / dependencies
Related to referrals checklist R4 under #64; no contract changes.
mentioned in commit
2204641a7bImplemented (merged to
main)Documentation and UX copy now match
referralStorage.ts: pending capture usesyieldomega.ref.v1(localStorage + sessionStorage); post-register “my code” cache usesyieldomega.myrefcode.v1.<lowercase wallet>(localStorage only). Cross-links: product doc anchor#referral-browser-storage-keys, invariants #64 section + compact test map,skills/verify-yo-referrals-surface/SKILL.md,skills/README.md, yieldomega-guardrails item 15.Verification checklist for @brouie
docs/product/referrals.md— table lists both keys and JSON payloads (code,ts).docs/testing/invariants-and-business-logic.md§ Referrals — R4 vs R7 rows and #85 paragraph distinguish pending vsmyrefcode./referrals“Links that count” — names both key patterns without implying one opaque key.npm run buildthenCI=1 npx playwright test e2e/referrals-surface.spec.ts e2e/referral-path.spec.ts --workers=5— 3 passed locally after merge.Leaving issue open for your sign-off.
Verified end-to-end on
7b0f37d. All 4 checklist items pass.docs/product/referrals.md
Storage keys table at lines 33-36 lists both keys with full JSON payloads:
Plus an explicit cross-link to #85 at line 38: "do not assume a single yieldomega.ref.v1 row covers post-register 'my code'; that row is pending capture only." That covers the exact drift I flagged in the #64 close note.
docs/testing/invariants-and-business-logic.md
Three places where the spec drift is now resolved:
R4 vs R7 separation is clean now and matches referralStorage.ts at runtime.
ReferralsPage.tsx — "Links that count" lede
Line 52 lede now names both keys explicitly: "Pending referral codes use key yieldomega.ref.v1 in localStorage and sessionStorage; after you register, your share-link code is cached per wallet under yieldomega.myrefcode.v1. plus your lowercased wallet address (localStorage only). Neither store owns codes onchain — ReferralRegistry + TimeCurve do."
No longer implies a single opaque key.
Playwright (CI-equivalent)
npm run build — built in 11.22s clean.
CI=1 npx playwright test e2e/referrals-surface.spec.ts e2e/referral-path.spec.ts --workers=5:
Running 3 tests using 3 workers, 3 passed (3.0s).
Matches your local result.
Closing #85.
cc @PlasticDigits
mentioned in issue #86
mentioned in issue #91
mentioned in issue #100
mentioned in issue #205
mentioned in issue #223