Skip to content

feat(storage): persist estimated difficulty evidence#38

Draft
hubab1 wants to merge 12 commits into
09d-keyword-status-separationfrom
20b-estimated-difficulty-persistence
Draft

feat(storage): persist estimated difficulty evidence#38
hubab1 wants to merge 12 commits into
09d-keyword-status-separationfrom
20b-estimated-difficulty-persistence

Conversation

@hubab1

@hubab1 hubab1 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • append additive SwiftData schema V4 with separate estimated-difficulty metric revisions and exact top-result evidence
  • persist explicit estimated/unavailable state, heuristic and algorithm provenance, requested scope, actual ranking source, source fetch/computation times, explanatory notes, and structured redacted fallback classifications
  • select immutable revisions deterministically so delayed contexts cannot regress visible results; compact visible losing revisions on later writes
  • validate coherent score/confidence/evidence shapes, cap the logical current evidence set at ten, derive staleness from ranking fetch time, and keep missing distinct from unavailable

Safety boundary

  • leaves released KeywordDailyMetric.difficultyScore and AppKeywordStats.difficultyScore untouched and performs no legacy backfill
  • contains no ranking refresh, UI, MCP DTO, CSV, import, or provider wiring; those remain in 20c
  • concurrent contexts may temporarily leave immutable losing revisions, but readers select one coherent winner and the next visible write compacts them
  • 20c must guard delete-versus-in-flight persistence with query-existence, generation, and cancellation checks
  • schema-changing draft: do not launch against the live user store before manual migration review

Validation

  • 39/39 focused persistence, migration, and dependency tests
  • 332/332 complete OpenASO tests
  • released v0.3.2 fixture migrates through V4 with both legacy difficulty sentinels still 42, both new tables initially empty, and bundled artifact hashes unchanged
  • direct V2-to-V4 and V3-to-V4 preservation tests
  • reversed-save tests for existing rows and concurrent first inserts
  • signed Debug build and codesign --verify --deep --strict
  • three independent final reviews with no actionable P1/P2 findings after concurrency hardening
  • app intentionally not launched because this branch changes the persistent schema

Dependencies and merge gate

This draft is stacked on #37. The eventual 20c integration also depends on #35 and #36. Keep this draft unmerged until the real-store migration/integrity review is complete.

Attribution

The broader estimated-difficulty idea was inspired by the upstream WIP commit akshaynexus@5de98ea. This persistence design and its tests are an independent rewrite; source link only, with no co-author trailer.

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