Skip to content

Automate weekly DB merge and publish; replace dead test with a source oracle - #18

Merged
dweekly merged 1 commit into
mainfrom
fix/db-update-pipeline
Nov 2, 2026
Merged

dweekly merged 1 commit into
mainfrom
fix/db-update-pipeline

Conversation

@dweekly

@dweekly dweekly commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The weekly database refresh stalled for two months because its PR got no CI and nothing merged or published it (#17). This makes the pipeline unattended end to end, with every gate machine-run, and replaces a test that never ran (#16) with one that checks the bundled database against every row of the data it was built from.

Changes

  • update-database.yml: after its existing gates (±20% thresholds, full suite), it opens the PR, dispatches ci.yml on the PR head (workflow_dispatch is the one event GITHUB_TOKEN may trigger), waits for CI with gh run watch --exit-status, merges with --match-head-commit, then a publish-database job checks out the merge commit and runs Scripts/publish-database.sh publish. Publishing fails loudly if the secrets are missing.
  • ci.yml: adds workflow_dispatch.
  • SourceOracleTests (new): for each v4/v6 source TSV whose SHA-256 matches the manifest's builderInput, looks up the first and last address of every row and requires the row's ASN and name (or no result for ASN 0). Skips when sources are absent; IP2ASN_REQUIRE_SOURCE_ORACLE=1 turns the skip into a failure, and the update workflow sets it.
  • Removed RandomIPVerificationTest: unconditional XCTSkip, no assertions, string-compared IPs, shelled out to whois.
  • CONTRIBUTING: documents the automated flow, the two secrets, and rollback.

Verification

# Sources must be the manifest's builder inputs (current bundle: iptoasn 2026-11-02)
curl -sfL https://iptoasn.com/data/ip2asn-v4.tsv.gz | gzip -dc > /tmp/ip2asn-v4.tsv   # digest-checked by the test
IP2ASN_RUN_FORMAT_TESTS=1 IP2ASN_SOURCE_DIR=/tmp IP2ASN_REQUIRE_SOURCE_ORACLE=1 swift test
  • Oracle passes: 1,080,582 v4 and ~240k v6 boundary lookups, ASN and name, in ~5 s.
  • Negative control: expecting ASN+1 fails 919,310 of 1,080,582 v4 lookups (the rest are ASN-0 rows, correctly absent either way).
  • Missing sources: skip by default; fail with IP2ASN_REQUIRE_SOURCE_ORACLE=1.
  • Full suite: 70 XCTests (2 skipped: live-CDN smoke, network-gated) + 14 Swift Testing tests pass.
  • actionlint: only a pre-existing SC2129 style note in the unchanged "Check for changes" step.

Not yet verified: the dispatch/merge/publish steps run only in Actions; they get exercised by dispatching the workflow after merge. Publishing needs CLOUDFLARE_R2_PUBLISH_TOKEN (and CLOUDFLARE_ACCOUNT_ID) set as repo secrets first.

Fixes #16. Fixes #17.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A8mvWkYd1YBhFyvbFx7UF7

The weekly update PR was opened with GITHUB_TOKEN, so CI never ran on
it, and nothing merged or published it: PR #15 sat for eight weeks and
the bundled and CDN databases went stale. The workflow now dispatches
CI on its PR, merges when CI passes, and publishes the merged pair to
R2 (needs CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_R2_PUBLISH_TOKEN).

RandomIPVerificationTest skipped unconditionally and asserted nothing.
It is replaced by SourceOracleTests, which checks the first and last
address of every v4 and v6 source row against the bundled database
when the manifest's exact builder inputs are present. The update
workflow requires it to run.

Fixes #16. Fixes #17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A8mvWkYd1YBhFyvbFx7UF7
@dweekly
dweekly merged commit 590f6f6 into main Nov 2, 2026
10 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.

Weekly DB update PR gets no CI and sat unmerged for 8 weeks RandomIPVerificationTest is unconditionally skipped

1 participant