Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
dbbasic-package.json · 9.9 KB · 137 lines
1{
2 "id": "app-shipping",
3 "name": "Shipping",
4 "version": "0.2.0",
5 "description": "One missing noun, and most of a warehouse falls out of it. An order says what is OWED; a shipment says what physically moved -- when, in which box, with which tracking number -- and every system that tries to hold both facts in one status field ends up lying about at least one of them. The immediate payoff is partial fulfillment, which stops being a flag somebody has to remember and becomes a COUNT: two of the three mugs went today, the third goes on Friday, and orders.status derives itself (partial -> shipped -> delivered) from what is on shipment lines rather than from anybody's memory. The gate that makes the derivation trustworthy is one hook -- cumulative shipped quantity per order line may never exceed what was ordered, refused with all three numbers so the packer knows which shipment is the wrong one -- and the goods leave the shelf when the box does: one sale stock move per line at the moment a shipment reaches shipped, idempotent by a per-line provenance marker, because a replayed event must move nothing twice. The other two objects here are READS, not tables, and deliberately so: a packing slip is one shipment printed (with no prices, ever -- a slip is not an invoice, and pricelessness by construction is what makes every parcel gift-safe without a flag anybody can forget to tick), and a pick list is ordered-minus-shipped folded live and grouped by product so a picker walks each shelf once, the same doctrine that keeps stock levels out of a table. app-shop keeps its zero-touch path: shop.auto_fulfill defaults true, so a payment still ships the whole order and still moves the stock -- it now travels through the shipment noun instead of writing moves directly, which is what lets a pick/pack shop set auto_fulfill=false and take over the packing bench without either shop reimplementing the other's behavior. What is deliberately NOT here, named so it reads as a decision rather than an omission: carrier labels and tracking polls (a connector boundary, manual-first until credentials exist), inbound returns and their disposition (the direction field carries the shape; the authorization ladder and the restock-or-waste choice are their own slice), PO receiving, and disputes. 0.2.0 is the carrier-facing layer, and the sentence that governs all of it is that a shop with NO carrier configured must lose nothing: you type the tracking number on the shipment, the manifest prints, the poll changes nothing and counts nothing against anybody, and the label button explains what to configure instead of 404ing or pretending to have bought postage. That is not a fallback path, it is the path -- most small shops will never hold a carrier API key, and a warehouse layer that only works with one is a warehouse layer for somebody else. The manifest is the third READ in this package and the strictest: /shipments/manifest?date=&carrier= is a fold over the parcels handed over on one day, grouped per carrier because that is the unit of handover, with a signature line under each pile, no prices at all (this document goes to a third party, and a carrier who can read the value of every parcel in the van has been handed a theft list), and NO way to change anything from the page -- a manifest you can edit after the van has left is not a manifest, it is a story about a van. It keys on shipped_on, which nothing in the box had ever written: system_order_fulfillment now stamps that date the moment it observes a shipment reach shipped, only when blank, so an operator who backdated a parcel keeps their date and the shop's own automation stops producing shipments that were never, on paper, handed to anybody. Tracking is one scheduled pass, system_tracking_poll, and its whole design is about the two kinds of silence: a carrier that cannot be asked (nothing configured, module missing, provider named that nobody installed) leaves every row untouched and counts NO attempt, so fixing the configuration drains the backlog with nothing to un-fail first; a parcel that cannot be READ counts one, and at three it stops being polled and starts being visible -- the same distinction system_scan_processor draws with `recoverable`, borrowed here under the connector contract's own word (`skip`) rather than spelled a third way. Hourly is the cadence: a carrier scan lands a handful of times a day so hourly is well inside the resolution of the facts, while a shop with parcels out is a shop whose customers are asking TODAY, and a nightly pass would make the answer to 'did it arrive?' up to a day stale exactly when somebody is standing there asking it. The carrier itself is a CONNECTOR, using the mechanism that already exists rather than a second one: connectors/manual.py is declared in this manifest for the shipments collection, resolved through object_packages.iter_connectors (escape-checked, package-relative, private overlay wins) and loaded by object_connectors.load_connector, so installing a real adapter is installing a package that declares the same collection. Its `reconcile` declines every tick on purpose and says why -- a parcel is not desired state, we cannot make a van arrive by wishing, and reading a carrier is time-driven work that belongs to a schedule. action_buy_label is one verb for both directions, because a return label is the same purchase with the addresses reversed and a second verb would be a second place for the credentials and the refusals to drift; unconfigured, it is a 409 naming carrier.provider (Stripe's precedent: the shop can see the button, so the button owes them a sentence they can act on), and with `manual` it records the tracking number the operator brought back from the counter plus the label PDF if they were handed one -- stored as evidence through object_user_files with a files row so it actually opens, a NEW file id per label rather than an overwrite, because the last label may be on a box somewhere. The attention count is parcels stuck in_transit past carrier.stuck_days (default 10), severity warning because nobody chose to put them there and the clock is running in a customer's inbox; it counts in_transit only, since `shipped` for a manual shop is every parcel forever and a band that is always lit is a band nobody reads. Two new doors: the manifest, and a plain /shipments index -- the count needed a page showing the rows it counted, and until now a shipment could only be reached by a URL you already knew.",
6 "compatibility": {
7 "dbbasic_object_server": ">=0.1.0"
8 },
9 "dependencies": ["app-orders", "app-views"],
10 "objects": [
11 {
12 "id": "hook_shipment_lines",
13 "path": "objects/hook/shipment_lines.py"
14 },
15 {
16 "id": "action_create_shipment",
17 "path": "objects/action/create_shipment.py"
18 },
19 {
20 "id": "system_order_fulfillment",
21 "path": "objects/system/order_fulfillment.py"
22 },
23 {
24 "id": "site_packing_slip",
25 "path": "objects/site/packing_slip.py"
26 },
27 {
28 "id": "site_pick_list",
29 "path": "objects/site/pick_list.py"
30 },
31 {
32 "id": "site_manifest",
33 "path": "objects/site/manifest.py"
34 },
35 {
36 "id": "system_tracking_poll",
37 "path": "objects/system/tracking_poll.py"
38 },
39 {
40 "id": "action_buy_label",
41 "path": "objects/action/buy_label.py"
42 },
43 {
44 "id": "system_shipment_attention",
45 "path": "objects/system/shipment_attention.py"
46 }
47 ],
48 "schemas": [
49 {
50 "collection": "shipments",
51 "path": "schemas/shipments.json"
52 },
53 {
54 "collection": "shipment_lines",
55 "path": "schemas/shipment_lines.json"
56 }
57 ],
58 "permissions": [
59 {
60 "path": "permissions/rules.json"
61 }
62 ],
63 "seed": [
64 {
65 "collection": "shipments",
66 "path": "seed/shipments.tsv"
67 },
68 {
69 "collection": "shipment_lines",
70 "path": "seed/shipment_lines.tsv"
71 },
72 {
73 "collection": "site_routes",
74 "path": "seed/site_routes.tsv"
75 },
76 {
77 "collection": "views",
78 "path": "seed/views.tsv"
79 }
80 ],
81 "migrations": [],
82 "connectors": [
83 {
84 "collection": "shipments",
85 "module": "connectors/manual.py",
86 "entry": "reconcile"
87 }
88 ],
89 "schedules": [
90 {
91 "id": "tracking_poll_hourly",
92 "object_id": "system_tracking_poll",
93 "schedule": "25 * * * *",
94 "description": "Ask the configured carrier where each parcel in flight is, and move the ones it reports delivered. Hourly, not nightly: a carrier scan lands a handful of times a day, so hourly is well inside the resolution of the underlying facts, while a shop with parcels out is a shop whose customers are asking about them today -- a nightly pass makes the answer to 'did it arrive?' up to a day stale exactly when somebody is standing there asking. Costs nothing on a box with no carrier configured, which is most of them: the pass declines, writes nothing and counts nothing. At 25 past so it does not collide with the top-of-hour crowd."
95 }
96 ],
97 "nav": [
98 {
99 "id": "shipments",
100 "label": "Shipments",
101 "path": "/shipments",
102 "blurb": "Every parcel that has gone out, with its carrier and tracking number",
103 "surface": "operator",
104 "group": "Warehouse",
105 "order": 510
106 },
107 {
108 "id": "pick_list",
109 "label": "Pick List",
110 "path": "/pick-list",
111 "blurb": "What to pull off the shelves for the orders waiting to ship",
112 "surface": "member",
113 "group": "Warehouse",
114 "order": 520
115 },
116 {
117 "id": "manifest",
118 "label": "Manifest",
119 "path": "/shipments/manifest",
120 "blurb": "One day's handover, per carrier, printable and signed for",
121 "surface": "operator",
122 "group": "Warehouse",
123 "order": 540
124 }
125 ],
126 "attention": [
127 {
128 "id": "shipments_stuck_in_transit",
129 "object_id": "system_shipment_attention",
130 "label": "Parcels not moving",
131 "path": "/shipments",
132 "group": "Warehouse",
133 "severity": "warning",
134 "nav_id": "shipments"
135 }
136 ]
137}