Skip to content

Commit 4a34656

Browse files
committed
Delete debug-only AuthProvider.notify-created.
The AuthProvider-side notify-created was documented as 'mostly for debugging purposes' and just appended a {'type': 'created'} event row. Nothing depends on that event, and the lone caller in fleet.toit already inserts the same kind of state through the broker's own (and load-bearing) notify-created. Removes: - the interface declaration in auth-provider.toit; - the Supabase and HTTP impls; - the fleet.toit caller and its 'mostly for testing purposes' comment; - the HTTP test server dispatch branch; - the COMMAND-NOTIFY-ARTEMIS-CREATED_ constant and its string mapping; - the test-notify-created test helper. The broker's own notify-created (BrokerCli.notify-created) is untouched.
1 parent c2af662 commit 4a34656

8 files changed

Lines changed: 3 additions & 47 deletions

File tree

src/cli/artemis.toit

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ class Artemis:
7777
ensure-authenticated -> none:
7878
connected-auth-provider_
7979

80-
notify-created --hardware-id/Uuid:
81-
server := connected-auth-provider_
82-
server.notify-created --hardware-id=hardware-id
83-
8480
create-device --device-id/Uuid? --organization-id/Uuid -> Device:
8581
return connected-auth-provider_.create-device-in-organization
8682
--device-id=device-id

src/cli/auth_providers/auth-provider.toit

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ interface AuthProvider implements Authenticatable:
6868
*/
6969
create-device-in-organization --organization-id/Uuid --device-id/Uuid? -> Device
7070

71-
/**
72-
Notifies the server that the device with the given $hardware-id was created.
73-
74-
This operation is mostly for debugging purposes, as the $create-device-in-organization
75-
already has a similar effect.
76-
*/
77-
notify-created --hardware-id/Uuid
78-
7971
/** Returns the used-id of the authenticated user. */
8072
get-current-user-id -> string
8173

src/cli/auth_providers/http/base.toit

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ class AuthProviderHttpToit implements AuthProvider:
8787
--id=Uuid.parse device-info["alias"]
8888
--organization-id=Uuid.parse device-info["organization_id"]
8989

90-
notify-created --hardware-id/Uuid -> none:
91-
send-request_ COMMAND-NOTIFY-ARTEMIS-CREATED_ {
92-
"hardware_id": "$hardware-id",
93-
"data": { "type": "created" },
94-
}
95-
9690
get-current-user-id -> Uuid:
9791
return current-user-id_
9892

src/cli/auth_providers/supabase/supabase.toit

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ class AuthProviderSupabase implements AuthProvider:
7373
--id=Uuid.parse inserted["alias"]
7474
--organization-id=Uuid.parse inserted["organization_id"]
7575

76-
notify-created --hardware-id/Uuid -> none:
77-
client_.rest.insert "events" --no-return-inserted {
78-
"device_id": "$hardware-id",
79-
"data": { "type": "created" }
80-
}
81-
8276
get-current-user-id -> Uuid:
8377
return Uuid.parse client_.auth.get-current-user["id"]
8478

src/cli/fleet.toit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,7 @@ class FleetWithDevices extends Fleet:
10411041
--device-id=device-id
10421042
--organization-id=organization-id
10431043
assert: device.id == device-id
1044-
hardware-id := device.hardware-id
10451044

1046-
// Insert an initial event mostly for testing purposes.
1047-
artemis.notify-created --hardware-id=hardware-id
10481045
broker.notify-created device
10491046

10501047
write-identity-file device --out-path=out-path

src/shared/constants.toit

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ COMMAND-SIGN-UP_ ::= 2
77
COMMAND-SIGN-IN_ ::= 3
88
COMMAND-GET-ORGANIZATIONS_ ::= 4
99
COMMAND-UPDATE-CURRENT-USER_ ::= 18
10-
COMMAND-NOTIFY-ARTEMIS-CREATED_ ::= 5
1110
COMMAND-GET-ORGANIZATION-DETAILS_ ::= 6
1211
COMMAND-CREATE-ORGANIZATION_ ::= 7
1312
COMMAND-UPDATE-ORGANIZATION_ ::= 8
@@ -25,7 +24,6 @@ ARTEMIS-COMMAND-TO-STRING ::= {
2524
COMMAND-SIGN-IN_: "sign-in",
2625
COMMAND-GET-ORGANIZATIONS_: "get-organizations",
2726
COMMAND-UPDATE-CURRENT-USER_: "update-current-user",
28-
COMMAND-NOTIFY-ARTEMIS-CREATED_: "notify-artemis-created",
2927
COMMAND-GET-ORGANIZATION-DETAILS_: "get-organization-details",
3028
COMMAND-CREATE-ORGANIZATION_: "create-organization",
3129
COMMAND-UPDATE-ORGANIZATION_: "update-organization",
@@ -46,12 +44,7 @@ COMMAND-DOWNLOAD-PRIVATE_ ::= 3
4644
// As of 2024-03-22 unused. Newer CLIs use $COMMAND-UPDATE-GOALS_ instead.
4745
COMMAND-UPDATE-GOAL_ ::= 4
4846
COMMAND-GET-DEVICES_ ::= 5
49-
/**
50-
Command to notify the Artemis server that a broker has been created.
51-
52-
To avoid accidental confusion with $COMMAND-NOTIFY-ARTEMIS-CREATED_, the
53-
command has the same constants.
54-
*/
47+
/** Command to notify the broker that a device has been created. */
5548
COMMAND-NOTIFY-BROKER-CREATED_ ::= 6
5649
COMMAND-GET-EVENTS_ ::= 7
5750
COMMAND-UPDATE-GOALS_ ::= 8

tests/auth-provider-test.toit

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ run-test artemis-server/TestArtemisServer [--authenticate]:
3939
network := net.open
4040
server-cli := AuthProvider network server-config --cli=cli
4141
authenticate.call server-cli
42-
hardware-id := test-create-device-in-organization server-cli backdoor
43-
test-notify-created server-cli backdoor --hardware-id=hardware-id
42+
test-create-device-in-organization server-cli backdoor
4443

4544
test-organizations server-cli backdoor
4645
test-profile server-cli backdoor
4746

48-
test-create-device-in-organization server-cli/AuthProvider backdoor/ArtemisServerBackdoor -> Uuid:
47+
test-create-device-in-organization server-cli/AuthProvider backdoor/ArtemisServerBackdoor:
4948
// Test without and with alias.
5049
device1 := server-cli.create-device-in-organization
5150
--device-id=null
@@ -66,13 +65,6 @@ test-create-device-in-organization server-cli/AuthProvider backdoor/ArtemisServe
6665
expect-equals TEST-ORGANIZATION-UUID data[1]
6766
expect-equals alias-id data[2]
6867

69-
return hardware-id2
70-
71-
test-notify-created server-cli/AuthProvider backdoor/ArtemisServerBackdoor --hardware-id/Uuid:
72-
expect-not (backdoor.has-event --hardware-id=hardware-id --type="created")
73-
server-cli.notify-created --hardware-id=hardware-id
74-
expect (backdoor.has-event --hardware-id=hardware-id --type="created")
75-
7668
test-organizations server-cli/AuthProvider backdoor/ArtemisServerBackdoor:
7769
original-orgs := server-cli.get-organizations
7870

tools/http_servers/artemis-server.toit

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ class HttpArtemisServer extends HttpServer:
103103
return store-event data
104104
if command == COMMAND-CREATE-DEVICE-IN-ORGANIZATION_:
105105
return create-device-in-organization data
106-
if command == COMMAND-NOTIFY-ARTEMIS-CREATED_:
107-
return store-event data
108106
if command == COMMAND-SIGN-UP_:
109107
return sign-up data
110108
if command == COMMAND-SIGN-IN_:

0 commit comments

Comments
 (0)