#JShell project for Tj-Bot!

1 messages ยท Page 7 of 1

sterile crest
#

It can become spaghetti if we don't approach correctly

compact holly
#

but grpahana for us would be a.. bonus feature

#

we survived without it

#

it that subsystem fails for whatever reasons, we will be fine

#

if it's designed in a modular way like that

sterile crest
#

I hate that I couldn't find where jshell was invoked manually in the server

#

I fr checked bots, spam, chitchat, questions

#

Maybe I'm blind, I couldn't find it

compact holly
#

yeah, you don't have diagnostic tooling

#

you don't have that one faulty session to investigate

#

you are not even aware where it happened

#

and why

#

what was the input.. etc

sterile crest
#

We don't even log it in the logging channels that somebody invoked a command:(

compact holly
#

this can all be improved

#

for example sessions that failed, errored out, could be perserved for 14 days

timber mirage
sterile crest
#

Yes kinda

compact holly
#

so if nothing else, you can manually play with them

sterile crest
timber mirage
compact holly
#

you kinda want everything, because currently it's hard to triage and reproduce bugs

#

and investigate

#

because it's just random sessions being spawned and killed

#

so if there is issue, you only have logs

#

logs are improved now tho, right?

sterile crest
compact holly
#

that's easy, pick one that is not active LUL

sterile crest
#

So when are we supporting different runtimes

#

I wanna run Kotlin

sterile crest
#

Or groovy

#

Or ruby

#

I wish ๐Ÿ˜ฆ

#

Tbh

#

I'm gonna suggest something crazy

#

But it's rewriting jshell

#

So we can support everything

compact holly
#

i mean, project like that would...

sterile crest
#

Now that we have it working on the vps

compact holly
#

we could make it commercial :p

sterile crest
compact holly
#

easy money

#

but it's hard work

sterile crest
#

It's not

compact holly
#

it always looks easy, until you realize how many complexities there are

#

but it would be a top product on the market

#

it runs any code

sterile crest
compact holly
#

and it's integrated in discord chat, on a website

#

on any platform

timber mirage
#

So

sterile crest
#

I wish I had my own discord bot in this server ๐Ÿ˜ฆ

compact holly
#

you can send output to email or your messaging server of choice

timber mirage
#

If you want to add graphana

#

just add code in JShellEval in TJ-Bot

#

and you are done

#

easy @sterile crest

compact holly
#

or in your terminal, like universal repl for every language

sterile crest
#

But yes it's easy

sterile crest
#

/jshell lang=ruby code=whatever

compact holly
sterile crest
#

Then for the docker part, just use the official docker image for the language

#

And just <command> <code>

#

And spit out the results

compact holly
#

yeah, whole AWS paltform is basically just few 'justs'

#

just spawn a server, just spawn an image and run it for 30 seconds

sterile crest
#

But I didn't mention AWS

#

We can use our infrastructure

compact holly
#

i mean, every software is 'just'

sterile crest
#

My brain is just bigger than yours peepo_heart

compact holly
#

most shit we work on are basic CRUD apps, like websites

#

you get some text, you pull something from the database, you send it back

#

easy peepo_happy

sterile crest
#

Yeah

#

Easyyy

#

Peasy

#

Lemon

#

Squeeezyyy

#

I'm weeezy

#

Like breezyy

#

Now I'm rapping

timber mirage
sterile crest
timber mirage
#

unless we do some magic

sterile crest
#

Yeah magic called abstractionpeepo_happy

timber mirage
#

but yea it could work

#

you would only need to add a new wrapper

#

for each language

sterile crest
#

Exactly

#

You got itt

#

You understand

#

I want my own bot added to TJ ๐Ÿ˜ฆ we can call it TJ community commands Bot

timber mirage
#

and the thing is that the wrapper doesn't use json or any complex format, so you don't even need any lib in the wrapper

sterile crest
#

Where people submit their own fun commands

#

I'm gonna suggest it

#

Where's the channel

#

#server-suggestions

compact holly
#

yeah, in theory it's all simple and cool

#

because we built our own in-house aws lambda

#

and we can run anything on it

sterile crest
#

You're acting like I can't POC the idea in under day pepekek pepekek

compact holly
#

that's why we have api, thinking about the future man (that you had doubts about, and thought was a dogshit idea) geniusidea

sterile crest
#

#server-suggestions message

sterile crest
#

Unless we're taking outside of TJ and making money peepo_yes

#

@timber mirage btw the way graphana works is...

#

We pull a docker image and that will start a web server

#

Then from any of our services we just push the metrics to a data source (e.g. promethius or a sql database)

#

And on the graphana website that it spun up, we can see the raw metrics that we collected and start making graphs for it

#

I.e. a new web page that contains stuff

#

E.g. "jshell" then all the stuff

#

And "TJ slash commands", "TJ errors" etc etc

#

Or however you want

#

We have flexibility on how we visualise the data

#

If I remember correctly, the graphs are just json files e.g.

{
tile: {
name,
x
y
data
aggregation
}
}

#

Some shit like that

bright lark
#

Springboot admin can do the monitoring stuff

#

With so much less efforts

sterile crest
#

uh no

bright lark
timber mirage
#

@bright lark any advancement ?

bright lark
#

not yet got some pressure recently at work

#

i'll try to check asaic

timber mirage
#

alright

bright lark
#

yesterday when i replied i was in bed

#

unable to sleep and got multiple notifs from u

#

so i wanted to join by phone

#

(i wasn't in front of laptop)

timber mirage
#

Take your time

bright lark
#

right, so im gonna do the fixes and what then ?

#

if we agree on a final approach, i'd probably go to the next usecase to write test for it

#

(btw im gonna explain what i did in readme)

bright lark
#

alr thanks for ur trust

bright lark
#

hi again and sorry i couldn't find enough time for pr review today, maybe tomorro stay tuned

bright lark
#

i mean on discord

#

to move faster

#

thanks in advance

timber mirage
bright lark
#

So u want to put the webtestclient chaining inside utility method?

#

So it becomes testEval(args)

#

Right?

timber mirage
bright lark
#

The test for state is also there

#

But the example u gave is about a list

timber mirage
timber mirage
bright lark
#
boolean isValidResult = result.snippetsResults()
            .stream()
            .filter(res -> res.result() != null)
            .anyMatch(res -> res.result().equals(TEST_CODE_EXPECTED_OUTPUT));
#

This checks if result has 4

timber mirage
#

why don't you just check there everything is correct ?

#

why can't you do what i said ?

#

i don't understand

bright lark
#

I did

timber mirage
#

?

bright lark
#

Ive checked tht everything is correct in the isValidResult variable

timber mirage
#

but that's not what i asked

#

I asked to simplify the tests

#

and add a test to test state

bright lark
#

ah Thats another test

#

Ill do it when we merge the pr

timber mirage
#

no

#

do it before

bright lark
#

Why no?

timber mirage
#

because we have no idea if your approach works with state

bright lark
#

U mean reuse session

#

?

timber mirage
#

yes

bright lark
#

My approach in the current test works just fine

#

No need to go faraway from this basic scenario

#

When i add the second test, i may do that

#

We agreed on setting one test in my pr, remember?

timber mirage
#

we need this second test

bright lark
#

Hmm

#

I didn't think about it

#

But i still dnt see the reason to block pr for tht, the wrapper container is shutdown when the test is finished

timber mirage
#

?

#

what do you not understand ?

bright lark
#

I mean we can merge the pr

#

Without adding another test

#

Anyway if u insist then i dnt have choice

#

Gotta go sleep now sorry, ill get back tomorro

timber mirage
bright lark
timber mirage
bright lark
#

but i just want to set exactly 1 test

#

in this pr and next we do others

#

as agreed previously

timber mirage
bright lark
#

the test u want me to add is a second scenario

#

and ok np

sterile crest
#

Unless the test you're requesting is directly related to a change he has made

timber mirage
bright lark
#

alright

#

bring it on

#

i'll take a look tonight

timber mirage
bright lark
#

huh

#

i didn't say no to that

#

i assume all integration tests are obviously relevant to infra

#

but nm

bright lark
#

Hi again! @timber mirage the next test is about using same session id (e.g: "test") used for "2+2" but with java expression right ?

timber mirage
bright lark
#
testEval(testEvalId, "2+2", "4");
testEval(testEvalId, "2-1", "1");
#

ah !

#

that means i must get same result again ?

timber mirage
#
testEval(testEvalId, "int a = 2+2", "4");
testEval(testEvalId, "a * 2", "8");
#

@bright lark

#

if you are correctly using the same session, the variable "a" should exist

bright lark
#

let me check that out

#

it works ! โœ…

timber mirage
#

also can you do it the way I gave you in the first point ?

timber mirage
timber mirage
bright lark
#

the result is as expected

#

the response is success

timber mirage
bright lark
#

u want me to check something else

timber mirage
bright lark
timber mirage
#

please check everything

#

it doesn't even cost you more lines of code that what you currently have

bright lark
#

status ?

timber mirage
#

for example

bright lark
#

alr

#

ill add this and done

timber mirage
#

add everything

#

this should only take one minute

bright lark
#

this is weird

#

it's not about how much it takes

#

it's about the reason

timber mirage
bright lark
#

but ok

timber mirage
timber mirage
bright lark
# timber mirage and no, it's not enough
testEval(testEvalId, "int a = 2+2", "4", SnippetStatus.VALID, SnippetType.ADDITION);

testEval(testEvalId, "a * 2", "8", SnippetStatus.VALID, SnippetType.ADDITION);
timber mirage
#

first of you didn't test everything

#

and I gave you the solution

bright lark
#

all is left is the id

#

please just tell me what else

timber mirage
bright lark
#

I think I DID

#

if u think that i didn't , then just tell me so i go to it straight

timber mirage
#

Your test is too complicated to test something too simple, you need to simplify it, create methods or classes for this so your test can be as simple as for example assertEquals(sendEval("2+2"), new JShellResult(...))

bright lark
#

ok

bright lark
bright lark
#

alright we're don..

timber mirage
#

why not JShellResult

bright lark
#

๐Ÿคท

#

the snippet comes from result

timber mirage
#

use JShellResult

#

please

bright lark
#

i think we'll not end

timber mirage
#

Why do you try to hard to find a way to not do that ?

bright lark
#

dnt be mad

#

alright it's done

#

im gonna commit

#

now i'm writing some docs in readme

bright lark
#

@timber mirage all is done !

sterile crest
#

@timber mirage wanna setup graphana and promethius with me?

#

promethius is what we'll use as a data store and graphana is how we'll create pretty charts

#

but i'm worried we'll have to fk around with networking so maybe we can get something working locally first and then... think about how to deploy it with marko, without having the same issues we did with jshell

#

since we need to expose 2 things:

#
  1. promethius to graphana and tj
#
  1. graphana to the web
sterile crest
#

I need to remember how to do this

#

I think TJ needs to export a website with metrics?

bright lark
#

why u dnt use spring boot admin

sterile crest
#

can you explain spring boot admin?

bright lark
#

it's a tool to follow deployed spring boot app

#

just add the dependency

#

and done

sterile crest
#

where in TJ are we using spring?

bright lark
#

i mean for jshellapi

#

as it's spring boot

#

nevermind

sterile crest
#

we can perhaps use the existing spring stuff in jshell to expose the metrics

#
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - 9090:9090

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    ports:
      - 3000:3000
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
#

(keeping this here so we don't lose it) - it's the docker-compose config

#

prometheus.yml ```
global:
scrape_interval: 15s

scrape_configs:

  • job_name: 'prometheus'
    static_configs:

    • targets: ['localhost:9090']
  • job_name: 'java-app' # You will update this to your app's details
    static_configs:

    • targets: ['<your-java-app-ip>:8080']
timber mirage
#

@sterile crest why do you try so much to make the aws solution comes into tj bot ?
what do you expect to do with it ?

sterile crest
#

where is AWS

#

you mean the PR?

#

Marko asked to see it, I only spent maybe 2 hours creating the PR and left it, idc if its merged or not

timber mirage
#

yes

sterile crest
#

but you know, 2 hours vs 6 months...

#

it's a big difference

timber mirage
sterile crest
#

it was 2 hours

#

less than 1 day, when I originally did the POC, it took 30 mins

#

remember, there's no docker, or any complicated logic

#

it's a simple eval API, that's it, no sessions etc

timber mirage
#

such api, I had one in late 2023

#

yes it took more time, but 6 months, it was 6 months waiting mostly

#

anyway

sterile crest
#

everything is a wrapper over this:

#

that's jshell

#

and then in AWS I am just OBJECT_MAPPER.writeValueAsString(JShellOutput); and AWS side is done

#

the rest was just the slash command

#

the PR looks big, but's mainly c&p from other projects I've done in the past

#

but again, idc about that solution now

#

though, with AWS we could skip promethius ๐Ÿ˜ฆ

#

but we have to set that up now and all the complexity around getting metrics exposed

cedar fog
#

OTel's not that hard to implement in and of itself, but properly defining what to track is another matter.

#

And having enough people with the required rights.

timber mirage
timber mirage
rotund kernel
#

I would like to join

timber mirage
rotund kernel
#

or it is already closed?

timber mirage
timber mirage
rotund kernel
rotund kernel
vivid cliff
timber mirage
vivid cliff
#

this is the repo

#

u can check it out

rotund kernel
rotund kernel
rotund kernel
#

how can i help you out?

timber mirage
rotund kernel
#

and i tried to ./gradlew bootRun

#

and it doesn't work for me

#

stuck on 88% messaging
2024-09-14T18:45:51.920+05:00 INFO 12684 --- [pool-2-thread-1] o.t.j.service.JShellSessionService : Scheduler heartbeat, sessions ready to die: []

timber mirage
rotund kernel
#

while at the bottom

#

Executing: 88%

#

<===========--> 88% EXECUTING [7m 20s]

#

and also about JShellWrapper:run

#

it is giving an exception requiring me to accept Terms&Conditions at gradle website

bright lark
#

๐Ÿ‘€

#

Never saw this

rotund kernel
bright lark
#

Ah the problem is with env variables

#

follow The readme file

#

U need to 2 env variables with specific values to make it run

rotund kernel
bright lark
#

U need to use comma

#

Rather than semicol

#

Between the variables

#

Thats how it works in intellij

rotund kernel
#

okay just a moment

bright lark
#

And dnt use spaces

rotund kernel
rotund kernel
bright lark
#

Oh damn

#

I got confused

#

use semicolon

#

But without spaces

rotund kernel
#

okay

timber mirage
rotund kernel
rotund kernel
#

how much it actually takes to make a run

bright lark
#

Seconds ig

rotund kernel
#

JShellWrapper:run i mean

rotund kernel
bright lark
#

U need to understand somthing here

#

U dnt have to run jshellwrapper by yourself

#

It is implicitly done by jshellapi

#

All u have to do is build the jshellwrapper img

#

And use post:eval endpoint

#

If u do, jshellapi communicates to docker and runs the img

#

Making it living for a period of time (session)

rotund kernel
#

okay thanks

timber mirage
#

@rotund kernel so ?

rotund kernel
#

but thinking about port 8080

#

Web server failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

#

i couldn't be able to kill it

#

it is creating one auto

timber mirage
rotund kernel
#

will change the config file

#

after will set it to default

timber mirage
#

right

#

mention me if you managed to make it work

#

or if you have any question

rotund kernel
timber mirage
#

@bright lark I reviewed your pr
Basically, you are transforming the readme into a report showing what you did... that's not what a readme is for
And some other changes
Ah and specifically one of them, is it possible to make so tests use a custom config file ?

timber mirage
sterile crest
#

I agree with Ala's comments on the README

bright lark
#

im checking ur comments

#

it looks like u didn't like

#

i tried to do some stuff as i thought about newcomers (new learners)

#

Ah and specifically one of them, is it possible to make so tests use a custom config file ?
sure

#

you'd like to set a config record and properties like the one under src/main ?

timber mirage
timber mirage
# bright lark i tried to do some stuff as i thought about newcomers (new learners)

I explained this in the readme, this is at best the wrong place.
And there are many things you put that won't help anyone anyway
What's the point of copy pasting the build.gradle, can't people just check it out ?
What's the point of copy pasting gradle rules, like file structure ?
Why do you need to explain each line of code you did in the readme ?
What's the point of saying that you, and us did this work in a random place in the readme ?
You are supposed to make doc for this, javadoc or equivalent for this
You are just making a report for a school project.

Also remember that readme purpose is to explain people how to use the project, not how to explain how it works.
Seriously, if I really did what you did but for the whole project instead of your test, the readme would be 10k lines long, it would be unreadable.

bright lark
#

So i thought i have to write some friendly hints to help unfamiliar contributors to understand

#

Somebody may not know about injecting the image name from root build.gradle file to subprojects

#

Also i tried to let know that the test class is about integration test and that it depends on additional configs in build.gradle file

#

Now i dnt have much time to discuss sorry. Will come back soon

#

But thanks for ur feedback

sterile crest
#

You can still have the documentation that you want just not on the parent README or in file comments that don't make sense

#

Instead, what we can do is create a docs folder that contains all our documentation as .md files

timber mirage
#

or create a wiki, like tj bot did

#

well, that's basically the same solution

sterile crest
#

Yeah even a docosaurous module

timber mirage
#

but even then, many of the things you wrote shouldn't be there

#

like there is no point to write gradle or maven rules

#

like when you said where the tests should be located

sterile crest
#

Maybe it's better suited for some contributing guidelines but whatever the case, there should located somewhere more specific for docs

timber mirage
#

and you need to make a difference between choices that you did and that you want to remember by writing them out
and actual explanation about how the project works

timber mirage
compact holly
#

there should be just an abstract overview how testing works, with simple example

timber mirage
compact holly
#

basically a broad guide on how to write tests on our project

timber mirage
compact holly
#

obviously ^^

sterile crest
#

He even said "thanks ala & wazei - Firas" in the README

#

It was cute peepo_heart

bright lark
#

Hello

#

Use Objects.requireNonNull instead of abusing Optional.

i wonder why u say that @timber mirage

timber mirage
bright lark
#

but i like it

fossil badge
#

invalid link, is this a bot to teach java?

timber mirage
stray wrenBOT
#
Alathreon's result

Snippets

Snippet 23, VALID

2+2```
jshell> `4`
## System out
[Nothing]
timber mirage
#

this

fossil badge
#

๐Ÿคฏ

bright lark
stray wrenBOT
#
bigigga212's result

Snippets

Snippet 23, VALID

Random random = new Random();```
jshell> `java.util.Random@67117f44`
## System out
[Nothing]
#
bigigga212's result

Snippets

Snippet 24, VALID

random.nextInt(20) + 1```
jshell> `19`
## System out
[Nothing]
fossil badge
#

๐Ÿคฏ

timber mirage
fossil badge
timber mirage
stray wrenBOT
#
bigigga212's result

Snippets

Snippet 25, REJECTED

nextInt(1, 21)```
## [WARNING] The code couldn't end properly...
Problematic source code:
```java
nextInt(1, 21)```
Cause:
The code doesn't compile:
cannot find symbol
  symbol:   method nextInt(int,int)
  location: class 

## System out
[Nothing]
timber mirage
stray wrenBOT
#
bigigga212's result

Snippets

Snippet 26, VALID

random.nextInt(1, 21)```
jshell> `2`
## System out
[Nothing]
fossil badge
#

very cool

#

is it safe from something silly like .getLocalHost()?

timber mirage
timber mirage
#

@fossil badge did you test it ? ๐Ÿ™‚

#

@bright lark any advancement ?

bright lark
#

But gonna check soon

timber mirage
#

alright

bright lark
#

It helped me a lot at work

#

So i reviewed some prs same way and it gives precious results

bright lark
#

@timber mirage i think about removing some content in the readme as u suggested

#

and put it in the PR description instead (not everything and briefly)

#

is that ok ?

timber mirage
#

since none of it is useful for an user

bright lark
#

i thought automated tests aren't for user

timber mirage
bright lark
#

the documentation is to help other developers to understand the approach

timber mirage
#

readme isn't documentation

#

it's user manual

bright lark
#

hmm

timber mirage
#

it's not documentation either

#

you would need to add a wiki

#

which

#

isn't priority for now

bright lark
#

alright but i'd put some details in the pr description about the approach

#

ok ?

timber mirage
# bright lark alright but i'd put some details in the pr description about the approach

in the pr itself ? you can
but remember, don't put things we already know or we can easily find, it's pointless to say where each file is, it's pointless to show code
and it's still not documentation
you don't explain to the programer how they should do it
you explain which challenegs you faced and the choices you made
this would have a place in the pr so we know how this was done

#

@bright lark actually, probably better to put such info in the issue, not the pr

#

so the issue has all info regarding the choices you made to make it work

bright lark
#

alright sounds good

#

can u answer me quickly on this ?

timber mirage
#

No, I'm cooking

#

In one hour or two

bright lark
#

lmao

#

ok

#

ive answered on GH anyway

timber mirage
bright lark
#

hello folks

#

fyi, im about to resume my pr review fixes

bright lark
#

@timber mirage ive pushed changes

#

would you like to take a look pls

timber mirage
#

@bright lark any advancement?

bright lark
#

what ?

#

ive finished

#

im waiting from someone to wrap up

timber mirage
bright lark
timber mirage
bright lark
timber mirage
#

@bright lark I made a review

bright lark
#

however ive answer u about others

timber mirage
bright lark
#

for dev and prod: merge common + devconfig

#

for test: merge commong + testconfig

timber mirage
bright lark
#

it doesn't make sense to keep one unfixed

timber mirage
#

And for the other one

#

it's not in the scope of this pr

#

and will cause many problems

#

because all the config files will need to be updated

timber mirage
#

You added something

#

it's wrong

#

I am merely asking you to fix it

bright lark
#

wdym

timber mirage
#

the variable doesn't follow conventions

#

i am simply asking you to fix it

bright lark
#

when i see predefined properties in docs, all are lowercase

timber mirage
bright lark
#

like i did

timber mirage
#

and even if

#

you have to follow the conventions of a project

#

that's the most important thing

#

if a project started with a particular convention

#

then you must follow it

bright lark
#

right

#

as for readme

#

i m going to just write the command to run tests

#

is that ok ?

#

or remove the section

timber mirage
bright lark
#

alright

#

so is this ok jshellWrapper-imageName

#

or i remove that - ?

#

nevermind

timber mirage
bright lark
#

another point please, ${jshellWrapperImageName} i m gonna change it

#

to uppercase with underscore

#

cuz it's like env variable

#

so i becomes ${JSHELL_WRAPPER_IMAGE_NAME}

#

jshellWrapperImageName: ${JSHELL_WRAPPER_IMAGE_NAME}

#

LGTM

timber mirage
#

yes do that please

bright lark
#

@timber mirage

timber mirage
bright lark
#

and put them in use in dev and runtime

#

and create a separate config for test that extends Config

#

in other words i'd have:

#
class Config extends CommonConfig {}
class TestConfig extends CommonConfig {}
timber mirage
#

no

bright lark
#

to avoid redundancy

timber mirage
#

there is no redonduncy at the fist place

#

you are the one adding it

#

just create a custom config object for the test

bright lark
#

as for the session it could customized

timber mirage
bright lark
timber mirage
bright lark
#

i think that integration test must follow the real scenario

#

if i set timeout in test lower or greater than the one used at runtime

timber mirage
#

we have a 30min timer

#

we can't make so the test takes hours

bright lark
#

so i think that some configs need to be customized between test and runtime

timber mirage
#

some yes

bright lark
#

but not some others

timber mirage
#

but we don't know which one

#

we just know that at least some need to be modified

bright lark
timber mirage
#

no

bright lark
#

and create extensions

timber mirage
#

because we can't know which one will be common

bright lark
#

for example the session timeout

#

(it could be only this one)

#

๐Ÿ˜ƒ

timber mirage
#

i could

#

or it couldn't

bright lark
#

we can start with it

#

and review others

timber mirage
#

also your approach is just worse

#

you are saying that you reduce duplication

#

but you are not doing that

#

you are doing the opposite

#

especially when the original solution is one line long

bright lark
#

i dnt see what u mean can u elaborate?

timber mirage
bright lark
#

you are doing the opposite

#

i dnt see how's tht

timber mirage
#

the current solution is one line long

#

you are asking, to replace the record with three classes

bright lark
timber mirage
#

so around 150 lines of code

bright lark
#

you asked to create a copy from Config

timber mirage
timber mirage
#

well

#

kinda

#

it depends

#

either there is a test config

#

or we just new Config

bright lark
#

well

#

as i said earlier "as u wish"

timber mirage
#

the problem of having a second config

#

is that we can't customize it

#

and so our tests will be more limited

#

so it's not a choice

#

it's weither or not we know what the tests will contain

bright lark
timber mirage
bright lark
#

it's valid to add a properties file under src/test/resources

timber mirage
#

no

#

that's not what I mean

#

what I mean is that we can't select different config for different tests

#

if we use a config file

bright lark
#

with profiles

#

@ActiveProfiles

timber mirage
#

well

#

I guess we could got for a single config file in resources

#

then we will change it later if needed

bright lark
#

that means no inheritance

#

configs are isolated

timber mirage
#

and you shouldn't use inheritance for this

#

it's just a bad idea

bright lark
#

Ok

timber mirage
#

@bright lark hello, any advancement ?

#

@sterile crest @compact holly hello, I just made a pr to update jshell to java 23 : https://github.com/Together-Java/JShellPlaygroundBackend/pull/54
I have a question, is it possible to make so it is automatic for the next versions ?

GitHub

Pull-request

I have read the contributing guidelines.
I have read the code guidelines.
I have created a relating issue.

Changes

Existing code
New feature

Closes Issue: NaN
Description
Rep...

sterile crest
#

So write a method e.g. int getVersion() and use it

compact holly
#

you don't want anything serious automated

sterile crest
#

Nope, but if we had Canary deployments.... peepo_heart peepo_heart

#

It would be perfect

timber mirage
sterile crest
#

But that's too much effort to teach because it's also doing the work

sterile crest
timber mirage
#

I have no idea how GHA works

sterile crest
#

How did you learn java?

#

You read books? YouTube? Etc right?

#

Go figure it out peepo_happy

timber mirage
#

Can't you teach me ?

sterile crest
#

Hmmmmmmmmmmmmmm

#

@compact holly should I teach him or let him figure it out?

#

Actually

#

Teaching is a big job

timber mirage
#

Or at least, can you tell me where I can find the code that create those auto pr for dependencies ?

sterile crest
#

Look inside the .github folder

compact holly
sterile crest
compact holly
#

but actions have docs, there are plethora of already made actions you can just use with a single line

stray wrenBOT
#
TJ-Bot
Does "Dunno" have the word "No" ?

Yes, "Dunno" does have the word "No" in it. "Dunno" is a colloquial contraction of "don't know," and it contains the word "no" within it. The word "no" is a negative particle used to express denial or refusal, while "don't know" is a phrase indicating a lack of knowledge or information about something. In this case, the contraction "dunno" combines these two elements into one word. It is important to recognize that language can be fluid and flexible, allowing for the creation of new words and expressions through processes like contraction. As such, while "dunno" may not be considered a standard term in formal writing or speech, it is commonly used in informal communication to convey uncertainty or lack of understanding. Overall, the presence of the word "no" within "dunno" adds to its meaning and serves as a reminder that language can evolve in unexpected ways.

compact holly
#

it's probably a common thing with a ton of google results

sterile crest
#

Tf lol

timber mirage
sterile crest
#

He didn't do anything in a certain way

timber mirage
compact holly
#

it's all pretty standard stuff, that every project uses

sterile crest
#

There is in a .yaml file

timber mirage
#

Well, I think ?

compact holly
#

basically 'getting stsrted guide'

sterile crest
#

The .yaml / .yml is how you create them

timber mirage
#

docker-publish.yaml
docker-verify.yaml
pre-commit.yaml
releases.yaml

sterile crest
#

Yess

timber mirage
#

there are those 4 files

sterile crest
#

Those are GHAs

timber mirage
#

There is also dependabot.yml that I have no idea what this is

sterile crest
#

Dependabot is provided by GitHub

#

Via a plugin

#

So it's not the best to reference

stray wrenBOT
#
TJ-Bot
Whats dependabot in 2 sentences

Dependabot is a GitHub bot that automatically creates pull requests to update dependencies in a repository to their latest versions. It helps keep projects secure and up-to-date by regularly scanning for outdated dependencies and suggesting updates.

sterile crest
#

Look use the pre-commit as your base

compact holly
#

you can see it in action in tj-bot

timber mirage
#

But huh

version: 2
updates:
  - package-ecosystem: "gradle"
    directory: "/"
    schedule:
      interval: "weekly"
#

nearly empty

stray wrenBOT
#
TJ-Bot
Create a GHA that can raise a PR that changes a line in my build.gradle with an output from a bash script

To create a GitHub Action (GHA) that can raise a Pull Request (PR) to change a line in your build.gradle file with an output from a bash script, follow these steps:

  1. Create a new GitHub repository for your project if you haven't already done so.

  2. In the root of your repository, create a new directory called .github/workflows.

  3. Inside this directory, create a new YAML file (e.g., update-build-gradle.yml) and add the following code:

name: Update build.gradle

on:
  push:
    branches:
      - main

jobs:
  update_build_gradle:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Run bash script
        run: |
          OUTPUT=$(bash script.sh)
          sed -i "s/old_line/$OUTPUT/" build.gradle

      - name: Commit changes
        run: |
          git config --global user.email "[email protected]"
          git config --global user.name "Your Name"
          git add build.gradle
          git commit -m "Update build.gradle"
          git push
  1. Create a bash script (e.g., script.sh) in the root of your repository to generate the output for the new line in build.gradle.

  2. Commit and push these changes to your repository.

  3. Once the workflow is triggered by pushing to the main branch, it will run the bash script, update the build.gradle file, commit the changes, and push them back to the repository as a PR.

This GHA will automate the process of updating your build.gradle file with an output from a bash script and raise a PR for further review and approval.

compact holly
#

yeah, like i said, it's default/standard stuff

sterile crest
#

There done

#

And instead of push to main make it a weekly schedule

stray wrenBOT
#
TJ-Bot
How can i update java version with dependabot

To update the Java version in your project using Dependabot, follow these steps:

  1. Check the current Java version in your project by running java -version in your terminal.
  2. Make sure Dependabot is enabled in your repository. If it's not, you can enable it by adding a configuration file (dependabot.yml) to the root of your repository.
  3. Dependabot will regularly scan your project for outdated dependencies, including the Java version. When it identifies an outdated Java version, it will create a pull request to update it.
  4. Review the pull request created by Dependabot to update the Java version. Ensure that all necessary changes are included and that there are no compatibility issues with other dependencies.
  5. Merge the pull request to apply the updated Java version to your project.

It's important to note that updating the Java version may require additional changes to your codebase, as newer versions of Java may introduce new features or deprecate existing ones. Make sure to test your application thoroughly after updating the Java version to ensure that it functions as expected.

If you encounter any issues during the update process, you can seek help from our community on the Discord server or refer to Dependabot's documentation for further assistance.

timber mirage
# stray wren

On top of that, it needs to check if the image is available, so can I do a http request in this ?

sterile crest
#

Yeah curl

timber mirage
#

alright

#

i'll check that

sterile crest
#

Make a .sh that spits out the latest version and sed it into the build gradle

timber mirage
#

thank you

sterile crest
#

It kinda sucks but it'll work

timber mirage
#

heh

#

a simple curl should work

#

I just need to check the error code

#

or something like this

#

I think

sterile crest
#

Yup

timber mirage
#

well

#

can I use curl in this yaml file ? or do I have to create a .sh file ?

sterile crest
#

You can curl inside the yaml, yes

timber mirage
#

one last question

#

is there a way I can test the action in local ? or do I have to create a test project ?

compact holly
#

that's so hacky lol

#

and inflexible

#

but you know

#

potentially dangerous

sterile crest
#

It's not

#

It's just raising a PR

#

That's it

#

If it breaks, we'll see a trash commit

sterile crest
sterile crest
cedar fog
timber mirage
sterile crest
#

you don't

timber mirage
#

huh

#

this is a problem

sterile crest
#

it's not

timber mirage
#

wdym

sterile crest
#

use the docker API

timber mirage
#

it requires an account

sterile crest
#

anyways have fun

timber mirage
#

hmm

#

Alright, I'll check that... when I'll have time

bright lark
#

Oh u mean other fixes

#

how I forgot

#

Sorry will check tomorro

timber mirage
# sterile crest

is it possible in the yaml to read the build.gradle ? since I would need to read the current java version...

sterile crest
#
      - name: Checkout code
        uses: actions/checkout@v4
#

when you do this, it'll checkout the code and you can run any linux commands you want

#

if you did a ls you'll see everything

#

so you can just read the line from gradle however you want

#

or better, use the gradle properties file

timber mirage
sterile crest
#

ah wait that's a spoonfeed

#

hehe

#

use grep ๐Ÿ™‚

timber mirage
#

You are funny

#

But what if there are several similar lines?

sterile crest
#

will there be multiple from.image?

#

match on a longer regex, from.image = 'eclipse-temurin: or match on the entire jib block and work your way down that way

timber mirage
#

Hmm

#

I guess it could work

sterile crest
#

this is where the properties file would have been better because it's easy to parse and use

timber mirage
#

But then what I do of it ?

#

I need to do version + 1

sterile crest
#

so do a grep to get the current value

#

then use a sed to replace it with version+1

timber mirage
#

Hmm I see

sterile crest
#

something like this:

#

sed -i "s/eclipse-temurin:$current_version/eclipse-temurin:$((current_version + 1))/" $GRADLE_FILE

#

do you want me to this for you

timber mirage
#

If you want, I'll check that regardless tomorrow

sterile crest
#

okay ill do it once you give up

timber mirage
#

Note that I will have limited internet starting Saturday, so I won't be able to push any contribution this week, only do reviews

#

So if I can't do it tomorrow, I will only be able to do it next weekend

timber mirage
sterile crest
#

lool

#

okay i can do this in less than 15 mins

timber mirage
sterile crest
#

I can't raise a PR

#

fml

#

I need to fork the project

#

I haven't tested the commit and create pull request

#

the rest works

#

well ig i can test it

#

gg tho @timber mirage

#

took less than 15 mins

#

works though

timber mirage
#

Huh

#

Gg ahah

sterile crest
#

wym gg i can fix this in 2 seconds

#

whoops messed up the PR

#

@timber mirage is this OK?

timber mirage
sterile crest
#

now ay

#

lma

#

why is wrapper using eclipse-temurin:22-alpine and API is using eclipse-temurin:21

#

?

timber mirage
#

Because the api doesn't need alpine

sterile crest
#

can we not use alpine for the wrapper?

#

then i can just change the path to the wrapper without needing to change the logic to handle "alpine"

timber mirage
#

Alpine is lightweight

sterile crest
#

i know

timber mirage
#

It is needed so the wrapper weights less, it's critical

#

Anyway, I'll go to sleep
I'll merge your pr tomorrow if I don't see any problem

sterile crest
#

you can't find problems when you couldnt' find the solution ๐Ÿ˜

#

๐Ÿ˜„ ๐Ÿ˜„

#

but the PR is all yours now

#

I don't wanna continue with it - it exceeded my 15 mins

#

30 mins is too much work ๐Ÿ˜ฆ

#

okay whatever, i pushed the fix to use alpine and jshellwrapper

#

@compact holly check out my hacky bash!!

quartz shell
#

did u guys end up switching to wazei's aws?

sterile crest
#

No

#

Primarily because i think everything is now working

bright lark
#

whatsup

#

@timber mirage im resuming the pr review fixes

#

and i find that it would be better to make checkJShellWrapperImageName() public

#

so i can reuse it in TestsConfig class

bright lark
#

done!

#

would you like to take a look please

stray wrenBOT
#

System out

Version: 22.0.2+9
Vendor: Eclipse Adoptium
OS: Linux
Arch: amd64

#
Nopox's result

Could not find session for member Nopox

timber mirage
#

@sterile crest I reviewed your pr

#

@bright lark you didn't address all the comments
once you addressed them, I'll validate it

sterile crest
bright lark
#

i dnt see anything left

#

u want to do that selection in the constructor DockerService or Config ?.

timber mirage
bright lark
#

(cuz im lost in those +50 reviews)

timber mirage
bright lark
#

I said in a comment

#

That's because of spotlessApply

#

Ig

#

It added an empty line at the end

timber mirage
#

ah

bright lark
#

it seems tht code wasn't formatted

stiff oak
#

@timber mirage

I'm new to open source contributions and have been exploring the code base. From what I've gathered so far, it seems that a new container is created for each session. While Iโ€™m still familiarizing myself with the entire context, I was wondering if it might be more efficient to implement a flexible pool of containers. In this approach, code snippets could be executed in an available container, which would then be refreshed (perhaps by restarting the JVM) and returned to the pool for reuse.

I understand that there may be details Iโ€™ve missed, and I apologize if Iโ€™m overlooking anything important. I would greatly appreciate your insights on this idea.

timber mirage
stiff oak
timber mirage
stiff oak
timber mirage
#

unless you want to research for a way

sterile crest
#

We could spin up a single container and run multiple instances of jshell

#

However, you get gg'd if person crashes the container then gg to everyones sessions

stiff oak
# timber mirage unless you want to research for a way

I would definitely like to explore this idea further. It seems, though, that you might have some reservations about the approach. If thatโ€™s the case, Iโ€™d love to hear your thoughts on why it might not be the best fit.

stiff oak
timber mirage
# stiff oak I would definitely like to explore this idea further. It seems, though, that you...
  • I didn't researched how you could persist JShell, but seeing how it works like a black box, I don't have much hope
  • You could just save the script and reexecute them, but executing cost a lot of time, so you are moving the problem of container amount into executin speed, which is a terrible trade
  • You could do what wazei said, several sessions per container, but it's always possible for someone to crash the session, or at least right now. You could fix this by making so each session is its own process, which should solve most of the issues... but then if you have several process, it would cost a lot more ram and cpu, so it's still not good enough
  • Something else ?
#

But note that this problem isn't currently a problem

#

we didn't reach a point where we had too many sessions yet

#

if you want to improve perfs, there is another area where you could do something : creating a container and executing the startup script costs a lot of time, so it would be great if we would have a buffer of one session, so we could just assign it, making so a /jshell eval would be much faster @stiff oak

stiff oak
stiff oak
timber mirage
stiff oak
# timber mirage yes

Alright, Please let me itemize the requirements:

  1. Pre-initialize some docker containers each with it's own identifying session id.
  2. For every new request for /eval we allocate a container from the buffer to the new session to make execution faster.
    This is what I've gotten so far.

However I have some questions:

  1. What happens when the session expires for such containers, do you want to leave them operating.
  2. Does this apply or should it apply to single eval too.
timber mirage
stiff oak
timber mirage
stiff oak
timber mirage
stiff oak
stiff oak
# timber mirage Check if there is an issue, if not, create one, I will complete it later

I've created an issue:
https://github.com/Together-Java/JShellPlaygroundBackend/issues/60

However, I think you may want to consider container reuse, which is essentially the same thing as earlier, only that this time, you invalidate the jshell session so that you don't have to restart another container for another session, however a mechanism like the amount of buffer containers at a time could also be implemented, like an array list, once a threshold is reached for containers in the buffer, new containers could be created and/or deleted.

GitHub

Currently, for each /eval request, a new Docker container is created, initialized, and assigned to the session. This process involves running startup scripts, which can significantly impact perform...

timber mirage
stiff oak
timber mirage
stiff oak
timber mirage
timber mirage
#

@sterile crest did you take into account that the GHA could create several pr if one isn't validated fast enough ?
also I can't edit the code of the pr since it's on your repo, or is it fine if I commit on your repo ?

timber mirage
sterile crest
timber mirage
#

@bright lark I merged your pr

timber mirage
sterile crest
#

u can c&p the entire workflow

#

and make a new PR

timber mirage
compact holly
#

waz is smart, doesn't want to get blamed when this thing inevitably blows up LUL

sterile crest
#

ala's repo, ala's responsibility

timber mirage
sterile crest
#

left a comment

timber mirage
sterile crest
#

testing sec

#

nah it didn't work

#

we need to fix that bit though

#

oh

timber mirage
#

I pushed minors changes in the echoes

timber mirage
sterile crest
#

no - this only happens when the PR already exists

#

i.e. we didn't merge the new PR and it tried to raise a new one of the same update

timber mirage
#

ah so the if failed ?

sterile crest
#

yeah

#

but idk why

timber mirage
#

if gh api repos/Together-Java/JShellPlaygroundBackend/branches/$branch_name >/dev/null 2>&1

#

well

#

let's test things one by one

#

does gh api repos/Together-Java/JShellPlaygroundBackend/branches/$branch_name works ?

sterile crest
#

nope lel

#

I added echo "A PR is already open for this release" but it didn't print out

timber mirage
#

But do we really need it ?

#

Since it will fail anyway

sterile crest
#

up to you

#

seeing this kinda is ugly

#

but if we don't have any alerting on failed actions then sure

timber mirage
#

Yes but it should only happen if we don't merge the pr within one week

#

I'll add a pr for that if you want to work on it$

sterile crest
#

i dont wanna work on it

timber mirage
#

Alright

#

done

#

Review it please

sterile crest
#

well approved

timber mirage
#

?

compact holly
#

philosophically or?

#

if you think about it, for the majority of time since big bang, nothing really happened

#

so i would say nothing happening is quite normal

sterile crest
#

It very clearly stated every Friday at midnight

#

But you can manually kick it off since I added workflow dispatch

bright lark
#

i dnt see the PR purpose

#

and it seems related to previous merged PR

#

the title says "update java version"

#

but i see in changes: "name: Auto-Update JShell Image version"

bright lark
#

BTW i'd like to raise awareness about the experience i got from the reviews done by ala it was really helpful

#

it was really helpful
no no this is insufficient

#

i mean it needs to be written on a book

sterile crest
#

2 junior developers helping each other improve, nice peepo_happy

bright lark
#

another junior is kidding

sterile crest
#

It's cute peepo_heart

#

wym these are junior level problems and reviews

bright lark
sterile crest
#

Yeah they are

bright lark
#

not at all

#

i mean

#

some were significantly important and they implicitly bring values

sterile crest
#

Yeah important sure

bright lark
#

i cannot explain deeply rn, it's just that i wanted to say that ala is a very good java player here

#

that doesn't mean he's the best in the whole server ofc

#

im talking within the context of this channel

sterile crest
#

Yeah he's just better than you

bright lark
#

ig i'll become better than him

#

๐Ÿ˜€