-
Notifications
You must be signed in to change notification settings - Fork 33
Aqua tests: agentic support #5820
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b689ddf
Rename platform tests directory
mikolajpp 51a4a7a
agents: add basic backend instructions
mikolajpp 74d98ad
agents: add backend tests instructions
mikolajpp 543deaf
Aqua tests: agent instrumentation
mikolajpp a12e661
Aqua tests: add a first-ever agent-generated aqua test
mikolajpp 11ce098
Add -ph-test-ls thread
mikolajpp af07683
Aqua tests: improve agent harness
mikolajpp 24e1dc4
contacts: add aqua tests
mikolajpp b0b7038
Aqua tests: improve docs
mikolajpp 44f499c
Aqua tests: misc fixes
mikolajpp f2b289b
Aqua tests: fix runner
mikolajpp 2069efb
Aqua tests: minor fixes
mikolajpp eedc54c
Aqua tests: allow agents to cool down
mikolajpp aeaa1a2
expose: don't inject empty citations
mikolajpp 80786ec
Aqua tests: various fixes
mikolajpp 8e644bf
Merge branch 'develop' into mp/aqua-tests
mikolajpp d6b5bc0
Aqua tests: misc
mikolajpp d4f8c73
Aqua tests: fix thread ids in the runner
mikolajpp 31eb6d4
Aqua tests: fix typo in test runner
mikolajpp 5349b8c
Merge branch 'develop' into mp/aqua-tests
mikolajpp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # AGENTS.md | ||
|
|
||
| # Tlon Messenger backend | ||
| The backend of the Tlon Messenger app is hosted on the Urbit platform. | ||
|
|
||
| All the backend code is located in the desk/ directory, which | ||
| is deployed to an urbit ship. | ||
|
|
||
| ## Development | ||
| Interface with a running urbit ship through a tmux session | ||
| running an urbit ship. Do not switch to that session, but interface | ||
| with it using tmux input and capture commands. | ||
| A typical command to verify connection is working is `%`, which will | ||
| display current identity, desk and time. | ||
|
|
||
| ## Backend tests | ||
|
|
||
| There are two kinds of backend tests in groups. The first kind uses the | ||
| `/lib/test-agent.hoon` library, which provides a monadic framework for | ||
| implementing gall agent tests. It works by simulating rudimentary gall | ||
| functionality, which allows testing of the agent core (which is a pure function of | ||
| agent state) under the variety of circumstances. | ||
|
|
||
| test-agent tests are located in `/tests` directory, under the | ||
| corresponding desk entry. For example, tests for `/app/groups.hoon` | ||
| agent would be located at `/tests/app/groups.hoon`. | ||
|
|
||
| The second kind of tests uses aqua-based ship virtualization. | ||
| Using aqua, a virtual fleet of ships can be run directly on a | ||
| ship with little resource cost. While these ships are not | ||
| fully-featured and do not support every urbit runtime event, they | ||
| nonetheless allow testing of gall agents running on virtualized ship. | ||
|
|
||
| Aqua tests are located in `/tests/ph` directory. | ||
|
|
||
| For details on how to work with aqua tests see documentation in `/docs/aqua` | ||
|
|
||
|
|
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| :: prepare aqua fleet snapshot | ||
| :: | ||
| :: snap-id=(unit @t) | ||
| :: fleet=(list ship) | ||
| :: sync=? | ||
| :: | ||
| /- spider, aquarium | ||
| /+ *strandio, ph-io, ph-test | ||
| =, strand=strand:spider | ||
| :: +sync-desk: sync aqua ship desk to host desk | ||
| :: | ||
| |% | ||
| ++ sync-desk | ||
| |= [her=ship desk=@tas] | ||
| =/ m (strand ,~) | ||
| ^- form:m | ||
| ;< =bowl:strand bind:m get-bowl | ||
| =/ sab=path | ||
| /(scot %p our.bowl)/[desk]/(scot %da now.bowl) | ||
| =| =path | ||
| =| raw-files=(list [^path page:clay]) | ||
| =. raw-files | ||
| |- | ||
| =* loop $ | ||
| =+ .^(=arch %cy (weld sab path)) | ||
| =. raw-files | ||
| %+ roll ~(tap in ~(key by dir.arch)) | ||
| |= [dir=@ta =_raw-files] | ||
| (welp loop(path (snoc path dir)) raw-files) | ||
| ?~ fil.arch raw-files | ||
| =+ .^(=page:clay %cs (weld sab /blob/(scot %uv u.fil.arch))) | ||
| :_ raw-files | ||
| [path page] | ||
| =/ files | ||
| %+ turn raw-files | ||
| |= [=^path =page:clay] | ||
| =+ .^(=dais:clay %cb (snoc sab p.page)) | ||
| =+ .^(=tube:clay %cc (weld sab /[p.page]/mime)) | ||
| =+ !<(=mime (tube (vale:dais q.page))) | ||
| [path ~ mime] | ||
| =/ =beam [[her desk ud+1] /] | ||
| ;< ~ bind:m (send-events:ph-io [%event her /c/mount/0v1abc [%mont desk beam]]~) | ||
| =/ =task:clay | ||
| [%into desk & files] | ||
| ;< ~ bind:m (send-events:ph-io [%event her /c/sync/0v1abc task]~) | ||
| ;< ~ bind:m (sleep ~s0) | ||
| (pure:m ~) | ||
| -- | ||
| ^- thread:spider | ||
| |= args=vase | ||
| =/ m (strand ,vase) | ||
| ^- form:m | ||
| =+ !<(args=(unit [snap-id=(unit @t) fleet=(list ship) sync=?]) args) | ||
| =/ [snap-id=(unit @t) fleet=(list ship) sync=?] | ||
| ?~ args ~|(%no-args-found !!) | ||
| [snap-id fleet sync]:u.args | ||
| =. fleet | ||
| ^- (list ship) | ||
| :* ~loshut-lonreg :: bait provider | ||
| ~rivfur-livmet :: notify provider | ||
| ~dem :: bait provider galaxy | ||
| ~fen :: notify provider galaxy | ||
| fleet | ||
| == | ||
|
mikolajpp marked this conversation as resolved.
Outdated
|
||
| ;< =bowl:spider bind:m get-bowl | ||
| ~> %slog.1^(crip "Booting fleet {<fleet>}") | ||
| ;< vane-tids=(map term tid:spider) bind:m start-simple:ph-io | ||
| ;< ~ bind:m | ||
| =/ n (strand ,~) | ||
| |- | ||
| ?~ fleet (pure:n ~) | ||
| ;< ~ bind:n (init-ship:ph-io i.fleet &) | ||
| $(fleet t.fleet) | ||
| :: | ||
| ;< ~ bind:m | ||
| =/ n (strand ,~) | ||
| ?. sync (pure:n ~) | ||
| ~> %slog.1^(crip "Syncing %groups desk to ships...") | ||
| |- | ||
| ?~ fleet (pure:n ~) | ||
| ;< ~ bind:n (sync-desk i.fleet %groups) | ||
| $(fleet t.fleet) | ||
| :: allow agents time to cool down. it takes about a minute | ||
| :: for ames connections to be established. | ||
|
mikolajpp marked this conversation as resolved.
|
||
| :: | ||
| ~> %slog.1^(crip "Cooling down %groups agents...") | ||
| ;< ~ bind:m (sleep ~m1) | ||
| ;< =bowl:spider bind:m get-bowl | ||
| =/ snap-id=@t | ||
| ?~ snap-id | ||
| =+ eny=(end 3^4 (sham eny.bowl)) | ||
| (cat 3 'aqua-tests-' (scot %uv eny)) | ||
| u.snap-id | ||
| ~> %slog.1^(crip "Taking snapshot {<snap-id>}...") | ||
| ;< ~ bind:m (send-events:ph-io [%snap-ships snap-id fleet]~) | ||
| (pure:m !>(snap-id)) | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.