G2 S3: spec/seed number consistency — audit minors m4/m5/m6/m7/n2#157
Merged
Conversation
…istency - m5 (fix data): satellite seeds' order_date window 21d -> ~122h (about 5.1 baseline days), 10,000 orders ~ 1,965/day per spec §1; §11 documents why §4 seasonality is deliberately not encoded in a 5-baseline-day seed - m6 (fix data): synthetic_seed.sql gs1_gtin now carries the genuine GS1 mod-10 check digit (pinned 160-digit string, asserted against gs1.gtin13_check_digit by a new invariant test); §12#7 extended to state the vault-seed literals are covered - m7 (fix data): amount bands re-centered on §1 avg checks (mp 1.5-2.8k mean 2,150; d2c 2-4.6k mean 3,300; B2B RU 30-74k mean 52k; dxb 60-120k mean 90k; ala 25-65k mean 45k) with multipliers re-chosen so small branch slices equidistribute; postgres_oltp/seed.sql mirrors the same formulas - m4 (fix spec text + tighten tests): §12#4 restated as the order-weighted aggregate B2B avg check (~54.9k in [30k,80k]) with dxb's 90k as the by-design outlier it always was per §1; invariant tests now assert the aggregates and pin spec-fixed defaults (160 SKUs, 30 suppliers 22/5/2/1, sourcing coverage per SKU) - n2 (relax spec): §1/§10 now state every branch is seeded in RUB and no generator/seed converts FX at runtime; AED/KZT/CNY constants documented as doc-level-only conversion basis Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DORA Metrics
MTTR note: No failed mainline CI runs in the selected window. |
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.
Closes the five minor G2-audit findings against
docs/generator-spec.md(S3 ofnew_plen_05_07_26.md). Each finding got an explicit fix-vs-relax decision:m5 — seed daily rate vs §1 (fixed the data)
satellite_seed.sql+satellite_seed_all_branches.sqlspread 10,000 orders over 21 days (~476/day) while §1 pins ~1,965/day. Nothing else in the repo referenced the 21-day window (git grep '24 \* 21'— only the 5 seed lines), so compressing was the low-risk path: window is now(number * 7) % 122— a ~122-hour (≈5.1-day) flat window, ≈1,965 orders/day, matching §11's "10,000 ≈ 5.1 baseline days" exactly. §11 gained a paragraph stating why §4's monthly seasonality is deliberately not encoded (baseline days are multiplier-1.0 by definition; a 5-day snapshot can't express a 12-month curve).m6 — 12-digit GTINs failing
is_valid_gtin13(fixed the data)synthetic_seed.sql'sgs1_gtinstems now append the genuine GS1 mod-10 check digit. Implementation: a pinned 160-char check-digit string (one char per SKU slot) rather than inline SQL arithmetic — deliberately, so correctness is machine-verified locally: new testtest_invariant_7_seed_sql_gtin_check_digit_string_is_genuinerecomputes the string from the stem formula viags1.gtin13_check_digitand asserts the SQL carries exactly it (plus structural guards on the stem formula). §12#7 now states the vault-seed literals are covered alongside the reference catalog.m7 — equal-range amounts skewing averages high (fixed the data)
Old bands' midpoints ran above §1's average checks (mp 2,250 vs 2,150; B2B RU 55k vs 52k; dxb realized 101.3k vs 90k — the small dxb/ala slices didn't even wrap their modulus, so realized means drifted further than the midpoint). New bands are centered on §1 means and multipliers re-chosen (empirically, over the exact
numberranges) to equidistribute: realized means mp 2,149 / d2c 3,301 / B2B msk 52,062 / spb 52,034 / ekb 51,920 / dxb 89,827 / ala 44,941.postgres_oltp/seed.sqlmirrors. No new distribution scheme — samelo + (n * mult) % modtechnique.m4 — §12#4 vs §1 contradiction + weak/unpinned tests (fixed spec text + tightened tests)
§12#4's flat "Avg B2B check ∈ [30k, 80k]" excluded dxb's §1-mandated 90k. The data is right, the sentence was wrong: §12#4 now claims the order-weighted aggregate (§1 ⇒ ≈54.9k) and explicitly names dxb's 90k as the by-design outlier. Tests:
test_invariant_4now asserts the order-weighted B2B and marketplace aggregates (not just per-branch proxies);test_invariant_5_per_sku/test_invariant_7pinlen(products) == 160/len(suppliers) == 30so their loops can't pass vacuously; newtest_build_reference_default_counts_match_specpins the default catalog shape incl. the §6 country split 22 CN + 5 RU + 2 AE + 1 KZ (also catches silent tax-id-collision drops in_make_suppliers).n2 — §10 FX constants declared but never applied (relaxed the spec)
Wiring AED/KZT into the seeds would be a currency-model rebuild, far beyond this finding's scope. §1/§10 now say what is actually true: every branch is seeded in ₽, no generator or seed converts FX at runtime, and the pinned AED/KZT/CNY constants live in
reference/legend.pysolely as the fixed basis for doc/evidence-level conversions (and for any future revision that does store branch-local currencies).Verification
ruff check/ruff format --checkonsrc/ tests/ scripts/— cleanmypy src/ --ignore-missing-imports— clean (124 files)pytest tests/unit/ tests/property/— 1385 passed; 1 env-only failure (test_sdk_wheel_contains_py_typed_marker: local machine lacks thehatchlingbuild backend for--no-isolation; unrelated to this diff, green in CI)numberranges (values quoted above)Reviewer sanity-checks: the 160-char check-digit string (test recomputes it — trust the test, not eyeballs);
substring(..., number + 1, 1)1-based indexing in ClickHouse; notedocs/dv2-multi-branch/demo_evidence.mdremains a dated capture of the old seeds — evidence regeneration is its own later plan step on the Mac stand.🤖 Generated with Claude Code