feat(columns): accept observations in three languages, like descriptions - #11
Merged
Conversation
`Column.observations` has always been three fields on the backend (`observationsPt`/`En`/`Es`), but all three column writers here took a single `observations` argument that lands in Portuguese only. There was no argument for the other two — a translation was impossible to express through the tool. Surveyed on production 2026-08-27: of 3,980 columns with a non-empty observation, 3,022 across 46 datasets were Portuguese-only. None had English or Spanish alone, so the gap was total, and it came from these arguments. - `upload_columns_from_sheet` reads `observations_en` and `observations_es` from the sheet alongside `observations` - `bulk_upsert_columns` accepts `observations_pt/_en/_es` in both the sheet and `columns_json` - `update_column` gains `observations_pt`, `observations_en` and `observations_es` A bare `observations` still means Portuguese in all three, so existing callers keep working. Empty fields are still not written, so a partial call cannot blank a translation that is already stored. Verified against staging: all three paths write all three fields, a lone `observations` still goes to Portuguese without touching English or Spanish, and `order`, the descriptions and `isPartition` are left intact.
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.
The problem
Column.observationsis three fields on the backend —observationsPt/observationsEn/observationsEs— exactly like the description fields. But all three column writers here took a single untaggedobservationsargument, which lands in Portuguese only. There was no English or Spanish argument to pass: a translated note was impossible to express through the tool.This is not a hypothetical gap. Surveyed on production 2026-08-27, of 3,980 columns with a non-empty observation, 3,022 across 46 datasets were Portuguese-only. None had English or Spanish alone, so the gap was total — and every one of them was written by these tools. Worst affected:
piaac734,open_payments646,bankfind231,cps219,anes_time_series185,pisa146,usaspending_gov124.Those columns have since been backfilled on prod (3,022) and staging (3,066). This PR stops them being recreated.
The change
bulk_upsert_columnsobservations_pt/observations_en/observations_es, in the sheet and incolumns_jsonupload_columns_from_sheetobservations_enandobservations_es, alongsideobservationsupdate_columnobservations_pt,observations_en,observations_esargumentsAll three now write
observationsPt/observationsEn/observationsEsexplicitly rather than the bareobservationskey. IntrospectingCreateUpdateColumnInputconfirms all four fields exist, so the bare key was reaching Portuguese via modeltranslation's default language — being explicit removes the ambiguity.Backward compatible. A bare
observationsstill means Portuguese everywhere, so existing callers keep working — and keep reproducing the original bug if they pass only it, which the docstrings now say plainly. Empty fields are still not written, so a partial call cannot blank a translation that is already stored.Verification
Writing to the wrong field would be silent, so this was not left to an import check.
Live round-trip on staging, against a real column (
elections.house_first_preference_division.ballot_position):bulk_upsert_columnswith all three → all three fields set.bulk_upsert_columnswith a bareobservations→ Portuguese updated, English and Spanish left untouched.update_columnwith the new arguments → all three fields set.order,descriptionPtandisPartitionwere unchanged throughout, confirming the partial input does not clobber neighbouring fields.Stubbed-sheet test for
upload_columns_from_sheet— that path needs a public Google Sheet, so the CSV download and the mutation POST were stubbed and the built payload inspected:observationsPt/En/EsobservationsPtalone, no emptyEn/Eskeysobservationskey absent from every payloadNote for reviewers
A running MCP server holds the old module until it restarts, so the new arguments will not appear in a session started before this merges.
🤖 Generated with Claude Code