···11+// Folder-specific settings
22+//
33+// For a full list of overridable settings, and general information on folder-specific settings,
44+// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
55+{
66+ "lsp": {
77+ "rust-analyzer": {
88+ "initialization_options": {
99+ "cargo": {
1010+ "allFeatures": true,
1111+ },
1212+ },
1313+ },
1414+ },
1515+}
···10101111#[allow(unused_imports)]
1212use core::marker::PhantomData;
1313-use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
1313+use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
1414+1515+#[allow(unused_imports)]
1616+use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
1417use jacquard_common::deps::smol_str::SmolStr;
1515-use jacquard_common::types::string::Did;
1818+use jacquard_common::types::string::{Did, Handle};
1619use jacquard_common::types::value::Data;
1720use jacquard_derive::IntoStatic;
2121+use jacquard_lexicon::lexicon::LexiconDoc;
2222+use jacquard_lexicon::schema::LexiconSchema;
2323+2424+#[allow(unused_imports)]
2525+use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
1826use serde::{Serialize, Deserialize};
1919-use crate::space_polymodel::actor::ProfileViewUnion;
2727+use crate::space_polymodel::actor::ProfileView;
2828+use crate::space_polymodel::actor::get_session;
20292130#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
2231#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
2332pub struct GetSessionOutput<S: BosStr = DefaultStr> {
2424- ///Always present. When false the response carries only this field (no identity/profile); when true, did/handle/profile are populated.
3333+ #[serde(flatten)]
3434+ pub value: get_session::SessionView<S>,
3535+ #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
3636+ pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
3737+}
3838+3939+/// Authenticated viewer identity for client session seeding. If authenticated is true, did, handle, and profile are all present.
4040+4141+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
4242+#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
4343+pub struct SessionAuthenticated<S: BosStr = DefaultStr> {
4444+ pub authenticated: bool,
4545+ pub did: Did<S>,
4646+ pub handle: Handle<S>,
4747+ pub profile: ProfileView<S>,
4848+ #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
4949+ pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
5050+}
5151+5252+/// Logged-out session marker. No identity fields are present when authenticated is false.
5353+5454+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
5555+#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
5656+pub struct SessionUnauthenticated<S: BosStr = DefaultStr> {
2557 pub authenticated: bool,
2626- #[serde(skip_serializing_if = "Option::is_none")]
2727- pub did: Option<Did<S>>,
2828- #[serde(skip_serializing_if = "Option::is_none")]
2929- pub handle: Option<S>,
3030- #[serde(skip_serializing_if = "Option::is_none")]
3131- pub profile: Option<ProfileViewUnion<S>>,
3258 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
3359 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
6060+}
6161+6262+6363+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
6464+#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
6565+pub enum SessionView<S: BosStr = DefaultStr> {
6666+ #[serde(rename = "space.polymodel.actor.getSession#sessionUnauthenticated")]
6767+ SessionUnauthenticated(Box<get_session::SessionUnauthenticated<S>>),
6868+ #[serde(rename = "space.polymodel.actor.getSession#sessionAuthenticated")]
6969+ SessionAuthenticated(Box<get_session::SessionAuthenticated<S>>),
3470}
35713672/** Request marker for the `space.polymodel.actor.getSession` query.
···65101 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
66102 type Request<S: BosStr> = GetSession;
67103 type Response = GetSessionResponse;
104104+}
105105+106106+impl<S: BosStr> LexiconSchema for SessionAuthenticated<S> {
107107+ fn nsid() -> &'static str {
108108+ "space.polymodel.actor.getSession"
109109+ }
110110+ fn def_name() -> &'static str {
111111+ "sessionAuthenticated"
112112+ }
113113+ fn lexicon_doc() -> LexiconDoc<'static> {
114114+ lexicon_doc_space_polymodel_actor_getSession()
115115+ }
116116+ fn validate(&self) -> Result<(), ConstraintError> {
117117+ Ok(())
118118+ }
119119+}
120120+121121+impl<S: BosStr> LexiconSchema for SessionUnauthenticated<S> {
122122+ fn nsid() -> &'static str {
123123+ "space.polymodel.actor.getSession"
124124+ }
125125+ fn def_name() -> &'static str {
126126+ "sessionUnauthenticated"
127127+ }
128128+ fn lexicon_doc() -> LexiconDoc<'static> {
129129+ lexicon_doc_space_polymodel_actor_getSession()
130130+ }
131131+ fn validate(&self) -> Result<(), ConstraintError> {
132132+ Ok(())
133133+ }
134134+}
135135+136136+pub mod session_authenticated_state {
137137+138138+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
139139+ #[allow(unused)]
140140+ use ::core::marker::PhantomData;
141141+ mod sealed {
142142+ pub trait Sealed {}
143143+ }
144144+ /// State trait tracking which required fields have been set
145145+ pub trait State: sealed::Sealed {
146146+ type Authenticated;
147147+ type Did;
148148+ type Handle;
149149+ type Profile;
150150+ }
151151+ /// Empty state - all required fields are unset
152152+ pub struct Empty(());
153153+ impl sealed::Sealed for Empty {}
154154+ impl State for Empty {
155155+ type Authenticated = Unset;
156156+ type Did = Unset;
157157+ type Handle = Unset;
158158+ type Profile = Unset;
159159+ }
160160+ ///State transition - sets the `authenticated` field to Set
161161+ pub struct SetAuthenticated<St: State = Empty>(PhantomData<fn() -> St>);
162162+ impl<St: State> sealed::Sealed for SetAuthenticated<St> {}
163163+ impl<St: State> State for SetAuthenticated<St> {
164164+ type Authenticated = Set<members::authenticated>;
165165+ type Did = St::Did;
166166+ type Handle = St::Handle;
167167+ type Profile = St::Profile;
168168+ }
169169+ ///State transition - sets the `did` field to Set
170170+ pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
171171+ impl<St: State> sealed::Sealed for SetDid<St> {}
172172+ impl<St: State> State for SetDid<St> {
173173+ type Authenticated = St::Authenticated;
174174+ type Did = Set<members::did>;
175175+ type Handle = St::Handle;
176176+ type Profile = St::Profile;
177177+ }
178178+ ///State transition - sets the `handle` field to Set
179179+ pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
180180+ impl<St: State> sealed::Sealed for SetHandle<St> {}
181181+ impl<St: State> State for SetHandle<St> {
182182+ type Authenticated = St::Authenticated;
183183+ type Did = St::Did;
184184+ type Handle = Set<members::handle>;
185185+ type Profile = St::Profile;
186186+ }
187187+ ///State transition - sets the `profile` field to Set
188188+ pub struct SetProfile<St: State = Empty>(PhantomData<fn() -> St>);
189189+ impl<St: State> sealed::Sealed for SetProfile<St> {}
190190+ impl<St: State> State for SetProfile<St> {
191191+ type Authenticated = St::Authenticated;
192192+ type Did = St::Did;
193193+ type Handle = St::Handle;
194194+ type Profile = Set<members::profile>;
195195+ }
196196+ /// Marker types for field names
197197+ #[allow(non_camel_case_types)]
198198+ pub mod members {
199199+ ///Marker type for the `authenticated` field
200200+ pub struct authenticated(());
201201+ ///Marker type for the `did` field
202202+ pub struct did(());
203203+ ///Marker type for the `handle` field
204204+ pub struct handle(());
205205+ ///Marker type for the `profile` field
206206+ pub struct profile(());
207207+ }
208208+}
209209+210210+/// Builder for constructing an instance of this type.
211211+pub struct SessionAuthenticatedBuilder<
212212+ St: session_authenticated_state::State,
213213+ S: BosStr = DefaultStr,
214214+> {
215215+ _state: PhantomData<fn() -> St>,
216216+ _fields: (Option<bool>, Option<Did<S>>, Option<Handle<S>>, Option<ProfileView<S>>),
217217+ _type: PhantomData<fn() -> S>,
218218+}
219219+220220+impl SessionAuthenticated<DefaultStr> {
221221+ /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
222222+ pub fn new() -> SessionAuthenticatedBuilder<
223223+ session_authenticated_state::Empty,
224224+ DefaultStr,
225225+ > {
226226+ SessionAuthenticatedBuilder::new()
227227+ }
228228+}
229229+230230+impl<S: BosStr> SessionAuthenticated<S> {
231231+ /// Create a new builder for this type
232232+ pub fn builder() -> SessionAuthenticatedBuilder<
233233+ session_authenticated_state::Empty,
234234+ S,
235235+ > {
236236+ SessionAuthenticatedBuilder::builder()
237237+ }
238238+}
239239+240240+impl SessionAuthenticatedBuilder<session_authenticated_state::Empty, DefaultStr> {
241241+ /// Create a new builder with all fields unset, using the default string type, if needed
242242+ pub fn new() -> Self {
243243+ SessionAuthenticatedBuilder {
244244+ _state: PhantomData,
245245+ _fields: (None, None, None, None),
246246+ _type: PhantomData,
247247+ }
248248+ }
249249+}
250250+251251+impl<S: BosStr> SessionAuthenticatedBuilder<session_authenticated_state::Empty, S> {
252252+ /// Create a new builder with all fields unset
253253+ pub fn builder() -> Self {
254254+ SessionAuthenticatedBuilder {
255255+ _state: PhantomData,
256256+ _fields: (None, None, None, None),
257257+ _type: PhantomData,
258258+ }
259259+ }
260260+}
261261+262262+impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>
263263+where
264264+ St: session_authenticated_state::State,
265265+ St::Authenticated: session_authenticated_state::IsUnset,
266266+{
267267+ /// Set the `authenticated` field (required)
268268+ pub fn authenticated(
269269+ mut self,
270270+ value: impl Into<bool>,
271271+ ) -> SessionAuthenticatedBuilder<
272272+ session_authenticated_state::SetAuthenticated<St>,
273273+ S,
274274+ > {
275275+ self._fields.0 = Option::Some(value.into());
276276+ SessionAuthenticatedBuilder {
277277+ _state: PhantomData,
278278+ _fields: self._fields,
279279+ _type: PhantomData,
280280+ }
281281+ }
282282+}
283283+284284+impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>
285285+where
286286+ St: session_authenticated_state::State,
287287+ St::Did: session_authenticated_state::IsUnset,
288288+{
289289+ /// Set the `did` field (required)
290290+ pub fn did(
291291+ mut self,
292292+ value: impl Into<Did<S>>,
293293+ ) -> SessionAuthenticatedBuilder<session_authenticated_state::SetDid<St>, S> {
294294+ self._fields.1 = Option::Some(value.into());
295295+ SessionAuthenticatedBuilder {
296296+ _state: PhantomData,
297297+ _fields: self._fields,
298298+ _type: PhantomData,
299299+ }
300300+ }
301301+}
302302+303303+impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>
304304+where
305305+ St: session_authenticated_state::State,
306306+ St::Handle: session_authenticated_state::IsUnset,
307307+{
308308+ /// Set the `handle` field (required)
309309+ pub fn handle(
310310+ mut self,
311311+ value: impl Into<Handle<S>>,
312312+ ) -> SessionAuthenticatedBuilder<session_authenticated_state::SetHandle<St>, S> {
313313+ self._fields.2 = Option::Some(value.into());
314314+ SessionAuthenticatedBuilder {
315315+ _state: PhantomData,
316316+ _fields: self._fields,
317317+ _type: PhantomData,
318318+ }
319319+ }
320320+}
321321+322322+impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>
323323+where
324324+ St: session_authenticated_state::State,
325325+ St::Profile: session_authenticated_state::IsUnset,
326326+{
327327+ /// Set the `profile` field (required)
328328+ pub fn profile(
329329+ mut self,
330330+ value: impl Into<ProfileView<S>>,
331331+ ) -> SessionAuthenticatedBuilder<session_authenticated_state::SetProfile<St>, S> {
332332+ self._fields.3 = Option::Some(value.into());
333333+ SessionAuthenticatedBuilder {
334334+ _state: PhantomData,
335335+ _fields: self._fields,
336336+ _type: PhantomData,
337337+ }
338338+ }
339339+}
340340+341341+impl<St, S: BosStr> SessionAuthenticatedBuilder<St, S>
342342+where
343343+ St: session_authenticated_state::State,
344344+ St::Authenticated: session_authenticated_state::IsSet,
345345+ St::Did: session_authenticated_state::IsSet,
346346+ St::Handle: session_authenticated_state::IsSet,
347347+ St::Profile: session_authenticated_state::IsSet,
348348+{
349349+ /// Build the final struct.
350350+ pub fn build(self) -> SessionAuthenticated<S> {
351351+ SessionAuthenticated {
352352+ authenticated: self._fields.0.unwrap(),
353353+ did: self._fields.1.unwrap(),
354354+ handle: self._fields.2.unwrap(),
355355+ profile: self._fields.3.unwrap(),
356356+ extra_data: Default::default(),
357357+ }
358358+ }
359359+ /// Build the final struct with custom extra_data.
360360+ pub fn build_with_data(
361361+ self,
362362+ extra_data: BTreeMap<SmolStr, Data<S>>,
363363+ ) -> SessionAuthenticated<S> {
364364+ SessionAuthenticated {
365365+ authenticated: self._fields.0.unwrap(),
366366+ did: self._fields.1.unwrap(),
367367+ handle: self._fields.2.unwrap(),
368368+ profile: self._fields.3.unwrap(),
369369+ extra_data: Some(extra_data),
370370+ }
371371+ }
372372+}
373373+374374+fn lexicon_doc_space_polymodel_actor_getSession() -> LexiconDoc<'static> {
375375+ #[allow(unused_imports)]
376376+ use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
377377+ use jacquard_lexicon::lexicon::*;
378378+ use alloc::collections::BTreeMap;
379379+ LexiconDoc {
380380+ lexicon: Lexicon::Lexicon1,
381381+ id: CowStr::new_static("space.polymodel.actor.getSession"),
382382+ defs: {
383383+ let mut map = BTreeMap::new();
384384+ map.insert(
385385+ SmolStr::new_static("main"),
386386+ LexUserType::XrpcQuery(LexXrpcQuery {
387387+ parameters: None,
388388+ ..Default::default()
389389+ }),
390390+ );
391391+ map.insert(
392392+ SmolStr::new_static("sessionAuthenticated"),
393393+ LexUserType::Object(LexObject {
394394+ description: Some(
395395+ CowStr::new_static(
396396+ "Authenticated viewer identity for client session seeding. If authenticated is true, did, handle, and profile are all present.",
397397+ ),
398398+ ),
399399+ required: Some(
400400+ vec![
401401+ SmolStr::new_static("authenticated"),
402402+ SmolStr::new_static("did"), SmolStr::new_static("handle"),
403403+ SmolStr::new_static("profile")
404404+ ],
405405+ ),
406406+ properties: {
407407+ #[allow(unused_mut)]
408408+ let mut map = BTreeMap::new();
409409+ map.insert(
410410+ SmolStr::new_static("authenticated"),
411411+ LexObjectProperty::Boolean(LexBoolean {
412412+ ..Default::default()
413413+ }),
414414+ );
415415+ map.insert(
416416+ SmolStr::new_static("did"),
417417+ LexObjectProperty::String(LexString {
418418+ format: Some(LexStringFormat::Did),
419419+ ..Default::default()
420420+ }),
421421+ );
422422+ map.insert(
423423+ SmolStr::new_static("handle"),
424424+ LexObjectProperty::String(LexString {
425425+ format: Some(LexStringFormat::Handle),
426426+ ..Default::default()
427427+ }),
428428+ );
429429+ map.insert(
430430+ SmolStr::new_static("profile"),
431431+ LexObjectProperty::Ref(LexRef {
432432+ r#ref: CowStr::new_static(
433433+ "space.polymodel.actor.defs#profileView",
434434+ ),
435435+ ..Default::default()
436436+ }),
437437+ );
438438+ map
439439+ },
440440+ ..Default::default()
441441+ }),
442442+ );
443443+ map.insert(
444444+ SmolStr::new_static("sessionUnauthenticated"),
445445+ LexUserType::Object(LexObject {
446446+ description: Some(
447447+ CowStr::new_static(
448448+ "Logged-out session marker. No identity fields are present when authenticated is false.",
449449+ ),
450450+ ),
451451+ required: Some(vec![SmolStr::new_static("authenticated")]),
452452+ properties: {
453453+ #[allow(unused_mut)]
454454+ let mut map = BTreeMap::new();
455455+ map.insert(
456456+ SmolStr::new_static("authenticated"),
457457+ LexObjectProperty::Boolean(LexBoolean {
458458+ ..Default::default()
459459+ }),
460460+ );
461461+ map
462462+ },
463463+ ..Default::default()
464464+ }),
465465+ );
466466+ map.insert(
467467+ SmolStr::new_static("sessionView"),
468468+ LexUserType::Union(LexRefUnion {
469469+ refs: vec![
470470+ CowStr::new_static("space.polymodel.actor.getSession#sessionUnauthenticated"),
471471+ CowStr::new_static("space.polymodel.actor.getSession#sessionAuthenticated")
472472+ ],
473473+ closed: Some(true),
474474+ ..Default::default()
475475+ }),
476476+ );
477477+ map
478478+ },
479479+ ..Default::default()
480480+ }
481481+}
482482+483483+pub mod session_unauthenticated_state {
484484+485485+ pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
486486+ #[allow(unused)]
487487+ use ::core::marker::PhantomData;
488488+ mod sealed {
489489+ pub trait Sealed {}
490490+ }
491491+ /// State trait tracking which required fields have been set
492492+ pub trait State: sealed::Sealed {
493493+ type Authenticated;
494494+ }
495495+ /// Empty state - all required fields are unset
496496+ pub struct Empty(());
497497+ impl sealed::Sealed for Empty {}
498498+ impl State for Empty {
499499+ type Authenticated = Unset;
500500+ }
501501+ ///State transition - sets the `authenticated` field to Set
502502+ pub struct SetAuthenticated<St: State = Empty>(PhantomData<fn() -> St>);
503503+ impl<St: State> sealed::Sealed for SetAuthenticated<St> {}
504504+ impl<St: State> State for SetAuthenticated<St> {
505505+ type Authenticated = Set<members::authenticated>;
506506+ }
507507+ /// Marker types for field names
508508+ #[allow(non_camel_case_types)]
509509+ pub mod members {
510510+ ///Marker type for the `authenticated` field
511511+ pub struct authenticated(());
512512+ }
513513+}
514514+515515+/// Builder for constructing an instance of this type.
516516+pub struct SessionUnauthenticatedBuilder<
517517+ St: session_unauthenticated_state::State,
518518+ S: BosStr = DefaultStr,
519519+> {
520520+ _state: PhantomData<fn() -> St>,
521521+ _fields: (Option<bool>,),
522522+ _type: PhantomData<fn() -> S>,
523523+}
524524+525525+impl SessionUnauthenticated<DefaultStr> {
526526+ /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
527527+ pub fn new() -> SessionUnauthenticatedBuilder<
528528+ session_unauthenticated_state::Empty,
529529+ DefaultStr,
530530+ > {
531531+ SessionUnauthenticatedBuilder::new()
532532+ }
533533+}
534534+535535+impl<S: BosStr> SessionUnauthenticated<S> {
536536+ /// Create a new builder for this type
537537+ pub fn builder() -> SessionUnauthenticatedBuilder<
538538+ session_unauthenticated_state::Empty,
539539+ S,
540540+ > {
541541+ SessionUnauthenticatedBuilder::builder()
542542+ }
543543+}
544544+545545+impl SessionUnauthenticatedBuilder<session_unauthenticated_state::Empty, DefaultStr> {
546546+ /// Create a new builder with all fields unset, using the default string type, if needed
547547+ pub fn new() -> Self {
548548+ SessionUnauthenticatedBuilder {
549549+ _state: PhantomData,
550550+ _fields: (None,),
551551+ _type: PhantomData,
552552+ }
553553+ }
554554+}
555555+556556+impl<S: BosStr> SessionUnauthenticatedBuilder<session_unauthenticated_state::Empty, S> {
557557+ /// Create a new builder with all fields unset
558558+ pub fn builder() -> Self {
559559+ SessionUnauthenticatedBuilder {
560560+ _state: PhantomData,
561561+ _fields: (None,),
562562+ _type: PhantomData,
563563+ }
564564+ }
565565+}
566566+567567+impl<St, S: BosStr> SessionUnauthenticatedBuilder<St, S>
568568+where
569569+ St: session_unauthenticated_state::State,
570570+ St::Authenticated: session_unauthenticated_state::IsUnset,
571571+{
572572+ /// Set the `authenticated` field (required)
573573+ pub fn authenticated(
574574+ mut self,
575575+ value: impl Into<bool>,
576576+ ) -> SessionUnauthenticatedBuilder<
577577+ session_unauthenticated_state::SetAuthenticated<St>,
578578+ S,
579579+ > {
580580+ self._fields.0 = Option::Some(value.into());
581581+ SessionUnauthenticatedBuilder {
582582+ _state: PhantomData,
583583+ _fields: self._fields,
584584+ _type: PhantomData,
585585+ }
586586+ }
587587+}
588588+589589+impl<St, S: BosStr> SessionUnauthenticatedBuilder<St, S>
590590+where
591591+ St: session_unauthenticated_state::State,
592592+ St::Authenticated: session_unauthenticated_state::IsSet,
593593+{
594594+ /// Build the final struct.
595595+ pub fn build(self) -> SessionUnauthenticated<S> {
596596+ SessionUnauthenticated {
597597+ authenticated: self._fields.0.unwrap(),
598598+ extra_data: Default::default(),
599599+ }
600600+ }
601601+ /// Build the final struct with custom extra_data.
602602+ pub fn build_with_data(
603603+ self,
604604+ extra_data: BTreeMap<SmolStr, Data<S>>,
605605+ ) -> SessionUnauthenticated<S> {
606606+ SessionUnauthenticated {
607607+ authenticated: self._fields.0.unwrap(),
608608+ extra_data: Some(extra_data),
609609+ }
610610+ }
68611}
+7-7
justfile
···2233set dotenv-load := false
4455-# Format and apply safe automatic fixes. This is the default pre-review cleanup command.
55+# Format Rust sources. Run clippy/check separately; clippy --fix can corrupt RSX.
66fix:
77 cargo fmt --all
88- cargo clippy --workspace --all-targets --fix --allow-dirty --allow-staged --allow-no-vcs -- -D warnings
99- cargo clippy -p polymodel --all-targets --features server --fix --allow-dirty --allow-staged --allow-no-vcs -- -D warnings
1010- cargo clippy -p polymodel --target wasm32-unknown-unknown --features web --fix --allow-dirty --allow-staged --allow-no-vcs -- -D warnings
1111-88+# Run clippy without --fix; automatic clippy rewrites can corrupt Dioxus RSX.
99+lint:
1010+ cargo clippy --workspace --all-targets -- -D warnings
1111+ cargo clippy -p polymodel --all-targets --features server -- -D warnings
1212+ cargo clippy -p polymodel --target wasm32-unknown-unknown --features web -- -D warnings
1213# Compile checks across the whole workspace plus the app's server/wasm targets.
1313-# Note: the server check uses compile-time `query!` macros that validate against a
1414# migrated SQLite database. Run `just migrate` first (or run `just sqlx-prepare`)
1515# so the macros can resolve.
1616check:
···3939 cargo nextest run -p polymodel --features server
40404141# Run all local validation expected before review.
4242-test-all: fix check test test-server
4242+test-all: fix check lint test test-server
4343# Run browser end-to-end tests.
4444e2e:
4545 cd e2e && npm test
+27-11
lexicons/actor/getSession.json
···22 "lexicon": 1,
33 "id": "space.polymodel.actor.getSession",
44 "defs": {
55+ "sessionUnauthenticated": {
66+ "type": "object",
77+ "description": "Logged-out session marker. No identity fields are present when authenticated is false.",
88+ "required": ["authenticated"],
99+ "properties": { "authenticated": { "type": "boolean", "const": false } }
1010+ },
1111+ "sessionAuthenticated": {
1212+ "type": "object",
1313+ "description": "Authenticated viewer identity for client session seeding. If authenticated is true, did, handle, and profile are all present.",
1414+ "required": ["authenticated", "did", "handle", "profile"],
1515+ "properties": {
1616+ "authenticated": { "type": "boolean", "const": true },
1717+ "did": { "type": "string", "format": "did" },
1818+ "handle": { "type": "string", "format": "handle" },
1919+ "profile": { "type": "ref", "ref": "space.polymodel.actor.defs#profileView" }
2020+ }
2121+ },
2222+ "sessionView": {
2323+ "type": "union",
2424+ "refs": [
2525+ "space.polymodel.actor.getSession#sessionUnauthenticated",
2626+ "space.polymodel.actor.getSession#sessionAuthenticated"
2727+ ],
2828+ "closed": true
2929+ },
530 "main": {
631 "type": "query",
77- "description": "Identity primitive (PM-9). Returns the authenticated viewer's identity plus profile for SSR-first session seeding, or an unauthenticated marker. The profile field reuses the getProfile union shape so the client renders identity + profile from a single first-paint value. PM-26 returns only the unauthenticated marker ({authenticated: false}); the authenticated fields (did/handle/profile) are populated once PM-27 wires OAuth session extraction, without changing this output contract. Takes no parameters: identity is derived from the request session, not an actor argument.",
3232+ "description": "Identity primitive (PM-9). Returns either a logged-out marker or the authenticated viewer's full identity/profile for client session seeding. Takes no parameters: identity is derived from the request session, not an actor argument.",
833 "output": {
934 "encoding": "application/json",
1010- "schema": {
1111- "type": "object",
1212- "required": ["authenticated"],
1313- "properties": {
1414- "authenticated": { "type": "boolean", "description": "Always present. When false the response carries only this field (no identity/profile); when true, did/handle/profile are populated." },
1515- "did": { "type": "string", "format": "did" },
1616- "handle": { "type": "string" },
1717- "profile": { "type": "ref", "ref": "space.polymodel.actor.defs#profileViewUnion" }
1818- }
1919- }
3535+ "schema": { "type": "ref", "ref": "space.polymodel.actor.getSession#sessionView" }
2036 }
2137 }
2238 }
+8-8
src/appview/actor.rs
···1515use polymodel_api::space_polymodel::actor::{
1616 ProfileViewUnion,
1717 get_profile::{GetProfileOutput, GetProfileRequest},
1818- get_session::{GetSessionOutput, GetSessionRequest},
1818+ get_session::{GetSessionOutput, GetSessionRequest, SessionUnauthenticated, SessionView},
1919};
20202121use super::error::{AppResult, internal};
···8282pub(super) async fn get_session(
8383 State(_state): State<Arc<AppState>>,
8484) -> AppResult<XrpcResponse<GetSessionRequest>> {
8585- // PM-26 ships the read seam + output contract only. Authenticated state
8686- // (did/handle/profile) is populated once PM-27 wires OAuth session extraction
8787- // — the output shape does not change, only which fields are filled.
8585+ // PM-26 ships the unauthenticated arm only. PM-27 will return
8686+ // `SessionAuthenticated` once OAuth session extraction and profile writes are wired.
8787+8888 Ok(XrpcResponse(GetSessionOutput {
8989- authenticated: false,
9090- did: None,
9191- handle: None,
9292- profile: None,
8989+ value: SessionView::SessionUnauthenticated(Box::new(SessionUnauthenticated {
9090+ authenticated: false,
9191+ extra_data: None,
9292+ })),
9393 extra_data: None,
9494 }))
9595}