# oauthkit BACKLOG
Single project ledger for the standalone `oauthkit` OAuth SDK. Rows follow the project pattern: `number | affected files | problem | acceptance criteria` with `status` and `tags` for drain tracking.
| number | affected files | problem | acceptance criteria | status | tags |
|--------|----------------|---------|---------------------|--------|------|
| 1 | `crates/oauthkit` (source), `libs/runtime/oauthkit` (target), `software/veyyon/veyyon-code/crates/Cargo.toml`, `software/veyyon/veyyon-code/crates/tui/Cargo.toml` | `oauthkit` is currently embedded inside `veyyon-code` as `crates/oauthkit`; it is meant to be a general-purpose library consumed by `veyyon-code` and others. | `oauthkit` is moved to `libs/runtime/oauthkit` as a standalone non-workspace crate; `veyyon-code` removes `oauthkit` from its workspace and consumes it via `workspace.dependencies` path; `cargo test` in `libs/runtime/oauthkit` and `cargo check -p veyyon-tui` in `veyyon-code` pass. | completed | A:Organization, D:Macro |
| 2 | `libs/runtime/oauthkit/Cargo.toml` | `oauthkit/Cargo.toml` uses `workspace = true` for every dependency and is only valid inside the `veyyon-code` workspace. | All dependencies are concrete versions with the same feature sets; `anyhow` is removed; no `workspace` references remain; `cargo test` passes. | completed | A:Architecture, D:Macro |
| 3 | `libs/runtime/oauthkit/LICENSE`, `CHANGELOG.md`, `SPEC.md`, `deny.toml`, `rust-toolchain.toml`, `Cargo.toml` | A standalone crate needs license, changelog, spec, and audit metadata. | Apache-2.0 license and `CHANGELOG.md` exist; `deny.toml` configures license/advisories; `rust-toolchain.toml` matches the 2024 edition requirement; `Cargo.toml` metadata is complete. | completed | D:Release/Evidence, C:Documentation |
| 4 | `libs/runtime/oauthkit/README.md`, `libs/runtime/oauthkit/src/lib.rs` | README and lib.rs doc examples use an OAuth flow that does not exist in the built-in registry. | Examples use only methods present in the built-in registry; docs honestly state that OAuth provider data is caller-supplied; `cargo test --doc` and `cargo test` pass. | completed | C:Documentation integrity, A:Product |
| 5 | `libs/runtime/oauthkit/src/flow/authorization_code.rs` | Fixed `redirect_uri` with port 0 binds to an ephemeral port but the authorize URL still contains port 0; callback path matching is hardcoded to `/callback` and `/`, so a custom redirect path returns 404 and the flow hangs. | `accept_code` uses the path from the configured `redirect_uri`; the actual bound port replaces any port 0 in the authorize URL; tests cover fixed port 0, custom path, and root path. | completed | B:Correctness, A:Architecture |
| 6 | `libs/runtime/oauthkit/BUILD.bazel` (new), `libs/runtime/oauthkit/rules/providers.toml` | `oauthkit` is in workspace `Cargo.toml` but has no Bazel `BUILD` file; `include_str!("../rules/providers.toml")` needs `compile_data` under Bazel. | `bazel build //crates/oauthkit` succeeds; `bazel test //crates/oauthkit:all` runs unit tests; `providers.toml` is declared as `compile_data`. | wontfix (obsolete: oauthkit is now a standalone Cargo crate at libs/runtime/oauthkit, outside the veyyon-code workspace, so the `//crates/oauthkit` Bazel target no longer exists. It ships to crates.io and is consumed via Cargo; a Bazel consumer gets a generated BUILD file from crate_universe. A hand-written BUILD.bazel would be unused maintenance rot — Law 1) | D:Fleet/Process, A:Organization |
| 7 | `libs/runtime/oauthkit/src/credentials.rs`, `libs/runtime/oauthkit/src/lib.rs`, `libs/runtime/oauthkit/src/tests.rs` | `Credential` is an open union with `access_token`, `refresh_token`, and `api_key` all as `Option<String>`; `CredentialKind` is separate so the type system does not enforce a valid shape. | `Credential` is an enum with `OAuth` and `ApiKey` variants; getters enforce shape; `secret()` and `Debug` redaction remain; `serde` tag preserves backward-compatible serialization; `cargo test` passes. | completed | A:Architecture, B:Correctness, testing.architecture |
| 8 | `libs/runtime/oauthkit/src/flow/mod.rs`, `libs/runtime/oauthkit/src/flow/device_code.rs`, `libs/runtime/oauthkit/src/flow/authorization_code.rs` | The `reqwest` client has no connect/read/write timeout; `post_token_form` does not parse OAuth error bodies for non-2xx device authorization; token errors may not surface structured `error_description` in all paths. | `http_client` has explicit timeouts or a configurable timeout; `device_code::request` reuses `TokenErrorResponse` on failure; tests cover timeout, OAuth error parsing, and malformed body. | completed | B:Reliability/Operability, C:DX/API |
| 9 | `libs/runtime/oauthkit/src/tests.rs` | No full integration tests for the authorization-code flow (mock loopback redirect plus token exchange) or device-code polling (mock device endpoint plus token endpoint). | Add contract tests with `wiremock` and `tiny_http` that drive the full flow, including state mismatch, timeout, `slow_down`, `access_denied`, and custom redirect path. | completed | B:Testing.contract, B:Testing.adversarial |
| 10 | `libs/runtime/oauthkit/src/provider.rs`, `libs/runtime/oauthkit/src/tests.rs` | Registry validation only checks non-empty strings, not URL validity, `redirect_uri` scheme, or `loopback_port` versus `redirect_uri` conflict. | `validate` rejects malformed `authorize_url`/`token_url`/`device_authorization_url`/`redirect_uri` and conflicting `loopback_port`/`redirect_uri` with clear errors; tests assert these rejections. | completed | B:Correctness/Conformance, C:DX/API |
| 11 | `libs/runtime/oauthkit/src/lib.rs`, `libs/runtime/oauthkit/src/tests.rs`, `libs/runtime/oauthkit/README.md` | `AuthClient` exposes `begin_device` but no `complete_device` helper; callers must manually call `DeviceAuthorization::poll`; there is no method dispatch helper. | Add `AuthClient::complete_device(provider_id, device_auth, max_wait)` or `AuthClient::sign_in_with_method(provider_id, method)` that dispatches and completes; update docs and tests. | completed | C:API/DX, A:Product |
| 12 | `libs/runtime/oauthkit/src/flow/mod.rs`, `libs/runtime/oauthkit/src/credentials.rs` | `TokenResponse` treats `token_type` as optional, but RFC 6749 section 5.1 requires it; lenient parsing may produce a `Credential` with no `token_type` and no error. | Either make `token_type` required and test failure when missing, or document and test the lenient behavior; `Credential` docs explain what `token_type` means. | completed | B:Conformance, C:Documentation |
| 13 | `libs/runtime/oauthkit/src/provider.rs`, `libs/runtime/oauthkit/src/lib.rs`, `libs/runtime/oauthkit/README.md` | `Provider::oauth()`, `device()`, and `api_key()` return the first matching method; a provider with two OAuth methods silently ignores the second. | `Registry::validate` rejects more than one method of the same kind per provider; `first-match` is now documented as a fallback for a valid, already-unique set; tests cover duplicate rejection. | completed | B:Correctness, C:Contract |
| 14 | `libs/runtime/oauthkit/Cargo.toml` | `anyhow` is declared but never used; the `tokio` `sync` feature is not used in `src` or tests; unused dependencies and features increase the build surface. | Remove `anyhow` dependency; remove `tokio` `sync` feature from `[dependencies]` and `[dev-dependencies]` if unused; `cargo test` still passes; `cargo check` and `cargo clippy` are clean. | completed | D:Macro/Process, A:Wiring |
| 15 | `libs/runtime/oauthkit/src/flow/mod.rs`, `libs/runtime/oauthkit/src/flow/authorization_code.rs`, `libs/runtime/oauthkit/src/flow/device_code.rs`, `libs/runtime/oauthkit/src/tests.rs`, `libs/runtime/oauthkit/Cargo.toml` | No tracing or instrumentation for async OAuth flows; failures are hard to observe in production. | Add `tracing` at `info`/`debug` for flow start, token request, error, and completion; use `#[tracing::instrument]` on async functions; tests confirm spans do not leak secrets. | completed | B:Operability, C:Observability |
| 16 | `libs/runtime/oauthkit/README.md` | OAuth provider data is not in the built-in registry; common model providers (Anthropic, OpenAI, Google) only have API-key entries, but the SDK is designed for OAuth. | Add real public OAuth provider parameters for at least the major providers that publish them, or document how a caller merges them; validate via registry tests and doc examples. | completed (documented the caller-merge path: BYO client_id TOML + OIDC discovery; fabricating public client_ids would violate product truth since providers do not publish universal ones) | A:Product, C:Documentation |
| 17 | `libs/runtime/oauthkit/src/credentials.rs`, `libs/runtime/oauthkit/src/lib.rs` | `CredentialStore` is `Send + Sync` but does not require `Clone`; `MemoryStore` is not `Clone`; some callers may want to share a store behind an `Arc`. | `MemoryStore` is `Clone`; `AuthClient<S: Clone + CredentialStore>` is `Clone`; tests confirm cloned stores are independent. | completed | C:API/DX, A:Architecture |
| 18 | `libs/runtime/oauthkit/src/pkce.rs` | PKCE verifier generation uses 64 random bytes, which is within the 43-128 range, but there is no test asserting verifier length or challenge derivation. | Add adversarial tests for verifier length, challenge derivation, and URL-safe base64 without padding. | completed | B:Testing.unit, B:Testing.adversarial |
| 19 | `libs/runtime/oauthkit/src/discovery.rs` (new), `libs/runtime/oauthkit/src/lib.rs`, `libs/runtime/oauthkit/src/tests.rs` | No support for OIDC discovery from `.well-known/openid-configuration`. | Add optional OIDC discovery that fetches `authorization_endpoint`, `token_endpoint`, and `revocation_endpoint` and builds an `OAuthConfig`; tests cover success and malformed discovery. | completed | A:Innovation, C:API/DX |
| 20 | `libs/runtime/oauthkit/src/encrypted_store.rs` (new), `libs/runtime/oauthkit/src/lib.rs`, `libs/runtime/oauthkit/Cargo.toml`, `libs/runtime/oauthkit/README.md`, `libs/runtime/oauthkit/src/tests.rs` | No guidance or integration for encrypting credentials at rest; `MemoryStore` is the only built-in store. | Document keyring integration or add a `keyring-store` feature; add an example store that encrypts with a user-provided key; tests prove redaction. | completed (opt-in `encrypted-store` feature: `EncryptedStore` seals credentials with ChaCha20-Poly1305 under a caller key; public `seal`/`open` for disk/keyring backing; tests prove ciphertext hides the secret, wrong key/tamper fail closed, fresh nonces) | A:Product, B:Security |
| 21 | `libs/runtime/oauthkit/README.md`, `libs/runtime/oauthkit/src/lib.rs` | README is hand-written and may drift from `lib.rs` doc examples. | Add `cargo-rdme` or equivalent so README is generated from `lib.rs` docs; CI enforces it; `README.md` and docs match. | completed (equivalent: README compiled as doctests via `#[doc = include_str!("../README.md")] #[cfg(doctest)]`, so every README example must compile against the real public API; enforced by `cargo test --doc` in CI. Locally verifiable, unlike cargo-rdme which would overwrite the richer hand-written README) | D:Release/Evidence, C:Documentation |
| 22 | `libs/runtime/oauthkit/.github/workflows/ci.yml` (new) | `oauthkit` has no dedicated testforge or CI entry; it is only tested through `veyyon-code` today. | Add `testforge` conformance tests and a CI job that runs `cargo test`, `cargo clippy`, `cargo deny`, and `cargo fmt` for the standalone crate. | completed (GitHub Actions CI: fmt --check, clippy -D warnings, test --all-features, doc tests, a 1.86 MSRV --lib build, and cargo-deny; all gates verified green locally) | B:Testing.conform, D:Macro |
| 23 | `libs/runtime/oauthkit/Cargo.toml`, `santhsecurity/oauthkit` | `oauthkit` is not published and has no remote repository configured for the standalone crate. | `Cargo.toml` declares `repository` and `publish = true`; `santhsecurity/oauthkit` is the canonical remote; release artifacts flow to `crates.io` and the Santh mirror. | ready-blocked-on-user (`Cargo.toml` declares `repository`/`homepage`/`documentation` and is publishable by default; `cargo package --all-features` is GREEN — the crate builds from its packaged tarball. The remaining steps are outward-facing and irreversible: create the `santhsecurity/oauthkit` remote and `cargo publish` to crates.io. These require the user's crates.io token and authorization, so they are intentionally not automated) | D:Release/Evidence, A:Product |
| 24 | `libs/runtime/oauthkit/src/provider.rs`, `libs/runtime/oauthkit/src/flow/authorization_code.rs`, `libs/runtime/oauthkit/src/tests.rs` | `OAuthConfig` uses `extra_authorize_params: Vec<(String, String)>` for common fields like `audience` and `prompt`. | Add typed optional fields for `audience`, `prompt`, `login_hint`, etc., and merge them into the authorize URL; keep `extra_authorize_params` for truly custom fields; tests cover. | completed | C:API/DX, A:Architecture |
| 25 | `libs/runtime/oauthkit` (all) | After extraction and refinement, the standalone crate, docs, tests, and `veyyon-code` consumer must stay coherent. | `cargo test` in `libs/runtime/oauthkit` passes; `cargo check -p veyyon-tui` in `veyyon-code` passes; `BACKLOG.md` rows are drained or flipped; README, SPEC, and code agree. | completed (all gates green on 1.88: fmt, clippy -D warnings, 49 tests + 4 doctests, deny; MSRV 1.86 --lib builds; `cargo check -p veyyon-tui` green against the updated crate; README/SPEC/CHANGELOG re-exports and API list reconciled; no stale version refs) | D:Macro, B:Testing.conform, C:Documentation |