Compare commits

..
Author SHA1 Message Date
spark ccb6552746 Merge pull request 'chore(runtime): WordPress PHP 8.5 + Node.js 24.22.1 baseline (BIT-31729)' (#56) from chore/BIT-31729-runtime-php84-node24 into main
Tests / writer-pipeline tests (push) Successful in 33s
Tests / bridge tests (push) Successful in 34s
Tests / frontend lib tests (push) Successful in 30s
2026-10-23 19:01:55 +01:00
tiago-neves e723e3ee5b chore(runtime): WordPress PHP 8.5 + Node.js 24.22.1 baseline (BIT-31729)
Tests / bridge tests (push) Successful in 39s
Tests / writer-pipeline tests (push) Successful in 42s
Tests / writer-pipeline tests (pull_request) Successful in 45s
Tests / frontend lib tests (push) Successful in 55s
Tests / bridge tests (pull_request) Successful in 35s
Tests / frontend lib tests (pull_request) Successful in 47s
Align docker-compose, engines, nvmrc, and CI with the company runtime baseline.
Official wordpress:6-php8.5-fpm ships PHP 8.5.6 today; host Node must move to 24.22.1 Active LTS.

Paperclip-Issue: BIT-31729
Paperclip-Run: 8b5ae44d-b3e7-430e-871e-d5fcb1bd9fb1
2026-10-23 18:52:30 +01:00
spark 528b020989 Merge pull request 'chore: fix CODEOWNERS to existing Gitea accounts' (#54) from chore/codeowners-fix into main
Tests / writer-pipeline tests (push) Successful in 38s
Tests / bridge tests (push) Successful in 40s
Tests / frontend lib tests (push) Successful in 30s
2026-10-22 04:51:59 +01:00
1sonhador b97b768057 chore: limit CODEOWNERS to active Gitea reviewers
Tests / writer-pipeline tests (push) Successful in 26s
Tests / bridge tests (push) Successful in 25s
Tests / frontend lib tests (push) Successful in 29s
Tests / writer-pipeline tests (pull_request) Successful in 26s
Tests / bridge tests (pull_request) Successful in 28s
Tests / frontend lib tests (pull_request) Successful in 37s
Only owners that review in practice are listed, so official review
requests from code owners never block merges on protected branches.
2026-10-22 04:45:01 +01:00
1sonhador fe9a19603c chore: corrige CODEOWNERS para contas existentes no Gitea
Tests / writer-pipeline tests (pull_request) Successful in 29s
Tests / bridge tests (pull_request) Successful in 32s
Tests / frontend lib tests (pull_request) Successful in 47s
Tests / writer-pipeline tests (push) Successful in 46s
Tests / bridge tests (push) Successful in 41s
Tests / frontend lib tests (push) Successful in 41s
2026-10-21 17:39:13 +01:00
spark b23ca87102 Merge pull request 'fix(writer-pipeline): decode literal \u2013 in revista PDF URLs (BIT-31118)' (#53) from fix/BIT-31118-revista-imprensa-u2013-404 into main
Tests / writer-pipeline tests (push) Successful in 36s
Tests / bridge tests (push) Successful in 37s
Tests / frontend lib tests (push) Successful in 41s
fix(writer-pipeline): decode literal \u2013 in revista PDF URLs (BIT-31118)

Merged PR #53.

Paperclip-Issue: BIT-31118
Paperclip-ERRSIG: 97ac27c4c5df
Paperclip-ERRCLUSTER: ddda2b9e3d39
2026-10-13 06:25:21 +01:00
tiago-neves dc1b6dd4f0 ci: retrigger push status checks for BIT-31118
Tests / writer-pipeline tests (push) Successful in 46s
Tests / bridge tests (push) Successful in 48s
Tests / frontend lib tests (push) Successful in 55s
Tests / writer-pipeline tests (pull_request) Successful in 54s
Tests / bridge tests (pull_request) Successful in 54s
Tests / frontend lib tests (pull_request) Successful in 56s
Paperclip-Issue: BIT-31118
Paperclip-ERRSIG: 97ac27c4c5df
Paperclip-ERRCLUSTER: ddda2b9e3d39
Paperclip-Run: 567916ae-2a3f-4379-8780-9eeaaa781a04
2026-10-13 06:23:06 +01:00
tiago-neves ded3c71ed6 fix(writer-pipeline): decode literal \u2013 in revista PDF URLs (BIT-31118)
Tests / writer-pipeline tests (pull_request) Successful in 38s
Tests / bridge tests (pull_request) Successful in 38s
Tests / frontend lib tests (pull_request) Successful in 43s
FPA media embeds Revista-de-Imprensa filenames with a literal JSON \u2013
escape; new URL turned the backslash into /u2013 and the fetch 404'd.
Decode \uXXXX before parsing and accept en-dash / hashed date filenames.

Paperclip-Issue: BIT-31118
Paperclip-ERRSIG: 97ac27c4c5df
Paperclip-ERRCLUSTER: ddda2b9e3d39
Paperclip-Run: 3f65156a-de49-43a1-876d-75f6285b4bc4
2026-10-13 06:19:06 +01:00
spark c7329a7ea5 Merge pull request 'feat(andebol): Classificação link on FPA agenda cards (BIT-31056)' (#52) from fix/BIT-31056-fpa-agenda-standings-link into main
Tests / writer-pipeline tests (push) Successful in 39s
Tests / bridge tests (push) Successful in 41s
Tests / frontend lib tests (push) Successful in 44s
2026-10-10 18:02:03 +01:00
tiago-neves de19fb7e1a feat(andebol): add Classificação link on FPA agenda game cards (BIT-31056)
Tests / writer-pipeline tests (push) Successful in 47s
Tests / bridge tests (push) Successful in 49s
Tests / frontend lib tests (push) Successful in 56s
Tests / writer-pipeline tests (pull_request) Successful in 51s
Tests / bridge tests (pull_request) Successful in 51s
Tests / frontend lib tests (pull_request) Successful in 54s
Map PROVA competition codes to public standings URLs so every "Próximos jogos"
card links to the competition table (Flashscore for Betclic leagues; FPA portal
hubs otherwise).

Paperclip-Issue: BIT-31056
Paperclip-Run: 5901136e-753a-494f-bd36-250d1b822690
2026-10-10 17:47:03 +01:00
spark e43f04705a Merge pull request 'fix(writer-pipeline): demote sitemap gateway 502/503/504 to warning (BIT-30847)' (#51) from fix/BIT-30847-eurohandball-sitemap-502-demote into main
Tests / writer-pipeline tests (push) Successful in 37s
Tests / bridge tests (push) Successful in 39s
Tests / frontend lib tests (push) Successful in 42s
2026-10-04 06:30:57 +01:00
tiago-neves c61c19216c fix(writer-pipeline): demote sitemap gateway 502/503/504 to warning
Tests / writer-pipeline tests (pull_request) Successful in 49s
Tests / bridge tests (pull_request) Successful in 50s
Tests / writer-pipeline tests (push) Successful in 56s
Tests / bridge tests (push) Successful in 56s
Tests / frontend lib tests (pull_request) Successful in 1m3s
Tests / frontend lib tests (push) Successful in 1m0s
EHF google-news-sitemap already retries; residual gateway blips (BIT-30847 /
ERRSIG a92b3521aec8) must not open Error Loop tickets. Keep HTTP 500 as error
so broken endpoints like the old /sitemap.xml stay actionable.

Paperclip-Agent: Bug Squasher (urlKey bug-squasher; id 4669adc7-6368-43ef-bf27-5a601a6b7b83)
Paperclip-Issue: BIT-30847
Paperclip-Run: ce265bf3-24dc-4532-b87d-92188cc55399
2026-10-04 06:17:33 +01:00
spark da539f33aa Merge pull request 'fix(writer-pipeline): retry WP draft POSTs; demote transient fetch noise (BIT-30583)' (#49) from fix/BIT-30583-draft-fetch-retry into main
Tests / writer-pipeline tests (push) Successful in 44s
Tests / bridge tests (push) Successful in 44s
Tests / frontend lib tests (push) Successful in 49s
2026-10-01 07:18:09 +01:00
30 changed files with 304 additions and 59 deletions

No files matched your search

+4 -4
View File
@@ -2,11 +2,11 @@
# Replace/add owners as needed per repository domain.
# CI and forge metadata
/.gitea/ @tiago-neves @david-santos
/.gitea/workflows/ @tiago-neves @david-santos
/.gitea/ @devops-engineer @founding-engineer
/.gitea/workflows/ @devops-engineer @founding-engineer
# Documentation
/docs/ @david-santos @planner
/docs/ @founding-engineer
# Catch-all
* @david-santos
* @founding-engineer
+3 -3
View File
@@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
node-version: "24.22.1"
cache: "npm"
cache-dependency-path: writer-pipeline/package-lock.json
- run: npm ci
@@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
node-version: "24.22.1"
cache: "npm"
cache-dependency-path: bridge/package-lock.json
- run: npm ci
@@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
node-version: "24.22.1"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- run: npm install
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
node-version: [24.22.1]
steps:
- uses: actions/checkout@v4
+1
View File
@@ -0,0 +1 @@
24.22.1
+4 -4
View File
@@ -2,11 +2,11 @@
# Replace/add owners as needed per repository domain.
# CI and forge metadata
/.gitea/ @tiago-neves @david-santos
/.gitea/workflows/ @tiago-neves @david-santos
/.gitea/ @devops-engineer @founding-engineer
/.gitea/workflows/ @devops-engineer @founding-engineer
# Documentation
/docs/ @david-santos @planner
/docs/ @founding-engineer
# Catch-all
* @david-santos
* @founding-engineer
+1
View File
@@ -0,0 +1 @@
24.22.1
+11 -8
View File
@@ -14,10 +14,13 @@
"ioredis": "^5.4.1"
},
"devDependencies": {
"@types/node": "^20.14.0",
"@types/node": "^24.19.2",
"pino-pretty": "^13.1.3",
"tsx": "^4.15.0",
"typescript": "^5.4.5"
},
"engines": {
"node": ">=24.22.1"
}
},
"node_modules/@esbuild/aix-ppc64": {
@@ -540,13 +543,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "20.19.37",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz",
"integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==",
"version": "24.19.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz",
"integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
"undici-types": ">=7.24.0 <7.24.7"
}
},
"node_modules/abstract-logging": {
@@ -1400,9 +1403,9 @@
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"version": "7.24.6",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
"dev": true,
"license": "MIT"
},
+6 -3
View File
@@ -4,13 +4,16 @@
"description": "WordPress REST API bridge for the news platform",
"type": "module",
"main": "dist/server.js",
"engines": {
"node": ">=24.22.1"
},
"scripts": {
"dev": "tsx watch src/server.ts",
"build": "tsc",
"start": "node dist/server.js",
"typecheck": "tsc --noEmit",
"test": "npm run build && node --test dist/lib/sanitize-html.test.js dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js dist/services/fpa-stream-match.test.js",
"test:coverage": "npm run build && node --experimental-test-coverage --test dist/lib/sanitize-html.test.js dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js dist/services/fpa-stream-match.test.js"
"test": "npm run build && node --test dist/lib/sanitize-html.test.js dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js dist/services/fpa-stream-match.test.js dist/services/fpa-standings-url.test.js",
"test:coverage": "npm run build && node --experimental-test-coverage --test dist/lib/sanitize-html.test.js dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js dist/services/fpa-stream-match.test.js dist/services/fpa-standings-url.test.js"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
@@ -19,7 +22,7 @@
"ioredis": "^5.4.1"
},
"devDependencies": {
"@types/node": "^20.14.0",
"@types/node": "^24.19.2",
"pino-pretty": "^13.1.3",
"tsx": "^4.15.0",
"typescript": "^5.4.5"
+3 -1
View File
@@ -8,6 +8,7 @@ import type { AndebolTvStreamEvent } from '../services/andeboltv.js';
import { fetch_andeboltv_stream_events } from '../services/andeboltv.js';
import { get_fpa_agenda_from_store } from '../services/fpa-agenda.js';
import { enrich_fpa_agenda_with_streams } from '../services/fpa-stream-match.js';
import { enrich_fpa_agenda_with_standings_urls } from '../services/fpa-standings-url.js';
// Number of articles per section
const HERO_COUNT = 3;
@@ -151,7 +152,8 @@ export async function homepage_routes(app: FastifyInstance): Promise<void> {
}
}),
]);
return enrich_fpa_agenda_with_streams(games, streams);
const with_streams = enrich_fpa_agenda_with_streams(games, streams);
return enrich_fpa_agenda_with_standings_urls(with_streams);
} catch (err) {
app.log.warn({ err, host }, 'FPA agenda fetch failed');
return [];
@@ -0,0 +1,48 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
enrich_fpa_agenda_with_standings_urls,
extract_fpa_competition_code,
FPA_STANDINGS_FALLBACK_URL,
resolve_fpa_standings_url,
} from './fpa-standings-url.js';
test('extract_fpa_competition_code reads leading PO codes', () => {
assert.equal(extract_fpa_competition_code('PO01 - Campeonato Betclic Masculino'), 'PO01');
assert.equal(extract_fpa_competition_code('PO01A - Divisao de Honra Masculina'), 'PO01A');
assert.equal(extract_fpa_competition_code('PO09 - Campeonato Betclic Feminino'), 'PO09');
assert.equal(extract_fpa_competition_code('PARTICULARES SELECOES NACIONAIS'), null);
});
test('resolve_fpa_standings_url maps Betclic leagues to Flashscore tables', () => {
assert.match(
resolve_fpa_standings_url('PO01 - Campeonato Betclic Masculino'),
/campeonato-betclic-masculino\/classificacao\/$/,
);
assert.match(
resolve_fpa_standings_url('PO09 - Campeonato Betclic Feminino'),
/campeonato-betclic-feminino\/classificacao\/$/,
);
});
test('resolve_fpa_standings_url falls back by gender then national hub', () => {
assert.match(
resolve_fpa_standings_url('PO02 - Campeonato Nacional 2a Divisao Masculina'),
/competicoes-nacionais-andebol-masculino\/$/,
);
assert.match(
resolve_fpa_standings_url('PO10 - Campeonato Nacional 2a Divisao Feminina'),
/competicoes-nacionais-andebol-feminino\/$/,
);
assert.equal(resolve_fpa_standings_url('PARTICULARES SELECOES NACIONAIS'), FPA_STANDINGS_FALLBACK_URL);
});
test('enrich_fpa_agenda_with_standings_urls always sets standings_url', () => {
const games: Array<{ competition: string; standings_url?: string | null }> = [
{ competition: 'PO01 - Campeonato Betclic Masculino' },
{ competition: 'Unknown cup', standings_url: null },
];
const enriched = enrich_fpa_agenda_with_standings_urls(games);
assert.ok(enriched[0]?.standings_url.startsWith('https://'));
assert.equal(enriched[1]?.standings_url, FPA_STANDINGS_FALLBACK_URL);
});
+74
View File
@@ -0,0 +1,74 @@
/**
* Resolve a public standings (classificação) URL for an FPA agenda competition name.
*
* Agenda rows only expose `PROVA` as a free-text label (e.g. "PO01 - Campeonato Betclic
* Masculino"). There is no competition id in the feed. We map known competition codes to
* public standings pages (Flashscore for top leagues that publish tables; FPA portal hubs
* otherwise), with a national competitions fallback.
*/
const FLASHSCORE_PT = 'https://www.flashscore.pt/andebol/portugal';
const PORTAL_FPA = 'https://portal.fpa.pt';
/** General FPA national competitions hub (final fallback). */
export const FPA_STANDINGS_FALLBACK_URL = `${PORTAL_FPA}/competicoes-nacionais/`;
const PORTAL_MASCULINO = `${PORTAL_FPA}/competicoes-nacionais-andebol-masculino/`;
const PORTAL_FEMININO = `${PORTAL_FPA}/competicoes-nacionais-andebol-feminino/`;
/**
* Competition code (from PROVA prefix) → public standings page.
* Prefer pages that actually render a league table when available.
*/
const STANDINGS_BY_CODE: Record<string, string> = {
PO01: `${FLASHSCORE_PT}/campeonato-betclic-masculino/classificacao/`,
PO01A: PORTAL_MASCULINO,
PO02: PORTAL_MASCULINO,
PO03: PORTAL_MASCULINO,
PO06: PORTAL_MASCULINO,
PO09: `${FLASHSCORE_PT}/campeonato-betclic-feminino/classificacao/`,
PO09A: PORTAL_FEMININO,
PO10: PORTAL_FEMININO,
PO12: PORTAL_FEMININO,
PO20: `${FLASHSCORE_PT}/taca-de-portugal/`,
PO23: PORTAL_FEMININO,
};
/** Extract leading competition code such as PO01 / PO01A / PO09A from a PROVA label. */
export function extract_fpa_competition_code(competition: string): string | null {
const m = competition.trim().match(/^([A-Z]{1,3}\d{1,3}[A-Z]?)\b/i);
return m?.[1] ? m[1].toUpperCase() : null;
}
function gender_hub_url(competition: string): string | null {
const lower = competition.toLowerCase();
if (/\bfemin/i.test(lower)) {
return PORTAL_FEMININO;
}
if (/\bmascul/i.test(lower)) {
return PORTAL_MASCULINO;
}
return null;
}
/**
* Always returns a URL suitable for an external "Classificação" link.
*/
export function resolve_fpa_standings_url(competition: string): string {
const code = extract_fpa_competition_code(competition);
if (code && STANDINGS_BY_CODE[code]) {
return STANDINGS_BY_CODE[code]!;
}
return gender_hub_url(competition) ?? FPA_STANDINGS_FALLBACK_URL;
}
/** Attach `standings_url` to each agenda game (idempotent). */
export function enrich_fpa_agenda_with_standings_urls<T extends { competition: string; standings_url?: string | null }>(
games: T[],
): Array<T & { standings_url: string }> {
return games.map((game) => ({
...game,
standings_url: game.standings_url || resolve_fpa_standings_url(game.competition),
}));
}
+5
View File
@@ -40,6 +40,11 @@ export interface FpaAgendaGame {
stream_status?: 'live' | 'upcoming' | null;
/** Convenience flag when `stream_status === 'live'`. */
is_live?: boolean;
/**
* Public standings (classificação) page for this competition.
* Resolved from the PROVA label (code map + gender hub + FPA national fallback).
*/
standings_url?: string | null;
}
export interface CategoryConfig {
+3 -2
View File
@@ -19,9 +19,10 @@ log "installing Docker..."
apt-get install -y --no-install-recommends docker.io docker-compose-plugin
systemctl enable --now docker
log "Node.js 22 (NodeSource)..."
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
log "Node.js 24 Active LTS (NodeSource)..."
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
apt-get install -y nodejs
# Target runtime: Node.js 24.22.1 (Active LTS). Verify with: node -v
log "PM2 (global)..."
npm install -g pm2
+1 -1
View File
@@ -25,7 +25,7 @@ The bridge is a lightweight Fastify HTTP server that sits between the Astro fron
| Layer | Choice |
|-------|--------|
| HTTP server | Fastify 5 |
| Language | TypeScript (Node.js 22+) |
| Language | TypeScript (Node.js 24.22.1+) |
| Cache | Redis (ioredis) |
| HTTP client | `undici` |
| Process manager | PM2 or systemd |
+3 -3
View File
@@ -73,7 +73,7 @@ Versioned script on the repo (run as **root** on a fresh Ubuntu 24.04 CT):
sudo bash /opt/news-platform/deploy/lxc/setup.sh
```
It installs nginx, Redis, Docker (+ compose plugin), Node.js 22, and PM2, and enables `docker` and `redis-server`.
It installs nginx, Redis, Docker (+ compose plugin), Node.js 24 (Active LTS), and PM2, and enables `docker` and `redis-server`.
---
@@ -184,7 +184,7 @@ A stack real está versionada em **`wordpress/docker-compose.yml`** (não duplic
| Item | Valor actual |
|------|----------------|
| Database | **MariaDB 11** (`mariadb:11`), serviço `db`, porta 3306 só na rede Compose |
| WordPress | `wordpress:6-php8.3-fpm` + `nginx:alpine` sidecar per site; `WORDPRESS_DB_HOST: db:3306` (andebol: `db-andebol`) |
| WordPress | `wordpress:6-php8.5-fpm` + `nginx:alpine` sidecar per site; `WORDPRESS_DB_HOST: db:3306` (andebol: `db-andebol`) |
| URL pública | Preferir `WORDPRESS_PUBLIC_URL=https://newsproject.bitreport.pt` no `wordpress/.env`. Se faltar, o `wp-config` infere `https://` + `Host` quando o pedido chega **via Nginx do CT** e traz qualquer *hint* de proxy (`X-Forwarded-Proto`, `X-Forwarded-For`, ou `X-Real-IP`); `X-Forwarded-Proto` deve reflectir o HTTPS do NPM — ver `deploy/nginx/newsproject.bitreport.pt.conf`. |
| Arranque | `depends_on: db` com `condition: service_healthy` |
| Volumes | `db_data` (MySQL), `wp_content` (uploads/plugins) |
@@ -218,7 +218,7 @@ pm2 startup
## Deployment Checklist
- [ ] LXC container created and running
- [ ] Base packages installed (Node 22, nginx, redis, docker)
- [ ] Base packages installed (Node 24.22.1, nginx, redis, docker)
- [ ] Git repo cloned to `/opt/news-platform/`
- [ ] `config/domains/newsproject.bitreport.pt.json` populated
- [ ] Bridge dependencies installed and built
+1 -1
View File
@@ -1 +1 @@
22
24.22.1
+9 -9
View File
@@ -12,11 +12,11 @@
"astro": "^6.0.8"
},
"devDependencies": {
"@types/node": "^20.19.39",
"@types/node": "^24.19.2",
"tsx": "^4.21.0"
},
"engines": {
"node": ">=22.12.0"
"node": ">=24.22.1"
}
},
"node_modules/@astrojs/compiler": {
@@ -1583,13 +1583,13 @@
}
},
"node_modules/@types/node": {
"version": "20.19.39",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.39.tgz",
"integrity": "sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw==",
"version": "24.19.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz",
"integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==",
"devOptional": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
"undici-types": ">=7.24.0 <7.24.7"
}
},
"node_modules/@types/unist": {
@@ -4491,9 +4491,9 @@
"license": "MIT"
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"version": "7.24.6",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
"devOptional": true,
"license": "MIT"
},
+2 -2
View File
@@ -4,7 +4,7 @@
"version": "0.1.0",
"description": "Astro SSR frontend for multi-domain sports news platform",
"engines": {
"node": ">=22.12.0"
"node": ">=24.22.1"
},
"scripts": {
"dev": "astro dev",
@@ -19,7 +19,7 @@
"astro": "^6.0.8"
},
"devDependencies": {
"@types/node": "^20.19.39",
"@types/node": "^24.19.2",
"tsx": "^4.21.0"
}
}
+3
View File
@@ -60,6 +60,7 @@ export type UiStrings = {
fpa_status_live: string;
fpa_watch_live: string;
fpa_watch_stream: string;
fpa_standings_link: string;
fpa_games_on_date: (count: number) => string;
/** News archive page title */
news_archive_title: string;
@@ -172,6 +173,7 @@ const en: UiStrings = {
fpa_status_live: 'Live',
fpa_watch_live: 'Watch live',
fpa_watch_stream: 'Watch on AndebolTV',
fpa_standings_link: 'Standings',
fpa_games_on_date: count => (count === 1 ? '1 match' : `${count} matches`),
news_archive_title: 'News',
news_all_filter: 'All',
@@ -268,6 +270,7 @@ const pt: UiStrings = {
fpa_status_live: 'Em direto',
fpa_watch_live: 'Ver em direto',
fpa_watch_stream: 'Ver na AndebolTV',
fpa_standings_link: 'Classificação',
fpa_games_on_date: count => (count === 1 ? '1 jogo' : `${count} jogos`),
news_archive_title: 'Notícias',
news_all_filter: 'Todas',
@@ -70,6 +70,7 @@ const date_groups = [...by_date.entries()];
const finished = is_finished(g);
const score = format_score(g);
const has_stream = Boolean(g.stream_url);
const standings_url = g.standings_url || 'https://portal.fpa.pt/competicoes-nacionais/';
const is_live = Boolean(g.is_live);
const status_label = finished
? ui.fpa_status_finished
@@ -173,6 +174,14 @@ const date_groups = [...by_date.entries()];
<span>{g.venue}</span>
</span>
)}
<a
class="fpa-agenda__standings-link"
href={standings_url}
target="_blank"
rel="noopener noreferrer"
>
{ui.fpa_standings_link}
</a>
{has_stream && (
<a
class="fpa-agenda__stream-link"
@@ -603,15 +612,24 @@ const date_groups = [...by_date.entries()];
opacity: 0.7;
}
.fpa-agenda__standings-link,
.fpa-agenda__stream-link {
margin-left: auto;
font-size: 0.8125rem;
font-weight: 700;
color: #a20c17;
text-decoration: none;
white-space: nowrap;
}
.fpa-agenda__standings-link {
margin-left: auto;
color: var(--color-primary);
}
.fpa-agenda__stream-link {
color: #a20c17;
}
.fpa-agenda__standings-link:hover,
.fpa-agenda__stream-link:hover {
text-decoration: underline;
}
+5
View File
@@ -55,6 +55,11 @@ export interface FpaAgendaGame {
stream_status?: 'live' | 'upcoming' | null;
/** Convenience flag when `stream_status === 'live'`. */
is_live?: boolean;
/**
* Public standings (classificação) page for this competition.
* Resolved from the PROVA label (code map + gender hub + FPA national fallback).
*/
standings_url?: string | null;
}
export interface Article {
+1 -1
View File
@@ -7,7 +7,7 @@ Headless WordPress instance serving the News Platform via the REST API. The WP f
| Service | Port | Notes |
|---------|------|-------|
| `nginx` | **8080** → 80 | Public HTTP edge; proxies to PHP-FPM |
| `wordpress` | (internal) | `wordpress:6-php8.3-fpm` — PHP-FPM only |
| `wordpress` | (internal) | `wordpress:6-php8.5-fpm` — PHP-FPM only |
| `nginx-andebol` | **8081** → 80 | Andebol WordPress edge |
| `wordpress-andebol` | (internal) | Second FPM stack |
| MariaDB 11 | 3306 | Internal only — not exposed to host (`db`, `db-andebol`) |
+2 -2
View File
@@ -17,7 +17,7 @@ services:
start_period: 90s
wordpress:
image: wordpress:6-php8.3-fpm
image: wordpress:6-php8.5-fpm
restart: unless-stopped
depends_on:
db:
@@ -135,7 +135,7 @@ services:
start_period: 90s
wordpress-andebol:
image: wordpress:6-php8.3-fpm
image: wordpress:6-php8.5-fpm
restart: unless-stopped
depends_on:
db-andebol:
+1
View File
@@ -0,0 +1 @@
24.22.1
+11 -8
View File
@@ -13,9 +13,12 @@
"rss-parser": "^3.13.0"
},
"devDependencies": {
"@types/node": "^20.14.0",
"@types/node": "^24.19.2",
"tsx": "^4.15.0",
"typescript": "^5.4.5"
},
"engines": {
"node": ">=24.22.1"
}
},
"node_modules/@esbuild/aix-ppc64": {
@@ -502,13 +505,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "20.19.37",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.37.tgz",
"integrity": "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==",
"version": "24.19.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz",
"integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
"undici-types": ">=7.24.0 <7.24.7"
}
},
"node_modules/abstract-logging": {
@@ -1145,9 +1148,9 @@
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"version": "7.24.6",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
"dev": true,
"license": "MIT"
},
+4 -1
View File
@@ -4,6 +4,9 @@
"private": true,
"type": "module",
"description": "Aggregator-first writer pipeline for andebol.net (shortlist, token metrics, WP drafts)",
"engines": {
"node": ">=24.22.1"
},
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit",
@@ -22,7 +25,7 @@
"rss-parser": "^3.13.0"
},
"devDependencies": {
"@types/node": "^20.14.0",
"@types/node": "^24.19.2",
"tsx": "^4.15.0",
"typescript": "^5.4.5"
}
+20 -1
View File
@@ -22,9 +22,28 @@ describe('cycleErrorMessageLevel', () => {
);
});
it('keeps whole-source sitemap failures as error', () => {
it('downgrades whole-source sitemap gateway blips to warning (BIT-30847)', () => {
assert.equal(
cycleErrorMessageLevel(
'sitemap eurohandball_sitemap (https://www.eurohandball.com/google-news-sitemap.xml): HTTP 502',
),
'warning',
);
assert.equal(
cycleErrorMessageLevel('sitemap eurohandball_sitemap (https://www.eurohandball.com/sitemap.xml): HTTP 503'),
'warning',
);
assert.equal(
cycleErrorMessageLevel(
'sitemap eurohandball_sitemap (https://www.eurohandball.com/google-news-sitemap.xml): HTTP 504',
),
'warning',
);
});
it('keeps whole-source sitemap HTTP 500 as error (actionable upstream/config)', () => {
assert.equal(
cycleErrorMessageLevel('sitemap eurohandball_sitemap (https://www.eurohandball.com/sitemap.xml): HTTP 500'),
'error',
);
});
@@ -5,6 +5,7 @@ import {
titleFromArticleUrl,
} from './html-listing.js';
import {
decodeJsonUnicodeEscapes,
extractRevistaPdfUrls,
isHandballRevistaLead,
leadUrlForRevistaEntry,
@@ -88,6 +89,21 @@ test('extractRevistaPdfUrls finds absolute and relative PDF hrefs', () => {
assert.ok(urls[0].includes('18.06.2026'));
});
test('decodeJsonUnicodeEscapes turns literal \\u2013 into en-dash (BIT-31118)', () => {
assert.equal(decodeJsonUnicodeEscapes('Revista-de-Imprensa-\\u2013-12.10.2026.pdf'), 'Revista-de-Imprensa-\u2013-12.10.2026.pdf');
});
test('extractRevistaPdfUrls decodes literal \\u2013 so URL is not /u2013 (BIT-31118)', () => {
const html = `
"pdf":"https://portal.fpa.pt/wp-content/uploads/2026/10/Revista-de-Imprensa-\\u2013-12.10.2026.pdf"
`;
const urls = extractRevistaPdfUrls(html, 'https://portal.fpa.pt/media/');
assert.equal(urls.length, 1);
assert.ok(!urls[0].includes('/u2013'), urls[0]);
assert.ok(urls[0].includes('%E2%80%93') || urls[0].includes('\u2013'), urls[0]);
assert.ok(urls[0].includes('12.10.2026'));
});
test('publishedAtFromPtDate parses DD/MM/YYYY', () => {
const iso = publishedAtFromPtDate('17/06/2026', '2026-01-01T00:00:00.000Z');
assert.equal(iso.slice(0, 10), '2026-06-17');
@@ -98,6 +114,18 @@ test('pdfDateFromRevistaUrl parses filename date', () => {
pdfDateFromRevistaUrl('https://portal.fpa.pt/wp-content/uploads/2026/06/Revista-de-Imprensa-18.06.2026.pdf'),
'2026-06-18',
);
assert.equal(
pdfDateFromRevistaUrl(
'https://portal.fpa.pt/wp-content/uploads/2026/10/Revista-de-Imprensa-%E2%80%93-12.10.2026.pdf',
),
'2026-10-12',
);
assert.equal(
pdfDateFromRevistaUrl(
'https://portal.fpa.pt/wp-content/uploads/2026/10/Revista-de-Imprensa-12.10.2026-9a3f277b.pdf',
),
'2026-10-12',
);
});
test('isHandballRevistaLead detects andebol keywords', () => {
@@ -16,6 +16,15 @@ export function cycleErrorMessageLevel(message: string): 'warning' | 'error' {
if (message.includes('truncating')) return 'warning';
// Per-URL HTML probe failed but other pages in the same source may have succeeded.
if (/^sitemap .+ page \(https?:\/\//.test(message)) return 'warning';
// Whole-source fetch already retries (http-retry); remaining gateway blips are upstream
// noise (BIT-30847 / ERRSIG a92b3521aec8). Keep HTTP 500 as error — that flagged the
// broken /sitemap.xml URL fixed in BIT-30741.
if (
/^sitemap .+ \(https?:\/\//.test(message) &&
/: HTTP (502|503|504)\b/.test(message)
) {
return 'warning';
}
return 'error';
}
+20 -2
View File
@@ -100,13 +100,25 @@ export function isHandballRevistaLead(title: string, source: string): boolean {
return /andebol|handball|\behf\b|liga dos campeões de andebol|fpa\b/.test(hay);
}
/**
* FPA media JSON sometimes embeds PDF filenames with a *literal* `\u2013`
* (en-dash) escape. `new URL` treats `\` as a path separator and turns that
* into `/u2013`, which 404s. Decode JSON-style `\uXXXX` before URL parsing
* (BIT-31118 / ERRSIG 97ac27c4c5df).
*/
export function decodeJsonUnicodeEscapes(raw: string): string {
return raw.replace(/\\u([0-9a-fA-F]{4})/g, (_, hex: string) =>
String.fromCharCode(parseInt(hex, 16)),
);
}
export function extractRevistaPdfUrls(html: string, pageUrl: string): string[] {
const seen = new Set<string>();
const out: string[] = [];
const add = (raw: string) => {
try {
const href = new URL(raw, pageUrl).href;
const href = new URL(decodeJsonUnicodeEscapes(raw), pageUrl).href;
if (!seen.has(href)) {
seen.add(href);
out.push(href);
@@ -134,7 +146,13 @@ export async function parseRevistaPdfBuffer(buffer: Buffer): Promise<RevistaEntr
}
export function pdfDateFromRevistaUrl(pdfUrl: string): string | null {
const m = pdfUrl.match(/Revista-de-Imprensa-(\d{2})\.(\d{2})\.(\d{4})\.pdf/i);
// Accept hyphen or en-dash before the date, and optional WP hash suffix:
// Revista-de-Imprensa-12.10.2026.pdf
// Revista-de-Imprensa-–-12.10.2026.pdf
// Revista-de-Imprensa-12.10.2026-9a3f277b.pdf
const m = pdfUrl.match(
/Revista-de-Imprensa-(?:(?:\u2013|%E2%80%93)-)?(\d{2})\.(\d{2})\.(\d{4})(?:-[a-f0-9]+)?\.pdf/i,
);
if (!m) return null;
return `${m[3]}-${m[2]}-${m[1]}`;
}