DEV Community

hc_xshh
hc_xshh

Posted on Edited on Originally published at notebookfield.com

One row in a government spreadsheet disagreed with ten ports in three official answers

The rule was four paragraphs. The decision was in three lists the rule said somebody else would publish.

I spent a morning working out whether a dog or cat arriving in China has to spend 30 days in quarantine, and the interesting part was not the notice — it was watching a single "exempt" list get misread, and finding that the annex nobody quotes contradicts the number everybody quotes.

What the notice actually says

China's customs announcement No. 5 of 2019 is short enough to hold in your head. Four operative paragraphs:

  1. Only dogs and cats, one per person per trip, with an official health certificate, a rabies vaccination certificate, and a microchip.
  2. Pets that do not qualify for an exemption are held 30 days in a customs facility, and must enter through a port that has quarantine facilities.
  3. Four situations end in return or destruction: over the allowance, missing certificates, a pet needing quarantine arriving at a port without facilities, failing quarantine.
  4. The detailed requirements are in an annex.

Paragraph two then delegates the interesting part: the list of designated places, the list of laboratories whose antibody results customs accepts, and the list of ports with quarantine facilities are "as published by the General Administration of Customs".

That sentence is where the engineering starts. If a rule delegates a decision to a list, the list is the rule. The notice is the schema; the lists are the data. Reading only the notice gives you a rule with three undefined symbols.

The trap: "designated" is not "permitted"

Here is the misreading I expected to find and did find, in forum posts and in my own first pass: if your country is not on the 19-place list, your animal is quarantined.

That is wrong in a way that matters. There are three exemption lanes, and the list governs only the cheapest one:

Lane Condition What it costs you
Designated place Chip + health certificate + vaccination certificate, on-site check passes Nothing extra
Antibody test Chip + certificates + rabies antibody report from an accepted lab, titre at or above 0.5 IU/ml A second vaccination, a blood draw, a lab bill
Assistance dog Guide, hearing or search-and-rescue dog, plus user and training certificates Paperwork

So the list does not decide whether your pet is quarantined. It decides whether you have to buy a lab test. The health certificate, the vaccination certificate and the chip are baseline for all three lanes — the exemption waives the 30 days, never the paperwork.

The first version of my decision function had exactly this bug in the other direction: I put the chip check inside the designated-country branch, which meant a pet from Germany with no chip fell through to "quarantine" instead of "returned or destroyed". Wrong outcome, wrong severity, and it only showed up when I wrote the test for it.

Turning it into something testable

Three branches, one baseline, and the whole notice fits in twenty lines:

DESIGNATED = {"NZ", "AU", "FJ", "PF", "US-HI", "US-GU", "JM", "IS", "GB",
              "IE", "LI", "CY", "PT", "SE", "CH", "JP", "SG", "HK", "MO"}

def outcome(origin, chip=False, health_cert=False, vacc_cert=False,
            titer=None, assistance_dog=False):
    if not (chip and health_cert and vacc_cert):
        return "return_or_destroy"          # baseline, every pet
    if assistance_dog:
        return "release"
    if origin in DESIGNATED:
        return "release"
    if titer is not None and titer >= 0.5:
        return "release"
    return "quarantine_30d"
Enter fullscreen mode Exit fullscreen mode

Eight tests, all derived from the notice's own sentences rather than from my reading of them: Sweden with documents releases; Germany with documents quarantines; Germany with a 0.6 titre releases; 0.4 does not; mainland US quarantines while Hawaii releases; a missing vaccination certificate returns the animal; an assistance dog releases.

The .5 matters: the announcement says the titre must be above 0.5 IU/ml, and labs report two decimals, so the boundary case is real rather than theoretical.

The annex that disagrees with every summary

Announcement No. 108 of 2019 published the approved quarantine sites. Its annex is a spreadsheet, and I wanted the row count, not a paraphrase. No pandas or xlrd on the machine, so:

soffice --headless --convert-to csv --outdir . facility.xls
Enter fullscreen mode Exit fullscreen mode

One data row. One site: Guangzhou Baiyun airport, operated by a company, dogs and cats (the annex file).

Meanwhile every official answer I could find — a 2021 reply attributed to Zhaoqing customs, a 2022 customs Q&A in People's Daily's overseas edition, a 2026 Guangzhou customs guide — says ten ports have quarantine conditions. Both numbers are quotable and they are not comparable: a "port with quarantine conditions" is a port customs lists as able to receive the animal; an approved site is a facility that passed an inspection, and customs says that list is managed dynamically.

The honest output is not "the real number is ten" or "the real number is one". It is: the annex attached to the notice is dated July 2019, the site list is dynamic, and the annex is therefore evidence about 2019, not about your flight.

The arithmetic is the answer readers want

Nobody needs a country list; they need to know whether their country is on it. Joining the 19 places against the European Union's 27 members:

eu = {"AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU",
      "IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE"}
print(len(eu & DESIGNATED), "of", len(eu))   # 4 of 27
Enter fullscreen mode Exit fullscreen mode

Four: Ireland, Portugal, Sweden, Cyprus. Germany, France, the Netherlands, Italy and Spain are all outside. The United States appears only as Hawaii and Guam, so the mainland is outside.

That single number does more work than the list itself, and it took one set intersection.

Where the sources were and weren't

gov.cn republishes customs texts in full, including the attached spreadsheet, and returned 200 for both notices and the annex. customs.gov.cn returned 412 Precondition Failed to every request I made — a WAF rule, not a 404 — which is why the port list came from three official-but-secondary enumerations instead of from the customs site.

Three sources agreeing is not the same as a primary source, and I labelled it that way in the piece: the ten ports are what customs offices said in 2021, 2022 and 2026, not what the customs site says today. Where I could not check something — the current site list, the accepted-lab list, the fee, whether the 30 days run from arrival or from admission — it went into an explicit "what I could not check" section rather than being smoothed over.

Three things worth carrying to the next document

  1. Follow the delegation. "As published separately" means the reading has not started yet.
  2. Open the annex. Summaries of an annex are somebody's row count, not yours. Mine was one.
  3. Date the artefact, not the page. The notice is current; its annex is from 2019; a dynamic list means both statements can be true at once.

The full version, with the 19 places, the ten ports, the certificate fields, the 14-day window and the antibody-test timing rules, is on my site: Bringing a pet to China: 30 days of quarantine, three exits.

Drafted with an AI assistant from my own reading of the primary documents; every clause number and link here was checked against the source.

Top comments (0)