feat(laws): expose the 개정이유 law.go.kr already ships (WI-P3)#99
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.reasonsounds like it should. It doesn't — it carries a bare change-type label, and on 개인정보 보호법 all 13 events returnNone.Meanwhile law.go.kr embeds the full 「개정이유 및 주요내용」 in every version detail response at
법령.제개정이유.제개정이유내용, alongside법령.개정문.개정문내용. Normalization discarded both.get-lawwas 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(kindrevision_reason_text).Version selection mirrors how the question actually gets asked:
--msttrace-law-historyalready puts in each event'sidentity.mst--as-of"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_offlag 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:
Also
Relaxes a hardcoded
== 27command count intest_refactor_compat.pyto>= 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)455 deterministic tests pass (11 new).
🤖 Generated with Claude Code