<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: fulfillmentyx</title>
    <description>The latest articles on DEV Community by fulfillmentyx (@burnash_mahaley_a0564934f).</description>
    <link>https://dev.to/burnash_mahaley_a0564934f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4225327%2F7db35e02-6748-495e-bd2a-b243630df71d.png</url>
      <title>DEV Community: fulfillmentyx</title>
      <link>https://dev.to/burnash_mahaley_a0564934f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/burnash_mahaley_a0564934f"/>
    <language>en</language>
    <item>
      <title>Grouping returns records when check-in and inspection are separate events</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:18:14 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/grouping-returns-records-when-check-in-and-inspection-are-separate-events-3ai4</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/grouping-returns-records-when-check-in-and-inspection-are-separate-events-3ai4</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;A returned package can be checked in by the receiving team on Tuesday and inspected on Wednesday. A daily report built from only the inspection date cannot tell receiving staff how much work arrived Tuesday. Use two event timestamps and two measures. Keep a separate count for records still awaiting inspection.&lt;/p&gt;

&lt;p&gt;The synthetic sample uses Asia/Shanghai as the reporting zone. Each tuple contains one return ID, a UTC check-in timestamp, and its optional UTC inspection timestamp. Report dates come from converting the event instant to the chosen reporting zone. This design counts returns, not returned item quantities.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from collections import Counter
from datetime import datetime
from zoneinfo import ZoneInfo

zone = ZoneInfo("Asia/Shanghai")
records = [
    ("R01", "2026-05-12T15:40:00+00:00", "2026-05-12T17:10:00+00:00"),
    ("R02", "2026-05-12T16:10:00+00:00", None),
    ("R03", "2026-05-12T10:20:00+00:00", "2026-05-12T12:00:00+00:00"),
]

def reporting_day(raw):
    return datetime.fromisoformat(raw).astimezone(zone).date().isoformat()

checked_in = Counter(reporting_day(arrived) for _, arrived, _ in records)
inspected = Counter(
    reporting_day(reviewed) for _, _, reviewed in records if reviewed is not None
)
awaiting = [return_id for return_id, _, reviewed in records if reviewed is None]
assert dict(checked_in) == {"2026-05-12": 2, "2026-05-13": 1}
assert dict(inspected) == {"2026-05-13": 1, "2026-05-12": 1}
assert awaiting == ["R02"]
for day in sorted(checked_in.keys() | inspected.keys()):
    print(day, "check-ins", checked_in[day], "inspections", inspected[day])
print("Awaiting inspection:", awaiting)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-05-12 check-ins 2 inspections 1
2026-05-13 check-ins 1 inspections 1
Awaiting inspection: ['R02']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;R01 arrives on May 12 in the reporting zone and is inspected on May 13. R02 contributes one arrival on May 13 and appears in the outstanding list. No inspection date needs to be invented. The two daily counts can cross even in a working process because inspections can draw on earlier arrivals.&lt;/p&gt;

&lt;p&gt;The outstanding list above is a current-state snapshot. For backlog at the end of a historical day, count all returns checked in before the next local day and exclude only those inspected before that same boundary. If a return can move through multiple inspections, name the measure precisely and decide whether it counts inspection events or distinct returns.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Describe partially fulfilled orders without double-counting the order</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:17:00 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/describe-partially-fulfilled-orders-without-double-counting-the-order-369b</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/describe-partially-fulfilled-orders-without-double-counting-the-order-369b</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;One customer order can move in more than one shipment. A report that labels package rows as “orders shipped” overstates how many orders have moved, and a report that sets “fulfilled” after the first parcel can hide unshipped units.&lt;/p&gt;

&lt;p&gt;Keep order lines, shipments and parcels separate in both the tables and the report. This example follows a five-unit order line through two shipments. Two parcels move in the first shipment and one in the second. Both shipment records represent parcels that have already been tendered, and one unit still waits in the warehouse.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from dataclasses import dataclass

@dataclass(frozen=True)
class Package:
    shipment_id: str
    package_id: str
    units: int

ordered_units = 5
packages = [
    Package("SH-1","P-1",2),
    Package("SH-1","P-2",1),
    Package("SH-2","P-3",1),
]
package_keys = {record.package_id for record in packages}
shipment_keys = {record.shipment_id for record in packages}
assert len(package_keys) == len(packages)

shipped_units = sum(record.units for record in packages)
remaining_units = ordered_units - shipped_units
assert (len(shipment_keys), len(package_keys), shipped_units, remaining_units) == (2, 3, 4, 1)
for record in packages:
    print(record.shipment_id, record.package_id, "units:", record.units)
print("Orders represented:", 1)
print("Shipments:", len(shipment_keys), "packages:", len(package_keys))
print("Units shipped:", shipped_units, "units remaining:", remaining_units)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SH-1 P-1 units: 2
SH-1 P-2 units: 1
SH-2 P-3 units: 1
Orders represented: 1
Shipments: 2 packages: 3
Units shipped: 4 units remaining: 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;At shipment grain the answer is two. At package grain it is three. At order grain there is one order with a partial shipment. The one remaining unit follows from this fixture's agreed quantity. New cancellations or revisions would change the denominator, so a historical snapshot needs the order quantity that was valid at that point in time.&lt;/p&gt;

&lt;p&gt;For a multi-item order, compute the progress per order line before determining the overall order status. Package manifests usually need a child table for item quantities. A simple package-level total can say “five units shipped” while a specific SKU still needs attention. Also agree whether a label issued, a package packed, or a parcel tendered is the event that counts as shipped.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why ordered and returned units should have separate measures</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:09:02 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/why-ordered-and-returned-units-should-have-separate-measures-2cpn</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/why-ordered-and-returned-units-should-have-separate-measures-2cpn</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;An order line says four units. Two separate receipts each show one returned unit against that line. Join the receipts directly to the order line and the order quantity appears twice, so summing it gives eight.&lt;/p&gt;

&lt;p&gt;Here is a synthetic reconciliation for one SKU. Four units were ordered on the first line and two on the second. Two distinct units from the first line were received as returns in separate receipts. A third parcel has a return approval but has not yet arrived, so it doesn't count toward received units.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sqlite3

db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE order_line (id TEXT PRIMARY KEY, quantity INTEGER NOT NULL);
CREATE TABLE return_receipt (
    id TEXT PRIMARY KEY, line_id TEXT NOT NULL, units INTEGER NOT NULL, state TEXT NOT NULL
);
INSERT INTO order_line VALUES ('L1',4), ('L2',2);
INSERT INTO return_receipt VALUES ('R1','L1',1,'received'),
                                  ('R2','L1',1,'received'),
                                  ('R3','L2',1,'approved');
""")

wrong = db.execute("""
    SELECT SUM(l.quantity), SUM(r.units)
    FROM order_line AS l
    LEFT JOIN return_receipt AS r ON r.line_id=l.id AND r.state='received'
""").fetchone()

correct = db.execute("""
    WITH receipts AS (
        SELECT line_id, SUM(units) AS returned_units
        FROM return_receipt WHERE state='received'
        GROUP BY line_id
    )
    SELECT SUM(l.quantity), SUM(COALESCE(r.returned_units,0))
    FROM order_line l LEFT JOIN receipts r ON r.line_id=l.id
""").fetchone()

assert wrong == (10, 2)
assert correct == (6, 2)
print("From raw join:", wrong)
print("From one row per line:", correct)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;From raw join: (10, 2)
From one row per line: (6, 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Pre-aggregating receipts to one row per order line keeps the order quantity from repeating. The corrected report shows six ordered units and two received returns. SUM(DISTINCT l.quantity) is also unreliable as a remedy because two different lines can legitimately contain equal quantities.&lt;/p&gt;

&lt;p&gt;Confirm the intended date basis before you group over time. Orders placed today divided by returns received today is a flow comparison across different cohorts. To estimate returns against orders from a given week, select those order lines first and use a stated receipt observation window. Reconciliation should retain both raw measures with their definitions even when the UI displays a derived ratio.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Testing idempotent order imports with duplicate event identifiers</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:07:04 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/testing-idempotent-order-imports-with-duplicate-event-identifiers-1o79</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/testing-idempotent-order-imports-with-duplicate-event-identifiers-1o79</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;A warehouse importer can see the same order event again after a retry. It can also see two genuine events that happen to request the same item. Both events belong in the ledger when their upstream identities differ. Deduplicating by SKU or matching payload would erase valid work.&lt;/p&gt;

&lt;p&gt;This offline example assumes upstream IDs are unique within a source. An exact replay is acknowledged without inserting another record. Reuse of the same ID with changed data is a discrepancy that stops the batch. The fixture stores only synthetic event and item values.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sqlite3

db = sqlite3.connect(":memory:")
db.execute("""
CREATE TABLE received_event (
    source TEXT NOT NULL,
    event_id TEXT NOT NULL,
    sku TEXT NOT NULL,
    qty INTEGER NOT NULL,
    PRIMARY KEY (source, event_id)
)
""")

def import_batch(events):
    inserted = 0
    with db:
        for source, event_id, sku, qty in events:
            cursor = db.execute("""
                INSERT INTO received_event VALUES (?, ?, ?, ?)
                ON CONFLICT(source, event_id) DO NOTHING
            """, (source, event_id, sku, qty))
            if cursor.rowcount:
                inserted += 1
                continue
            original = db.execute("""
                SELECT sku, qty FROM received_event
                WHERE source=? AND event_id=?
            """, (source, event_id)).fetchone()
            if original != (sku, qty):
                raise ValueError(f"Conflicting event {source}/{event_id}")
    return inserted

data = [("shop-a", "E-1", "S-7", 2),
        ("shop-a", "E-2", "S-7", 2)]
first, second = import_batch(data), import_batch(data)
rows = db.execute("SELECT COUNT(*) FROM received_event").fetchone()[0]
assert (first, second, rows) == (2, 0, 2)
print("First insert, retry insert, stored rows:", first, second, rows)

try:
    import_batch([("shop-a", "E-3", "S-7", 1),
                  ("shop-a", "E-1", "S-7", 3)])
except ValueError as error:
    print(error)
else:
    raise AssertionError("conflicting payload was accepted")

assert db.execute("SELECT COUNT(*) FROM received_event").fetchone()[0] == 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;First insert, retry insert, stored rows: 2 0 2
Conflicting event shop-a/E-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The second import stores zero new rows. The two original records remain even though their item and quantity match. The conflicting batch includes a new event before the conflict, so the last assertion also checks that the transaction rolls back that insert.&lt;/p&gt;

&lt;p&gt;Keep the deduplication record and any resulting database updates in the same transaction. An acknowledgment sent before commit can cause the source to stop retrying while the warehouse has yet to store the event. Use a durable outbox or another explicitly idempotent mechanism for work that crosses the database boundary. This test exercises SQLite transaction behavior in one process, and covers neither network retries nor distributed delivery.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Testing a quantity field received as a string</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:05:06 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/testing-a-quantity-field-received-as-a-string-30ba</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/testing-a-quantity-field-received-as-a-string-30ba</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;The partner column contains text, including the value 0. This import accepts whole numbers from zero through 999,999 and allows surrounding whitespace. Blank, missing, signed and decimal values each get their own result. A planning quantity can be zero here; a physical pick instruction may have a different rule.&lt;/p&gt;

&lt;p&gt;A result carries both its disposition and the parsed count. That makes it straightforward to quarantine bad rows without replacing their quantities with zero.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import re

DIGITS = re.compile(r"[0-9]{1,6}")

def parse_units(raw):
    if raw is None:
        return "missing", None
    if not isinstance(raw, str):
        return "type error", None
    value = raw.strip()
    if not value:
        return "blank", None
    if DIGITS.fullmatch(value) is None:
        return "invalid integer", None
    return "accepted", int(value)

inputs = ["0", " 003 ", "-1", None, "", "1.5", "1.0", "1000000", 7]
actual = [parse_units(item) for item in inputs]
assert actual == [
    ("accepted", 0), ("accepted", 3), ("invalid integer", None),
    ("missing", None), ("blank", None), ("invalid integer", None),
    ("invalid integer", None), ("invalid integer", None), ("type error", None),
]
for raw, outcome in zip(inputs, actual):
    print(repr(raw), "=&amp;gt;", outcome)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'0' =&amp;gt; ('accepted', 0)
' 003 ' =&amp;gt; ('accepted', 3)
'-1' =&amp;gt; ('invalid integer', None)
None =&amp;gt; ('missing', None)
'' =&amp;gt; ('blank', None)
'1.5' =&amp;gt; ('invalid integer', None)
'1.0' =&amp;gt; ('invalid integer', None)
'1000000' =&amp;gt; ('invalid integer', None)
7 =&amp;gt; ('type error', None)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The decimal form 1.0 is rejected even though its magnitude is a whole number. The source agreed to send an integer token. Accepting more forms quietly makes integrations difficult to correct later. The six-character bound also prevents the parser from treating a misplaced identifier as an order quantity of arbitrary size.&lt;/p&gt;

&lt;p&gt;Leading zeroes are fine here because the field records a magnitude. Keep the original token in the import audit when it helps diagnose the source. Handle measured quantities such as weight with a separate contract covering units and decimal precision. A malformed line should surface at intake, where a reviewer can still request a corrected file.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Showing inventory snapshots reproducibly when timestamps tie</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:03:09 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/showing-inventory-snapshots-reproducibly-when-timestamps-tie-5h7h</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/showing-inventory-snapshots-reproducibly-when-timestamps-tie-5h7h</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;An inventory snapshot may contain multiple updates with the same recorded instant because the source exports timestamps at second precision. Picking the row with the greatest timestamp is incomplete when two rows tie. Define a second sort key tied to the event order the source actually promises. A stable output without a defensible tie policy can still misrepresent which balance won.&lt;/p&gt;

&lt;p&gt;Assume a synthetic source whose sequence increases within each SKU and whose timestamps are already normalised as fixed-width UTC strings. Each event carries the on-hand balance after applying its change. The snapshot reader sorts by instant and then by source sequence.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sqlite3

rows = [
    ("A", "2026-05-12T08:00:00Z", 10, 12),
    ("A", "2026-05-12T08:30:00Z", 11, 9),
    ("A", "2026-05-12T08:30:00Z", 12, 10),
    ("B", "2026-05-12T08:20:00Z", 3, 5),
]

def snapshot(events, cutoff):
    db = sqlite3.connect(":memory:")
    db.execute("""CREATE TABLE events (
        sku TEXT NOT NULL, recorded_at TEXT NOT NULL, seq INTEGER NOT NULL,
        balance INTEGER NOT NULL, PRIMARY KEY (sku, seq)
    )""")
    db.executemany("INSERT INTO events VALUES (?,?,?,?)", events)
    result = db.execute("""
        WITH ranked AS (
            SELECT sku, seq, balance,
                   ROW_NUMBER() OVER (
                       PARTITION BY sku ORDER BY recorded_at DESC, seq DESC
                   ) AS rank
            FROM events WHERE recorded_at &amp;lt;= ?
        )
        SELECT sku, seq, balance FROM ranked WHERE rank=1 ORDER BY sku
    """, (cutoff,)).fetchall()
    db.close()
    return result

at = "2026-05-12T08:30:00Z"
first = snapshot(rows, at)
second = snapshot(list(reversed(rows)), at)
assert first == second == [("A", 12, 10), ("B", 3, 5)]
assert snapshot(rows, "2026-05-12T08:29:59Z") == [("A", 10, 12), ("B", 3, 5)]
print("Run 1:", first)
print("Run 2:", second)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run 1: [('A', 12, 10), ('B', 3, 5)]
Run 2: [('A', 12, 10), ('B', 3, 5)]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Reversing insertion order leaves both snapshots identical. Including a cutoff a second earlier proves the ranking considers only events eligible at the requested instant. The warehouse can use the result for reconciliation if its source really does provide the stated sequence and after-event balances.&lt;/p&gt;

&lt;p&gt;Random event identifiers sometimes make a useful display tie-breaker, but they cannot establish business order. If timestamps and sequence numbers conflict or come from independent streams, document how to reconcile them before claiming a balance is authoritative. If events contain deltas rather than after-event balances, replay those deltas from a valid baseline instead of selecting one row.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Selecting a warehouse date boundary in a local time-zone test</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 11:01:32 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/selecting-a-warehouse-date-boundary-in-a-local-time-zone-test-2dck</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/selecting-a-warehouse-date-boundary-in-a-local-time-zone-test-2dck</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;At 16:20 UTC it is already the next day in Shanghai. In Los Angeles it is still the same day. Group the event by the date printed on the UTC timestamp and the Shanghai report credits it to the wrong day.&lt;/p&gt;

&lt;p&gt;Define the report day in an IANA time zone and store the source as an offset-aware instant. For a range query, construct the local start of the day and the local start of the next day, then convert both to UTC. The sample uses synthetic instants and a half-open interval.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from datetime import datetime, time, timedelta, timezone
from zoneinfo import ZoneInfo

UTC = timezone.utc

def belongs(instant, start, stop):
    return start &amp;lt;= instant &amp;lt; stop

event = datetime(2026, 5, 12, 16, 20, tzinfo=UTC)
for name, expected_day in (
    ("Asia/Shanghai", "2026-05-13"),
    ("America/Los_Angeles", "2026-05-12"),
):
    zone = ZoneInfo(name)
    local = event.astimezone(zone)
    day = local.date()
    start = datetime.combine(day, time.min, zone).astimezone(UTC)
    stop = datetime.combine(day + timedelta(days=1), time.min, zone).astimezone(UTC)
    assert day.isoformat() == expected_day
    assert belongs(event, start, stop)
    assert belongs(start, start, stop)
    assert not belongs(stop, start, stop)
    print(name, local.isoformat(), "report day:", day)
    print("UTC query interval:", start.isoformat(), "to", stop.isoformat())
print("Source instant:", event.isoformat())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Asia/Shanghai 2026-05-13T00:20:00+08:00 report day: 2026-05-13
UTC query interval: 2026-05-12T16:00:00+00:00 to 2026-05-13T16:00:00+00:00
America/Los_Angeles 2026-05-12T09:20:00-07:00 report day: 2026-05-12
UTC query interval: 2026-05-12T07:00:00+00:00 to 2026-05-13T07:00:00+00:00
Source instant: 2026-05-12T16:20:00+00:00
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Each report assigns the event to the day its own staff see on the clock, while both can link back to the same UTC instant for reconciliation. The exclusive end ensures an event exactly at the next boundary belongs only to the next day. Use matching comparisons in the database, typically greater than or equal to start and strictly less than stop.&lt;/p&gt;

&lt;p&gt;A local day can span 23 or 25 UTC hours during a daylight-saving transition. Building the next local midnight is safer than adding 24 UTC hours to the first. For a shift-based report, replace midnight with the documented shift cutoff. Where a cutoff can be ambiguous or nonexistent under daylight-saving rules, settle that policy separately and add specific test dates.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Reversing a fulfilment event in a toy ledger</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 10:59:55 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/reversing-a-fulfilment-event-in-a-toy-ledger-4kd2</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/reversing-a-fulfilment-event-in-a-toy-ledger-4kd2</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;When a pick is cancelled, an append-only stock ledger can preserve the original pick and add a compensating movement. This helps a reviewer answer both “How many units remain?” and “Why did the recorded balance change twice?” Replacing the original row with a zero leaves the first question answerable at the cost of the second.&lt;/p&gt;

&lt;p&gt;The synthetic ledger here supports one full reversal per pick. The reversal has a reference to the original ID and derives its quantity from that movement. It has its own audit ID.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from dataclasses import dataclass

@dataclass(frozen=True)
class Movement:
    event_id: str
    delta: int
    reverses: str = ""

class Ledger:
    def __init__(self, opening):
        self.opening = opening
        self.entries = {}

    @property
    def balance(self):
        return self.opening + sum(event.delta for event in self.entries.values())

    def pick(self, event_id, units):
        if event_id in self.entries or not 0 &amp;lt; units &amp;lt;= self.balance:
            raise ValueError("Invalid pick")
        self.entries[event_id] = Movement(event_id, -units)

    def reverse_pick(self, event_id, original_id):
        original = self.entries.get(original_id)
        already_reversed = any(row.reverses == original_id for row in self.entries.values())
        if event_id in self.entries or original is None or original.delta &amp;gt;= 0 or already_reversed:
            raise ValueError("Invalid reversal")
        self.entries[event_id] = Movement(event_id, -original.delta, original_id)

ledger = Ledger(10)
ledger.pick("E-1", 3)
assert ledger.balance == 7
ledger.reverse_pick("E-2", "E-1")
assert ledger.balance == 10
running = ledger.opening
for row in ledger.entries.values():
    running += row.delta
    print(row.event_id, row.delta, "reverses:", row.reverses or "-", "balance:", running)

try:
    ledger.reverse_pick("E-3", "E-1")
except ValueError as error:
    print(error)
else:
    raise AssertionError("pick was reversed twice")
assert ledger.balance == 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;E-1 -3 reverses: - balance: 7
E-2 3 reverses: E-1 balance: 10
Invalid reversal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The final balance returns to ten through a traceable debit and credit. The ledger rejects a second reversal even under a different event ID. If an operation restores only part of a pick, model the remaining reversible quantity explicitly and add tests for cumulative over-reversal. An actual warehouse may also place recovered items in inspection or quarantine before moving them into available stock.&lt;/p&gt;

&lt;p&gt;This example is an in-memory, single-item replay. For concurrent writes, enforce identity and reversal rules transactionally with constraints appropriate to the database. Log the original event, confirmed movement, reason, and responsible actor under the site's own audit and permissions policy.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Keeping supplier references separate from warehouse item keys</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 10:57:33 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/keeping-supplier-references-separate-from-warehouse-item-keys-36b2</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/keeping-supplier-references-separate-from-warehouse-item-keys-36b2</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;A receiving file can list supplier SKU X17 from two different suppliers. Those labels can legitimately refer to different warehouse items. Give the warehouse item its own identifier and resolve a supplier reference using both the supplier and that supplier's SKU. If a site or catalogue adds another namespace, include it explicitly in the mapping.&lt;/p&gt;

&lt;p&gt;Run a packing-list import against the same two inbound rows before and after introducing supplier B's mapping. The fixture keeps unmatched receiving records in the result for review.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sqlite3

db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE supplier_map (
    supplier TEXT NOT NULL, supplier_sku TEXT NOT NULL,
    item_key TEXT NOT NULL, PRIMARY KEY (supplier, supplier_sku)
);
CREATE TABLE incoming (
    line_id TEXT PRIMARY KEY,
    supplier TEXT NOT NULL, supplier_sku TEXT NOT NULL
);
INSERT INTO supplier_map VALUES ('A','X17','WH-441');
INSERT INTO incoming VALUES ('R1','A','X17'), ('R2','B','X17');
""")

def resolve():
    return db.execute("""
        SELECT incoming.line_id, supplier_map.item_key
        FROM incoming
        LEFT JOIN supplier_map
          ON incoming.supplier = supplier_map.supplier
         AND incoming.supplier_sku = supplier_map.supplier_sku
        ORDER BY incoming.line_id
    """).fetchall()

before = resolve()
db.execute("INSERT INTO supplier_map VALUES ('B','X17','WH-612')")
after = resolve()
wrong_rows = db.execute("""
    SELECT COUNT(*) FROM incoming
    JOIN supplier_map USING (supplier_sku)
""").fetchone()[0]
assert before == [("R1", "WH-441"), ("R2", None)]
assert after == [("R1", "WH-441"), ("R2", "WH-612")]
assert wrong_rows == 4
print("Before supplier B mapping:", before)
print("After supplier B mapping:", after)
print("Rows from SKU-only join:", wrong_rows)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before supplier B mapping: [('R1', 'WH-441'), ('R2', None)]
After supplier B mapping: [('R1', 'WH-441'), ('R2', 'WH-612')]
Rows from SKU-only join: 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;A row without a mapping remains visible for resolution. Adding the mapping for B then affects only R2. Joining on supplier SKU alone would match every inbound row against both supplier records. A report can detect that symptom by checking the promised number of results per inbound line.&lt;/p&gt;

&lt;p&gt;Some suppliers may intentionally share a warehouse item when their products have been approved as interchangeable. Keep two supplier keys that map to the same warehouse key in that case. Where mappings change over time, save the mapping decision against a receipt or use dated mappings that prevent a later change from rewriting the earlier stock history.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Choosing how to present an unpriced service in JSON</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 10:15:24 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/choosing-how-to-present-an-unpriced-service-in-json-8ma</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/choosing-how-to-present-an-unpriced-service-in-json-8ma</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;A rate card has several reasons why a service might lack a displayed amount. A proposal can explicitly waive a fee, the provider can still be waiting for a measurement to price it, or the service can be absent from a particular proposal. Rendering all three as “0.00” gives the reader a false answer.&lt;/p&gt;

&lt;p&gt;This response schema represents a priced service with integer minor units and currency. A pending service has a distinct status. A service for which the source supplied no entry is missing from the service map. The reader uses membership to tell that last case apart from an explicit entry with an unsupported shape.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json

quote = {
    "packing": {"state": "priced", "minor_units": 0, "currency": "USD"},
    "palletising": {"state": "pending"},
}

def classify(services, service):
    if service not in services:
        return "missing", None
    line = services[service]
    if line.get("state") == "pending":
        return "pending", None
    if (
        line.get("state") == "priced"
        and type(line.get("minor_units")) is int
        and line["minor_units"] &amp;gt;= 0
        and line.get("currency")
    ):
        return "priced", (line["currency"], line["minor_units"])
    raise ValueError("Unsupported rate entry")

stored = json.dumps(quote, sort_keys=True)
restored = json.loads(stored)
statuses = [classify(restored, name) for name in ("packing", "palletising", "photo check")]
assert statuses == [("priced", ("USD", 0)), ("pending", None), ("missing", None)]
for name, outcome in zip(("packing", "palletising", "photo check"), statuses):
    print(name, "=&amp;gt;", outcome)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;packing =&amp;gt; ('priced', ('USD', 0))
palletising =&amp;gt; ('pending', None)
photo check =&amp;gt; ('missing', None)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The round trip preserves the price of zero and the two reasons an amount isn't available. A subtotal can add confirmed amounts only and display how many service lines are pending, rather than implying the entire quote is priced. Store source currency in each price entry and add across currencies only under an explicit conversion policy.&lt;/p&gt;

&lt;p&gt;The example makes “missing” a statement about this response payload. It does not establish that the provider never offers the service. If clients also need “out of scope” or “included elsewhere,” give that business state a separate explicit value and test the display. Converting every absent amount to zero during ingestion removes information no front end can recover.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why a line count and a unit count need separate tests</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 19 Nov 2026 09:40:18 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/why-a-line-count-and-a-unit-count-need-separate-tests-418l</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/why-a-line-count-and-a-unit-count-need-separate-tests-418l</guid>
      <description>&lt;p&gt;By YX Fulfillment&lt;/p&gt;

&lt;p&gt;One line asks for three units, and another asks for one. The pick list needs two instructions. Inventory needs four units. A test made entirely of one-unit lines can let a report swap those two counts without anyone noticing.&lt;/p&gt;

&lt;p&gt;Use a synthetic order with two active lines for the same item and a third cancelled line. Assume partial cancellation has already been applied to each eligible line's quantity and that this report represents the current order state.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import sqlite3

db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE line (
    line_id TEXT PRIMARY KEY,
    sku TEXT NOT NULL,
    qty INTEGER NOT NULL CHECK (qty &amp;gt; 0),
    status TEXT NOT NULL CHECK (status IN ('open', 'cancelled'))
);
INSERT INTO line VALUES ('L1','S-9',3,'open'),
                        ('L2','S-9',1,'open'),
                        ('L3','S-8',5,'cancelled');
""")

wrong = db.execute("""
    SELECT COUNT(*), COUNT(qty) FROM line WHERE status='open'
""").fetchone()
counts = db.execute("""
    SELECT COUNT(*), COALESCE(SUM(qty), 0) FROM line WHERE status='open'
""").fetchone()
assert wrong == (2, 2)
assert wrong != (2, 4)
assert counts == (2, 4)
print("COUNT(qty) implementation:", wrong)
print("Line count and unit count:", counts)

db.execute("UPDATE line SET status='cancelled'")
empty = db.execute("""
    SELECT COUNT(*), COALESCE(SUM(qty), 0) FROM line WHERE status='open'
""").fetchone()
assert empty == (0, 0)
print("All lines cancelled:", empty)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output from a local run on Python 3.9.6&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;COUNT(qty) implementation: (2, 2)
Line count and unit count: (2, 4)
All lines cancelled: (0, 0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;COUNT(qty) counts rows with a non-NULL quantity. Because the column rejects NULL, it always equals the line count in this fixture. SUM(qty) adds the requested units. Both metrics use the same eligible-row filter, so the five cancelled units contribute to neither. COUNT(DISTINCT sku) would answer a third question and return one here.&lt;/p&gt;

&lt;p&gt;If the source is a status history rather than a current-state table, choose exactly one accepted revision per order line before summing. If an order line splits into several warehouse instructions, use the instruction table to measure pick tasks and state clearly whether those quantities are planned, picked, or shipped.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Plan Connected Rooms as One Dye Lot Before Weaving or Tufting Starts</title>
      <dc:creator>fulfillmentyx</dc:creator>
      <pubDate>Thu, 12 Nov 2026 05:20:16 +0000</pubDate>
      <link>https://dev.to/burnash_mahaley_a0564934f/plan-connected-rooms-as-one-dye-lot-before-weaving-or-tufting-starts-3hln</link>
      <guid>https://dev.to/burnash_mahaley_a0564934f/plan-connected-rooms-as-one-dye-lot-before-weaving-or-tufting-starts-3hln</guid>
      <description>&lt;p&gt;Open a hotel drawing and look, first, at the views rather than at the room names. A lobby that opens onto a corridor is already one field to a person walking in. Two guest rooms that share a doorway, or a lounge that is read in the same glance as the passage beside it, are already one field as well. The names on the plan may be different. The eye is not. If those rooms are later woven or tufted from more than one dye lot, the join will be visible in the very place the drawing had already shown as continuous.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ywhz2dueiz9z8ubfoh7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ywhz2dueiz9z8ubfoh7.jpg" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is a planning decision, and it has to be made on the drawing, before a loom or a tufting gun starts. It is not a correction to be made after a colour difference has been noticed on site. ADA FLOOR is a bespoke carpet design and manufacturing studio that entered this work in 2001. It works with luxury hotels, architects, interior practices, and private residences, and it keeps design, material engineering, factory production, and installation coordination on one chain. The official site is &lt;a href="https://adafloor.net/" rel="noopener noreferrer"&gt;https://adafloor.net/&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read the sightlines on the drawing first
&lt;/h2&gt;

&lt;p&gt;The question is not whether two rooms have the same name. The question is whether, in use, they will be read as one surface. Stand, on the plan, at the entrance to the lobby and ask what the first long view actually takes in. Follow the corridor that leaves that lobby and ask whether a person turning the corner still sees the same field. Mark the adjacent rooms that open in one view. Those marks, not the room schedule alone, tell you where a single dye lot has to be planned.&lt;/p&gt;

&lt;p&gt;A hotel may still share a colour family across a building and use different constructions in the lobby, the corridor, and the guest rooms. That is a separate decision. Construction and fibre follow use. Dye lot follows sight. A lobby in one construction and a corridor in another can still be planned so that, where the eye reads them together, the colour field is drawn from the same lot. Where the constructions differ, the join should be placed where the view already breaks — a threshold, a change of direction — not in the middle of a continuous field.&lt;/p&gt;

&lt;p&gt;A common planning habit, confirmed on the actual plan rather than treated as a law, is to use four-metre Axminster broadloom for regular guest rooms and corridors, and to turn to hand-tufting for irregular areas such as curved walls or circular floors, so a seam is not left in the main view. That habit is about seams and construction. It does not replace the dye-lot decision. An irregular field that is tufted as one piece still has to be planned, if it is seen together with a woven field, so that the colour they share comes from the same lot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write the lot decision before the machine starts
&lt;/h2&gt;

&lt;p&gt;Once the connected fields are marked, the brief and the ticket have to carry the decision. Yarn pre-blend is one of the factory methods that keep a colour field even, but pre-blend cannot repair a plan that has already split a continuous view across two lots. In-line checks of pile height, density, and pattern will later compare what comes off the machine with the sealed sample; they will not invent a unity that the drawing failed to ask for. A batch number will later be mapped to the room layout, and a roll will be packed only after inspection. Those steps protect a decision that has already been made. They are not a substitute for making it.&lt;/p&gt;

&lt;p&gt;Do not leave the lot to a later conversation. If two rooms are to be read as one field, say so on the drawing and on the sample sheet, in the same language as the space type and the area. The sealed sample then represents that field, not a single room that happens to have been sampled first. Three parties seal the same physical piece under real light. After that seal, production has a reference for the connected rooms, not only for a fragment of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this decision is not
&lt;/h2&gt;

&lt;p&gt;It is not a method for tracking a colour difference after the floor is down. If a difference is later found, the lot and the batch map will help a repair follow the right reference, rather than a photograph. That is useful work, and it belongs to another moment. The work described here happens earlier. It asks, while the plan is still a drawing, whether a continuous view has been given a continuous lot.&lt;/p&gt;

&lt;p&gt;It is also not a rule that the whole hotel must come from one lot. Rooms that do not read together do not need to be forced into one field. A guest room at the end of a plan, out of sight of the lobby, can be planned on its own terms. The discipline is to group what the eye groups, and to leave ungrouped what the eye already separates.&lt;/p&gt;

&lt;p&gt;Fire, antistatic, and emission targets still belong on the sample sheet and are confirmed against the codes for that project. Delivery and installation conditions still belong in the inquiry. None of those facts replaces the sightline decision. A floor can meet its codes and still show a lot change in the first view from the door, if that view was never marked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the mark while the plan can still change
&lt;/h2&gt;

&lt;p&gt;The right time to plan one dye lot for a connected field is the time when the drawing can still be revised: during design development and budget alignment, before A4 and 1:1 samples are approved as if they represented only a single room. Once the loom or the gun has started, the lot is no longer a line on a plan. It is yarn already in work. The cheaper correction is the earlier one. Mark the continuous views. Plan those rooms as one dye lot. Then let the factory follow a decision the drawing has already made.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
