transfer: a non-container resource can be transferred beyond its on-hand/accounting quantity
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Start in src/zenflows/vf/economic_event/domain.ex, especially EconomicEvent.Domain.handle_insert/3 for transfer and the cited quantity update sections. Read the existing container checks and related transfer tests, then add coverage for transfers above the held quantity and exactly equal to it, including transferCustody and transferAllRights if their checks belong there. Done when invalid transfers are rejected with clear errors and valid boundary transfers pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
A transfer of a resource that is not a container does not check the event's resourceQuantity against the source resource's quantities. A provider can transfer more than they hold. The source resource's onhandQuantity and accountingQuantity then go negative, and the receiver gets the full amount.
In EconomicEvent.Domain.handle_insert/3 for transfer, the quantity checks apply only when res.container?. For a plain resource, the update then decrements both quantities by the event's quantity with no lower bound (L980-L990, L1023-L1029).
Example: a resource with on-hand 1, transfer of 5. The event is accepted, the source goes to -4 and the receiver's new resource holds 5.
Why it matters now
The marketplace (interfacer-medusa) is moving from one-unit listings to N units (interfacerproject/interfacer-gui#962, interfacerproject/interfacer-medusa#7). That PR now re-reads the on-hand quantity before every delivery and refuses an overdraw. But the ledger itself should not accept a quantity that does not exist, whoever the client is.
Proposal
For a non-container source, refuse when resource_quantity > accounting_quantity or resource_quantity > onhand_quantity, with errors in the style of the existing ones. For example: "the transfer events can't transfer more than the resource's accounting-quantity" / "onhand-quantity". The same check probably applies to transferCustody (on-hand) and transferAllRights (accounting). Add tests for 'more than held' and 'exactly what is held'.
Found while working on interfacerproject/interfacer-gui#962. Not reproduced against a running instance; read from the code at 91be858.
Generated by Claude Code
- Lingua principale
- Elixir
- Stelle
- 18
- Fork
- 4
- Merge medio
- 22g 17h
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di interfacerproject/zenflows
-
transfer into an existing resource hands the source resource's rights and custody to the receiverAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug workstream:authz-integration
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
-
workstream:authz-integration
Difficoltà 5/5 Più di una settimana Idoneità per principianti 5/100
interfacerproject/zenflows#74 · 12 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Allow users to register with email addressesForse di nuovo libera @protodeniz l’ha presa 1302 giorni fa e non c’è nessuna pull request aperta. Aperta
interfacerproject/zenflows#54 · 1 assegnatario ·
Tutte le issue di interfacerproject/zenflows
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
intellij-elixir/intellij-elixir#4938 ·
I maintainer di solito rispondono entro 1 giorno
-
Attribute selectors match elements without the attribute; [x^=''] matches everythingForse già presa @bardrop l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
expert-lsp/expert#1040 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
ash-project/ash_mysql#278 · 2 commenti ·
-
L: github:actions L: javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
dependabot/dependabot-core#17100 ·
I maintainer di solito rispondono entro 2 giorni