Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have AI gen some contributor docs, docstrings, comments #1370

Open
bitnom opened this issue Mar 31, 2024 · 18 comments
Open

Have AI gen some contributor docs, docstrings, comments #1370

bitnom opened this issue Mar 31, 2024 · 18 comments

Comments

@bitnom
Copy link

bitnom commented Mar 31, 2024

If you're someone who knows gun's code structure very well, you could go back and forth with an LLM, and generate some pretty helpful contrib docs & code comments in less than an hour. It's needed for contributions. There are too many issues, and people who want to help don't feel like they can without reverse engineering.

#1362 (comment)

I have a big project I would like to use gun for, but the issues are scary to read through. Must resolve. This might be my favorite code repo of all time. I wish I could use it with negligible fear.

@crunchysteve
Copy link

Yes, totally agree! Gun.js could save the world, it is THE zero backend solution for any application, but the code is unreadable by newcomers and the documentation doesn't help enough with this.

@fitouch
Copy link

fitouch commented Mar 31, 2024

Same here.

@amark
Copy link
Owner

amark commented Apr 4, 2024

@bitnom @crunchysteve @fitouch happy to do podcasted screencalls with ANYONE reviewing & explaining code.

(an aside problem: (A) somehow I broke GitHub notifications, so I often completely miss issues/PRs until they're mentioned in the http://chat.gun.eco , so helping me get that fixed would improve my response time to GitHub (B) I lost control of being able to keep up with lower priority bugs when we spiked from 72K mau -> 26M + my life got demolished separately, so I'm still trying to finish high priority bug fixes around scaling but barely have had time, tho I think I'm entering into a stage of my life where that's calmed down and can hope hope hope back from legal/etc. to coding next month. EITHER WAY, GETTING ME ON SCREENCALLS IS THE BEST WAY TO GET MY ATTENTION, I usually reply fastest by DMing me on Twitter, pretty much every other social I have notifications turned off... even telegram now. Tho even Twitter is starting to get invaded. The protocol is to just frequently [please do this!] ping me saying "free for a code call?" randomly and within a day or few usually it works.)

@bitnom
Copy link
Author

bitnom commented Apr 9, 2024

@bitnom @crunchysteve @fitouch happy to do podcasted screencalls with ANYONE reviewing & explaining code.

(an aside problem: (A) somehow I broke GitHub notifications, so I often completely miss issues/PRs until they're mentioned in the http://chat.gun.eco , so helping me get that fixed would improve my response time to GitHub (B) I lost control of being able to keep up with lower priority bugs when we spiked from 72K mau -> 26M + my life got demolished separately, so I'm still trying to finish high priority bug fixes around scaling but barely have had time, tho I think I'm entering into a stage of my life where that's calmed down and can hope hope hope back from legal/etc. to coding next month. EITHER WAY, GETTING ME ON SCREENCALLS IS THE BEST WAY TO GET MY ATTENTION, I usually reply fastest by DMing me on Twitter, pretty much every other social I have notifications turned off... even telegram now. Tho even Twitter is starting to get invaded. The protocol is to just frequently [please do this!] ping me saying "free for a code call?" randomly and within a day or few usually it works.)

I'm going to make time for this as soon as I'm done resolving the cards currently on my clickup board. I should be through it by the end of the week.

@fitouch
Copy link

fitouch commented Apr 9, 2024

@amark @bitnom @crunchysteve I'd like to help with cleaning up and improving the code. Additionally, I'm interested in developing it in TypeScript and creating a more user-friendly storage adapter for native mobile applications. Right now the code is hard to understand what it’s doing.

@bitnom
Copy link
Author

bitnom commented Apr 12, 2024

@amark @bitnom @crunchysteve I'd like to help with cleaning up and improving the code. Additionally, I'm interested in developing it in TypeScript and creating a more user-friendly storage adapter for native mobile applications. Right now the code is hard to understand what it’s doing.

I've been thinking about this as well. Once everything is typed, transpiling and porting are within reach as well. There has yet to be a successful port that I'm aware of.

@amark
Copy link
Owner

amark commented Apr 12, 2024

Back in the USA @bitnom @fitouch @crunchysteve best to DM me on Twitter cause that triggers a notification for me. Or WhatsApp.

http://gun.eco/docs/Porting-GUN many work, by "successful" what are you measuring? For me, it's performance.

There was notabug's typescript gun that handled 2M/monthly users at one point, and a new project called top-gun. If you're interested in typescript, prob better to do calls with those people, as I have 0 interest in using typescript myself and won't want to be distracted with it on calls, just as heads up.

@bitnom
Copy link
Author

bitnom commented Apr 12, 2024

Back in the USA @bitnom @fitouch @crunchysteve best to DM me on Twitter cause that triggers a notification for me. Or WhatsApp.

http://gun.eco/docs/Porting-GUN many work, by "successful" what are you measuring? For me, it's performance.

There was notabug's typescript gun that handled 2M/monthly users at one point, and a new project called top-gun. If you're interested in typescript, prob better to do calls with those people, as I have 0 interest in using typescript myself and won't want to be distracted with it on calls, just as heads up.

I wouldn't want to talk about TS.

@fitouch
Copy link

fitouch commented Apr 12, 2024

Back in the USA @bitnom @fitouch @crunchysteve best to DM me on Twitter cause that triggers a notification for me. Or WhatsApp.

http://gun.eco/docs/Porting-GUN many work, by "successful" what are you measuring? For me, it's performance.

There was notabug's typescript gun that handled 2M/monthly users at one point, and a new project called top-gun. If you're interested in typescript, prob better to do calls with those people, as I have 0 interest in using typescript myself and won't want to be distracted with it on calls, just as heads up.

I'm currently not focusing on TypeScript, but I do plan to eventually address it. I'm interested in implementing Gun.js across different programming languages like Swift, Kotlin, etc. Based on your suggestion, should I start by looking into the 'Porting-GUN' documentation to facilitate this?

BTW I don't have Twitter anymore, what's your WhatsApp #?

@amark
Copy link
Owner

amark commented Apr 15, 2024

mY w HAT numb ER iz ONEPLUS USA then seven hundred sixty. Six ate 9. 2 four 6 ate. (lol, I asked AI to extract the # and it did, no problem. I guess its useless to combat/fight bots. lol)

Yes, Porting-GUN best.
Highest priority would be Rust.
Here were my learning attempts: https://gun.eco/docs/Rust
Martti was about to attempt the PANIC tests which is probably farthest along port perhaps can continue from https://github.com/mmalmi/rod (fork tho)

Back from Mexico, DM me & we'll do a call!
@fitouch @bitnom @crunchysteve

@crunchysteve
Copy link

I have spent the last 10 years, since retiring from broadcasting (audio producer), learning C++ and am coming to the conclusion in recent months that I NEED to learn Rust. Even for the microcontroller stuff I play with! I think from cursory sandbox playing, Rust is "the one ring to rule them all" and agree, the first port of gun needs to be to Rust. Second port, yeah, C++, for back compatibility.

While I don't get what the Javascript code is doing (JS breaks my brain completely. (I have tried, failure is no shame, I accept that minor learning difficulty), I do understand the basics of how Gun works and what a systems level language could do for Rust. I've been following the whole peer-to-peer internet thing for a few years now and it's not too big a call to say that the fate of civilisation rests in breaking the corporate control over network services. I genuinely believe that Gun is the tool that can give social networking back to the people and put the data miners and social engineers like Zuck and Musk back in their boxes.

Taking Gun to a systems level environment, like Rust, has "mum and dad coder" accessibility implications that C++ simply can't deliver. Garage coders are the people who can balance the corporate/capitalist internet and give is more privacy and protection from the knid of manipulations that first become "mainstream public" with Cambridge Analytica.

I'm not a skilled coder, I've just spent a lifetime working with tech and made it my job to understand the deeper workings of my tools of trade. This has made me a tech watcher, with my news media background also giving me an understanding of the social implications of distributed tech versus centralised tech. Centraised tech is "IBM's Toaster." Decentralised, true peer-to-peer tech, is "Microsoft's toaster," everybody has one, they can be a bit temperamental, but they're mostly interoperable and we mostly know what's inside. (I use Apple's platforms, but I can't deny that the historical importance of the PC-AT and its descendents!)

From a social standpoint, and with a dream of even handheld and desktop hardware being the actual network infrastructure with some sort of LoRa/WiFi hybrid replacing cellular, Gun is placed ahead of the curve to be able to build an internet where we are all our own server. Yeah, I'm a thinker rather than an actor, but Gun blows my mind for its potential for the next big tech revolution. No pressure, but don't drop the ball! :-)

I'll bow out now, and keep watching. Just my 2 cents worth (and in AU$ at that) but I'm impressed, even if I struggle to read even the basic bits of the code. Gun or something like it may just break the back of corporate control of the internet. Pass the popcorn, my money's on you right now, Mark.

@bitnom
Copy link
Author

bitnom commented Apr 21, 2024

mY w HAT numb ER iz ONEPLUS USA then seven hundred sixty. Six ate 9. 2 four 6 ate. (lol, I asked AI to extract the # and it did, no problem. I guess its useless to combat/fight bots. lol)

Yes, Porting-GUN best. Highest priority would be Rust. Here were my learning attempts: https://gun.eco/docs/Rust Martti was about to attempt the PANIC tests which is probably farthest along port perhaps can continue from https://github.com/mmalmi/rod (fork tho)

Back from Mexico, DM me & we'll do a call! @fitouch @bitnom @crunchysteve

is rust rly necessary? I would be even more inclined to use something like zig, which I have no problem writing. When I look at Rust code, I feel like I'd rather be getting a root canal than looking at it. Not that I don't understand the benefits. I do (mostly) but I question the ultimate worth in the grand scheme of things. Is it rly THAT much more safe than if I use zig? I have my doubts. One does hope to finish the code they start, someday.

@amark
Copy link
Owner

amark commented Apr 25, 2024

thanks @crunchysteve , would love your help tho! The 2 resources I pointed to make my code be less scary :P

@bitnom unfortunately it just seems about popularity - since GUN is an embedded database, having a library in the most popular of server side langs, makes it easier for other devs to adopt - else, they have to make their own interface, but then its no longer embedded (you lose performance, etc. etc. lot more work to integrate, etc.)

@bitnom
Copy link
Author

bitnom commented Oct 11, 2024

Things have changed since I originally posted this issue...

https://github.com/firesight-ai/amnesia-machine-js
https://github.com/firesight-ai/amnesia-machine-py

  • Using AI to write code has become a meme, but people like ThePrimeagen who hate on it are wrong. Articles come out about copilot and such reducing productivity. Idk how true that is but I know most developers who are using LLMs are not using the state-of-the-art tools (Multi-agent tool users) now available to us.
  • We now have what it takes to competently generate entire codebases. The two repos I linked (amnesia-machine-js & amnesia-machine-py) were entirely generated. Of course, it wasn't done in 0 or 1 shot. It's a collaborative, iterative process best managed by a competent software engineer. I made those two repos very quickly. I'm sure there are changes that could or should be made to them but that's beside the point.
  • LLMs benchmark highest on Python.
  • Gun needs a refactor (For a few relatively obvious reasons) and a port to something more performant. You decided on Rust. I don't like it, but it doesn't matter much.
  • Once the AI has helped port something to Python, it is then in a format/shape the LLM can most easily work with (And document), since what is generated is mostly the result of their training & fine-tuning.

Those two example repos I linked were created casually, over the course of about 3 hours.

Plan of Attack

  1. Use AI to separate Gun into multiple modules and recode/refactor (Javascript). The separation part is relatively trivial since Gun is already modular. How it's modularized will of course change (By will of the LLM), which is fine.
  2. Use the AI to port each refactored JS module to Python.
  3. Use the Javascript/Python module pairs as a base for the LLM to better reason about Gun's code (This is the magic step)
  4. Optionally: fine-tune a model on the original Gun code and JS/PY pairs. This might improve ability to port to other languages as well. My guess is it would. Would it outperform the strongest base models? Maybe.
  5. Have the AI assist in document generation, porting to Rust, and whatever else.
  6. Profit...

@mblaney
Copy link
Contributor

mblaney commented Oct 12, 2024

thanks for putting some time into this @bitnom I like the modular approach. I agree that Gun needs a refactor so if this produces something reasonable then that it great. I'm less interested in the language ports after that, but want to see a rock solid JS version first.

If you just refactor the existing code into readable modules I'm worried existing design problems might get brought along with it. To avoid that it might be worth getting the refactored JS to pass a refactored version of the tests? I would be interested to see what the smallest subset of code and tests look like together, and then we could discuss a way forward from there.

@bitnom
Copy link
Author

bitnom commented Oct 16, 2024

thanks for putting some time into this @bitnom I like the modular approach. I agree that Gun needs a refactor so if this produces something reasonable then that it great. I'm less interested in the language ports after that, but want to see a rock solid JS version first.

If you just refactor the existing code into readable modules I'm worried existing design problems might get brought along with it. To avoid that it might be worth getting the refactored JS to pass a refactored version of the tests? I would be interested to see what the smallest subset of code and tests look like together, and then we could discuss a way forward from there.

Of course, tests are most important. I have a system in-place for auto-iterating on tests and running them for feedback. I only await a bit of additional funding to free (soon) for such side-projects as this, to accommodate the 10x more resources removing that much human from loop will consume. However, I should be able to start this weekend with a subset as you suggested.

The main reason for the Python port is purely to increase accuracy generating for gun.js (Or other). The point about design problems is well-taken. I'm sure (At least I hope) the community will help us spot any bad directions once this gets ramped up a bit more.

Will keep moving it forward and provide updates.

@mblaney
Copy link
Contributor

mblaney commented Oct 16, 2024

thanks for putting some time into this @bitnom I like the modular approach. I agree that Gun needs a refactor so if this produces something reasonable then that it great. I'm less interested in the language ports after that, but want to see a rock solid JS version first.
If you just refactor the existing code into readable modules I'm worried existing design problems might get brought along with it. To avoid that it might be worth getting the refactored JS to pass a refactored version of the tests? I would be interested to see what the smallest subset of code and tests look like together, and then we could discuss a way forward from there.

Of course, tests are most important. I have a system in-place for auto-iterating on tests and running them for feedback. I only await a bit of additional funding to free (soon) for such side-projects as this, to accommodate the 10x more resources removing that much human from loop will consume. However, I should be able to start this weekend with a subset as you suggested.

The main reason for the Python port is purely to increase accuracy generating for gun.js (Or other). The point about design problems is well-taken. I'm sure (At least I hope) the community will help us spot any bad directions once this gets ramped up a bit more.

Will keep moving it forward and provide updates.

amazing, thanks again this all sounds good. The design problems I've seen should be easy to spot if the starting point and iterations on that are all small enough. I'm happy to help with that.

@amark
Copy link
Owner

amark commented Oct 19, 2024

always love more GUN ports or alt JS implementations.

make sure to add their repos to https://gun.eco/docs/Porting-GUN

I challenge you on the perf ;) tho, GUN hits 10K chats/sec on 10 year old Air mocha test/panic/chat.js or ~70K on M1, that's why the codebase is the way it is, non-feature-complete RUST does about the same speed.

What would be helpful for me & the community tho, is if you could apply these efforts towards THE Render engine instead, there's 3 volunteers working on it now and the sooner we can get it as a stable product out the better. DM me on twitter if willing to help there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants