Submit

Back to the channels

#primate

  1. dreamreal feed subcribe https://primate.run/blog.rss
  2. dreamreal feed add https://primate.run/blog.rss
  3. nevet Error: No RSS/Atom feed found at https://primate.run/blog.rss
  4. dreamreal feed add https://primate.run/blog.rss
  5. nevet Added feed "Primate Blog" with 20 entries
  6. dreamreal feed subscribe https://primate.run/blog.rss
  7. nevet Subscribed to "Primate Blog"
  8. dreamreal blue: there you go
  9. blue thanks, dreamreal
  10. dreamreal blue: I was thinking of publishing the backend rest services to rest.bytecode.news, which would mean that I could actually handle github updates live instead of polling for them
  11. dreamreal and that would give UIs a consistent thing to hit, but it means that I need to harden some aspects of the services while I'm at it
  12. blue I'm... not sure why that is the case; because you can't do it without a universally reachable url?
  13. blue anyway don't call it REST: call it api, would be my call. rest exposes the technically implementation, which is irrelevant
  14. dreamreal true enough
  15. dreamreal but what do you mean: why is that not the case for... what?
  16. dreamreal if we have api.bytecode.news, github can indeed post updates to a consistent URL
  17. dreamreal and then we can stop polling github for updates
  18. blue yes that was my point. if you don't 'expose' the backend in some universally reachable way, you can only do polling
  19. dreamreal I feel like we're saying the same things but different
  20. blue yes
  21. dreamreal so let's reset: my thought is, get api.bytecode.news online ASAP. Since it allows anonymous posts to the content, that means we need to make sure that *write* operations are constrained where possible and have *limits* where constraints aren't possible, like content posting
  22. blue dreamreal: idea; if you have api.bytecode.news, then... other subdomains feel a bit overengineered. I'm truly questioning the usefulness of primate/nextjs here vs just a frontend
  23. blue why the indirection? what's the value?
  24. dreamreal blue: https://enigmastation.com/2014/07/09/repost-some-of-what-id-wanted-to-do-for-theserverside/ is the mindset I had
  25. dreamreal Ignore the JCR bit, JCR is great but effectively dead and gone
  26. dreamreal (not really, but it's a lot for the value it would provide here)
  27. blue yeah I'm down to frotnends now
  28. blue I read REALLY fast -- faster than you :P
  29. dreamreal it's not a race, newsom
  30. blue yeah the problem still remains the indirection. a react.bytecode.news might make sense... I'm not sure nextjs/primate
  31. dreamreal my thought was that most users would use bytecode.news or www.bytecode.news
  32. dreamreal so whatever fulfilled the interface requirements best would be that
  33. blue I understand that. I'm just still convinced about having two backends, especially if you have api.bytecode.news
  34. blue not convinced*
  35. blue but maybe.. hm.
  36. dreamreal Yeah... I ... don't know what the "other backends" would be
  37. dreamreal There's a design question here I'm not qualified to answer
  38. blue so there's a real tension here, and the tension is there. normal web app applications typically don't use APIs, at least directly
  39. blue they use bespoke paths, which might or might not compose over APIs
  40. blue you follow?
  41. blue api.bytecode.news is interestingly not for a web app... but for someone writing clients for nevet
  42. blue interesting*
  43. blue of course, a web app COULD use it. but it would typically also access a DB in a more direct fashion
  44. blue things like transactions... are harder to realise if you have a backend solely relying on an API
  45. dreamreal I mean... this is just AJAX stuff
  46. dreamreal I'm saying that front ends would use AJAX to hit the api
  47. blue I realise this is ajax stuff. but say I want to have a route bunlding SEVERAL API calls in one. how do I transactionalise this?
  48. dreamreal Admittedly I'm probably BADLY out of date...
  49. dreamreal I don't know! But the API endpoints were designed to BE transactional endpoints - you wouldn't normally WANT to bundle them separately
  50. blue in which case, an extra backend such as nextjs/primate is an indirection layer with zero added value
  51. dreamreal unless the front end NEEDED it, I suppose, gut ... again, this is not my area of expertise at all
  52. dreamreal I had to look up the term AJAX to remember it!
  53. blue yeah, we don't use that anymore. just REST/JSON
  54. blue but let me give you an example
  55. dreamreal sure
  56. blue DELETE /admin/comments/{id}
  57. dreamreal okay?
  58. blue say the frontend has the ability to select several comments for deletion. the primate route would get the ids. what does it do now?
  59. blue in a normal application, this would be transactionalised
  60. blue now you COULD say, I'll just create another endpoint where you can delete several comments at once, fair
  61. blue but there are other cases that are less straightforward
  62. dreamreal ah. Right. Okay, I'd say that THAT BEHAVIOR is actually out of spec. And if behavior like that SHOULD BE in spec, we need to create a backend endpoint for it. That's part of why I want to get the API public and out there as soon as possible.
  63. blue I guess the point I'm trying to make is... building web apps on top of APIs is possible, but typically, you do need transactions to give you the bespoke abstraction level that isn't available over API call composition
  64. blue "I want to delete the comments but also inform the user about it, and I want it as a binary operation -- either everything or nothing"
  65. dreamreal yeah, well, I've been trying to design the API such that the response to that is "cool story bro the API is right there." And the other thing about nevet is that it's VERY literally designed on a messaging platform: you could, in fact, connect to the underlying mechanisms if you had access and do EXACTLY THAT.
  66. dreamreal The API isn't designed to be composed; it's designed to be "these are the things you can do," not elements of transactions *but transactions*.
  67. blue yeah I understand
  68. blue that however, makes frontends very rigid
  69. blue and maybe that's intended
  70. dreamreal it is, for better or for worse
  71. blue but frontends aren't supposed to transport API/backend logic 1:1
  72. dreamreal well, there are different design philosophies, and tradeoffs are definitely involved
  73. dreamreal I didn't want the ability of a front end to work to depend on how well a given developer could compose operations
  74. dreamreal the operations work or they don't, so the front end's "works or not" is based on whether it interacts with those sets of operations
  75. blue so from this perspective, I *think* having a secondary backend is totally an overkill
  76. blue that is: rather than using primate, I would be taking your reference and rewriting it in svelte or react
  77. dreamreal the front end, in the end, is an ingress/egress adapter itself: the controllers *quite literally* translate the HTTP data into operational types, and these get fed into the event system, *just like* IRC strings do, discord, slack. It's all the same engine. the factoid operations work over HTTP just like they do IRC - it's *very* literally the same code, there's not an HttpFactoidOperation, just a
  78. dreamreal GetFactoidOperation that knows how to translate strings into factoid requests (for stringly communications) and how to respond to factoid requests
  79. dreamreal *nod*
  80. blue but also, this might result on having to reiterate on the API quite a lot; see comments example: if you want to be able to delete several comments, sending n API calls is a nightmare
  81. blue result in*
  82. blue any composed operation in the frontend that has no API correspondence... would trigger either "no, you can't do that" or "wait, I need to add this to the API"
  83. blue I'm telling you from experience this COULD become rather unpleasant
  84. blue different proposition:
  85. dreamreal Oh, you're not wrong, at all. But again, this is why I was trying to involve people with UI experience early and often, and I even said "please give me feedback" because we expect the surface to mutate until it fits the needs well
  86. blue the primate backend is a FULL-STACK app *using* nevet. in which case, it has its own database. but there might be a lot of data repetition involved
  87. blue so the primate backend/app can compose however much it wants, using nevet API primitives
  88. dreamreal *nod* And I'd say that as a strategy, that could *work* but would be suboptimal - a front end should NEVER EVER talk to nevet's database, because the fact that nevet uses postgresql is *incidental*. I could easily swap it for an IMDG (and as soon as I convince gigaspaces to give me a license, you better believe I'm doing it) or mongodb.
  89. blue it's more than that. primate would enterain its own db, completely separated from nevet's pgsl
  90. blue entertain*
  91. dreamreal if it did so, that'd be fine. I wouldn't care.
  92. dreamreal The key is that they'd be SEPARATE systems, and the system of record would be nevet.
  93. blue but I'm not a super huge fan of data duplication
  94. dreamreal (I used to work for gigaspaces; nati shalom is a good friend.)
  95. dreamreal So is gil tene, actually
  96. blue .ils?
  97. blue they do sound like it
  98. dreamreal aye
  99. blue maybe the golden path is the primate app acting as a sort of medial cache here
  100. dreamreal ... for primate, sure
  101. blue for data
  102. dreamreal Like I said, my goal was to provide the system of record and the API as a baseline; how it's used isn't important to me AS LONG AS nevet remains the system of record
  103. blue I'd need to think how to make that works, but things like posts/comments would be cached
  104. blue work*
  105. blue deleting them.. well, there it becomes hard because you need the source of truth for that
  106. blue so for example
  107. dreamreal Well, primate could do that as a transaction: cascade each one as an op through nevet in order. failures would radiate outward depending on what they were (not found isn't the same as "could not delete.") But if the API *needs* a "delete multiple things" then maybe that's a need that gets addressed.
  108. blue `GET /posts/search` this could be well cached by the primate database, with periodic resync
  109. dreamreal I'd think search would be one of those things caching would serve LEAST, but eh
  110. dreamreal the way I see it, primate's local DB would be a cache of *actual known data* - like, hit a slug, that's a known thing, you can cache that (and hope it doesn't get updated after caching).
  111. blue well, consider this
  112. blue for me as an app developer, doing this is ideal: `const posts = await Post.find({ where: ... });`
  113. blue this is typically a primate ORM query
  114. blue I can build an interface around it, with querying for certain aspects for a post, limiting, criteria, etc.
  115. blue now, one things I've been working on which would be already beneficial is the generation of the openapi client
  116. blue in which case, I'd already have at least a client that can do API calls, as documented
  117. blue so if the operation id is searchPosts, it'd be `client.searchPosts` instead
  118. blue this call, however, is EXPENSIVE. it's an API call
  119. blue it's possibly also not very flexible, so maybe doing a GET posts periodically instead, and caching it in my own db, is faster
  120. phaleth does that call enforce pagination?
  121. dreamreal in the openapi call, yes
  122. blue there is a `page` param, yes
  123. blue in both GET posts and GET posts/search
  124. phaleth then can put max limit to the page size in order to not make it expensive
  125. blue the expensive part is the extra web request
  126. blue that means every primate frontend<>backend request is essentially two web requests
  127. phaleth well, that's the problem of the web
  128. blue also, if I ever wanted to stream posts... or dynamically update the page..
  129. phaleth provide bson API or some sort of gRPC, but that's all you can do
  130. phaleth cause there are two big problems in programming, and you can avoid the second one: cache invalidation problem
  131. blue yeah I thought of gRPC or json rpc, but currently nevet is a simple JSON api, and there's charm in that simplicaition
  132. blue and yes, cache invalidation is an absolute dumpster fire catastrophe, I 100% agree
  133. blue but I'm worried about performance, perhaps prematurely here
  134. blue my mind says: "if there's an API, and the API is all the composition we get, why not query it directly then? what's the use for a primate backend?"
  135. blue just issue `fetch` directly to api.bytecode.news and be done with it. no real need for primate
  136. phaleth in any case we can always employ memcached or something like that but only when that starts making any sense, but I'd not worry even if there's traffic already
  137. phaleth of which there is currently none
  138. blue ya
  139. dreamreal ew
  140. dreamreal memcached
  141. dreamreal ew
  142. blue maybe I'm chasing imaginary ghosts
  143. dreamreal ew
  144. dreamreal memcached--
  145. nevet memcached now has karma of -1.
  146. dreamreal what a POS
  147. dreamreal memcached--
  148. nevet memcached now has karma of -2.
  149. blue but APIs aren't built for performance... they're built for inter-app communication
  150. phaleth for sure one can shoot themselves in the foot with memcached, but again avoid the second big problem of programming if possible
  151. blue you didn't stay the first one
  152. phaleth what you can do is make the application layer scalable by not storing sessions server side
  153. blue state*
  154. phaleth eh
  155. phaleth of course it's naming, can't solve that one
  156. blue ah. thought you'd say rust
  157. blue :P
  158. phaleth heh
  159. blue which btw
  160. blue ew
  161. blue rust
  162. blue ew
  163. blue ew
  164. blue rust--
  165. nevet rust now has karma of -1.
  166. blue what a PON
  167. blue rust--
  168. nevet rust now has karma of -2.
  169. blue done!
  170. dreamreal karma chronos
  171. nevet chronos has karma of 3.
  172. dreamreal nevet's karma database still isn't old enough to decay yet :D
  173. blue true
  174. dreamreal karma decays so "old karma" affects you less than new karma
  175. blue rust--
  176. nevet rust now has karma of -3.
  177. blue *patpat* good boy nevet
  178. dreamreal nevet is in the "ignore list" for karma automatically, too :D
  179. blue phaleth: dreamreal had a cool suggestion earlier: https://github.com/primate-run/primate/issues/250
  180. nevet Support for HEAD · Issue #250 · primate-run/primate
  181. blue which I'm probably gonna add to .37
  182. blue as an opt-in config option: http.autoHead: p.boolean.default(false)
  183. blue oh man I HATE camelcase
  184. phaleth yeah, web is broken when services respond with 404 on HEAD requests
  185. blue 16:45 < phaleth> of course it's naming, can't solve that one
  186. blue +1
  187. blue I need to update the config page
  188. blue https://primate.run/docs/configuration
  189. blue https://github.com/primate-run/primate/blob/master/packages/core/src/private/config/schema.ts
  190. blue those aren't synced
  191. blue you know what, maybe I should just add jsdocs atop that and general that page automatically
  192. blue generate*
  193. blue because I know I will never remember to update the docs whenever I add or remove a config option
  194. phaleth yeah, clankers are getting confused now
  195. blue this is another case against ai, true
  196. blue emergent technology is practically useless
  197. blue so everyone just regenerates old, outdated code
  198. phaleth with the same old bugs
  199. blue we had it earlier with nevet, I was querying it for an HTTP RFC, it gave me an old, obsolete one instead of the newer one
  200. blue it's almost like AI hinders progress
  201. blue it will give you reliable info about express, but garbage about primate
  202. phaleth AI straight up hinders progress
  203. blue dreamreal: how far are we from nevet informing us here in the channel about issues, issue comments, PRs, commits and commit comments occuring on GH?
  204. dreamreal if it can poll, about two minutes
  205. dreamreal yeah, webhooks needs the api.bytecode.news
  206. blue ok, I'll wait for that then
  207. blue those can be reliably tested, btw
  208. blue in the webhook conf screen ongh
  209. blue on gh*
  210. blue there's like a test event
  211. blue dreamreal: https://github.com/terrablue/gpbot/blob/master/routes/index.js
  212. blue if you need reference, here is how gpbot used to do it. I only added the events I was interested in
  213. phaleth last night at the exact same moment 47.7 clankers have been misled https://images4.imagebam.com/2e/60/e5/ME1AZ46G_o.png
  214. blue which was release, issues, push, commit_comment and ping
  215. blue phaleth: LOL
  216. blue https://github.com/terrablue/gpbot/blob/master/routes/index.js#L25-L27
  217. blue I do believe that htia function can be replaced by https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromHex today
  218. nevet Uint8Array.fromHex() - JavaScript | MDN
  219. blue which is so nice!
  220. blue dreamreal: java equivalent: byte[] bytes = HexFormat.of().parseHex("CAFED00D");
  221. blue (need `import java.util.HexFormat`)
  222. phaleth not too sure I ran the right command https://images4.imagebam.com/de/91/9f/ME1AZ705_o.png
  223. bot <discord:blue> Looks good
  224. bot <discord:blue> But you can also drop the mvnw nonsense and use maven directly
  225. phaleth maven: not found
  226. bot <discord:josephbottinger> mvn and mvnw
  227. phaleth mvn: not found
  228. blue phaleth: https://gitea.repopack.app/jottinger/bytecode.news/commit/3162d8ed1ae5d7d789b7005468e144bc44f3cb87
  229. blue dreamreal: fyi https://github.com/terrablue/bytecode.news/commit/3162d8ed1ae5d7d789b7005468e144bc44f3cb87
  230. blue phaleth: I'll move that jottinger org to `blue`, on gitea, if you don't mind
  231. blue it would be nice if you could include this primate app in your deployment, and it would be able to reach the nevet backend
  232. blue so three nspawn machines: pgsl, nevet, and primate
  233. blue the only one that needs exposure to the world is the primate one
  234. blue is this possible?
  235. blue regarding mvn, you need an image that contains mave
  236. blue maven*
  237. blue phaleth: https://dpaste.com/GWFBVPGA3
  238. phaleth yeah, trying to make it work with the zip first
  239. blue `maven:3.9.12-eclipse-temurin-25`
  240. phaleth dpaste.com blocks my proxy, but don't worry, it builds
  241. blue dreamreal: the most relevant part of that integration is the otp/request route: https://github.com/terrablue/bytecode.news/blob/master/apps/primate/routes/otp/request.ts
  242. blue it takes JSON from the frontend, verifies it's an email, then sends it to nevet
  243. blue most of this is boilerplating that will later be replaced by the opencpi client
  244. blue so: client.verifyOtp({ email })
  245. blue should replace https://github.com/terrablue/bytecode.news/blob/master/apps/primate/routes/otp/request.ts#L15-L23
  246. blue ... and this probably shouldn't be a GET route
  247. blue anyway, I just need something for phaleth to work with. once we have that threeway setup, I can get productive with it!
  248. blue expect... greatness!
  249. phaleth turns out nevet runs on postgres 18.3 https://upaste.de/raw/5gH
  250. blue very nice
  251. phaleth yeah, it keeps crashing
  252. blue lol
  253. blue phaleth: https://gitea.repopack.app/blue/bytecode.news/
  254. phaleth actually, the connection failed, so I
  255. phaleth I'll try postgres 17.9 tomorrow
  256. blue ok
  257. phaleth gotta go now
  258. blue ciao
  259. phaleth bye
  260. blue dreamreal: https://github.com/primate-run/primate/issues/251
  261. nevet Proposal: Add `AppFacade#env(key: string)` · Issue #251 · primate-run/primate
  262. blue chovy: I believe automatic env loading is also something you have expressed interest in in the past
  263. blue jreicher: if you feel like commenting this, you're welcome! https://github.com/primate-run/primate/issues/251
  264. nevet Proposal: Add `AppFacade#env(key: string)` · Issue #251 · primate-run/primate

Search posts