[{"data":1,"prerenderedAt":340},["ShallowReactive",2],{"tag-labels":3,"site-header":4,"article-every-write-comes-back-as-news-en":75},{},{"featuredPost":5,"navigations":29},{"id":6,"title":7,"title_id":8,"slug":9,"excerpt":10,"excerpt_id":11,"has_translation":12,"published_at":13,"reading_time":14,"hidden_from_listing":15,"tags":16,"thumbnail_image":21,"og_image":22,"series":23,"authors":28},110,"When You Pick a Framework Just to Look Different","Ketika Pilih Framework Cuma Biar Kelihatan Beda","ketika-pilih-framework-cuma-biar-kelihatan-beda","The last time you chose a new framework or library, was it because your problem needed that tool, or because it sounded cool and few people around you were using it? That question is uncomfortable. Technology decisions are often made for reasons that never appear in any technical document.","Terakhir kali kamu milih framework atau library baru, itu karena masalahmu butuh alat itu, atau karena alatnya kedengaran keren dan belum banyak yang pakai? Pertanyaan ini nggak enak dijawab. Soalnya keputusan teknologi sering diambil dengan alasan yang nggak pernah ditulis di dokumen teknis mana pun.",true,"2026-10-06T15:25:21.000Z",5,false,[17,18,19,20],"karier","framework","opini","pengalaman",null,"\u002Fog\u002Fketika-pilih-framework-cuma-biar-kelihatan-beda.png",{"id":24,"title":25,"title_id":26,"slug":27},9,"Articles","Artikel","all",[],[30,49,70],{"collection":31,"item":32},"series",{"__typename":31,"title":25,"title_id":26,"slug":27,"children_series":33},[34,38,42,46],{"title":35,"title_id":36,"slug":37},"Artificial Intelligence","Kecerdasan Artifisial","kecerdasan-artifisial",{"title":39,"title_id":40,"slug":41},"Programming Fundamentals","Konsep Dasar Pemrograman","konsep-dasar-pemrograman",{"title":43,"title_id":44,"slug":45},"Algorithms and Data Structures","Algoritma dan Struktur Data","algoritma-struktur-data",{"title":47,"title_id":47,"slug":48},"LLM Systems","llm-systems",{"collection":31,"item":50},{"__typename":31,"title":51,"title_id":51,"slug":52,"children_series":53},"Tutorial","tutorial",[54,58,62,66],{"title":55,"title_id":56,"slug":57},"Learning Python","Belajar Python","belajar-python",{"title":59,"title_id":60,"slug":61},"Learning Go","Belajar Golang","belajar-golang",{"title":63,"title_id":64,"slug":65},"Learning Java","Belajar Java","belajar-java",{"title":67,"title_id":68,"slug":69},"Learning Pascal","Belajar Pascal","belajar-pascal",{"collection":31,"item":71},{"__typename":31,"title":72,"title_id":72,"slug":73,"children_series":74},"Lab","lab",[],{"article":76,"renderedBody":226,"renderedTakeaway":227,"latestArticles":228,"toc":323},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":14,"hidden_from_listing":15,"tags":84,"thumbnail_image":21,"og_image":88,"series":89,"authors":218,"seoTitle":21,"seoDescription":21,"body_locale":221,"available_locales":222,"body":224,"takeway":225,"prerequisite":21},152,"Every Write Comes Back as News","Tiap Write Balik ke Kamu sebagai Kabar Baru","every-write-comes-back-as-news","A supplier file says the mug is gone, the app drafts it, the store puts it back, forty times. Seven checks, and the eager webhook handler is only the second problem.","File supplier bilang mug-nya habis, app bikin draft, store mengembalikannya, 40 kali. Tujuh pemeriksaan, handler webhook yang sigap cuma masalah kedua.","2026-12-01T01:00:00.000Z",[85,86,87,73],"webhook","event-driven","distributed-systems","\u002Fog\u002Fevery-write-comes-back-as-news.png",{"id":90,"title":72,"title_id":72,"slug":73,"description":91,"description_id":92,"articles":93,"children_series":217,"parent_series":21},29,"Practice labs: work the problem first, then read the answer. Every lab ships with a repo you can clone, production-sized data, and a target you have to hit yourself. The write-up lives in this series too, and it only opens from the problem article.","Lab praktik: kerjakan masalahnya dulu, baru lihat jawabannya. Tiap lab punya repo yang bisa di-clone, data seukuran produksi, dan target yang harus kamu capai sendiri. Artikel jawabannya ada di seri ini juga, dan cuma bisa kamu buka dari artikel masalahnya.",[94,115,132,148,165,180,197,202],{"id":95,"title":96,"title_id":97,"slug":98,"excerpt":99,"excerpt_id":100,"has_translation":12,"published_at":101,"reading_time":14,"hidden_from_listing":15,"tags":102,"thumbnail_image":21,"og_image":106,"series":107,"authors":108},104,"N+1 Was Never the Bottleneck: 41 Queries Down to 2, Still One Second","Query-nya Tinggal 2, Tapi Response-nya Masih 1 Detik","query-tinggal-2-tapi-response-masih-1-detik","A feed endpoint that shows 20 posts takes a full second and hits the database with 41 queries. Apply the standard N+1 advice, get it down to 2 queries, and the latency does not move. This is that problem as it happened, plus the lab.","Endpoint feed yang cuma menampilkan 20 tulisan butuh satu detik, dan server database dihujani 41 query. Kamu kerjakan nasihat N+1 yang standar, query-nya turun jadi 2, dan latency-nya nggak bergerak. Ini versi \"apa adanya\" dari masalah itu, plus lab-nya.","2026-10-04T09:59:21.000Z",[103,104,105],"database","performance","backend","\u002Fog\u002Fquery-tinggal-2-tapi-response-masih-1-detik.png",{"id":90,"title":72,"title_id":72,"slug":73},[109],{"authors_id":110},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},1,"Daffa Izzuddin","izzudd","Writer",{"id":116,"title":117,"title_id":118,"slug":119,"excerpt":120,"excerpt_id":121,"has_translation":12,"published_at":122,"reading_time":123,"hidden_from_listing":15,"tags":124,"thumbnail_image":21,"og_image":127,"series":128,"authors":129},114,"One Payment, Four Ledger Rows: An Idempotency Lab","Saldo Naik Empat Kali untuk Satu Pembayaran","saldo-naik-empat-kali-untuk-satu-pembayaran","The code is not wrong and the gateway is not wrong, yet one payment shows up four times in the ledger. Guess why, then make `make check` green in the lab.","Kodenya nggak salah, dan gateway-nya juga nggak salah. Tapi satu pembayaran muncul empat kali di ledger. Coba tebak kenapa — lalu bikin `make check` hijau di lab-nya.","2026-10-11T13:45:00.000Z",4,[125,85,126,103,73],"idempotency","postgres","\u002Fog\u002Fsaldo-naik-empat-kali-untuk-satu-pembayaran.png",{"id":90,"title":72,"title_id":72,"slug":73},[130],{"authors_id":131},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":133,"title":134,"title_id":135,"slug":136,"excerpt":137,"excerpt_id":138,"has_translation":12,"published_at":139,"reading_time":140,"hidden_from_listing":15,"tags":141,"thumbnail_image":21,"og_image":143,"series":144,"authors":145},116,"The Webhook Arrived Late. The Reconciliation Job Had Already Run.","Webhook-nya Telat, Job Rekonsiliasinya Keburu Jalan","webhook-telat-job-rekonsiliasi-keburu-jalan","The webhook path is already idempotent. Then a morning reconciliation job appears, and one payment gets recorded twice from two paths that are both right. Guess where the key is wrong.","Jalur webhook sudah idempotent. Lalu ada job rekonsiliasi pagi, dan satu pembayaran tercatat dua kali dari dua jalur yang dua-duanya benar. Coba tebak kuncinya salah di mana.","2026-10-11T13:44:00.000Z",3,[125,142,85,126,73],"reconciliation","\u002Fog\u002Fwebhook-telat-job-rekonsiliasi-keburu-jalan.png",{"id":90,"title":72,"title_id":72,"slug":73},[146],{"authors_id":147},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":149,"title":150,"title_id":151,"slug":152,"excerpt":153,"excerpt_id":154,"has_translation":12,"published_at":155,"reading_time":123,"hidden_from_listing":15,"tags":156,"thumbnail_image":21,"og_image":160,"series":161,"authors":162},120,"Every Receipt in This Café Lists the Same Order","Tiap Nota di Kafe Ini Isinya Pesanan yang Sama","tiap-nota-isinya-pesanan-yang-sama","Every table's receipt holds the same items, and the total is Rp0, even though each table ordered exactly one thing. Guess why, then make `make check` green. A Python scope and mutation lab.","Nota tiap meja isinya sama semua, dan totalnya Rp0 — padahal tiap meja cuma pesan satu barang. Coba tebak kenapa.","2026-10-11T23:00:15.000Z",[157,158,159,73],"python","scope","mutasi","\u002Fog\u002Ftiap-nota-isinya-pesanan-yang-sama.png",{"id":90,"title":72,"title_id":72,"slug":73},[163],{"authors_id":164},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":166,"title":167,"title_id":168,"slug":169,"excerpt":170,"excerpt_id":171,"has_translation":12,"published_at":155,"reading_time":123,"hidden_from_listing":15,"tags":172,"thumbnail_image":21,"og_image":175,"series":176,"authors":177},122,"A Script That Cannot Say Where It Went Wrong","Script yang Nggak Bisa Bilang di Mana Salahnya","script-yang-tidak-bilang-di-mana-salahnya","A script that stops at the first bad line reports only part of the problem. This is what shows up on screen right now.","Script yang berhenti di baris jelek pertama cuma melaporkan sebagian masalah yang ada. Ini yang muncul di layar sekarang.",[157,173,174,73],"error-handling","validasi","\u002Fog\u002Fscript-yang-tidak-bilang-di-mana-salahnya.png",{"id":90,"title":72,"title_id":72,"slug":73},[178],{"authors_id":179},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":181,"title":182,"title_id":183,"slug":184,"excerpt":185,"excerpt_id":186,"has_translation":12,"published_at":187,"reading_time":140,"hidden_from_listing":15,"tags":188,"thumbnail_image":21,"og_image":192,"series":193,"authors":194},141,"A 6,000-Token Handbook and a 0% Cache Hit Rate","Buku Panduan 6.000 Token dan Hit Rate Cache 0%","cache-hit-rate-zero","Twenty-four turns, caching switched on, and a bill 21% higher than running with no cache at all. A support agent whose prompt looks static, and the three lines that quietly change it every turn.","Dua puluh empat giliran, caching menyala, dan tagihan 21% lebih tinggi daripada menjalankannya tanpa cache sama sekali. Agen support yang prompt-nya kelihatan statis, dan tiga baris yang diam-diam mengubahnya tiap giliran.","2026-11-08T01:20:00.000Z",[73,189,190,191],"llm","cache","api","\u002Fog\u002Fcache-hit-rate-zero.png",{"id":90,"title":72,"title_id":72,"slug":73},[195],{"authors_id":196},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":14,"hidden_from_listing":15,"tags":84,"thumbnail_image":21,"og_image":88,"series":198,"authors":199},{"id":90,"title":72,"title_id":72,"slug":73},[200],{"authors_id":201},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":203,"title":204,"title_id":205,"slug":206,"excerpt":207,"excerpt_id":208,"has_translation":12,"published_at":209,"reading_time":210,"hidden_from_listing":15,"tags":211,"thumbnail_image":21,"og_image":212,"series":213,"authors":214},155,"Stock Says Four, the Shelf Says Six","Stok Bilang Empat, Raknya Bilang Enam","stock-says-four-the-shelf-says-six","Eleven stock messages, three of them out of order: the mug reads four while six sit on the shelf, and the cap counted at zero still sold. Five checks, one guard.","Sebelas pesan stok, tiga di antaranya datang tidak berurutan: mug terbaca empat sementara enam ada di rak, dan topi yang dihitung nol tetap terjual. Lima pemeriksaan, satu penjaga.","2026-11-13T01:00:00.000Z",6,[73,86,87],"\u002Fog\u002Fstock-says-four-the-shelf-says-six.png",{"id":90,"title":72,"title_id":72,"slug":73},[215],{"authors_id":216},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},[],[219],{"authors_id":220},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},"en",[221,223],"id","\nThe supplier's file says the enamel mug is gone. The app reads that, decides the mug should be a\ndraft, and writes `status: DRAFT` to the store. The store accepts it. Then the merchant's automation\nruns, sees a product with twelve units on hand and a draft status, and puts it back to `ACTIVE`. The\nstore fires `products\u002Fupdate` for its own change, the app receives it, still believes the mug should\nbe a draft, and writes again.\n\nForty rounds later the store's rate limit stops it. The mug is still on sale.\n\nNo single step in that loop is broken: the app reads the supplier file accurately, the automation\nenforces its stock rule, and the webhook reports a real change that the app itself requested.\n\n## What it measures now\n\nEvery line below comes from `make demo` and `make check`, run on the starter as it ships:\n\n| check | what it says |\n|---|---|\n| `make demo` | `writes=120  throttled=3  final=ACTIVE`, forty writes per product |\n| A. supplier says unavailable, product ends `DRAFT` | `MUG-01 status=ACTIVE after 40 writes` |\n| B. that change costs at most 2 writes | `40 writes to sync one product` |\n| C. no product is ever throttled | `2 product(s) throttled across 4 scenarios: MUG-01, TEE-01` |\n| D. renaming a product produces 0 writes | `39 app write(s) after 1 title edit` |\n| E. a burst of five changes ends on the fifth | `first decision after the burst: ACTIVE; fifth update says DRAFT, first said ACTIVE` |\n| F. supplier restores it, product ends `ACTIVE` | `out: ACTIVE\u002F12, back: ACTIVE\u002F12` |\n| G. no write whose payload already equals the live value | `40 redundant of 160 writes` |\n\n`make check`: **0 of 7 green**.\n\nIn row D, a single title edit triggers thirty-nine writes because the handler recalculates everything\non every product event without checking whether anything changed. That noisy bug is easy to spot first,\nand it floods the log enough to hide the other failures.\n\n## Two rules, one field\n\n```text\nsupplier file  ->  app decides status  ->  store.write(status=\"DRAFT\")\n                                                    |\n                          the store's automation:   |  inventory > 0 and DRAFT\n                          status = \"ACTIVE\"  \u003C------+\n                                                    |\n                          products\u002Fupdate  ---------+--->  the app, again\n```\n\nThe app's rule is \"no supplier stock means draft\". The store's rule is \"stock on hand means it cannot\nbe a draft\". Both rules are defensible, yet together they have no state that satisfies both, so the two\nsystems keep undoing each other's writes one round trip at a time.\n\nTreat `store\u002Fstore.py` as the test harness rather than code to edit. It fires `products\u002Fupdate` after\nevery accepted write, including a write that changed nothing, which is what a real store does and what\nturns a redundant write into a loop instead of a no-op. It throttles a product after forty writes so the\nloop becomes a log you can read instead of a process that hangs. And it delivers the webhook\nsynchronously, inside `write()`, before returning: a real store does it over the network in the same\nwindow between your write and your next line of code. The lab collapses the network so the failure is\nreproducible instead of flaky.\n\n## Your mission\n\nMake `make check` green. The seven checks cover three conditions:\n\n1. One supplier change for one product ends in `DRAFT`, costs at most two writes, and never hits the\n   rate limit in any scenario.\n2. Unrelated edits produce zero writes: renaming a product triggers nothing, and no write sends a\n   payload that already matches the live value.\n3. The newest supplier answer wins: five updates arriving before the worker runs end on the fifth, and\n   restoring the product returns it to `ACTIVE` with its previous stock so drafting does not permanently\n   wipe out the stock count.\n\nYou may change anything in `app\u002F`. Do not change `store\u002F`, `data\u002F`, or `scripts\u002Fcheck.py`.\n\n## What this lab does not do\n\nThere is no concurrency here: one thread, one queue, and no locks. The usual production fix of keeping\none lane per product so two workers cannot interleave writes is not exercised or rewarded by\n`make check`, because this lab focuses on field ownership.\n\nThe lab also does not call a real store, so there is no network and no credentials. The write counts are\nexact and reproducible for the harness, while a real store enforces per-minute quotas per app and a loop\noften triggers hours after deploy on an unmonitored product.\n\nFinally, redundant writes here cost log lines and eventually a throttle error rather than billing against\na shared merchant API quota.\n\n## The answer\n\nThe answer article is [here](\u002Fp\u002Fthe-answer-make-the-two-rules-agree), and the fix lives on the\n`solusi` branch: `git diff main solusi -- 0007.echo-loop\u002F`. Read [`HINTS.md`](https:\u002F\u002Fgithub.com\u002Fizzudd\u002Finva-lab\u002Fblob\u002Fmain\u002F0007.echo-loop\u002FHINTS.md)\nfirst; it has three levels, one per bug, and the first is enough for most people.\n\nStopping the handler from reacting to its own writes only quiets the log; it still leaves the mug active\non the storefront.\n","- A write that the store answers with a webhook is a write that comes back to you as input.\n- The app and the store's automation both own `status`, and no state satisfies both rules, so every write undoes the last one.\n- Forty writes to one product means the rate limit stopped the loop, while the underlying conflict remains.\n- Quieting the handler makes the log readable and leaves the product in the wrong state: check A is the one that notices.\n- The lab has no concurrency on purpose, so the one-lane-per-product advice you would reach for is not exercised here.","\u003Cp>The supplier&#39;s file says the enamel mug is gone. The app reads that, decides the mug should be a\ndraft, and writes \u003Ccode>status: DRAFT\u003C\u002Fcode> to the store. The store accepts it. Then the merchant&#39;s automation\nruns, sees a product with twelve units on hand and a draft status, and puts it back to \u003Ccode>ACTIVE\u003C\u002Fcode>. The\nstore fires \u003Ccode>products\u002Fupdate\u003C\u002Fcode> for its own change, the app receives it, still believes the mug should\nbe a draft, and writes again.\u003C\u002Fp>\n\u003Cp>Forty rounds later the store&#39;s rate limit stops it. The mug is still on sale.\u003C\u002Fp>\n\u003Cp>No single step in that loop is broken: the app reads the supplier file accurately, the automation\nenforces its stock rule, and the webhook reports a real change that the app itself requested.\u003C\u002Fp>\n\u003Ch2 id=\"what-it-measures-now\">What it measures now\u003C\u002Fh2>\n\u003Cp>Every line below comes from \u003Ccode>make demo\u003C\u002Fcode> and \u003Ccode>make check\u003C\u002Fcode>, run on the starter as it ships:\u003C\u002Fp>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>check\u003C\u002Fth>\n\u003Cth>what it says\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\u003Ctr>\n\u003Ctd>\u003Ccode>make demo\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>writes=120  throttled=3  final=ACTIVE\u003C\u002Fcode>, forty writes per product\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>A. supplier says unavailable, product ends \u003Ccode>DRAFT\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>MUG-01 status=ACTIVE after 40 writes\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>B. that change costs at most 2 writes\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>40 writes to sync one product\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>C. no product is ever throttled\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>2 product(s) throttled across 4 scenarios: MUG-01, TEE-01\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>D. renaming a product produces 0 writes\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>39 app write(s) after 1 title edit\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>E. a burst of five changes ends on the fifth\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>first decision after the burst: ACTIVE; fifth update says DRAFT, first said ACTIVE\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>F. supplier restores it, product ends \u003Ccode>ACTIVE\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>out: ACTIVE\u002F12, back: ACTIVE\u002F12\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>G. no write whose payload already equals the live value\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>40 redundant of 160 writes\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\u003C\u002Ftable>\n\u003Cp>\u003Ccode>make check\u003C\u002Fcode>: \u003Cstrong>0 of 7 green\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Cp>In row D, a single title edit triggers thirty-nine writes because the handler recalculates everything\non every product event without checking whether anything changed. That noisy bug is easy to spot first,\nand it floods the log enough to hide the other failures.\u003C\u002Fp>\n\u003Ch2 id=\"two-rules-one-field\">Two rules, one field\u003C\u002Fh2>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"supplier%20file%20%20-%3E%20%20app%20decides%20status%20%20-%3E%20%20store.write(status%3D%22DRAFT%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20the%20store's%20automation%3A%20%20%20%7C%20%20inventory%20%3E%200%20and%20DRAFT%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20status%20%3D%20%22ACTIVE%22%20%20%3C------%2B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20products%2Fupdate%20%20---------%2B---%3E%20%20the%20app%2C%20again\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>supplier file  -&gt;  app decides status  -&gt;  store.write(status=\"DRAFT\")\n                                                    |\n                          the store's automation:   |  inventory &gt; 0 and DRAFT\n                          status = \"ACTIVE\"  &lt;------+\n                                                    |\n                          products\u002Fupdate  ---------+---&gt;  the app, again\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The app&#39;s rule is &quot;no supplier stock means draft&quot;. The store&#39;s rule is &quot;stock on hand means it cannot\nbe a draft&quot;. Both rules are defensible, yet together they have no state that satisfies both, so the two\nsystems keep undoing each other&#39;s writes one round trip at a time.\u003C\u002Fp>\n\u003Cp>Treat \u003Ccode>store\u002Fstore.py\u003C\u002Fcode> as the test harness rather than code to edit. It fires \u003Ccode>products\u002Fupdate\u003C\u002Fcode> after\nevery accepted write, including a write that changed nothing, which is what a real store does and what\nturns a redundant write into a loop instead of a no-op. It throttles a product after forty writes so the\nloop becomes a log you can read instead of a process that hangs. And it delivers the webhook\nsynchronously, inside \u003Ccode>write()\u003C\u002Fcode>, before returning: a real store does it over the network in the same\nwindow between your write and your next line of code. The lab collapses the network so the failure is\nreproducible instead of flaky.\u003C\u002Fp>\n\u003Ch2 id=\"your-mission\">Your mission\u003C\u002Fh2>\n\u003Cp>Make \u003Ccode>make check\u003C\u002Fcode> green. The seven checks cover three conditions:\u003C\u002Fp>\n\u003Col>\n\u003Cli>One supplier change for one product ends in \u003Ccode>DRAFT\u003C\u002Fcode>, costs at most two writes, and never hits the\nrate limit in any scenario.\u003C\u002Fli>\n\u003Cli>Unrelated edits produce zero writes: renaming a product triggers nothing, and no write sends a\npayload that already matches the live value.\u003C\u002Fli>\n\u003Cli>The newest supplier answer wins: five updates arriving before the worker runs end on the fifth, and\nrestoring the product returns it to \u003Ccode>ACTIVE\u003C\u002Fcode> with its previous stock so drafting does not permanently\nwipe out the stock count.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>You may change anything in \u003Ccode>app\u002F\u003C\u002Fcode>. Do not change \u003Ccode>store\u002F\u003C\u002Fcode>, \u003Ccode>data\u002F\u003C\u002Fcode>, or \u003Ccode>scripts\u002Fcheck.py\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"what-this-lab-does-not-do\">What this lab does not do\u003C\u002Fh2>\n\u003Cp>There is no concurrency here: one thread, one queue, and no locks. The usual production fix of keeping\none lane per product so two workers cannot interleave writes is not exercised or rewarded by\n\u003Ccode>make check\u003C\u002Fcode>, because this lab focuses on field ownership.\u003C\u002Fp>\n\u003Cp>The lab also does not call a real store, so there is no network and no credentials. The write counts are\nexact and reproducible for the harness, while a real store enforces per-minute quotas per app and a loop\noften triggers hours after deploy on an unmonitored product.\u003C\u002Fp>\n\u003Cp>Finally, redundant writes here cost log lines and eventually a throttle error rather than billing against\na shared merchant API quota.\u003C\u002Fp>\n\u003Ch2 id=\"the-answer\">The answer\u003C\u002Fh2>\n\u003Cp>The answer article is \u003Ca href=\"\u002Fp\u002Fthe-answer-make-the-two-rules-agree\">here\u003C\u002Fa>, and the fix lives on the\n\u003Ccode>solusi\u003C\u002Fcode> branch: \u003Ccode>git diff main solusi -- 0007.echo-loop\u002F\u003C\u002Fcode>. Read \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fizzudd\u002Finva-lab\u002Fblob\u002Fmain\u002F0007.echo-loop\u002FHINTS.md\">\u003Ccode>HINTS.md\u003C\u002Fcode>\u003C\u002Fa>\nfirst; it has three levels, one per bug, and the first is enough for most people.\u003C\u002Fp>\n\u003Cp>Stopping the handler from reacting to its own writes only quiets the log; it still leaves the mug active\non the storefront.\u003C\u002Fp>\n","\u003Cul>\n\u003Cli>A write that the store answers with a webhook is a write that comes back to you as input.\u003C\u002Fli>\n\u003Cli>The app and the store&#39;s automation both own \u003Ccode>status\u003C\u002Fcode>, and no state satisfies both rules, so every write undoes the last one.\u003C\u002Fli>\n\u003Cli>Forty writes to one product means the rate limit stopped the loop, while the underlying conflict remains.\u003C\u002Fli>\n\u003Cli>Quieting the handler makes the log readable and leaves the product in the wrong state: check A is the one that notices.\u003C\u002Fli>\n\u003Cli>The lab has no concurrency on purpose, so the one-lane-per-product advice you would reach for is not exercised here.\u003C\u002Fli>\n\u003C\u002Ful>\n",[229,234,248,266,287,306],{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":14,"hidden_from_listing":15,"tags":84,"thumbnail_image":21,"og_image":88,"series":230,"authors":231},{"id":90,"title":72,"title_id":72,"slug":73},[232],{"authors_id":233},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":235,"title":236,"title_id":237,"slug":238,"excerpt":239,"excerpt_id":240,"has_translation":12,"published_at":83,"reading_time":123,"hidden_from_listing":15,"tags":241,"thumbnail_image":21,"og_image":243,"series":244,"authors":245},151,"The Status That Changed Itself","Status yang Mengubah Dirinya Sendiri","the-status-that-changed-itself","A product's status blinks between published and draft, nothing errors, and the guard you wrote first works right up until it doesn't. The loop was never an echo.","Status produk berkedip antara published dan draft, tidak ada yang error, dan penjaga pertamamu jalan sampai akhirnya tidak. Loop-nya bukan gema.",[85,86,87,242],"post-mortem","\u002Fog\u002Fthe-status-that-changed-itself.png",{"id":24,"title":25,"title_id":26,"slug":27},[246],{"authors_id":247},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":249,"title":250,"title_id":251,"slug":252,"excerpt":253,"excerpt_id":254,"has_translation":12,"published_at":255,"reading_time":256,"hidden_from_listing":15,"tags":257,"thumbnail_image":21,"og_image":260,"series":261,"authors":263},164,"Python Capstone: Why a Blank CSV Field Cut the Class Average","Python Capstone: Kenapa Satu Kolom CSV Kosong Memotong Rata-rata Kelas","python-capstone-gradebook","A gradebook reads four students and writes a JSON report. The class average says 52.42, because two empty fields became zeros.","Buku nilai membaca empat siswa dan menulis laporan JSON. Rata-rata kelasnya bilang 52.42, karena dua kolom kosong berubah jadi nol.","2026-11-21T01:00:00.000Z",8,[157,258,259],"input-output","cli","\u002Fog\u002Fpython-capstone-gradebook.png",{"id":262,"title":55,"title_id":56,"slug":57},10,[264],{"authors_id":265},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":267,"title":268,"title_id":269,"slug":270,"excerpt":271,"excerpt_id":272,"has_translation":12,"published_at":255,"reading_time":123,"hidden_from_listing":15,"tags":273,"thumbnail_image":21,"og_image":278,"series":279,"authors":284},48,"What a Linked List Actually Is","Tentang Struktur Data LinkedList","tentang-struktur-data-linked-list","A linked list is a linear chain of nodes, each holding data and a pointer to the next node. Here is what that chain looks like, what it costs next to an array, and the same minimal implementation in Java, Python, and JavaScript.","Linked list adalah rantai linear berisi node, dan setiap node menyimpan data plus pointer ke node berikutnya. Ini bentuk rantainya, ongkosnya dibanding array, dan implementasi paling sederhana dalam Java, Python, serta JavaScript.",[274,275,276,277],"struktur-data","linked-list","pointer","konsep","\u002Fog\u002Ftentang-struktur-data-linked-list.png",{"id":280,"title":281,"title_id":282,"slug":283},28,"Linear Data Structures","Struktur Data Linear","asd-struktur-linear",[285],{"authors_id":286},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":288,"title":289,"title_id":290,"slug":291,"excerpt":292,"excerpt_id":293,"has_translation":12,"published_at":294,"reading_time":210,"hidden_from_listing":15,"tags":295,"thumbnail_image":21,"og_image":300,"series":301,"authors":303},163,"Pascal Capstone: Why Every Gradebook Score Came Back Zero","Capstone Pascal: Kenapa Semua Skor Buku Nilai Kembali Nol","pascal-gradebook-capstone","A gradebook reads three students from a file, prints three rows, and every score is 0. The procedure filled a copy of the array, because the parameter was missing `var`. Add the word and the report matches the file; the compiler had already warned about the call that filled nothing.","Sebuah buku nilai membaca tiga siswa dari berkas, mencetak tiga baris, dan setiap skornya 0. Prosedurnya mengisi salinan array, karena parameternya kehilangan `var`. Tambahkan kata itu dan laporannya cocok dengan berkasnya; kompilator sudah memperingatkan soal pemanggilan yang tidak mengisi apa pun.","2026-11-20T01:00:00.000Z",[296,297,298,299],"pascal","record","array","prosedur","\u002Fog\u002Fpascal-gradebook-capstone.png",{"id":302,"title":67,"title_id":68,"slug":69},14,[304],{"authors_id":305},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":307,"title":308,"title_id":309,"slug":310,"excerpt":311,"excerpt_id":312,"has_translation":12,"published_at":294,"reading_time":210,"hidden_from_listing":15,"tags":313,"thumbnail_image":21,"og_image":314,"series":315,"authors":320},162,"Python File I\u002FO: Why the Second Read Came Back Empty","Python File I\u002FO: Kenapa Pembacaan Kedua Kembali Kosong","python-file-read-write","A notes script saves a line, prints it back, then counts zero. The file on disk is correct: `read()` left the pointer at the end, so the second call returned an empty string. Read once into a variable, or `seek(0)`, and the count matches the file.","Skrip catatan menyimpan satu baris, mencetaknya kembali, lalu menghitung nol. Berkas di disk sudah benar: `read()` meninggalkan pointer di ujung, jadi panggilan kedua mengembalikan string kosong. Baca sekali ke sebuah variabel, atau `seek(0)`, dan hitungannya cocok dengan berkas.",[157,258],"\u002Fog\u002Fpython-file-read-write.png",{"id":316,"title":317,"title_id":318,"slug":319},18,"Working with Python Scripts","Menggunakan Script Python","python-pemrograman-dengan-script",[321],{"authors_id":322},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},[324,328,331,334,337],{"text":325,"depth":326,"id":327},"What it measures now",2,"what-it-measures-now",{"text":329,"depth":326,"id":330},"Two rules, one field","two-rules-one-field",{"text":332,"depth":326,"id":333},"Your mission","your-mission",{"text":335,"depth":326,"id":336},"What this lab does not do","what-this-lab-does-not-do",{"text":338,"depth":326,"id":339},"The answer","the-answer",1796084020615]