Backend¶
- Status: The
bedroomprofile is deployed. Theandrea-techprofile and its RSS sources are prepared in the local branch; release identity is recorded in the runbook. - Technology: .NET 10, C# 14, ASP.NET Core Minimal API
The backend keeps modern, changing integrations away from Android 5.1. It authenticates to configured device identities, collects and selects provider content, renders bounded image cards, and publishes immutable manifests and assets. The Android app remains a native client. This page describes the checked-in implementation. Release identity and operational evidence are recorded in deployment.
What exists¶
The solution contains an API project and an xUnit test project. A single hosted refresh loop fetches due sources in the background, with no provider work in device requests. It permits at most two concurrent source fetches and recomposes only profiles that use a changed source. Dashboard snapshots are volatile; the optional shared sports fetcher also keeps a durable quota ledger. The API exposes:
| Route | Current role |
|---|---|
GET / |
Service identity |
GET /health/live |
Process liveness |
GET /health/ready |
Readiness for deployment checks |
GET /api/v1/dashboard |
Authenticated, profile-specific schema-1 manifest |
GET /api/v1/assets/{sha256}.png |
Authenticated immutable rendered card image |
Both device routes authenticate a bearer token against its configured SHA-256
hash and resolve the assigned profile. The manifest and assets support
conditional ETag requests. Assets are addressed by their PNG SHA-256 and
receive immutable cache headers. The process keeps the current snapshot and up
to two prior snapshots per profile in memory so assets from a recently replaced
manifest remain available. IFeedSnapshotStore is the snapshot store boundary.
Integration tests exercise the full application with WebApplicationFactory.
The deployed bedroom configuration assigns six sources: Bogotá weather
(Open-Meteo), NYT and Guardian RSS headlines, international men's fútbol, and
Iowa State NCAA football and men's basketball. The two MLB postseason sources
remain defined but are disabled and unassigned. Their source IDs keep their
historical Yankees names for compatibility with scripts. Sources and profile
assignments are configuration-driven, but this checkout does not include an
administration or enrollment interface.
The andrea-tech profile is separate and currently assigns five RSS
sources: WIRED en Español Gadgets and Ciencia, NASA Artemis, TechCrunch AI, and
Spaceflight Now launch news.
They reuse the RSS adapter and existing headline renderer. A source can be
shared between profiles while each profile independently chooses its sources
and ordering. The profile also has a bounded launch-event source and two
daily briefing feeds. The backend definition is deployed on OVH, and the Play
still maps to bedroom.
The RSS adapter is a bounded HTTP/XML client for fixed HTTPS source URLs. It
supports the RSS shape used by the current feeds and scans a bounded number of
items before normalizing content. RssMaxResponseBytes is an optional
per-source decompressed-body limit: omission uses 1 MiB, and configuration is
bounded to 10 MiB. The client checks a declared content length when available
and also stops while streaming if the actual body crosses the configured cap.
The item and elapsed-time guards still apply. Raw XML is not retained or
published; only normalized content is kept in source state and used to compose
profile snapshots. Podcast audio is never fetched or retained. If a publisher
uses Atom, that requires an explicit shared parser enhancement rather than a
publisher-specific adapter.
With RssDailyBriefing=true, the same RSS parser projects a feed item into a
single dated podcast episode instead of a list of headlines. The card shows
the episode title, publisher, and publication date; its original feed link
stays internal and is not exposed as a tap-to-play action. There is no
transcript or audio processing. The local Andrea configuration includes two
optional candidates, tech-news-daily-briefing (Tech News Daily from
Brief) and
daily-tech-headlines-briefing (Daily Tech Headlines from
Acast). Both are enabled in the
local configuration. Outside Andrea's reserved Bulletins, the ordinary lineup
uses one eligible episode only if capacity remains. If both feeds have a
fresh episode, the selected provider alternates by the profile's Bogotá local
calendar date whenever the profile is recomposed; there is no midnight timer.
If only one is eligible, it is used. Future-dated episodes and episodes older
than 36 hours are excluded. A selected episode expires earlier if its source
has not been confirmed for six hours.
BulletinReservations is profile configuration, not podcast-specific.
Each rule lists scheduled profile-local LocalTimes and candidate
SourceIds assigned to the profile. It reserves the first eligible card
from one source; when more than one source is eligible, choice rotates by
local calendar date in configured order. Up to two rules are supported.
Leave one slot per rule in the eight-image manifest pool; the ordinary
MaxCards and Bulletin duration still cap each displayed lineup. Andrea
reserves one card at 08:00 and 08:30, after a priority launch but before
ordinary headlines. Without an eligible candidate, the normal lineup applies.
Older APKs do not interpret reservations; update the Play before switching
it to this profile. No production mapping has changed.
sinc-ciencia is another disabled, unassigned RSS source definition for
evaluation. It is ordinary headline content and is not added to Andrea's
profile. Neither these candidates nor the feed-size change has been deployed
to OVH.
Launch event tracking¶
The local Andrea profile uses a Launch Library 2 (LL2)
v2.3.0 adapter for an operator-curated watchlist. The adapter polls the fixed
LL2 launch endpoint in one batch every 15 minutes, using the API's comma-
separated id filter, and bounds the watchlist to eight operator UUIDs. One
enabled LL2 source is allowed; failure retries are at least five minutes
apart, with longer backoff or a provider retry delay when applicable. Its
initial entry is Starship Flight 15
(0f867f0c-5422-4d44-93b8-d7faaae7019b). Dates and status come from the live
provider record; the UUID is the configured identity, so rescheduling does not
need a code change.
Selection admits one priority launch card when a precise launch time is within 48 hours; the earliest eligible launch wins. A delayed or scrubbed imminent launch can produce a 15-minute notice. Provider failure preserves the last confirmed launch state with a stale label, then hides it after 45 minutes without confirmation or at the end of its launch window. Canceled and completed launches are retired. RSS announcements continue through the normal headline adapter and are not automatically correlated with launch records.
Spaceflight Now's launch schedule and Space Launch Schedule serve as human editorial cross-checks only; the backend does not scrape them. The SpaceX Flight 15 page is a separate operator reference. This adapter and profile configuration are local and are not part of the deployed OVH release.
Read-only access evidence for international fútbol and Iowa State feeds is in Sports provider access. Shared adapters and selection are implemented; fútbol and football are enabled in the checked-in configuration. Consult deployment for release status. College basketball activation remains conditional on demonstrating current-season access.
Shared fútbol and college sports¶
ApiSportsSoccer, ApiSportsAmericanFootball, and ApiSportsBasketball
normalize date slates into the common sports model. TeamIds selects followed
provider teams locally; CompetitionId optionally narrows the competition.
The example definitions cover the five senior men's national teams and Iowa
State in NCAA football and men's basketball. They do not use restricted
current-season, next-game, or paid batch filters.
The shared fetcher caches requests across sources and profiles, including legitimate empty responses. Each API has a separate conservative ceiling of 90 requests per UTC day and eight per minute. Reservations are persisted before sending; pages, failures and detail/event requests all consume the same budget. Upstream remaining-count hints may reduce the allowance but cannot replenish it. A corrupt, unavailable or locked ledger stops requests, rather than silently resetting the budget. Other programs using the same key still consume the provider account's quota; this ledger is not account-wide.
Date discovery normally refreshes hourly. Selected ongoing matches can use budgeted individual-ID lookups every 15 minutes; fútbol uses inline events when supplied, without automatically adding an events request. Empty groups produce no placeholder card. Empty groups are revisited every 15 minutes, but their cached date slates still refresh hourly. Near-kickoff detail caches are shortened so an earlier "not started" response cannot mask the kickoff check. The daily cap remains authoritative even if many games are live; updates stop when it is exhausted and cards expire rather than claim freshness. Entitlement/validation failures are unavailable sources, not evidence that no match exists. The old baseball adapter retains its separate, in-process quota policy.
Each game retains the confirmation time of the response that supplied it. Reusing a cached date does not renew that time. This lets a freshly checked live score coexist with an older confirmed final. Shared live cards expire after 20 minutes without confirmation. Across sports, confirmed finals from today or yesterday remain eligible through the end of the day after kickoff in the source's configured time zone. They expire at that next midnight, not 24 hours after kickoff or a rolling confirmation TTL. Refreshing a final does not extend that calendar boundary; live-score freshness rules are unchanged. Upcoming schedule cards expire at their earliest kickoff or eight hours after confirmation, whichever comes first. This covers the six-hour tomorrow-cache lifetime without falsely renewing it. Provider coverage is not a guarantee of immediate live updates.
See the quota storage decision and activation requirements.
Baseball provider evaluation¶
The API registers two keyed baseball adapters. Earlier releases selected both
for separately attributed comparison cards, first following the Yankees, then
the postseason without a team filter. The current profile assigns neither
adapter. The earlier MlbStats adapter also remains disabled.
For team-scoped profiles, the alternative adapter uses API-Sports team ID 25, requests the local
yesterday/today/tomorrow dates without a season/team filter, and selects the
configured team from shared date snapshots. In the observed free plan, the
current season was denied when a season parameter was present, whereas
date-only current games worked. Adjacent dates may be denied as the rolling
free window crosses UTC midnight; a denied optional date is skipped until the
next UTC day. Today remains required. The adapter keeps a per-process ceiling
of 90 upstream requests per UTC day, below the provider's 100/day free quota.
Its cached day snapshots are not durable across API restarts. Normal refreshes
are no faster than 30 minutes, and live-game refreshes no faster than 15
minutes. Multiple time zones consume separate date snapshots and share that
same request ceiling. The source's missing key or a provider entitlement error
leaves the previous valid dashboard snapshot in place through the existing
failure policy. Live cards expire 20 minutes after their last successful
confirmation, so the 15-minute permitted refresh does not leave a recurring
10-minute gap; if refreshes fail, the stale live card still disappears.
The adapter is selected by a server source definition, not by the Android contract. It reuses the game selector and sports-card renderer, so adding phones does not multiply upstream calls. Its 90/day ceiling and date caches reset when the API process restarts; they are not a durable account-wide quota ledger. The exact image was rehearsed and both cards were accepted over public HTTPS; longer-term freshness and provider reliability remain evaluation work.
For team-scoped profiles, BALLDONTLIE uses team ID 19 and one team-filtered request for yesterday
through seven days ahead, with up to 100 games. A non-null pagination cursor
is treated as an incomplete response rather than publishing a misleading next
game. Its documented free access is five requests per minute; the normal
refresh floor is 15 minutes and live games refresh every two minutes. The
adapter maps status_state, runs, and inning into the same GameContent as
the other baseball adapters. A scheduled game's placeholder zeroes are not
published as a 0–0 score. Both keys stay server-side. See
Deployment for activation and
rollback.
Both adapters support the current postseason scope. The BALLDONTLIE MLB
games documentation describes its
postseason=true filter and response metadata. The adapter bounds
that request to three pages of at most 100 games each, 1 MiB per page and 3 MiB
in aggregate. Repeated cursors, malformed entries, oversized pages, and
duplicate game IDs fail the fetch; the team-scoped request remains a single
page. The API-Sports Baseball games documentation
documents no per-game postseason phase field, so its scope requires both
PostseasonStartDate and PostseasonEndDate as inclusive ISO
calendar dates. It filters league 1 games by their date in the configured
source time zone, uses the same team-neutral yesterday/today/tomorrow cache,
and applies no team filter. Duplicate game IDs in a date response fail closed;
overlapping cached dates are merged by ID, preferring the newest snapshot.
These operator dates select candidates; they do not assert that API-Sports
marked a game as postseason.
The adapters return a GamesContent slate. The composer expands it to one card
per game using the stable ID {sourceId}:game:{gameId}. It can reuse a
rendered image while its game content and confirmation time are unchanged, and
prunes memo entries outside the published slots or no longer active in a
recomposed profile. Selection gives available sources their first slot in
configured order, then considers later games in round-robin laps. When two or
more postseason candidates are available in a lap, the composer reserves them
together; if they do not all fit the remaining MaxCards capacity, those
candidates are skipped while other source cards can still use remaining slots.
If only one postseason provider has a candidate for a lap, that card may be
included. A rendering failure can also leave only one card from a paired set.
When MaxCards is smaller than the number of available sources, configured
order determines first-slot coverage. Thus two postseason sources with three
games each plus weather and two news cards produce seven cards, rather than an
unpaired eighth postseason candidate, when only one slot remains. MaxCards
defaults to 8 and is bounded to 1–8.
Live refresh policy checks every game in the slate: the API-Sports floor is 15
minutes and the BALLDONTLIE floor is two minutes when any game is
live or delayed after play has started. Each published game's validity is
still calculated independently by the existing sports-card policy.
The retained baseball source definitions use postseason scope with inclusive
API-Sports coverage dates from 2026-09-29 through 2026-11-15. These are operator
coverage bounds, not a predicted end date. BALLDONTLIE uses its postseason
filter; API-Sports uses the configured dates because it does not document
per-game postseason metadata. The bedroom profile has
AutoBulletinBudget=true, MaxCards=8, a 15-second card duration and a
75-second configured floor. The automatic budget is
min(240, max(floor, selectedCardCount × CardDurationSeconds)), so a
five-card feed uses 75 seconds and eight cards can use 120 seconds. Card
durations are bounded to 5–30 seconds, the floor to 15–240 seconds, and
MaxCards to 1–8. The actual selected card count can be zero when sources have
no valid content. These settings are delivered in the existing phone contract.
Neither adapter supplies authoritative champion metadata. Completion is an
explicit source configuration fact, never a schedule inference. When an
operator has confirmed the champion, configure the same PostseasonCompletion
on both sources, including ChampionName, ConfirmedAt as a UTC instant, and
RetainDays (default 7; valid range 1–30), then restart the API. Configuring
completion disables provider fetches immediately, including while the
confirmation time is in the future; the API waits locally until that instant.
The champion card
expires at ConfirmedAt + RetainDays, and the source is retired after that
retention window. No completion is configured now. The selector may exclude an
explicitly flagged conditional fixture, but current adapter responses do not
establish that detection. Both parsers require positive team IDs and nonempty
names, so malformed concrete entries fail closed. BALLDONTLIE's explicit
scheduled postseason placeholder (id=-1, UNK, Unknown) is omitted while
its opponent is unresolved; it is not a predicted participant or evidence
that an “if necessary” game will be played. Duplicate IDs still fail closed,
including IDs belonging to omitted placeholders.
Implemented pipeline¶
flowchart LR
Providers[Open-Meteo / API-Sports / BALLDONTLIE / RSS] --> Adapters[Provider adapters]
Disabled[MLB Stats - disabled] -. not selected .-> Adapters
Adapters --> Loop[RefreshCoordinator and hosted loop]
Loop --> Composer[FeedComposer]
Composer --> Renderer[SkiaSharp renderer]
Renderer --> Snapshots[IFeedSnapshotStore]
Snapshots --> Contract[Versioned dashboard manifest]
Snapshots --> Media[Hash-addressed PNG assets]
Contract --> Device[Android client]
Media --> Device
Minimal API endpoints stay focused on HTTP transport and authorization. Provider
adapters normalize external payloads; the refresh coordinator owns source state,
ETags, due times, deadlines, and bounded concurrency; FeedComposer selects
valid source content per profile and asks the renderer for cards. The snapshot
store publishes a complete immutable manifest plus its referenced image bytes.
The Android app downloads missing images, verifies size and hash, stages them,
and activates a manifest only after all its assets are available.
The shared schema-1 fixtures under contracts/dashboard/v1/ are read by the
backend and Android contract tests. Keep additions compatible with older
clients and update both sides when the contract changes.
Sport-neutral content model¶
The server model separates a game's identity and state from its sport:
GameContentcarries game ID, start instant, sport, optional competition, teams, nullable scores, state, and explicit in-progress status.- Progress is typed: baseball inning/half-inning and doubleheader metadata, fútbol half/minute/stoppage time, or a numbered quarter/period with an optional provider-reported clock.
- Optional goal/red-card events are copied into a read-only list bounded to eight entries. Presentation includes at most four goals/red cards, with red cards prioritized and bounded player names; richer statistics remain outside scope. These are content, not instructions to animate the phone.
- A
GamesContentslate holds neutral games. Adapters normalize provider metadata; shared selectors and publication policy choose which games become cards. Baseball postseason rules remain separate from other sports' rules.
Published identity remains {sourceId}:game:{gameId}: the source namespaces
provider game IDs, so two providers can describe the same match without
colliding. Team IDs are optional provider-local references; their names and
abbreviations remain the display fallback.
SourceState.LastSuccessAt records successful source fetches. Shared slates
also retain each game's original response confirmation time, so a cached final
and a freshly checked live score have independent freshness. The composer
derives each card's ValidUntil using SourcePolicy; timestamps are not
duplicated inside GameContent. Baseball retains its provider-specific refresh
floors, while final-game retention follows the shared calendar-day policy.
A delayed game uses normalized in-progress status rather than assuming that
the existence of an inning proves play has started.
The shared model supports the enabled fútbol and football feeds as well as the baseball adapters. Grouped schedules and cached logos are rendered into the existing Android schema-1 manifest and PNG transport; the phone does not parse provider payloads or download team logos separately.
Team logos and flags¶
Adapters may attach a provider/team identity and the response's logo URL to
each team. An absent or malformed logo field does not invalidate a game.
TeamLogoCache validates the URL before any download: only HTTPS on
media.api-sports.io, port 443, with the exact sport-specific
/teams/{id}.png path is allowed. Queries, user information, other hosts and
different team IDs are rejected. Each of at most two redirects is checked
again, and the asset client sends no provider key or device token.
Downloads are capped at 1 MiB and eight seconds across headers, body and redirects. Skia inspects the raster before decoding: PNG, JPEG or WebP only, no animation/SVG, at most 2048 pixels per side and 4,194,304 total pixels. Images preserve alpha and aspect ratio within 192×192 pixels; normalized PNGs are capped at 128 KiB. Composition also bounds total logo preparation per card, so a slow logo cannot hold up publication indefinitely.
A dedicated persistent cache uses hashed provider/team keys and atomic entry replacement. Its 128-entry/16-MiB limits include metadata and encoded image bytes. Revalidation normally occurs after seven days and uses ETag or Last-Modified when available. Failures back off for an hour, including across restarts; a last-good logo remains usable. Opportunistic cleanup removes entries unused for 30 days and evicts older entries when the budget is full. An unavailable, corrupt or already-owned cache falls back to abbreviations. This optional logo cache is distinct from the non-disposable sports quota ledger. CDN asset downloads do not call the keyed game-data endpoints.
The composer prepares logos asynchronously before rendering and includes their content in render-memo identity. Revalidation can therefore change a PNG even when the score is unchanged. Logos are embedded in the ordinary opaque card; phones make no separate logo downloads. Provider licensing/attribution remains an independent requirement before wider distribution.
API-Sports supplies team-logo URLs; the current BALLDONTLIE adapter does not. Consequently the baseball comparison can show a logo on one provider's card and an abbreviation on the other's. If providers are deduplicated later, introduce an explicit cross-provider team-identity mapping and resolve both providers to the same cached API-Sports visual. Game data and logo data need not come from the same provider. Never equate their numeric team IDs or infer identity solely from a display name; preserve attribution and usage rights.
Card rendering and container¶
SkiaCardRenderer produces opaque 1280×720 PNGs. SkiaSharp and its Linux
native assets are pinned together at version 4.153.1; the API project targets
linux-musl-x64 and the final image is .NET 10 Alpine. IBM Plex Sans Regular
and SemiBold are bundled with their SIL Open Font License text. tzdata is
installed in the image so profile IANA zones such as America/Bogota resolve.
The container sets DOTNET_gcServer=0 (workstation GC) and runs as the
non-root app user. Published configuration, fonts and binaries are owned by
that user so a private umask 077 preparation remains readable; the production
read-only root filesystem still prevents modification. These are checked-in
image settings, not production
resource measurements.
Packaging and deployment boundary¶
The API has a production container definition intended for loopback port 8088
on the OVH host, reached through system Nginx; the container listens on 8080.
See deployment for release identity and rollback. Rendered dashboard
images are currently stored in process memory and served by the API, not from a filesystem
/assets directory, filesystem cache, or Nginx static files. A process
restart discards runtime snapshots; the API serves an empty cold-start
manifest until source results produce a new profile snapshot. Durable
photographs and music would need a
separately backed-up store outside the container and release directories.
DNS, HTTPS, VPS state, and deployment status are documented in the operational runbook; they are distinct from the local implementation status above. Runtime device credentials are supplied through environment configuration and are not checked in. See OVH deployment and ADR 0002.