Skip to content

Comments

lockscreen: bridge homed users into AccountsService with visibility filtering#177

Open
samcday wants to merge 1 commit intomainfrom
codex/github-mention-re-examine-org.fdo.accountsservice-usage
Open

lockscreen: bridge homed users into AccountsService with visibility filtering#177
samcday wants to merge 1 commit intomainfrom
codex/github-mention-re-examine-org.fdo.accountsservice-usage

Conversation

@samcday
Copy link
Owner

@samcday samcday commented Feb 20, 2026

Motivation

  • AccountsService alone can miss users created/managed by systemd-homed, causing homed users to not appear in the chooser.
  • The UI currently shows every cached user verbatim, which can leak service/system accounts like greetd.
  • Add a pragmatic, portable bridge to discover homed users and make them visible via AccountsService while preserving AccountsService as the primary source of truth.
  • Provide test fixtures to exercise the bridge and visibility rules in integration tests.

Description

  • Added a org.freedesktop.home1.Manager DBus proxy (ListHomes) to src/dbus.rs so the runtime can discover homed-managed accounts via home1.
  • Implemented a homed-to-AccountsService bridge in src/user_session_page.rs that: seeds the chooser from ListCachedUsers, queries ListHomes and calls CacheUser for discovered homed accounts, then re-syncs the chooser from AccountsService, and runs a periodic reconciliation loop to keep things in sync.
  • Added account visibility filtering before appending users to the chooser using local_account, system_account and an explicit suppression of the greetd service account to avoid surfacing service/system accounts.
  • Extended the DBus test fixtures in tests/common/dbus.rs and tests/common/mod.rs to support configurable fixture options, cache_user on AccountsService, local_account/system_account properties on users, and a home1 manager fixture.
  • Added an integration test tests/homed_accounts_bridge.rs that 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

  • Ran cargo fmt and cargo fmt --check, which completed successfully.
  • Ran cargo test --no-run to build the test suite, which failed in this environment because the system GLib development files were not available to pkg-config (error: missing glib-2.0.pc), so tests could not be executed here.
  • Added integration coverage via tests/homed_accounts_bridge.rs that 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

Copy link
Owner Author

@samcday samcday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex some feedback, get cracking on another pass of the PR pluz

Comment on lines +273 to +282
Vec<(
String,
u32,
String,
u32,
String,
String,
String,
zbus::zvariant::OwnedObjectPath,
)>,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()],
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +253 to +255
for (username, _, _, _, _, _, _, _) in homes {
if let Err(err) = accounts_proxy.cache_user(&username).await {
glib::warn!("failed to cache homed user {}: {}", username, err);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@samcday
Copy link
Owner Author

samcday commented Feb 21, 2026

@codex update PR addressing all feedback

@chatgpt-codex-connector
Copy link

Summary

Testing

  • cargo fmt
  • cargo fmt --check
  • ⚠️ cargo test --no-run (fails in this environment due to missing system GLib pkg-config metadata: glib-2.0.pc)

Committed as:

  • a4053adlockscreen: reconcile homed cache lifecycle

Also created the requested follow-up PR via make_pr with title:

  • lockscreen: follow-up fixes for homed bridge reviewer feedback

View task →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-examine org.fdo.AccountsService usage

1 participant