feat(ads): server-driven ad-banner backend, wire & admin console (PR1)
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 14s
CI / ui (pull_request) Successful in 49s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m12s

Turn the gated-off mock banner into a real advertising subsystem (backend +
admin half; the UI rotation lands in PR2).

- internal/ads: campaigns (percent weight + validity window; a perpetual,
  undeletable default that fills the remainder up to 100%), 1..N bilingual
  messages (en+ru), global display timings; ActiveSet computes the
  window-filtered, default-remainder, GCD-reduced, language-resolved rotation
  feed. Smooth-weighted-round-robin math is unit-tested.
- migration 00006 (+ jetgen): ad_campaigns / ad_messages / ad_settings, seeded
  default campaign + house message + default timings.
- eligibility = !paid_account && hint_balance==0 && !no_banner role (new role;
  guests qualify). The resolved feed rides the profile.get response (no new RPC,
  works for guests, nothing distinct to filter); language by service_language.
- live update: a notify `banner` sub-kind (re-poll signal) published when an
  operator grants hints or grants/revokes no_banner, so the client shows/hides
  in place.
- admin console /_gm/banners (+ /_gm/banner-settings): campaign + message CRUD
  with reorder, default protection, clamped timings.
- wire: fbs BannerInfo/BannerCampaign on Profile; gateway transcode forwards it.
- docs: ARCHITECTURE §10, FUNCTIONAL (+ _ru), backend README, PRERELEASE tracker
  (incl. the deferred app.load aggregator note).
This commit is contained in:
Ilia Denisov
2026-06-15 23:00:19 +02:00
parent f59c8dcd43
commit 0946a3f66c
45 changed files with 2993 additions and 28 deletions
+126
View File
@@ -0,0 +1,126 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { BannerCampaign } from '../scrabblefb/banner-campaign.js';
export class BannerInfo {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):BannerInfo {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsBannerInfo(bb:flatbuffers.ByteBuffer, obj?:BannerInfo):BannerInfo {
return (obj || new BannerInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsBannerInfo(bb:flatbuffers.ByteBuffer, obj?:BannerInfo):BannerInfo {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new BannerInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
campaigns(index: number, obj?:BannerCampaign):BannerCampaign|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? (obj || new BannerCampaign()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
campaignsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
holdMs():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
edgePauseMs():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
scrollPxPerSec():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
fadeOutMs():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
gapMs():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
fadeInMs():number {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
static startBannerInfo(builder:flatbuffers.Builder) {
builder.startObject(7);
}
static addCampaigns(builder:flatbuffers.Builder, campaignsOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, campaignsOffset, 0);
}
static createCampaignsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startCampaignsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addHoldMs(builder:flatbuffers.Builder, holdMs:number) {
builder.addFieldInt32(1, holdMs, 0);
}
static addEdgePauseMs(builder:flatbuffers.Builder, edgePauseMs:number) {
builder.addFieldInt32(2, edgePauseMs, 0);
}
static addScrollPxPerSec(builder:flatbuffers.Builder, scrollPxPerSec:number) {
builder.addFieldInt32(3, scrollPxPerSec, 0);
}
static addFadeOutMs(builder:flatbuffers.Builder, fadeOutMs:number) {
builder.addFieldInt32(4, fadeOutMs, 0);
}
static addGapMs(builder:flatbuffers.Builder, gapMs:number) {
builder.addFieldInt32(5, gapMs, 0);
}
static addFadeInMs(builder:flatbuffers.Builder, fadeInMs:number) {
builder.addFieldInt32(6, fadeInMs, 0);
}
static endBannerInfo(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createBannerInfo(builder:flatbuffers.Builder, campaignsOffset:flatbuffers.Offset, holdMs:number, edgePauseMs:number, scrollPxPerSec:number, fadeOutMs:number, gapMs:number, fadeInMs:number):flatbuffers.Offset {
BannerInfo.startBannerInfo(builder);
BannerInfo.addCampaigns(builder, campaignsOffset);
BannerInfo.addHoldMs(builder, holdMs);
BannerInfo.addEdgePauseMs(builder, edgePauseMs);
BannerInfo.addScrollPxPerSec(builder, scrollPxPerSec);
BannerInfo.addFadeOutMs(builder, fadeOutMs);
BannerInfo.addGapMs(builder, gapMs);
BannerInfo.addFadeInMs(builder, fadeInMs);
return BannerInfo.endBannerInfo(builder);
}
}