Skip to content

fix(graph): make WAM authentication non-blocking and cancellable - #512

Merged
adamgell merged 10 commits into
mainfrom
codex/issue-441-nonblocking-graph-auth
Aug 5, 2026
Merged

adamgell merged 10 commits into
mainfrom
codex/issue-441-nonblocking-graph-auth

Conversation

@adamgell

@adamgell adamgell commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • probe Windows Web Account Manager capability off-thread before sign-in
  • allow organizational accounts only and report personal-only or unavailable hosts explicitly
  • enforce one request-ID-owned interactive operation with matching cancellation, one absolute 120-second deadline, and late-token publication protection
  • expose async, runtime-validated Tauri authentication and permission-consent commands without blocking the UI thread
  • model checking, signing in, cancelling, connected, unsupported, stale, and error outcomes separately; enabling the feature no longer launches WAM automatically
  • retire disabled requests so a late completion cannot reapply state after disable and re-enable

Verification

  • local frontend suite: 51 files, 648 tests passed
  • local Graph integration suite: 83 tests passed
  • local Graph unit suite: 19 tests passed
  • TypeScript typecheck and production frontend build passed
  • exact-head CI for 8d95da5a passed: TypeScript, E2E, full Rust checks/tests/Clippy, supply-chain and security audit, Rust 1.88 on Ubuntu and Windows, Windows Graph/ESP/full-workspace/Clippy, CodeQL, and Windows/Linux/macOS release builds
  • CI evidence: https://github.com/adamgell/cmtraceopen/actions/runs/31001022606
  • CodeRabbit review has no current unresolved threads

Residual manual acceptance

CI exercises the Windows implementation and all deterministic cancellation, timeout, stale-result, capability, and publication contracts. It does not open the interactive WAM dialog against a live organizational account. A Windows demo with a real Entra account remains the final environment acceptance step; it is not a code or merge blocker.

Closes #441

Summary by CodeRabbit

  • New Features

    • Added responsive Graph sign-in with progress states, cancellation, timeout handling, and clearer capability-specific messaging.
    • Added support for detecting unsupported account or host capabilities before authentication.
    • Added safer permission upgrades and protection against stale or cancelled authentication attempts.
    • Expanded connection status details, including identity, tenant, scopes, expiration, and recent attempt outcomes.
  • Documentation

    • Added implementation plans for the updated Graph authentication experience and workflows.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Graph authentication now probes Windows account capability before WAM sign-in, runs interactive work asynchronously, supports request-scoped cancellation, and returns structured outcomes. The frontend tracks transient authentication phases without persisting runtime state.

Changes

Graph authentication flow

Layer / File(s) Summary
Authentication contracts and transient state
docs/superpowers/plans/..., src-tauri/src/graph_api/models.rs, src/lib/commands.ts, src/stores/ui-store.ts
Defines capability, authentication-attempt, operation-ticket, timeout, and typed token-projection contracts. Graph runtime state is transient, while only explicit opt-in is persisted.
Native capability and authentication flow
src-tauri/src/graph_api.rs, src-tauri/src/commands/graph_api.rs, src-tauri/src/lib.rs, src-tauri/src/ipc_bridge.rs, src-tauri/tests/graph_esp_diagnostics.rs
Adds organizations-only capability probing, blocking WAM workers, exclusive operation leases, shared deadlines, cancellation, guarded token publication, and structured permission outcomes.
Frontend lifecycle and cancellation
src/components/dialogs/settings/GraphApiTab.tsx, src/components/dialogs/settings/GraphApiTab.test.tsx, src/components/layout/StatusBar.tsx, src/lib/commands.test.ts, src/stores/ui-store.test.ts, src/workspaces/*
Adds capability-aware phases, native request IDs, cancellation controls, timeout and unsupported-account messaging, stale-result protection, transient-state rehydration rules, and updated status rendering.
Platform wiring and verification
src-tauri/src/lib.rs, src-tauri/src/ipc_bridge.rs, src/lib/commands.test.ts, src-tauri/tests/graph_esp_diagnostics.rs, docs/superpowers/plans/..., library.md
Registers Windows-only commands, rejects Graph operations in the debug IPC bridge, updates contract and regression tests, and records implementation plans and verification gates.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Settings as GraphApiTab
  participant IPC as Tauri commands
  participant Native as GraphAuthState
  participant WAM
  User->>Settings: Start sign-in
  Settings->>IPC: Reserve operation and authenticate with attempt ID
  IPC->>Native: Claim lease and start blocking worker
  Native->>WAM: Probe capability and acquire token with deadline
  User->>Settings: Cancel sign-in
  Settings->>IPC: Cancel matching attempt
  WAM-->>Native: Structured authentication outcome
  Native-->>IPC: GraphAuthAttemptResult
  IPC-->>Settings: Update phase and last attempt
Loading

Suggested labels: windows, security

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and clearly describes the non-blocking, cancellable Graph WAM authentication change.
Linked Issues check ✅ Passed The implementation addresses #441 by preventing blocking WAM attempts and detecting unsupported personal-account hosts before authentication.
Out of Scope Changes check ✅ Passed The changes support the Graph authentication objectives, including backend behavior, frontend state, IPC, tests, and related documentation.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-441-nonblocking-graph-auth

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src-tauri/src/graph_api.rs`:
- Around line 363-367: Remove the unused Windows-only receive_before_deadline
helper and DeadlineReceiveError definitions, along with their obsolete test.
Alternatively, restrict those definitions and the test to #[cfg(test)] so they
are excluded from production builds and no longer trigger dead_code warnings.

In `@src/components/dialogs/settings/GraphApiTab.tsx`:
- Around line 306-315: Update the cancellation call in the interactiveAction
branch of the surrounding handler to attach a rejection handler, matching
handleCancelAuthentication’s existing .catch(() => false) treatment for
graphCancelAuthentication. Preserve the current requestId check and
invalidateSharedGraphActions fallback.
- Around line 938-948: Add role="alert" to the message container rendered by the
graphApiLastAttempt block in GraphApiTab.tsx, preserving the existing styling
and conditional rendering so completed sign-in failure messages are announced to
assistive technology.
- Around line 206-219: Update the disconnected-panel render logic near the
native last-attempt message and unsupportedCapabilityMessage call so the
capability block is rendered only when graphApiLastAttempt.message is absent.
Preserve the native message when present, while retaining the capability message
fallback for unsupported outcomes without a last-attempt message.

In `@src/stores/ui-store.test.ts`:
- Around line 61-79: The test should validate rehydration rather than only
inspecting a newly written snapshot. In the test around useUiStore, seed
localStorage with graphApiEnabled plus stale graphApiStatus, graphApiCapability,
and graphApiLastAttempt, reset the store to its initial runtime state, await
useUiStore.persist.rehydrate(), then assert graphApiEnabled survives while
graphApiStatus is "disconnected" and transient fields are not restored.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 70dd04a8-c72c-49d3-a66e-5065da10c7df

📥 Commits

Reviewing files that changed from the base of the PR and between 162f1c2 and d89df55.

📒 Files selected for processing (18)
  • docs/superpowers/plans/2026-08-05-graph-auth-nonblocking.md
  • library.md
  • src-tauri/src/commands/graph_api.rs
  • src-tauri/src/graph_api.rs
  • src-tauri/src/graph_api/models.rs
  • src-tauri/src/ipc_bridge.rs
  • src-tauri/src/lib.rs
  • src-tauri/tests/graph_esp_diagnostics.rs
  • src/components/dialogs/settings/GraphApiTab.test.tsx
  • src/components/dialogs/settings/GraphApiTab.tsx
  • src/components/layout/StatusBar.tsx
  • src/lib/commands.test.ts
  • src/lib/commands.ts
  • src/stores/ui-store.test.ts
  • src/stores/ui-store.ts
  • src/workspaces/esp-diagnostics/EspDiagnosticsWorkspace.test.tsx
  • src/workspaces/esp-diagnostics/esp-diagnostics-store.test.ts
  • src/workspaces/registry.test.ts

Comment thread src-tauri/src/graph_api.rs Resolved
Comment thread src/stores/ui-store.test.ts Resolved
@adamgell
adamgell force-pushed the codex/issue-441-nonblocking-graph-auth branch from d89df55 to 0c25942 Compare August 5, 2026 10:45
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src-tauri/src/ipc_bridge.rs (1)

317-343: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover all four rejected Graph commands, not just the permission upgrade.

The arm at lines 186 to 190 now rejects graph_authenticate, graph_probe_capability, and graph_cancel_authentication, but no test asserts it. If any name is dropped from that arm later, dispatch falls through to _ => {"result":null} and the frontend receives null where it expects a GraphHostCapability. The sibling test at line 300 already loops over a command list, so use the same shape here.

♻️ Proposed coverage for the remaining three commands
+    #[test]
+    fn debug_bridge_explicitly_rejects_graph_authentication_commands() {
+        for command in [
+            "graph_authenticate",
+            "graph_probe_capability",
+            "graph_cancel_authentication",
+        ] {
+            let response = dispatch(
+                &serde_json::json!({ "cmd": command, "args": { "requestId": "r-1" } })
+                    .to_string(),
+                &state(),
+            );
+            let value: serde_json::Value = serde_json::from_str(&response).unwrap();
+            assert_eq!(
+                value["error"],
+                "Microsoft Graph sign-in is unavailable through the debug IPC bridge"
+            );
+            assert!(value.get("result").is_none());
+        }
+    }
+
     #[test]
     fn debug_bridge_rejects_graph_permission_upgrade_with_or_without_caller_scopes() {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src-tauri/src/ipc_bridge.rs` around lines 317 - 343, Expand the test
alongside
debug_bridge_rejects_graph_permission_upgrade_with_or_without_caller_scopes to
iterate over all four rejected Graph commands:
graph_request_missing_permissions, graph_authenticate, graph_probe_capability,
and graph_cancel_authentication. Dispatch each command and assert the same
unavailable-through-debug-IPC error with no result field, following the
command-list loop pattern used by the sibling test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/plans/2026-08-05-graph-auth-nonblocking.md`:
- Around line 87-92: Make the Cargo manifest location explicit in
docs/superpowers/plans/2026-08-05-graph-auth-nonblocking.md at lines 87-92,
133-138, 160-167, 192-197, and 261-277: add --manifest-path src-tauri/Cargo.toml
to every Cargo command, while keeping frontend commands running from the
repository root. Verify the referenced paths and flags exist in the repository.

In `@src-tauri/src/graph_api.rs`:
- Around line 695-742: In enumerate_accounts, add log::debug! calls for each
swallowed WAM error before returning ProviderUnavailable or Unknown: provider
lookup failures, provider wait Denied/Failed errors, account discovery
initiation failures, and account discovery wait Denied/Failed errors. Include
the relevant error value and operation context, while preserving the existing
classifications and cancellation/timeout propagation.
- Around line 1273-1275: Make the lease parameter of
request_missing_permissions_with mandatory by changing it to
&GraphInteractiveOperationLease, then remove the None-specific publication path
and use the lease unconditionally for publish_if_active. Update
permission_upgrade_tests, including
graph_permission_upgrade_strict_superset_replaces_token_and_advances_once, to
create a GraphInteractiveOperationRegistry, call begin(), and pass the resulting
lease so tests exercise the production cancellation-guard path.

In `@src/components/dialogs/settings/GraphApiTab.test.tsx`:
- Around line 1290-1312: Add a test case alongside the timeout test that mocks
graphAuthenticate to resolve with a stale outcome, then assert the UI preserves
the current connection phase instead of publishing result.status and records
stale in graphApiLastAttempt.outcome. Keep the setup and assertions consistent
with the existing GraphApiTab authentication outcome tests.

In `@src/components/dialogs/settings/GraphApiTab.tsx`:
- Around line 306-339: Update the Graph disable flow around
graphCancelAuthentication and the UI result handling near confirmEnable so the
cancelled action is immediately retired and its later result cannot update Graph
state, while retaining ownership until the native cancellation promise settles.
Ensure re-enabling Graph creates a distinct active generation, and add coverage
for disable, immediate re-enable, then late successful completion of the old
request.

In `@src/components/layout/StatusBar.tsx`:
- Around line 540-592: Replace the three graphApiStatus ternary chains in the
StatusBar indicator with a single module-scope lookup record keyed by the
exported phase union from ui-store, excluding "disconnected". Store each phase’s
color, title, and label in the record, read the entry for rendering, and
preserve the existing disconnected guard; use the typed Record so adding or
renaming a phase is compile-time checked.

In `@src/lib/commands.test.ts`:
- Around line 153-173: Update graphProbeCapability, graphAuthenticate, and
graphCancelAuthentication to validate their invokeCommand IPC payloads against
the expected response shapes before returning them, rejecting malformed values
instead of trusting the generic type. Extend the “Graph authentication IPC
boundary” tests with malformed-payload cases for each command while preserving
the existing valid-response and requestId assertions.

In `@src/lib/commands.ts`:
- Around line 786-810: Add runtime decoders for GraphHostCapability,
GraphAuthAttemptResult, and GraphPermissionUpgradeResult, including
GraphAuthStatus nested fields and all enum values, then pass the appropriate
decoder through each graph function’s invokeCommand call so malformed IPC
payloads are rejected before returning. Add tests covering invalid top-level,
nested, and enum payloads.

---

Outside diff comments:
In `@src-tauri/src/ipc_bridge.rs`:
- Around line 317-343: Expand the test alongside
debug_bridge_rejects_graph_permission_upgrade_with_or_without_caller_scopes to
iterate over all four rejected Graph commands:
graph_request_missing_permissions, graph_authenticate, graph_probe_capability,
and graph_cancel_authentication. Dispatch each command and assert the same
unavailable-through-debug-IPC error with no result field, following the
command-list loop pattern used by the sibling test.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 921966ed-a2fb-46db-a426-3206a3b8a907

📥 Commits

Reviewing files that changed from the base of the PR and between e59aed3 and 0c25942.

📒 Files selected for processing (18)
  • docs/superpowers/plans/2026-08-05-graph-auth-nonblocking.md
  • library.md
  • src-tauri/src/commands/graph_api.rs
  • src-tauri/src/graph_api.rs
  • src-tauri/src/graph_api/models.rs
  • src-tauri/src/ipc_bridge.rs
  • src-tauri/src/lib.rs
  • src-tauri/tests/graph_esp_diagnostics.rs
  • src/components/dialogs/settings/GraphApiTab.test.tsx
  • src/components/dialogs/settings/GraphApiTab.tsx
  • src/components/layout/StatusBar.tsx
  • src/lib/commands.test.ts
  • src/lib/commands.ts
  • src/stores/ui-store.test.ts
  • src/stores/ui-store.ts
  • src/workspaces/esp-diagnostics/EspDiagnosticsWorkspace.test.tsx
  • src/workspaces/esp-diagnostics/esp-diagnostics-store.test.ts
  • src/workspaces/registry.test.ts

Comment thread src-tauri/src/graph_api.rs Resolved
Comment thread src-tauri/src/graph_api.rs Resolved
Comment thread src/components/layout/StatusBar.tsx Resolved
Comment thread src/lib/commands.test.ts Resolved
Comment thread src/lib/commands.ts Resolved
@adamgell

adamgell commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/dialogs/settings/GraphApiTab.tsx (1)

420-428: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The catch reports a WAM failure for every rejection, including reservation refusal.

graphReserveInteractiveOperation at line 379 rejects when the native registry is busy. reserve_interactive_operation in src-tauri/src/graph_api.rs returns "Another Microsoft Graph sign-in action is already in progress." That rejection lands in this catch and is reported as "Windows could not complete Microsoft Graph sign-in."

The frontend beginGraphAction guard does not cover this case. A native lease can outlive a component remount, so a fresh mount can start a sign-in that the native side refuses.

Surface the caught message when one exists.

🩹 Proposed fix
-    } catch {
+    } catch (error) {
       if (!canApplySharedGraphAction(generation)) return;
       if (useUiStore.getState().graphApiEnabled) {
         useUiStore.getState().setGraphApiLastAttempt({
           outcome: "failed",
-          message: "Windows could not complete Microsoft Graph sign-in.",
+          message:
+            error instanceof Error && error.message
+              ? error.message
+              : "Windows could not complete Microsoft Graph sign-in.",
         });
         useUiStore.getState().setGraphApiStatus("error");
       }
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dialogs/settings/GraphApiTab.tsx` around lines 420 - 428,
Update the catch handling around graphReserveInteractiveOperation in the sign-in
flow to accept the caught error and surface its message when available, falling
back to the existing Windows sign-in failure text otherwise. Preserve the
canApplySharedGraphAction guard and existing failed-attempt/status updates,
including the native reservation refusal message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/plans/2026-08-05-graph-auth-critic-rework.md`:
- Around line 99-101: Update the Cargo command examples so --manifest-path is
placed after the subcommand (for example, after test or clippy) because Cargo
rejects it in the current position. Apply this fix consistently to the command
snippets referenced by the plan, including the ones around the
graph_esp_diagnostics and graph_wam test command and the clippy-related
examples, while keeping the rest of each command unchanged.

In `@src-tauri/tests/graph_esp_diagnostics.rs`:
- Around line 238-266: Update
graph_interactive_commands_require_native_single_use_tickets so it verifies
observable behavior instead of source text; remove the substring checks against
graph_reserve_interactive_operation, graph_authenticate, and
graph_request_missing_permissions that assert on
state.reserve_interactive_operation(kind), claim_interactive_operation, and
GraphInteractiveOperationKind literals. Keep only the contract that can be
checked from the command signatures, such as the attempt_id parameter on the
interactive command functions, and rely on
graph_interactive_operation_issues_single_use_kind_bound_tickets for the
single-use and wrong-kind behavior coverage.

---

Outside diff comments:
In `@src/components/dialogs/settings/GraphApiTab.tsx`:
- Around line 420-428: Update the catch handling around
graphReserveInteractiveOperation in the sign-in flow to accept the caught error
and surface its message when available, falling back to the existing Windows
sign-in failure text otherwise. Preserve the canApplySharedGraphAction guard and
existing failed-attempt/status updates, including the native reservation refusal
message.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a5b467b9-73ff-4c04-ac4f-0fc6e0f041d6

📥 Commits

Reviewing files that changed from the base of the PR and between 8d95da5 and 13aa5c1.

📒 Files selected for processing (14)
  • docs/superpowers/plans/2026-08-05-graph-auth-critic-rework.md
  • library.md
  • src-tauri/src/commands/graph_api.rs
  • src-tauri/src/graph_api.rs
  • src-tauri/src/graph_api/models.rs
  • src-tauri/src/ipc_bridge.rs
  • src-tauri/src/lib.rs
  • src-tauri/tests/graph_esp_diagnostics.rs
  • src/components/dialogs/settings/GraphApiTab.test.tsx
  • src/components/dialogs/settings/GraphApiTab.tsx
  • src/components/layout/StatusBar.tsx
  • src/lib/commands.test.ts
  • src/lib/commands.ts
  • src/stores/ui-store.ts
💤 Files with no reviewable changes (2)
  • src/stores/ui-store.ts
  • src/components/layout/StatusBar.tsx

Comment on lines +99 to +101
```bash
cargo +1.88 --manifest-path src-tauri/Cargo.toml test --locked --test graph_esp_diagnostics graph_wam -- --nocapture
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether any working script or CI workflow uses the pre-subcommand flag order.
rg -n -- '--manifest-path' --glob '!node_modules/**' . | head -50

Repository: adamgell/cmtraceopen

Length of output: 6817


🏁 Script executed:

#!/bin/bash
set +e

printf '%s\n' '--- manifest path ---'
if test -f src-tauri/Cargo.toml; then
  printf '%s\n' 'src-tauri/Cargo.toml exists'
else
  printf '%s\n' 'src-tauri/Cargo.toml is missing'
fi

printf '%s\n' '--- Cargo version ---'
cargo --version 2>&1

printf '%s\n' '--- pre-subcommand probe ---'
cargo --manifest-path src-tauri/Cargo.toml test --help >/tmp/cargo-pre.out 2>&1
pre_status=$?
printf 'status=%s\n' "$pre_status"
sed -n '1,8p' /tmp/cargo-pre.out

printf '%s\n' '--- post-subcommand probe ---'
cargo test --manifest-path src-tauri/Cargo.toml --help >/tmp/cargo-post.out 2>&1
post_status=$?
printf 'status=%s\n' "$post_status"
sed -n '1,8p' /tmp/cargo-post.out

printf '%s\n' '--- plan occurrences ---'
rg -n -- '--manifest-path' docs/superpowers/plans/2026-08-05-graph-auth-critic-rework.md

Repository: adamgell/cmtraceopen

Length of output: 1726


🌐 Web query:

site:doc.rust-lang.org/cargo/commands/cargo-test.html --manifest-path cargo test

💡 Result:

The --manifest-path option is a command-line argument used with cargo commands, including cargo test, to specify the path to a particular Cargo.toml file [1]. By default, Cargo searches for a Cargo.toml file in the current directory or its parent directories [1]. When you use --manifest-path, you explicitly tell Cargo which manifest file to use instead of relying on the default discovery mechanism [1]. When executing cargo test with this flag, the packages selected for testing depend on the specified manifest file [1]. If the provided path points to a workspace root, Cargo will default to testing the workspace members; otherwise, it will test the specific package defined by that manifest [1].

Citations:


🌐 Web query:

Cargo CLI global options manifest-path before subcommand cargo --manifest-path test unexpected argument

💡 Result:

In Cargo, the --manifest-path option is not a global option that can be placed before the subcommand [1][2]. It is a command-specific option (part of the "Manifest Options" group) and must be placed after the subcommand [2][3]. If you attempt to use it before the subcommand, such as in cargo --manifest-path path/to/Cargo.toml build, Cargo will treat --manifest-path as an unknown global argument and typically throw an "unexpected argument" error because it expects a subcommand (like build, run, check, etc.) immediately after the cargo binary. Correct usage requires placing the option after the subcommand: cargo build --manifest-path path/to/Cargo.toml The only standard option that must appear before the command name is the change-working-directory flag, -C (e.g., cargo -C path/to/project build) [1][2]. All other flags related to manifest configuration, such as --manifest-path or --config, are subcommand-specific and follow the command name [1][4].

Citations:


Move --manifest-path after the subcommand.

Cargo rejects this option before test or clippy. Update lines 100, 125, 126, 181, 200, and 201.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-08-05-graph-auth-critic-rework.md` around lines
99 - 101, Update the Cargo command examples so --manifest-path is placed after
the subcommand (for example, after test or clippy) because Cargo rejects it in
the current position. Apply this fix consistently to the command snippets
referenced by the plan, including the ones around the graph_esp_diagnostics and
graph_wam test command and the clippy-related examples, while keeping the rest
of each command unchanged.

Source: Path instructions

@adamgell

adamgell commented Aug 5, 2026

Copy link
Copy Markdown
Owner Author

Rework evidence pack — ready for repository approval

Target: 8dfa86fca9edb28162b324d8a7746f6a4c29ddd9 on base bba7eea9176cf7ae25d4a417216fb036320b15c3.

Critic gate: ACCEPT — zero High, Medium, or Low findings. The fixed review confirmed: passive initialization is broker-free; authentication and permission consent share one organizations-only scope request; native UUID-v4 tickets are kind-bound, single-use, and exact-cancel; the absolute 120-second deadline, WinRT cancellation, memory-only token handling, and adversarial race coverage remain intact.

Exact-head hosted evidence:

  • CodeQL: pass (all analyzers)
  • CodeRabbit: pass
  • TypeScript + frontend tests: pass
  • E2E: pass
  • Rust MSRV 1.88: pass on Windows and Ubuntu
  • Rust check/test/clippy/audit lane: pass
  • Windows ESP diagnostics, Graph diagnostics, full workspace, and clippy: pass
  • Package builds: pass on Windows x64, Linux x64, and macOS arm64

Base evidence: bba7eea9176cf7ae25d4a417216fb036320b15c3 is the second parent of merge commit 13aa5c1ea466c3c08480be2e038cb39dba746b63 and an ancestor of the frozen head. Both Graph library routes are present exactly once.

Out of scope: no live organizational-account WAM validation was started.

GitHub reports the PR mergeable, with the remaining branch-protection gate REVIEW_REQUIRED; no bypass or merge was attempted.

@adamgell
adamgell merged commit 9567055 into main Aug 5, 2026
16 checks passed
adamgell pushed a commit that referenced this pull request Sep 24, 2026
`library.md` is what a session reads to find context: sixteen "IF <task> → read <plan>"
rules. Checked today, and **all thirteen issues and pull requests it names are closed or
merged** (#317, #490, #500, #512, #409, #441, #410, #414, #506, #507, #326, #321, #333).
The plan files themselves still exist, so nothing is broken — but nothing here is current
either.

`docs/superpowers/plans/` holds 40 files, several of them months newer (through
2026-08-30), and the index mentions none of them. So an agent following it is routed
exclusively into finished work, which is worse than an empty index: it looks like
guidance.

Flagged rather than rewritten. Regenerating the rules from the plans directory is
mechanical — one rule per file, date included — but deciding which subjects still matter
is a judgement about this repository's live work, and that is the owner's.
@adamgell
adamgell deleted the codex/issue-441-nonblocking-graph-auth branch September 25, 2026 13:40
adamgell added a commit that referenced this pull request Oct 3, 2026
* docs: correct four checkpoint rows whose work merged weeks ago

`memory.md` and `soul.md` both carry a "Verified Checkpoints" table, and every row
is stale: all four issues merged weeks ago while the tables still say NOT
merge-ready, hold the PR until clean, full gate pending, findings outstanding.

| Issue | Table said | Verified 2026-09-24 |
|---|---|---|
| #320 client health | NOT merge-ready | merged via #340, issue closed 2026-08-05 |
| #329 DP lifecycle | P1 open, hold PR | merged via #385 |
| #330 SUP coverage | full gate pending | merged via #377 |
| #366 Intune CP | findings to address | merged via #460 |

The rows are not wrong about the *commits* — those SHAs are preserved on origin
branches — only about whether the work landed, which is the one thing the table
exists to say. `soul.md` prefixes it with "Always verify state before acting"; the
instruction was right and unheeded for seven weeks, including by the session that
found this.

Also notes the failure mode in `memory.md`, so the next reader knows the table
tracks pointers rather than state.

* docs: the recovery branches are accurate; their targets have landed

Verified rather than assumed, since this table gives instructions rather than just
describing state:

- **All six branches are still present on `origin`** with the SHAs listed, so the
  "preserve refs" instruction has held — the second artifact today that checks out
  exactly as written.
- **Their targets have landed.** `#365` and `#360` are done, `intune/apps/macos` and
  `intune/portal/{macos,ios_ipados}` exist on main, and the epic tracker marks the
  corresponding rows complete. So the second instruction — "check merged equivalents
  for closed macOS/iOS issues before any PR" — is answered rather than open.

The branches stay as evidence, which is what the heading already calls them. The note
records why, so the next reader does not treat them as pending work the way the
checkpoint table above invited.

* docs: the worktree forest is ~65, not 450+

Measured rather than read, since the line gives a number:

| Location | Count |
|---|---|
| `.worktrees/` | 34 (35 registered with `git worktree list`) |
| `~/.codex/worktrees/` | 28 |
| `/private/tmp/cmtraceopen-*` | 1 |
| repo `.claude/worktrees/` | 1 |
| `~/.claude/worktrees/` | 1 |

The forest is real — the description below the number holds, including the deep
branches and the parallel work — but it is a seventh of the size claimed. A count
nobody retakes decays in one direction only, and cleaning up merged lanes is exactly
what shrinks it.

Not updated: the "246 SCCM branches" line. My count matched 211 branches against a
looser pattern, which is not the same measurement, and a mismatched instrument is
what produced two wrong findings earlier today. It needs counting properly or being
marked as approximate.

* docs: the charter this table cites is not readable here

`memory.md` sources the checkpoint SHAs from `~/.hermes/cmtrace-pm-charter.md`, and the
CEO charter treats that path as required: "Main reads this charter ... If the contract is
absent or unreadable, Main fails closed before orchestration."

Checked 2026-09-24: **the path does not exist on this workstation**. So the citation
cannot be followed by a session that reads this table, which is a second reason the
SHAs need to be quoted in full rather than referenced — the first being that four of
them were stale.

The line now says the source is unreadable here and why the table stands alone. If the
charter is provisioned on the operator's machine only, this line should say that
instead of naming a path a session cannot open.

* docs: the routing index routes only into the past

`library.md` is what a session reads to find context: sixteen "IF <task> → read <plan>"
rules. Checked today, and **all thirteen issues and pull requests it names are closed or
merged** (#317, #490, #500, #512, #409, #441, #410, #414, #506, #507, #326, #321, #333).
The plan files themselves still exist, so nothing is broken — but nothing here is current
either.

`docs/superpowers/plans/` holds 40 files, several of them months newer (through
2026-08-30), and the index mentions none of them. So an agent following it is routed
exclusively into finished work, which is worse than an empty index: it looks like
guidance.

Flagged rather than rewritten. Regenerating the rules from the plans directory is
mechanical — one rule per file, date included — but deciding which subjects still matter
is a judgement about this repository's live work, and that is the owner's.

* docs(adr): ADR-005 is accepted; its own confirm-at-merge condition is met

The status line read "Proposed — recorded as the resolution of issue #635. Confirm at
merge." All three of those are now satisfied rather than pending:

- the resolution landed as `a7a21428` on `main` ("stop control and honest coverage for
  large explicit loads");
- PR #639 merged 2026-09-19;
- issue #635 is closed.

So the ADR asked to be confirmed at merge and was never advanced afterwards — the same
shape as the checkpoint table, one document class over: a normative record whose status
lags the work it governs. The revisit criteria keep their role; they are the trigger for
reopening, not a reason to leave the status proposed.

Checked the rest of the chain while I was here, and it is well maintained: ADR-004's base,
revision 1 and revision 2 each state what they supersede and what remains in force.

* docs: the gate list was understated in three files, not two

`CONTRIBUTING.md` and `CLAUDE.md` both said three checks where seven jobs run. So did
`memory.md`, in a one-line summary whose own heading names `CLAUDE.md` as its source —
which is the mechanism: a file copies a summary, the summary drifts, and the copies keep
its authority because each looks like a local statement rather than a citation.

Found by grepping for the phrase rather than assuming the pair I had already fixed was all
of them. The correction names the seven jobs, so the next copy has something to copy that
is right.

* docs: cite the landing PR for the merged checkpoints, and recount the worktrees

CodeRabbit review 5, three threads: the checkpoint rows named preparation PRs that landed on codex/parser-family-skeleton (#340, #385, #377) rather than #490, which merged into main and closed #320/#329/#330 within seconds; the worktree counts contradicted the layout block below them and both were stale; and library.md called Aug 30 months newer than Aug 4-5 plans, which is about four weeks.

* docs(library): leave library.md to #767

#767 rewrites library.md's routes. The note this branch added said the
routes point only at finished work and should be regenerated, which is
what #767 does, so the note would be wrong as soon as #767 merges.
Dropping it here also removes the conflict between the two PRs.

The memory.md, soul.md and ADR-005 corrections are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(memory): distinguish unreconciled historical worktree counts

* docs: preserve recovery history and correct SCCM landing references

---------

Co-authored-by: Adam Gell <adam@cmtraceopen.dev>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
adamgell added a commit that referenced this pull request Oct 3, 2026
library.md is a sixteen-rule task router and every rule pointed at finished work: eleven PR-integration and critic-rework routes for windows that closed when #500, #490 and #512 merged. An agent routed there arrived at a plan describing completed work and had to work out it was history.

Two route classes are treated differently, as #686 sets out. The eleven dead integration routes are removed. The fixture-oracle and #326 corpus routes are kept because their targets still exist and are still consulted, but they are reworded from review tasks into reference pointers, which is what they are. The specialist-agent route is kept unchanged; soul.md and memory.md both still exist.

The workspace index also told agents to read this file for 'the full repo path/subject catalog'. That is not what it is, and no such catalog exists for the backend or frontend trees, so an agent followed that instruction and found neither a catalog nor a live route. Both the file itself and the routing line in .Clairvoyance/library.md now say what it is: a route list. The historical plans remain reachable through one pointer rather than eleven.

Every remaining target resolves; git diff --check is clean.

Co-authored-by: chenzeyan54-commits <chenzeyan54@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Enabling Graph API blocks until authenticated or attempt times out

1 participant