Skip to content

feat(laws): expose the 개정이유 law.go.kr already ships (WI-P3)#99

Merged
tjdwls101010 merged 1 commit into
mainfrom
wi-p3-revision-reason
Jul 19, 2026
Merged

feat(laws): expose the 개정이유 law.go.kr already ships (WI-P3)#99
tjdwls101010 merged 1 commit into
mainfrom
wi-p3-revision-reason

Conversation

@tjdwls101010

Copy link
Copy Markdown
Owner

Why

The package could say what a statute now reads (get-law) and what changed between versions (compare-law-versions), but nothing reached why it changed.

HistoryEvent.reason sounds like it should. It doesn't — it carries a bare change-type label, and on 개인정보 보호법 all 13 events return None.

Meanwhile law.go.kr embeds the full 「개정이유 및 주요내용」 in every version detail response at 법령.제개정이유.제개정이유내용, alongside 법령.개정문.개정문내용. Normalization discarded both. get-law was already downloading this text and dropping it on the floor — the fetch was paid for, only the parse was missing.

What

get-revision-reason --law <id> [--mst <mst> | --as-of <date>]RevisionReason (kind revision_reason_text).

Version selection mirrors how the question actually gets asked:

input resolves to
--mst that exact version — the value trace-law-history already puts in each event's identity.mst
--as-of the version in force on that date
neither the newest version on file

"Newest" rather than "in force today" is deliberate: the most recent amendment is usually what a 왜 바뀌었나 question means, even when its effective date hasn't arrived. The existing not_effective_as_of flag keeps that from reading as current law — and the acceptance case is itself future-effective, so it does fire.

Two disciplines ride along, because the failure modes here are interpretive rather than technical:

  • An 개정이유 is the proposer's own account of intent, not a verified effect. Citing it as the reason a law changed launders an advocacy document into a finding.
  • It belongs to one version. Generalizing it into the statute's amendment story silently replaces every other amendment's rationale with this one.

Also

Relaxes a hardcoded == 27 command count in test_refactor_compat.py to >= 27. The invariant worth holding is the parser/catalog set equality asserted directly above it; pinning the number only guarantees that whoever adds a command also edits that line.

Verification

Live against law.go.kr:

  • --mst 283839"[일부개정] ◇ 개정이유 최근 주요 통신사, 금융사, 플랫폼 사업자 등의 대규모 개인정보 유출사고 …", not_effective_as_of: true
  • --as-of 2024-01-01 → mst 248613 (시행 20230915)
  • no selector → mst 283839

455 deterministic tests pass (11 new).

🤖 Generated with Claude Code

The package could say what a statute now reads and what changed between two
versions, but nothing reached *why* it changed. `HistoryEvent.reason` sounds
like it should: it is a bare change-type label, and on 개인정보 보호법 all 13
events return None. Meanwhile every version detail response carries the full
「개정이유 및 주요내용」 in `법령.제개정이유.제개정이유내용`, and normalization
was throwing it away — get-law already downloads this text and discards it.

`get-revision-reason --law <id> [--mst | --as-of]` returns that block plus
the promulgation text. Version selection mirrors how the question is
actually asked: `--mst` pins a version (the value `trace-law-history`
already puts in each event's identity), `--as-of` takes the version in
force then, and no selector takes the newest version on file — usually the
amendment a "왜 바뀌었나" question means, even when its effective date has
not arrived. The existing temporal flag keeps that from reading as current
law; the acceptance case (mst 283839) is future-effective and does flag.

Two disciplines ride along, because the failure modes here are
interpretive rather than technical. An 개정이유 is the proposer's own
account of intent, not a verified effect — citing it as the reason a law
changed launders an advocacy document into a finding. And it belongs to one
version, so generalizing it into the statute's amendment story silently
replaces every other amendment's rationale with this one.

Also relaxes a hardcoded `== 27` command count to a lower bound. The
invariant worth holding is the parser/catalog set equality asserted on the
line above; pinning the number only guarantees that whoever adds a command
also edits that line.

Verified live: mst 283839 → "대규모 개인정보 유출사고 …"; --as-of 2024-01-01
resolves to mst 248613; no selector resolves to 283839.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tjdwls101010
tjdwls101010 merged commit bbe2c8e into main Jul 19, 2026
5 checks passed
@tjdwls101010
tjdwls101010 deleted the wi-p3-revision-reason branch July 19, 2026 13:42
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