Would you merge this AI-written field migration?
Both fields are numeric. The proposed conversion still lacks a contract.
The question
Lumen is replacing its invoice source. An AI-generated PR renames amount_minor to amount and removes a currency check. The producer has supplied two sample rows but has not defined the new amount unit or how nulls behave.
| Invoice | amount_minor | currency | Meaning | |
|---|---|---|---|---|
| Old row A | i1 | 1250 | GBP | £12.50 |
| Old row B | i2 | 2500 | JPY | ¥2,500 |
The old contract uses each currency’s minor-unit exponent; JPY has zero decimal places in this authored packet.
| Invoice | amount | currency | |
|---|---|---|---|
| New row A | i1 | 1250 | GBP |
| New row B | i2 | 2500 | JPY |
Samples show numeric shape only. New-source monetary unit and null meaning are not documented.
SELECT invoice_id, amount / 100 AS amount_major FROM invoices_v2; -- currency is no longer required
“What can you accept now, and what must be verified before changing the consumer?”
Not saved by this site. Your browser may restore text when you navigate back.
A strong answer, step by step
Open each step in turn. This is one strong answer, not the only one.
Step 1: Name the missing meaning
What would you do here? Open the move you’d make.
Accept because the column type is unchanged
Tempting, but it misses something. Numeric types do not state units or lifecycle meaning.
Infer the contract from the two samples
Tempting, but it misses something. The sample is not a guarantee for other currencies, nulls or future rows.
Request the producer contract before mapping
The strong move. A schema-compatible number can change monetary meaning.
See how a strong candidate says it
“I cannot infer units from a numeric type or two samples. I need the producer’s definition of amount, currency, null and refund sign before I choose a conversion. The existing consumer contract remains the reference.”
Why it works: A schema-compatible number can change monetary meaning.
Step 2: Test a discriminating example
What would you do here? Open the move you’d make.
Test only that amount is non-null
Tempting, but it misses something. A populated numeric value can still be wrong by a factor of 100.
Test GBP and JPY against stated expected amounts
The strong move. A sample that crosses unit conventions exposes a mapping that a GBP-only test misses.
Convert every numeric amount with /100
Tempting, but it misses something. That contradicts the authored JPY contract.
See how a strong candidate says it
“Under the old contract, GBP 1250 becomes £12.50; JPY 2500 remains ¥2,500. A universal divide-by-100 produces ¥25 for the second invoice. I would include both in the consumer acceptance tests.”
Why it works: A sample that crosses unit conventions exposes a mapping that a GBP-only test misses.
Step 3: Find the affected consumers
What would you do here? Open the move you’d make.
Reconcile contract examples with the consumer owners
The strong move. The downstream use determines what must stay true.
Merge after the generated SQL parses
Tempting, but it misses something. Parsing checks syntax, not the consumer’s business result.
Compare only the source and output row count
Tempting, but it misses something. Equal row counts can contain systematically wrong amounts.
See how a strong candidate says it
“I would inspect lineage for billing, refunds and reporting, identify the owning teams and require their contract-specific reconciliations. A row-count check is useful but cannot prove monetary equivalence.”
Why it works: The downstream use determines what must stay true.
Step 4: Keep the unproved mapping out of publication
What would you do here? Open the move you’d make.
Rename the field now and repair reports later
Tempting, but it misses something. That transfers an unknown semantic change into live consumers.
Treat an AI-suggested unit rule as the contract
Tempting, but it misses something. The recommendation has no authority over business meaning.
Hold the conversion until producer and consumer evidence agrees
The strong move. Do not turn an undocumented guess into a shared interface.
See how a strong candidate says it
“I would hold this PR’s amount conversion and currency removal until the new producer contract is explicit and consumer tests agree. An AI-suggested rule may help draft a test; it cannot approve the unit or null semantics.”
Why it works: Do not turn an undocumented guess into a shared interface.
The answer, in short
- Decision
- Hold the proposed conversion; agree on meaning and run consumer tests.
- Because
- The same numeric schema admits different currency units, and the PR removes data the conversion needs.
- What would change it
- A versioned new-source contract plus reconciled consumer examples could support a specific mapping.
Common traps
- Assuming every currency uses two decimal places.
- Treating sample inference as a producer guarantee.
Check your answer
- Did you name the missing unit and null contract?
- Did you calculate the JPY failure?
- Did you identify the downstream owners?
- Did you keep the unverified conversion out of publication?
Last reviewed Nov 10, 2026