Skip to content

fix(japanpost): repair KEN_ALL_ROME download URL and refresh data#12

Open
stjean2016 wants to merge 3 commits into
masterfrom
fix/japanpost-download-url-and-auto-update
Open

fix(japanpost): repair KEN_ALL_ROME download URL and refresh data#12
stjean2016 wants to merge 3 commits into
masterfrom
fix/japanpost-download-url-and-auto-update

Conversation

@stjean2016

Copy link
Copy Markdown

Problem

216-0043 (神奈川県川崎市宮前区野川台) and every postal code created since 2023-08 returned 404 — the served data (jp/*.json on S3) had been frozen at the 2023-08-22 snapshot.

Root cause: Japan Post moved the entire postal-code download tree from /zipcode/dl/ to /service/search/zipcode/download/. japanpost/gen.sh still pointed at the old http://www.post.japanpost.jp/zipcode/dl/roman/ken_all_rome.zip, which now 404s, so the data could no longer be regenerated. There was also no scheduled job running the update — s3-sync.yaml only deploys jp.tar.gz when it changes.

Changes

Pipeline fixes (c301e04d9)

  • japanpost/gen.sh
    • Fix the download URL → https://www.post.japanpost.jp/service/search/zipcode/download/roman/KEN_ALL_ROME.zip.
    • Build the processor for the host platform when Go is available. The committed binary is macOS/amd64 and won't run on arm64 Macs or Linux CI runners.
    • Pack jp.tar.gz with a relative path (tar -C "$WORK_DIR" ... jp) so it stays rooted at jp/; s3_sync.sh extracts it and runs aws s3 sync jp/, which needs a top-level jp/ entry.
  • update.sh — also stage jp.tar.gz so the S3 Sync workflow (which triggers on that file) actually fires after a manual update.
  • .github/workflows/update-data.yaml (new) — workflow_dispatch + monthly cron that regenerates the data and opens a PR whenever Japan Post publishes changes.

Data refresh (c6ec4d2e0)

  • Regenerated from Japan Post's current KEN_ALL_ROME (dated 2025-06-03): 730 new postal codes, 671 updated, including 216-0043.

Verification

  • bash -n, go vet, YAML parse: pass.
  • Built processor from main.go; ran it against the real KEN_ALL_ROME.CSVjp/2160043.json = {"prefecture":"神奈川県","city":"川崎市宮前区","town":"野川台"}.
  • Repacked jp.tar.gz verified: 120,851 entries, rooted at jp/, no corruption, contains 2160043; matches the jp/ tree exactly.

Notes for reviewers

  • For the monthly cron to open PRs automatically, enable Settings → Actions → General → Workflow permissions → "Allow GitHub Actions to create and approve pull requests."
  • This PR includes ~1,400 changed data files (two years of accumulated updates). If you'd prefer to review the pipeline change on its own, the data commit (c6ec4d2e0) can be dropped and regenerated via the new workflow after merge.

🤖 Generated with Claude Code

stjean2016 and others added 3 commits July 2, 2026 16:03
…fresh

Japan Post moved the postal-code download to https and renamed the file to
KEN_ALL_ROME.zip; the old http/lowercase URL now 404s, so gen.sh could no
longer fetch source data and jp/*.json froze at the 2023-08 snapshot (e.g.
216-0043 / 神奈川県川崎市宮前区野川台 was missing).

- gen.sh: fix download URL; build the processor for the host platform when Go
  is available (the committed binary is macOS/amd64, unusable on arm64 Macs and
  Linux runners); pack jp.tar.gz with a relative path so it stays rooted at jp/
  (s3_sync.sh needs a top-level jp/ entry).
- update.sh: also stage jp.tar.gz so the S3 Sync workflow (triggered on that
  file) actually fires.
- add .github/workflows/update-data.yaml: workflow_dispatch + monthly cron that
  regenerates the data and opens a PR when Japan Post publishes changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Regenerated with the repaired pipeline against Japan Post's current
KEN_ALL_ROME (dated 2025-06-03). Adds 730 new postal codes and updates 671,
including 216-0043 (神奈川県川崎市宮前区野川台) which was missing from the
2023-08 snapshot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant