fin_code = "ALL" series breaks can never surface through cog_explain()
#19
Closed
opened 2026-07-29 19:57:52 -04:00 by jared
·
1 comment
No Branch/Tag Specified
main
ci/mirror-canonical-tags
chore/release-47-badges-mirror-pr
docs/readme-perf-remeasure-56
feat/pagination-search-balances-57
feat/duckdb-threads-60
feat/cohort-predicates-58
fix/windows-backslash-paths
ci/mirror-to-github
ci/github-actions-matrix
feat/public-release-0.3.0
chore/fixture-sb203
ci/apt-https
fix/pushdown-pagination
feat/all-categories-37
fix/partial-coverage-signposting-9
fix/schema-v7
fix/cog-categories-balance-subtype
feat/cog-balances-25
feat/revenue-concepts-12
feat/expenditure-concepts-11
feat/coverage-disclosure-13
feat/complete-argument-18
fix/kodor-batch-14-15-16
fix/all-scoped-series-breaks-19
fix/regen-fixture-corpus-18
test/walkthrough-findings
feat/expenditure-concept
fix/3-url-trailing-slash
feat/phase-r3-signposting
fix/fixture-option-b-aggregates
feat/phase-r2-harmonization
feat/phase-r1-forward
feat/cog-gov-search-basket-mode
v0.4.0
Labels
Clear labels
kodor
kodor/feature-proposal
kodor/fix
kodor/needs-review
kodor/triaged
madison-walkthrough
severity/high
severity/low
severity/medium
south-guide
verdict/defect
verdict/definitional
kodor
kodor/feature-proposal
kodor/fix
kodor/needs-review
kodor/triaged
Kodor should process this issue
Kodor has written a feature proposal
Kodor should implement a fix (assigned to Kodor)
Kodor's work or failure needs Jared's review
Kodor has already triaged this issue (skip)
Surfaced while building the client-facing Southern API guide
needs
human
Cannot move without a person -- a decision, a check an agent cannot make, something outside the repo
origin
client
Came from a client ask
origin
obligation
Created by a change elsewhere
origin
review
Came from human review
origin
roborev
Promoted from a roborev finding
type
chore
Maintenance with no behaviour change
type
debt
Owed work -- docs, tests, cleanup a change obligated
type
decision
Needs a decision before work can proceed
type
defect
Something is wrong
type
feature
New capability
ws
api
Query verbs and results
ws
corpus
Corpus, mirror, provenance
ws
docs
Vignettes and guides
Assign a task to kodor
Kodor thinks this needs a feature.
Kodor should fix this
Kodor thinks the user is ready to review this.
Kodor is done with this issue.
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Civilytics/uscogdata#19
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
R/series_breaks.Rlooks breaks up withmatching against the item codes present in the result. An entry whose
fin_codeis the literal string"ALL"can therefore never match, because no row'sitem_codeis"ALL".Four catalogued corpus-wide breaks are affected -- every one of them a caveat that applies to every code:
SB085SB087SB086SB194$0before FY2012,not reportedafter)Verified against the live API just now -- a FY2011 Madison Police query returns
provenance.series_break_refs: [], andSB085(which applies to it) is not surfaced.SB194is the one that makes this urgent:census_of_governments_finance_pipeline#64DoD 4 was "series_breaks.csvcarries anALL @ 2012entry describing the representation change, socog_explain()surfaces it." The entry exists and was published, but the reader path drops it, so that intent is not actually met. The pre-existing three have been invisible the same way for longer.Definition of done
ALL-scoped entries are returned for any query whose year range spans theirbreak_year, regardless of which codes the result contains.ALLcaveat applies to the whole result, not to one series.SB085, and a query spanning 2011->2012 surfacesSB194.Note
cog_code_info()in the pipeline repo has the same exclusion (sb[sb$fin_code != "ALL", ]inR/reshape.R), deliberately, because it is a per-code lookup. This issue is about the explain path, which is not per-code.Implemented in PR #21 (stacked on #20).
DoD 1 and DoD 3 conflict, and I followed DoD 1.
DoD 1: ALL-scoped entries fire when the query's year range spans their
break_year.DoD 3: a FY2011 query surfaces
SB085— whosebreak_yearis 1977.A FY2011 query does not span 1977, so both cannot hold. Reading
SB085's own row settles it:All four ALL entries are boundary caveats, not era caveats — crossing 1976/1977, FY2002-2006, absence not being comparable across FY2012, pre- vs post-2017 ids. So
break_year BETWEEN min(years) AND max(years)— the same rule the code-specific path already uses — is the right one, and a FY2011-only query is genuinely unaffected bySB085.SB085is tested with a range that actually spans 1977 (years = 1975:1980, plus a negative case at1978:1980), and theSB194half of DoD 3 is tested exactly as written (a query spanning 2011→2012).If the intent was instead era scoping — e.g. "any query touching FY1967-1976 gets
SB085, any query touching the wide era getsSB194" — that is a different and defensible rule, but a different one; say so and I will change it.DoD 2 is met with a separate
corpus_break_refsprovenance field rather than extra entries inseries_break_refs: an ALL caveat qualifies the whole result, and merging them invites reading one as a caveat about a single series. The two are disjoint by construction and a test asserts it. cog-api passes provenance through verbatim, so the field reaches the API with no change there.