Commit Graph

77 Commits

Author SHA1 Message Date
fang
14266c8d46
eyre: GETting non-existent channels 404s
Contrary to the argument made by 4affae8, this is the _actually correct_
behavior. Not creating server-side resources in response to GETs
respects the expected method semantics, and more importantly, serving a
404 is an important signal for clients trying to connect to a channel
they were using previously. Without that, they have no way of telling
whether, when reconnecting, if their channel was reaped in the mean time
or not.

The "empty PUT" affordance provided by 34148f9 makes requiring a PUT
request for channel creation more reasonable.

We leave the general refactoring done by #6789 in place, but do
emphasize the reasoning given here with a few additional comments.
2023-10-04 22:42:50 +02:00
fang
34148f9f44 eyre: allow PUTting empty channel-request list
Previously, we would reject this with a 400 error. Considering the
request body is expected to contain "array of requests" and that arrays
may be empty, we really should not be rejecting the requests.

Prior to 156ca21472, sending the empty array would have been convenient
for channel creation. Empty arrays getting rejected forced clients to
inject a faux poke (commonly hi-ing oneself). With that recent change,
the most common case for wanting to PUT the empty list of requests is
largely obsolete, but one can still imagine it being useful for clients
that want to keep their channel alive without necessarily being
connected to it. This also implements sloppier clients from running into
400 responses when they submit an empty "command queue" for whatever.

Regardless, there seems to be no clear reason why the empty request list
_shouldn't_ be accepted and processed as normal.

We add a small test to ensure eyre accepts this.
2023-09-19 19:12:25 +03:00
fang
4affae8181 eyre: GETting non-existent channels creates them
Previously, a channel could only be created by sending a PUT request,
and a GET request to receive the channel's stream would only succeed
after channel creation had happened that way. This forces client
libraries, that generally have an explicit "set up" step before allowing
normal operation, to do strange things, like sending faux pokes
(commonly hi-ing oneself) before connecting to the channel's stream as
normal.

Here, we update the GET request handling for channels to allow requests
for non-existent channels. When this happens, the channel will be
created, and eyre tracks the request as normal.

We do some... gentle restructuring... of +on-get-request:by-channel to
let the new creation case share code with the "already exists" codepath.
In the process, we find that duct-to-key was never getting updated in
the case where we replace the original channel request/connection with
the new incoming one. We fix this, it's trivial. We also identify two
other areas with vaguely-incorrect behavior, but consider them less
important and out of scope.

We also add a test case for "create channel through GET".
2023-09-19 19:12:25 +03:00
fang
b427c9e800 eyre: serve 503 if bound agent is not running
Previously, for endpoints bound to agents, we would pass the request
onto the agent even if the agents wasn't currently running.

Here, we make eyre check to see if the agent is actually running, before
passing the request on. If the bound agent is not running, eyre serves a
503 synchronously instead.

This way, we avoid cluttering up the gall queue for the bound agent.
2023-09-18 15:52:28 +03:00
pkova
9929fcc6fb tests: revert test now that dead flow consolidation is default off 2023-09-14 23:13:24 +03:00
fang
f87871f0c1
tests: update eyre tests with new wire format
See also a9e3ebb
2023-08-11 11:48:23 +02:00
pkova
64ba325463 tests: fix tests broken by dead flow consolidation 2023-07-28 16:33:34 +03:00
yosoyubik
b359239f3d Merge branch 'develop' into next/kelvin/412 2023-06-28 12:52:18 +02:00
fang
c33ddfa101
Merge branch 'next/kelvin/412' into m/eyre-mirage 2023-06-26 13:47:39 +02:00
fang
41048b21e2
tests: update for new eauth architecture
Tag names have been changed, communication direction is now
client->host, and other changes which heavily affect the tests.
2023-06-16 21:20:20 +02:00
Josh Lehman
82aae2f9e3
Merge pull request #6630 from urbit/jb/insane
hoon: fixes (sane %t) for multi-byte glyphs
2023-06-09 08:17:16 -07:00
Tinnus Napbus
7c3a1c4d7c Merge branch 'next/kelvin/412' into tinnus/local-provenance 2023-06-07 20:38:05 +12:00
Ted Blackman
fc5598718b Merge branch 'develop' into next/kelvin/412 2023-06-06 12:50:11 -04:00
yosoyubik
385ede5c89 tests: remove misleading comment 2023-06-05 15:43:55 +02:00
yosoyubik
7b15f5c022 ames: fix tests 2023-06-05 11:41:39 +02:00
yosoyubik
6696f587be Merge branch 'next/kelvin/412' into i/6103/abet-pure 2023-06-01 17:46:36 +02:00
yosoyubik
8b518f4bfe Merge branch 'develop' into next/kelvin/412 2023-06-01 17:39:42 +02:00
Joe Bryan
e92878d778 test: adds failing multi-byte-glyph sanity 2023-05-31 14:32:39 -04:00
Tinnus Napbus
0105be6459 Merge branch 'develop' into tinnus/local-provenance 2023-05-31 12:52:53 +12:00
Tinnus Napbus
df53148183 tests: change sock to sack 2023-05-30 23:38:26 +12:00
yosoyubik
96e3bdcf11 Merge branch 'develop' into i/6103/abet-pure 2023-05-30 10:38:39 +02:00
yosoyubik
ff0584807a ames: fix grq tests 2023-05-30 10:33:13 +02:00
yosoyubik
4f27ac7329 ames: use %deep task in test-nack 2023-05-30 10:33:13 +02:00
Joe Bryan
d4b900bf3f
Merge pull request #6612 from urbit/i/6611/lose-boon
ames: correctly %lose a %boon we crashed on
2023-05-26 11:19:57 -04:00
Joe Bryan
6443e80bdc tests: adds failing misordered fine response test 2023-05-24 13:00:44 -04:00
Joe Bryan
1e6899660b test: removes unused arms from fine tests, factors out duplicate paths 2023-05-24 12:46:42 -04:00
fang
30cde41800
tests: add ames test for crashing on %boon
To detect regressions of the bug d8e11b6 fixed.
2023-05-23 22:12:21 +02:00
fang
bf64e94ca3
tests: expand eyre eauth tests
For the server case, we add tests for http-first finalization, incorrect
eauth tokens, attempt expiration, client abort signalling, and client
deletion requests.

For the client case, we add a test for approving eauth attempts without
being locally authenticated.

To this end, we refactor the layout of the eauth tests. The +eauth core
now contains the tasks/gifts to be handled by the client/server, but no
longer does move checking. This happens within the test arms only. This
way, we may trivially re-run parts of the eauth flow under different
conditions.
2023-05-23 20:32:24 +02:00
Tinnus Napbus
2ba8e45fd2 tests: fix tests for provenance 2023-05-23 01:55:55 +12:00
fang
a6acfe3c93
tests: add based happy-path eauth tests 2023-05-19 19:25:04 +02:00
fang
3347e84811
eyre: rename authentication-state to auth
Only in the $server-state type, the lull typename remains unchanged (for
now). "authentication-state" is just such a mouthful!
2023-05-19 11:32:07 +02:00
fang
dd41df7d7c
tests: make eyre tests build & succeed again 2023-05-19 11:09:11 +02:00
fang
b8ff52d79a
tests: remove trailing whitespace in eyre tests 2023-05-16 21:47:23 +02:00
fang
637992475b
eyre: refactor guest name generation
Concatenating before we truncate, instead of truncating the entropy by
itself, is slightly simpler.

Because this slightly changes the naming algorithm, we must update the
eyre tests to match.
2023-05-16 21:46:48 +02:00
Philip Monk
c3dc248b30 Merge remote-tracking branch 'origin/m/the-open-eyre' into philip/mare 2023-05-11 11:19:25 -07:00
fang
466fc0b63b
eyre: pass session-id+identity into auth handling
This lets it also clean up guest sessions created just for the login
request, and lets us display the current guest identity on the login
page.
2023-05-09 15:10:14 +02:00
yosoyubik
b154c62fdc ames, tests: remove extraneous comments 2023-05-09 11:43:54 +02:00
Philip Monk
8910e12f67 eyre: refactor tests
This shaves off 1000 lines of testing code while maintaining the same
tests.  It reduces boilerplate by introducing "mare", a monad for
testing Eyre.  It's very simple (just maintains the current state of
Eyre and the current time), but it's easier to build helper functions in
this form, and that reduces the immense quantities of copy-and-paste
that were in the old tests.  What's there now could surely be improved
further, but I think this is a good start.

The underlying mare machinery is not really specific to Eyre, so it
would be straightforward to apply this strategy to other vanes.  The
work is in creating appropriate helper functions for each vane.  Eyre is
undergoing work, so that's the only one I've changed here.  Further,
it's not clear that this is the ultimate solution to unit testing vanes.
The resulting code is IMO clearer than before, but I wouldn't say it's
*clear*.
2023-05-08 20:40:28 -07:00
fang
67799c77e0
tests: update eyre tests for guest sessions
Unauthenticated requests now also create sessions. This affects most
HTTP request handling tests.

The situation here is not ideal, and worsening over time. Worth spending
some time to think about how to best refactor the Eyre tests to make
them more manageable and easier to maintain.
2023-05-08 19:10:00 +02:00
yosoyubik
f53fee723a ames: defer mutual calls between |pump and |sink
|pump and |sink call into each other in three places
related to nacks and naxplanations (sending a nack,
notifying the |pump of a naxplanation, or dropping a
nack from the |sink). This intra calls are making implicit
updates to more parts of the state than the core should
manage. To avoid that we emit a move to %arvo, encoded
as an %ames plea, to handle that in the next event.
2023-05-08 15:28:13 +02:00
yosoyubik
6213e0bbb3 ames: move +bind-duct to peer-core 2023-05-05 13:06:17 +02:00
~wicrum-wicrun
99ca67db7f tests: remove defunct deq test 2023-05-02 17:02:58 +02:00
~wicrum-wicrun
6355b84d35 tests: use @uxyowl instead of @uxmeow 2023-04-24 19:56:24 +02:00
~wicrum-wicrun
738b17d0ca tests: remove .siz from $meow 2023-04-24 17:48:00 +02:00
yosoyubik
fc22926ed6 tests: fix rift/life in ames/fine tests 2023-04-23 09:40:57 +02:00
Joe Bryan
36821967be tests: fixes $wail serialization in fine tests 2023-04-23 02:01:50 -04:00
Ted Blackman
84cd948f30 Merge branch 'next/kelvin/413' into i/5788/remote-scry 2023-04-22 14:33:20 -04:00
yosoyubik
d259656e29 lull: clean up remote scry namespace missmatches
(note: first pass, subject to change)
2023-04-22 10:57:49 +02:00
Joe Bryan
3eeca101ac test: fixes ames tests (broken due to $roar refactoring) 2023-04-21 13:16:59 -04:00
yosoyubik
2bcfd7599a ames: fix %fine tests to account for updated %tune 2023-04-21 17:54:01 +02:00