0.3.0: freeform client fields and a payee - #2
Merged
Merged
Conversation
…e out moshcode's /client keeps contact details the way they arrive — a comma form for what you pasted out of a signature, --a.b dotted flags for everything else, and no fixed field list. This model had columns and nothing else, so moving a client out of ~/.moshcode/business.json would have dropped every field nobody predicted. A lossy migration is one nobody should run, which is why the delegation in moshcode is still behind a flag. This is the half that had to exist first. billing client add "Acme Inc", https://acme.com, +1-555-0100 billing client add acme --contact.telephone +1-555-0100 --contact.name Jane billing client payee acme solana:9xQe... The comma form reads by shape rather than position, because nobody's signature comes in a fixed order, and a segment nothing recognises is kept as a note rather than dropped — losing a line somebody pasted is worse than filing it imprecisely. Any dotted flag sets that path and merges onto what is there, so setting one field cannot drop the rest. An *undotted* unknown flag is still an error: freeform fields must not turn every typo into a silently accepted one. setPath refuses __proto__, constructor and prototype. These paths come straight off a command line, so --__proto__.x has to be a field called __proto__ and not a write to Object.prototype. There is a test that asserts the prototype is clean afterwards. payee is recorded, never guessed. A bare address with no chain: prefix and no --chain is filed as "unknown" rather than assumed, and `client payee acme` with no address is refused rather than clearing the one already there — a typo must not silently change where money goes. `invoice render --format json` carries it, which is how an outside payment rail asks where to settle; moshcode's /payments stays where it is and reads that. `billing import` carries the lot: every key moshcode kept that has no column here travels as-is, and the columns that do exist are not duplicated into fields. 129 tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The half that has to exist before moshcode's
/clientcan move out.moshcode keeps contact details the way they arrive — a comma form for what you pasted out of a signature,
--a.bdotted flags for everything else, and no fixed field list. This model had columns and nothing else, so moving a client out of~/.moshcode/business.jsonwould have dropped every field nobody predicted. A lossy migration is one nobody should run, which is why the delegation in moshcode is still behindMOSHCODE_EXTERNAL_BILLING.billing client add "Acme Inc", https://acme.com, +1-555-0100 billing client add acme --contact.telephone +1-555-0100 --contact.name Jane billing client payee acme solana:9xQe...The rules that earned their lines
setPathrefuses__proto__,constructor,prototype. These paths come straight off a command line, so--__proto__.xhas to be a field called__proto__and not a write toObject.prototype. There is a test asserting the prototype is clean afterwards.chain:prefix and no--chainis filed asunknownrather than assumed, andclient payee acmewith no address is refused rather than clearing the one already there — a typo must not silently change where money goes.invoice render --format jsonnow carries the payee, which is how an outside payment rail asks where to settle. moshcode's/paymentsstays where it is and reads that.billing importcarries the lot: every key moshcode kept that has no column here travels as-is, and the columns that do exist are not duplicated intofields. There is a test for exactly that round-trip.129 tests. This is also the first release to go out through the new
publish.ymlrather than by hand.🤖 Generated with Claude Code
https://claude.ai/code/session_01KVUZsx4WBZK5rnJJFGgwF5