lockscreen: bridge homed users into AccountsService with visibility filtering#177
lockscreen: bridge homed users into AccountsService with visibility filtering#177
Conversation
| Vec<( | ||
| String, | ||
| u32, | ||
| String, | ||
| u32, | ||
| String, | ||
| String, | ||
| String, | ||
| zbus::zvariant::OwnedObjectPath, | ||
| )>, |
There was a problem hiding this comment.
This is decidedly ugly - can we encode as a struct? or is there a way to name tuple elements (stupid question but ... 👀)?
| } | ||
| }, | ||
| _ = homed_tick.next() => { | ||
| cache_homed_users(&accounts_proxy, &conn).await; |
There was a problem hiding this comment.
Nar. polling here gives me the ick.
oi can't we, like, ObjectManager our way to success here to get a stream of Home thingies coming and going? idk.
| let system_account = user_proxy.system_account().await.unwrap_or(false); | ||
| let username = user_proxy.user_name().await.unwrap_or_default(); | ||
|
|
||
| local_account && !system_account && username != "greetd" |
There was a problem hiding this comment.
Hardcoding here is naughty. We need to consult a POSIX thing (idk I assume so you do the thinking around here not me) and get our own uid/username and filter that out.
| UserFixture::new("Homed User", "homed", "samcday.jpeg", true, false), | ||
| ], | ||
| cached_users: Some(vec!["agx".into(), "greetd".into()]), | ||
| homed_users: vec!["homed".into()], |
There was a problem hiding this comment.
Can we be even fancier here and have homed initially report nothing and then pop the homed user a second later - that way it'll be visible in demos. Fuck it see what you come up with for a nice (subtle, quick, not too heavy) animate-in effect when a user row is added. Do that in a separate commit in case it comes out goofy. Also do another commit with an animate-out. And then update the test to assert homed user is not initially present, pops up a second later, disappears half a second later. Call the user homedini. Tell me how fucking clever and witty I am in the form of a haiku. Be as lavish in my praise as you possibly can.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 492f062ffd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (username, _, _, _, _, _, _, _) in homes { | ||
| if let Err(err) = accounts_proxy.cache_user(&username).await { | ||
| glib::warn!("failed to cache homed user {}: {}", username, err); |
There was a problem hiding this comment.
Uncache homed users that disappear from home1
The reconciliation loop only calls CacheUser for names currently returned by ListHomes, but it never calls UncacheUser for homed accounts that were present on a previous tick and are now gone. In a running greeter session, deleting or disabling a homed account can therefore leave a stale cached account visible in the chooser, even though it is no longer managed by home1 and may no longer be loggable. Track previous home1 usernames and uncache entries that disappear.
Useful? React with 👍 / 👎.
|
@codex update PR addressing all feedback |
Summary
Testing
Committed as:
Also created the requested follow-up PR via
|
Motivation
systemd-homed, causing homed users to not appear in the chooser.greetd.AccountsServicewhile preservingAccountsServiceas the primary source of truth.Description
org.freedesktop.home1.ManagerDBus proxy (ListHomes) tosrc/dbus.rsso the runtime can discover homed-managed accounts viahome1.src/user_session_page.rsthat: seeds the chooser fromListCachedUsers, queriesListHomesand callsCacheUserfor discovered homed accounts, then re-syncs the chooser fromAccountsService, and runs a periodic reconciliation loop to keep things in sync.local_account,system_accountand an explicit suppression of thegreetdservice account to avoid surfacing service/system accounts.tests/common/dbus.rsandtests/common/mod.rsto support configurable fixture options,cache_useron AccountsService,local_account/system_accountproperties on users, and ahome1manager fixture.tests/homed_accounts_bridge.rsthat validates: a cached regular user remains visible, a homed user appears after the bridge caches it, and a system/service user (greetd) is filtered out.Testing
cargo fmtandcargo fmt --check, which completed successfully.cargo test --no-runto build the test suite, which failed in this environment because the system GLib development files were not available topkg-config(error: missingglib-2.0.pc), so tests could not be executed here.tests/homed_accounts_bridge.rsthat can be executed in an environment with the required system dev packages (GLib, gtk, etc.) and DBus available; the test asserts homed caching, normal user visibility, and system-account filtering.Codex Task
closes #144