Skip to content

feat(flags): experimental refresh strategies in Diagnostics (#984) - #1670

Merged
XaaT merged 7 commits into
devfrom
feat/984-p2c-strategies
Nov 16, 2026
Merged

XaaT merged 7 commits into
devfrom
feat/984-p2c-strategies

Conversation

@XaaT

@XaaT XaaT commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #984 (flags refresh failing on cellular). Stacked on #1669 (P2b), itself on #1668 (P2a) and #1667 (socle). Adds experimental refresh settings in Diagnostics so testers can compare strategies on their own network, as asked on the DEV topic.

Settings (Diagnostics only, not the main Settings screen)

  • Strategy: Socle (default, the socle behaviour), Ancien (all categories in parallel, unbounded; data protections kept, no fail-all), single global request, or global request first then categories. An unknown stored value falls back to Socle.
  • Read bound N from 1 to 20 (default 5), with the effective N shown; application retry on or off (default on).
  • The dialog states what the global request cannot see: stickies, and read flags of topics that are not favourites. A 15/11 corpus on the agent account established the rule: the global request lists a topic only if it is not sticky and (favourite or new message).

Global client

  • Reads topics/{participated|read|favorites}/ as grouped results; envelope, group category, topic identity and subcategory are cross-checked, and contradictions are rejected before publication.
  • Positive observations only: a missing topic is never deleted; an existing row is never downgraded (read state, position and anchors kept; unread and favourite OR-ed; counters max); stickies untouched; nothing is marked complete.
  • A global row is purged only when its category bucket succeeds in the same batch (or the row predates the last bucket success); a failing bucket keeps it.
  • "Global first" keeps the categories within the same 12 s budget; its failure does not block them. An empty global read on a cold cache publishes nothing.
  • The global source is never persisted: it is written as LEGACY_UNKNOWN and unknown stored sources read as neutral, so the socle build can read the table (schema 23 unchanged).

Other changes

  • A policy change starts a new generation, cancels and drains old reads before the single limiter is replaced.
  • findFlag tells Found, Absent and Unavailable apart; a cold targeted lookup records only that category, the others stay unverified.
  • Each FlagsRefresh log line carries the strategy and the effective N.
  • Test fixtures are minimal and neutralized, derived from REST captures of 15/11/2026 (agent account); no raw capture is committed.

Known limits (minor, open): with "global only", a cold cache without unread topics shows an error whose retry cannot succeed, and a row added by the global read is never removed or marked read without a targeted lookup or a strategy change.

Validation

  • Full validation on socadisc, f0f5e9cba: GREEN, 7 695 tests, 0 failure; KSP-exported schema 23 identical. After the UI pass, 69d34d1da: GREEN, 7 699 tests.
  • Seen on an emulator (Pixel 8, light and dark); the UI pass gave each strategy its own description, 48 dp selectable rows, -/+ icon buttons for N, N disabled with Ancien, and a shorter title.
  • Gates: Astra NO GO on the first version (persisted source unreadable by older builds, targeted lookup recorded as a full inventory, destructive global merge, contradictory subcategory accepted, banner hiding socle errors) → fixed → Fable NO GO (global rows purged on a historical success, empty cold success hiding errors) → fixed → Fable GO with reservations.

Parity-Impact: none — the only Topic change is the long-press flag-removal feedback (#809), which tells an unavailable lookup apart from a certified absence; MP has no flags.

Rebased on P2b

  • P2b moved the Diagnostics screen out of DiagnosticsViewModel.kt into DiagnosticsScreen.kt: the strategies button now sits under the connection-test panel, and DiagnosticsViewModel takes both NetworkProbeService and UserPreferencesRepository (its test stubs the latter).
  • The refresh begin line now reads <policy> <restrictions> <network> <timing>.
  • Provenance sidecars added for the six rest_global_* fixtures (repo-guards).

PR générée par Claude (Opus 5.5) à la demande de @xatrix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a

@XaaT XaaT added this to the Infra & dette milestone Nov 16, 2026
@XaaT
XaaT force-pushed the feat/984-p2c-strategies branch from 69d34d1 to 3b71b4b Compare November 16, 2026 20:29
@XaaT
XaaT changed the base branch from feat/984-socle to feat/984-p2b-network-test November 16, 2026 20:29
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch from d7b46e8 to e5784f9 Compare November 16, 2026 20:30
@XaaT
XaaT force-pushed the feat/984-p2c-strategies branch from 3b71b4b to 7da274a Compare November 16, 2026 20:30
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch from e5784f9 to b79dddd Compare November 16, 2026 20:34
@XaaT
XaaT force-pushed the feat/984-p2c-strategies branch from 7da274a to b34e0fa Compare November 16, 2026 20:34
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch from b79dddd to d248554 Compare November 16, 2026 20:34
@XaaT
XaaT force-pushed the feat/984-p2c-strategies branch from b34e0fa to e300fa9 Compare November 16, 2026 20:48
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch from d248554 to f857c8c Compare November 16, 2026 20:48
@XaaT
XaaT force-pushed the feat/984-p2c-strategies branch from e300fa9 to 2ad1eaa Compare November 16, 2026 21:00
@XaaT
XaaT force-pushed the feat/984-p2b-network-test branch 2 times, most recently from 38e2a59 to 5163825 Compare November 16, 2026 21:15
XaaT and others added 7 commits November 16, 2026 22:16
…nd a global flags client (#984)

Diagnostics gets experimental refresh settings for testers:
- Strategy: Socle (default, current behaviour), Ancien (unbounded fan-out,
  data protections kept, no fail-all), single global request, or global
  request first then categories. Unknown stored value falls back to Socle.
- Read bound N from 1 to 20 (default 5), effective N shown; application
  retry on or off (default on).

The global client reads topics/{participated|read|favorites}/ as grouped
results and only adds positive observations: a missing topic is never
deleted, marked read or moved, stickies and their dates are untouched, and
the global read never marks a category complete. "Global first" keeps the
categories within the same 12 s budget; its failure does not block them.

A policy change starts a new generation, cancels and drains the old reads
before the single limiter is replaced. findFlag now tells Found, Absent and
Unavailable apart, so a partial cache never yields a false "absent".
Each FlagsRefresh log line carries the strategy and the effective N.

Test fixtures are minimal and neutralized, derived from REST captures of
15/11/2026 (agent account); no raw capture is committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
…ge, targeted coverage is not an inventory (#984)

Fixes from the P2c gate:
- GLOBAL stays in memory: it is written as LEGACY_UNKNOWN and any unknown
  stored source reads as LEGACY_UNKNOWN, so the socle build can read the
  table (schema 23 unchanged).
- A global observation never downgrades an existing row: read state,
  position and anchors are kept; unread and favourite are OR-ed; counters and
  last reply take the max. Stickies are untouched, absent rows are added,
  nothing is deleted.
- A cold findFlag on one category no longer records a complete inventory:
  the other categories stay unverified and the banner counts them.
- A subcategory that contradicts the group or topic category is rejected
  before publication.
- Any Socle refresh clears the global marker; Socle errors stay visible and
  take priority in the banner.
- An empty global list is a no-op success: nothing persisted, no marker.
- Missing imports for RestListEnvelope and RestTopic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
…eeds, no empty cold success (#984)

Fixes from the P2c re-gate:
- A row observed by the global read (stored LEGACY_UNKNOWN) is purged only
  when its category bucket succeeds in the same batch, or when it predates the
  last bucket success; a failing bucket keeps it.
- An empty global read on a cold cache publishes nothing and writes nothing,
  so a category failure stays visible.
- A targeted lookup keeps the global marker; only an inventory batch clears it.
- Test DAO stub aligned with the real converter (GLOBAL -> LEGACY_UNKNOWN).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
…Ancien in the strategies dialog (#984)

Seen on the emulator:
- Each strategy shows its own secondary description under its label; whole
  rows are selectable radio buttons in a selectable group, 48 dp minimum.
- N uses -/+ icon buttons (48 dp, accessible descriptions) instead of text
  buttons that wrapped at N=20.
- With Ancien, the chosen N and its buttons are disabled, with a short
  explanation; the stored value is kept.
- Shorter title; the opening button aligns with the screen text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
… repository (#984)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
…he policy preferences and read limiter (#984)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7pvomKHW15zFqZ5T6WA6a
@XaaT
XaaT force-pushed the feat/984-p2c-strategies branch from 2ad1eaa to bc5284d Compare November 16, 2026 21:16
@XaaT
XaaT changed the base branch from feat/984-p2b-network-test to dev November 16, 2026 21:16
@XaaT
XaaT merged commit d262e3d into dev Nov 16, 2026
0 of 4 checks passed
@XaaT
XaaT deleted the feat/984-p2c-strategies branch November 16, 2026 21:16
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