Skip to content

G D.12 — per-fact verified_at via repo variables#15

Merged
blackbrowed-labs merged 2 commits into
mainfrom
dev
May 12, 2026
Merged

G D.12 — per-fact verified_at via repo variables#15
blackbrowed-labs merged 2 commits into
mainfrom
dev

Conversation

@larsweiser
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to PR #14 (G D.10 + G D.11). The post-merge state had a real semantic issue: the per-fact bbl-verified-at-dpf and bbl-verified-at-cwa markers stayed at 2026-04-29 even after both checks re-verified clean today, because they read JSON's per-fact verified_at and JSON only gets written on value-change runs (per the G D.11.1 design). The field name "verified_at" implies "when last verified" — JSON-direct sourcing didn't match.

G D.12 extends the env-var → repo-variable pattern to the per-fact markers, mirroring the top-level mechanism.

What changed

  • Two new repo variables (created manually with seed 2026-04-29T00:00:00Z): VERIFIER_DPF_VERIFIED_AT, VERIFIER_CWA_VERIFIED_AT. Updated independently of VERIFIER_LAST_OK_AT by the verifier whenever the corresponding fact returns ok — so on mixed-status runs the clean-fact's marker still refreshes.
  • Orchestrator (scripts/run-verifier.mjs): emits two new GITHUB_OUTPUT flags dpf_ok / cwa_retention_ok; dry-run preview expanded to log the per-fact variable-update paths.
  • Verifier workflow: two new variable-update steps gated independently on the new flags (using the same VERIFIER_VARIABLE_TOKEN fine-grained PAT); mock-dispatch dry-run branch pins the new flags to false.
  • All four build workflows (deploy-staging, deploy-production, rebuild-nightly, rebuild-nightly-staging): pass VERIFIED_AT_DPF + VERIFIED_AT_CWA env vars to npm run build.
  • Helper (src/lib/cloudflare-facts.ts): getEffectiveVerifiedDate generalised with a source: 'top' | 'dpf' | 'cwa' parameter. JSON fallback per source. File-level JSDoc rewritten — the G D.11 note saying "per-fact markers deliberately read JSON, NOT this helper" is reversed.
  • Privacy pages (DE + EN): per-fact markers now route through the helper with the right source arg. Frontmatter comment about the post-deploy smoke step removed (that step was deleted by G D.11.1).

Test plan / staging evidence

  • npm run build clean; astro check 0 errors / 0 warnings.
  • Local build smoke matrix:
    • All three env vars set to 2026-05-12T... → all three markers show 2026-05-12 on both DE and EN.
    • Unset → falls back to JSON.
    • Malformed → falls back to JSON (Date.parse guard).
  • Verifier dry-run matrix (per-fact independence):
    • cwa-activedpf_ok=true, cwa_retention_ok=true → would update all 3 vars.
    • cwa-changed-figuredpf_ok=true, cwa_retention_ok=false → would update DPF var + open PR.
    • dpf-absentdpf_ok=false, cwa_retention_ok=true → would update CWA var + open PR.
    • cwa-parser-brokendpf_ok=true, cwa_retention_ok=false → would update DPF var + open Issue.
  • Live verifier dispatch against dev (run 25728379992): all three variable-update steps succeeded; all three variables now at 2026-05-12T10:22:24Z; channel steps correctly skipped.
  • Staging redeploy + curl dev.blackbrowedlabs.com/datenschutz + /en/privacy: all three markers (top + dpf + cwa) show 2026-05-12 on both locales.

Notable design

  • Per-fact independence: each variable advances on its own _ok flag, so a mixed-status run (e.g., DPF ok + CWA parser-broken) still refreshes the DPF marker — the user-facing date no longer says "we didn't verify this fact today" when in fact we did.
  • Vite-friendly env access: import.meta.env.X only gets build-time-replaced when X is a literal property — the helper branches explicitly on source rather than computing the env key.
  • Same PAT, no new secrets: the existing VERIFIER_VARIABLE_TOKEN (Variables: read/write) covers all three update steps.

Refs

🤖 Generated with Claude Code

blackbrowed-labs and others added 2 commits May 12, 2026 12:21
Extend the env-var → repo-variable display refresh pattern from G D.11
to the per-fact `bbl-verified-at-dpf` and `bbl-verified-at-cwa` hidden
meta markers on the privacy pages. Previously those markers read JSON's
per-fact `verified_at` fields directly; on the silent-when-healthy
weekly cron path JSON stays untouched, so the per-fact markers were
stuck at the last value-change date (the 2026-04-29 seed) even when
both checks DID re-verify clean today. The field name "verified_at"
strongly implies "when we last verified" — JSON-direct sourcing didn't
match.

Two new repo variables (created manually by Lars, seed 2026-04-29):
  - VERIFIER_DPF_VERIFIED_AT  — advances when the DPF check returns ok
  - VERIFIER_CWA_VERIFIED_AT  — advances when the CWA check returns ok

These advance independently of the top-level VERIFIER_LAST_OK_AT, so on
mixed-status runs the per-fact marker for the clean-on-this-run fact
still refreshes:
  - all-ok run:            all three variables advance
  - CWA changed (PR path): DPF variable still advances; CWA stays
  - DPF absent (PR path):  CWA variable still advances; DPF stays
  - CWA parser-broken:     DPF variable advances; Issue opens for CWA
  - DPF unreachable:       CWA variable advances; Issue opens for DPF

Implementation:
- scripts/run-verifier.mjs: emit dpf_ok + cwa_retention_ok GH outputs
  alongside the existing three flags; expand the dry-run preview log
  to include the per-fact variable-update paths.
- .github/workflows/verify-cloudflare-facts.yml: pin the two new flags
  to false in the mock-dispatch dry-run branch; add two new variable-
  update steps gated independently on dpf_ok / cwa_retention_ok
  (using the same VERIFIER_VARIABLE_TOKEN fine-grained PAT).
- All four build workflows (deploy-staging, deploy-production,
  rebuild-nightly, rebuild-nightly-staging): pass VERIFIED_AT_DPF and
  VERIFIED_AT_CWA env vars to `npm run build` from the new repo vars.
- src/lib/cloudflare-facts.ts: generalize getEffectiveVerifiedDate
  with a `source: 'top' | 'dpf' | 'cwa'` parameter. JSON fallback per
  source; Vite-friendly literal env-property access. File-level JSDoc
  rewritten: the G D.11 note that said "per-fact markers deliberately
  read JSON, NOT this helper" is reversed under G D.12.
- src/pages/datenschutz.astro + src/pages/en/privacy.astro: route the
  per-fact `bbl-verified-at-{dpf,cwa}` markers through the generalized
  helper. The frontmatter comment about the verifier's post-deploy
  smoke step is dropped (that step was removed by G D.11.1).

Local smoke:
- npm run build with all three env vars set → all three markers show
  the env-supplied date on both DE and EN pages. Unset env → all three
  fall back to JSON. Malformed env → fallback (Date.parse guard).
- astro check: 0 errors, 0 warnings (2 pre-existing handoff-bundle
  CJS hints).
- Verifier dry-run matrix (per-fact independence):
  cwa-active        → dpf_ok=true,  cwa_ok=true  → all 3 vars
  cwa-changed-figure→ dpf_ok=true,  cwa_ok=false → DPF var + PR
  dpf-absent        → dpf_ok=false, cwa_ok=true  → CWA var + PR
  cwa-parser-broken → dpf_ok=true,  cwa_ok=false → DPF var + Issue

Surfaced post-G-D.11 ship when the per-fact markers stayed at
2026-04-29 even after the top-level marker advanced to today,
prompting the design discussion that produced this gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Routine "update branch" per docs/TECH_STACK.md §8.4 merge-commit
workflow. main got PR #14's merge commit (f76833a → ...); this
brings that commit into dev's history so PR #15 (G D.12) is up
to date with main and can be merged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@blackbrowed-labs blackbrowed-labs merged commit 70844ce into main May 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants