Skip to content

feat(auth): publish reusable soma-auth crate - #320

Open
jmagar wants to merge 5 commits into
mainfrom
feat/publishable-soma-auth
Open

jmagar wants to merge 5 commits into
mainfrom
feat/publishable-soma-auth

Conversation

@jmagar

@jmagar jmagar commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • publishes soma-auth 0.5.0 as a crates.io-ready shared crate with zero local/path dependencies
  • moves product identity into an explicit AuthProfile and keeps Soma values in soma-integrations
  • adds typed configuration construction plus an optional EnvAuthConfigLoader
  • parameterizes upstream OAuth dynamic-registration client name and callback path
  • adds crate README, changelog, examples, docs.rs metadata, external-consumer package proof, CI Gate coverage, and a protected crates.io release workflow

Verified

  • 359 soma-auth tests
  • 18 soma-integrations tests
  • all four public feature combinations
  • full Soma all-features check
  • strict clippy and warning-free rustdoc
  • architecture, generated docs, version sync, file-size, and test-sibling gates
  • exact packaged .crate compiled from a blank external consumer under every feature combination
  • cargo publish --dry-run --locked reached the upload stage

Release

This PR does not publish the crate. Publication remains gated by the protected crates-io GitHub environment and the soma-auth-vX.Y.Z release workflow.

Copilot AI lite review requested due to automatic review settings August 4, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 4, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 5, 2026 03:10
@jmagar
jmagar force-pushed the feat/publishable-soma-auth branch from 89a9e16 to c382eea Compare August 5, 2026 03:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jmagar
jmagar force-pushed the feat/publishable-soma-auth branch from c382eea to 4ef5215 Compare August 5, 2026 03:12
Copilot AI review requested due to automatic review settings August 5, 2026 05:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jmagar

jmagar commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed the review finding on `crates/shared/auth/src/config_profile.rs`: `AuthProfile::default()` / `AuthConfigBuilder::new()` were resolving the SQLite token store and Ed25519 JWT signing key to a bare relative `./.auth` path — cwd-dependent, and a regression from the previous `$HOME`-anchored behavior.

Restored absolute resolution via a new `resolve_default_data_dir()` helper: platform data dir (`dirs::data_dir()`, i.e. `XDG_DATA_HOME`/`~/.local/share` etc.) → home dir (`dirs::home_dir()`) → bare relative path only as a last resort when neither is available. Added `dirs = "6"` to `crates/shared/auth/Cargo.toml` (same pin already used by `crates/soma/config`, `crates/soma/cli`, `crates/synapse/import`), so the crate stays publishable with no homelab-specific paths hard-coded.

Added two unit tests pinning the resolution precedence and guarding against regressing back to the bare relative path, and updated the one existing test that asserted the buggy literal `.auth` value.

Verification: `cargo test -q -p soma-auth --lib` → 131 passed, 0 failed. `cargo clippy -p soma-auth --lib -- -D warnings` and `cargo fmt -p soma-auth -- --check` both clean.

@jmagar
jmagar force-pushed the feat/publishable-soma-auth branch from 5edf1d6 to b495d48 Compare August 5, 2026 14:44
Copilot AI review requested due to automatic review settings August 5, 2026 14:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

jmagar added 5 commits August 5, 2026 18:12
…lative path

AuthProfile::default()/AuthConfigBuilder::new() resolved the SQLite token
store and Ed25519 JWT signing key to a bare relative "./.auth" path, which
is cwd-dependent and can silently split or lose auth state across process
restarts depending on the launch directory. Previously (before this crate's
data dir became configurable via AuthProfile) it resolved under $HOME.

Restore that behavior generically: prefer the platform data directory
(XDG_DATA_HOME/~/.local/share via `dirs::data_dir()`), fall back to the
home directory, and only fall back to the bare relative path when neither
is available. No homelab-specific path is hard-coded, keeping the crate
publishable; `dirs` is already used elsewhere in this workspace for the
same purpose (crates/soma/config, crates/soma/cli, crates/synapse/import).

Adds unit tests pinning the resolution precedence and guarding against
regressing back to the bare relative path.
@jmagar
jmagar force-pushed the feat/publishable-soma-auth branch from b495d48 to a1aa2de Compare August 5, 2026 22:39
Copilot AI review requested due to automatic review settings August 5, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants