Root cause: DOMAINS_CONFIG_PATH was missing from the frontend env so
getDomainConfig('andebol.net') fell through to the English fallback.
Fixes applied:
- deploy/systemd/frontend.env.example: add DOMAINS_CONFIG_PATH and
BRIDGE_INTERNAL_URL so Astro SSR resolves domain JSON on the CT
- bridge/src/lib/request-host.ts: drop X-Site-Host; resolve site domain
from the HTTP Host header which nginx already preserves ($host)
- frontend/src/lib/bridge.ts: multi-domain SWR cache keys; nginx-routed
bridge calls via public hostname with BRIDGE_INTERNAL_URL loopback
override for CT environments where public DNS does not resolve locally
- config/writers/f0251a61: restrict Nelson Alves topics to Andebol only
(remove Futebol / Desportos — BIT-22288 intent)
- frontend: overhauled article page (hero image, masthead, sidebar,
share bar), rich related-articles grid, improved LatestGrid institutional
theme, FpaAgendaSection rewrite, ui-i18n PT strings completed
- Add backfill-featured-from-fpa.ts: matches andebol.net post slugs against
FPA portal WP REST API and uploads featured images for matched posts
- Export attachFeaturedImageToPost from wp-publish.ts for reuse by backfill
- Add npm script backfill:featured for one-shot execution
- Extend RSS ingest to extract media:content and media:thumbnail fields
(BIT-24388: FPA feed uses <media:content> for images, not <enclosure>)
- Update config/domains/andebol.net.json: wp_endpoint → public HTTPS URL
- Update docs; add pino-pretty dev dep to bridge
Backfill result (2026-06-05): 30 updated, 52 skipped (no FPA match), 0 errors.
Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8)
Paperclip-Issue: BIT-24389
The bridge imported ./lib/errorReporter.mjs but tsc never emitted that file
into dist/, so production systemd crashed with ERR_MODULE_NOT_FOUND. Move
the module to TypeScript so `npm run build` produces dist/lib/errorReporter.js.
Report 5xx errors from the Fastify error handler to the central ingest API.
Enabled when ERROR_REPORTING_TOKEN is set in the environment.
Paperclip-Agent: peter-spark
Paperclip-Issue: BIT-750
Paperclip-Run: c2c29aef-e79f-4e69-98ed-3353d04b7a6d
Automated health monitoring for the news-platform services on CT222,
motivated by the bridge crash-loop incident (BIT-743) where 3,608
restarts went undetected until manual discovery.
Health endpoints:
- Bridge /health enhanced with optional ?checks=true for deep
dependency probes (WordPress, Redis) and uptime reporting
- Frontend /health.json added as Astro API route
Monitoring infrastructure:
- healthcheck.sh: periodic probe script with HTTP checks, systemd
restart-count detection, cooldown logic, and Ntfy push alerting
- news-healthcheck.timer: runs every 3 min (detection < 5 min)
- [email protected]: OnFailure template for instant crash alerts
- All three service units updated with OnFailure= directive
- deploy.sh updated to install monitoring units and env file
Paperclip-Agent: peter-spark
Paperclip-Issue: BIT-744
Paperclip-Run: 405ab587-8b8b-4963-8867-0feb95a994e3
The module-level singleton called mkdirSync('config/writers') which
fatally crashed the bridge when running as www-data without write
permission to the working directory. The bridge has been crash-looping
with restart counter >3600, taking andebol.net offline.
Constructor now catches EACCES gracefully (warn + degrade) instead of
killing the process. Deploy scripts also ensure the directory exists
with correct ownership.
Paperclip-Agent: peter-spark
Paperclip-Issue: BIT-743
Paperclip-Run: 817ec0b4-3778-44ae-8c07-efd97a2bdd86
Implement BIT-709 acceptance: GET /search and /stats on the writer-pipeline
aggregator; bridge AggregatorClient calls /search and maps items with
source_url. /writers/:id/candidates merges aggregator-first with WordPress,
exposes candidate_source and matched_sources, and passes max_age_hours into
ranking. Add docs/AGGREGATOR_OPERATIONS.md and store unit tests.
Paperclip-Issue: BIT-709
Made-with: Cursor
The bridge built hero, trending, featured, latest, and category rows from
overlapping slices of the same post list, so the same thumbnails appeared many
times. Reserve post ids top-to-bottom, over-fetch the main feed and category
queries, and de-dupe the hero when stickies overlap the feed.
Render the featured slice as its own banded section, localize the sports
trending strip, and use distinct heading ids when two grids share the page.
Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
Enable fpa_agenda_enabled on andebol.net domain config. The bridge fetches
ws.fpa.pt getAgendaJogosFAP with SWR caching, normalises rows, and attaches
fpa_agenda to the homepage JSON. The institutional theme renders a responsive
fixtures table with FPA attribution.
Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
Now that _embed works correctly, WordPress returns full wp:term data where
some categories have undefined description fields. Guard strip_html against
null/undefined input.
Co-Authored-By: Paperclip <[email protected]>
The EMBED constant ('_embed=wp:featuredmedia,author,wp:term') was used as a
URLSearchParams key, which encodes the '=' as '%3D'. The .replace('%3D=','=')
hack never matched because '%3D' is followed by 'w' (from 'wp:'), not '='.
Result: WordPress never received the _embed parameter, so _embedded data
(featured images, author, terms) was always missing from API responses.
The bridge normalized this to featured_image: null for every article.
Fix: use URLSearchParams.set('_embed', EMBED_VALUE) so the key and value
are properly separated and encoded.
Co-Authored-By: Paperclip <[email protected]>
- Forward X-Site-Host from Astro to the bridge so loopback calls use the public domain JSON
- Normalize newsproject.bitreport.pt.json (categories slug/label, wp on 127.0.0.1:8080)
- Degrade homepage/trending when WordPress is down instead of 500
- Extend webhook-deploy.sh for config/ and wordpress/ changes; add deploy-hook-server + systemd unit
- Document automatic Gitea webhook flow in docs/deployment.md; align DOMAINS_CONFIG_PATH env
Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
- Fastify + TypeScript service in bridge/ listening on port 3200
- WordPress REST API client with _embed support and data normalization
- Redis stale-while-revalidate cache with in-process Map fallback
- Domain routing: reads config/domains/<host>.json per Host header
- Routes: /homepage, /articles, /articles/:slug, /articles/:slug/related,
/categories, /categories/:slug, /trending, /api/tags, /api/media/:id,
/api/site-config, /health
- /api/posts and /api/categories aliases redirect to canonical routes
- Rate limiting via @fastify/rate-limit; CORS via @fastify/cors
- Error handling: WP unavailable → serve stale cache or 503
- Domain configs for localhost and newsproject.bitreport.pt
Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor