Compare commits

...
Author SHA1 Message Date
Artur MoreiraandCursor 0ea1fa8cc3 docs(writer-pipeline): clarify WebDAV failure fallback in run-cycle metrics
Tests / writer-pipeline tests (push) Successful in 13s
Tests / bridge tests (push) Successful in 13s
Tests / frontend lib tests (push) Successful in 15s
Co-authored-by: Cursor <[email protected]>
2026-05-14 17:43:26 +00:00
Artur Moreira 738c1a56d0 fix(writer-pipeline): handle ns0: XML namespace prefix in WebDAV PROPFIND parser (BIT-22306)
Tests / writer-pipeline tests (push) Successful in 14s
Tests / bridge tests (push) Successful in 14s
Tests / frontend lib tests (push) Successful in 15s
Tests / writer-pipeline tests (pull_request) Successful in 11s
Tests / bridge tests (pull_request) Successful in 12s
Tests / frontend lib tests (pull_request) Successful in 13s
Python's xml.etree.ElementTree auto-assigns numeric prefixes like ns0: for
the first namespace it encounters. The PROPFIND regex [a-z]+: did not match
ns0: because of the digit, causing parsePropfindImageHrefs to return empty
on any WebDAV server backed by Python (WsgiDAV, some NextCloud configs).

Change [a-z]+: → [a-z][a-z0-9]*: in all three namespace-tagged element
patterns (response, href, getlastmodified). Test added with a real WsgiDAV
multistatus fixture.

Paperclip-Issue: BIT-22306
2026-05-14 16:33:49 +00:00
spark 9d03d489e0 Merge pull request 'feat(writer-pipeline): WebDAV archive fallback + handball shortlist (BIT-22292 / BIT-22288)' (#11) from feat/bit-21912-cf-cache-rules-script into main
Tests / writer-pipeline tests (push) Failing after 10s
Tests / bridge tests (push) Successful in 14s
Tests / frontend lib tests (push) Successful in 16s
2026-05-14 15:27:09 +01:00
spark b4af1397b7 Merge pull request 'fix(frontend): auth redirects use strict false-check for auth_links (BIT-22298)' (#10) from fix/BIT-22298-auth-redirect into main
Tests / writer-pipeline tests (push) Successful in 11s
Tests / bridge tests (push) Successful in 11s
Tests / frontend lib tests (push) Successful in 12s
Merge fix/BIT-22298-auth-redirect: auth redirects strict false-check (BIT-22298)
2026-05-14 14:52:54 +01:00
Artur Moreira 11cea53dab fix(frontend): auth redirects use strict false-check for auth_links (BIT-22298)
Tests / writer-pipeline tests (push) Successful in 13s
Tests / bridge tests (push) Successful in 12s
Tests / frontend lib tests (push) Successful in 12s
Tests / writer-pipeline tests (pull_request) Successful in 11s
Tests / bridge tests (pull_request) Successful in 13s
Tests / frontend lib tests (pull_request) Successful in 14s
/entrar and /registar redirected to / because !config.auth_links is
truthy when auth_links is undefined (config fallback).  Change both
pages to config.auth_links === false so only an explicit opt-out sends
the user home; missing or true both forward to wp-login.php.

Also add Cache-Control: no-store to the redirect response so edge
proxies never cache auth flows, and extend smoke-andebol.sh to assert
/entrar and /registar resolve to a wp-login URL.

Paperclip-Issue: BIT-22298
Paperclip-Agent: d706f4e6-5d05-4cec-b6e8-f8fb1f203aae
2026-05-14 13:48:27 +00:00
spark 35e8b60684 Merge pull request 'feat: add Node.js CI workflow' (#9) from feature/add-ci-workflow into main
Tests / writer-pipeline tests (push) Successful in 13s
Tests / bridge tests (push) Successful in 13s
Tests / frontend lib tests (push) Successful in 14s
Merge feature/add-ci-workflow (branch cleanup BIT-22162)
2026-05-13 22:57:30 +01:00
spark da7a01a1c1 Merge pull request 'feat(deploy): cf-cache-rules-apply.sh for BIT-21912 / BIT-21847' (#8) from feat/bit-21912-cf-cache-rules-script into main
Tests / writer-pipeline tests (push) Successful in 12s
Tests / bridge tests (push) Successful in 14s
Tests / frontend lib tests (push) Successful in 15s
2026-05-12 12:33:47 +01:00
Artur Moreira dbf2d342a7 feat: add Node.js CI workflow for bridge
Node.js CI / build-and-test (18) (pull_request) Failing after 11s
Node.js CI / build-and-test (20) (pull_request) Failing after 13s
2026-04-27 22:45:43 +00:00
7 changed files with 68 additions and 6 deletions

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
# Node.js CI for news-platform bridge
# Runs on: PR and push to main/develop
# Checks: TypeScript build and type checking
name: Node.js CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CI: "true"
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
working-directory: bridge
- name: TypeScript build
run: npm run build
working-directory: bridge
if: always()
- name: TypeScript type checking
run: npm run typecheck
working-directory: bridge
if: always()
+9
View File
@@ -53,4 +53,13 @@ _c="$(code_for "$BASE_URL/wp-json/wp/v2/")"
[[ "$_c" == "200" ]] || fail "GET $BASE_URL/wp-json/wp/v2/ expected 200, got $_c (WP andebol :8081)"
ok "GET /wp-json/wp/v2/ → $_c"
# Auth redirects — /entrar and /registar must NOT land on / (BIT-22298)
_final_entrar="$(curl -fsS -o /dev/null -w '%{url_effective}' --max-time 25 -L -H "Host: $HOST_HEADER" "$BASE_URL/entrar" 2>/dev/null || true)"
[[ "$_final_entrar" == *"wp-login"* ]] || fail "/entrar final URL must contain wp-login; got: $_final_entrar"
ok "GET /entrar → $_final_entrar"
_final_registar="$(curl -fsS -o /dev/null -w '%{url_effective}' --max-time 25 -L -H "Host: $HOST_HEADER" "$BASE_URL/registar" 2>/dev/null || true)"
[[ "$_final_registar" == *"wp-login"* ]] || fail "/registar final URL must contain wp-login; got: $_final_registar"
ok "GET /registar → $_final_registar"
echo "All smokes passed for BASE_URL=$BASE_URL (host: $HOST_HEADER)"
+1 -1
View File
@@ -29,7 +29,7 @@ See [`docs/ANDEBOL_EDITORIAL_BRIEF.md`](ANDEBOL_EDITORIAL_BRIEF.md) for detailed
- **Per feed:** a failing RSS URL is logged in `metrics.errors`; other feeds still run.
- **Per URL (legacy comparison):** failed HTML fetch does not block the cycle; aggregator metrics still apply for production reads.
- **WP publish:** if credentials are missing, the cycle completes with a clear error string and **no** draft creation.
- **Featured image (BIT-22288 / BIT-22292):** drafts require a rights-cleared image. The pipeline uses RSS enclosure / `og:image` / `twitter:image` first. If none are present, it can **list a WebDAV collection** (authenticated Basic auth) and pick the best-matching filename against the headline, then upload to WP with caption/alt. Configure with `WRITER_WEBDAV_*` env vars (see `deploy/systemd/writer-andebol.env.example`). If WebDAV is enabled but PROPFIND/GET fails, draft creation for that item fails with an explicit error (no silent fallback to a random web image).
- **Featured image (BIT-22288 / BIT-22292):** drafts require a rights-cleared image. The pipeline uses RSS enclosure / `og:image` / `twitter:image` first. If none are present, it can **list a WebDAV collection** (authenticated Basic auth) and pick the best-matching filename against the headline, then upload to WP with caption/alt. Configure with `WRITER_WEBDAV_*` env vars (see `deploy/systemd/writer-andebol.env.example`). If WebDAV is enabled but PROPFIND/GET fails, draft creation for **that URL** fails with an explicit error (no silent fallback to a random web image). **`run-cycle`** catches per-item publish errors: the failure is appended to `metrics.errors` and the rest of the cycle (other feeds, other shortlist items) still completes.
## Commands
+2 -1
View File
@@ -2,8 +2,9 @@
import { getDomainConfig } from '../lib/domain.js';
const config = getDomainConfig(Astro.url.hostname);
if (!config.auth_links) {
if (config.auth_links === false) {
return Astro.redirect('/', 302);
}
Astro.response.headers.set('Cache-Control', 'no-store');
return Astro.redirect('/wp-login.php', 302);
---
+2 -1
View File
@@ -2,8 +2,9 @@
import { getDomainConfig } from '../lib/domain.js';
const config = getDomainConfig(Astro.url.hostname);
if (!config.auth_links) {
if (config.auth_links === false) {
return Astro.redirect('/', 302);
}
Astro.response.headers.set('Cache-Control', 'no-store');
return Astro.redirect('/wp-login.php?action=register', 302);
---
@@ -24,6 +24,15 @@ test('parsePropfindImageHrefs skips collection root and lists image files', () =
assert.equal(rows[0].lastMod, 'Wed, 01 Jan 2025 12:00:00 GMT');
});
test('parsePropfindImageHrefs handles ns0: namespace prefix (WsgiDAV / Python ElementTree)', () => {
const xml = `<?xml version="1.0" encoding="utf-8" ?>
<ns0:multistatus xmlns:ns0="DAV:"><ns0:response><ns0:href>/</ns0:href><ns0:propstat><ns0:prop><ns0:getlastmodified>Thu, 14 May 2026 16:11:04 GMT</ns0:getlastmodified><ns0:resourcetype><ns0:collection /></ns0:resourcetype></ns0:prop><ns0:status>HTTP/1.1 200 OK</ns0:status></ns0:propstat></ns0:response><ns0:response><ns0:href>/Foto_FPA___duplo-embate-croacia-m20-euro.jpg</ns0:href><ns0:propstat><ns0:prop><ns0:getlastmodified>Thu, 14 May 2026 16:11:26 GMT</ns0:getlastmodified><ns0:resourcetype /></ns0:prop><ns0:status>HTTP/1.1 200 OK</ns0:status></ns0:propstat></ns0:response></ns0:multistatus>`;
const rows = parsePropfindImageHrefs(xml, 'http://127.0.0.1:8088/');
assert.equal(rows.length, 1);
assert.match(rows[0].href, /Foto_FPA___duplo-embate-croacia-m20-euro\.jpg$/);
assert.equal(rows[0].lastMod, 'Thu, 14 May 2026 16:11:26 GMT');
});
test('pickBestArchiveImage prefers hrefs whose path matches title tokens', () => {
const item: AggregatedItem = {
id: '1',
+3 -3
View File
@@ -29,14 +29,14 @@ function decodeXmlText(s: string): string {
export function parsePropfindImageHrefs(xml: string, collectionUrl: string): { href: string; lastMod?: string }[] {
const base = new URL(collectionUrl.endsWith('/') ? collectionUrl : `${collectionUrl}/`);
const out: { href: string; lastMod?: string }[] = [];
const reResponse = /<(?:[a-z]+:)?response[^>]*>([\s\S]*?)<\/(?:[a-z]+:)?response>/gi;
const reResponse = /<(?:[a-z][a-z0-9]*:)?response[^>]*>([\s\S]*?)<\/(?:[a-z][a-z0-9]*:)?response>/gi;
let m: RegExpExecArray | null;
while ((m = reResponse.exec(xml))) {
const block = m[1];
const hrefM = /<(?:[a-z]+:)?href>([^<]+)<\/(?:[a-z]+:)?href>/i.exec(block);
const hrefM = /<(?:[a-z][a-z0-9]*:)?href>([^<]+)<\/(?:[a-z][a-z0-9]*:)?href>/i.exec(block);
if (!hrefM) continue;
const hrefRaw = decodeXmlText(hrefM[1].trim());
const lmM = /<(?:[a-z]+:)?getlastmodified>([^<]+)<\/(?:[a-z]+:)?getlastmodified>/i.exec(block);
const lmM = /<(?:[a-z][a-z0-9]*:)?getlastmodified>([^<]+)<\/(?:[a-z][a-z0-9]*:)?getlastmodified>/i.exec(block);
const lastMod = lmM ? decodeXmlText(lmM[1].trim()) : undefined;
if (!IMAGE_EXT_RE.test(hrefRaw)) continue;
let abs: string;