---
phase: 13-feature-flag-verification
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - crates/pmcp-tasks/src/store/mod.rs
  - crates/pmcp-tasks/src/types/workflow.rs
  - crates/pmcp-tasks/src/router.rs
  - Makefile
  - .github/workflows/ci.yml
autonomous: true
requirements: [TEST-04]

must_haves:
  truths:
    - "The crate compiles with no feature flags (default: InMemoryBackend only)"
    - "The crate compiles with only dynamodb enabled (InMemory + DynamoDB)"
    - "The crate compiles with only redis enabled (InMemory + Redis)"
    - "The crate compiles with both dynamodb and redis enabled (all backends)"
    - "cargo doc generates clean documentation with no broken links for all 4 feature combinations"
    - "A Makefile target exists to verify all 4 feature flag combinations"
    - "CI runs feature-flag isolation checks on every push/PR"
  artifacts:
    - path: "crates/pmcp-tasks/src/store/mod.rs"
      provides: "Clean doc-links that work regardless of enabled features"
      contains: "DynamoDbBackend"
    - path: "crates/pmcp-tasks/src/types/workflow.rs"
      provides: "Fixed cross-crate doc-links (no references to pmcp parent crate types)"
      contains: "SequentialWorkflow"
    - path: "crates/pmcp-tasks/src/router.rs"
      provides: "Fixed cross-crate doc-links for WorkflowProgress and WORKFLOW_PROGRESS_KEY"
      contains: "WorkflowProgress"
    - path: "Makefile"
      provides: "test-feature-flags target for 4-combination verification"
      contains: "test-feature-flags"
    - path: ".github/workflows/ci.yml"
      provides: "Feature flag matrix CI job"
      contains: "feature-flags"
  key_links:
    - from: "Makefile test-feature-flags"
      to: "cargo check/clippy/test per feature combination"
      via: "shell commands for 4 combinations"
      pattern: "cargo (check|clippy|test).*-p pmcp-tasks"
    - from: ".github/workflows/ci.yml"
      to: "Makefile test-feature-flags target"
      via: "make test-feature-flags in CI job"
      pattern: "make test-feature-flags"
---

<objective>
Fix all broken intra-doc links in pmcp-tasks and add automated feature-flag verification to the Makefile and CI.

Purpose: Ensure all four feature flag combinations (none, dynamodb-only, redis-only, both) compile cleanly with zero doc-link warnings, and that this property is verified automatically on every CI run to prevent regression.

Output: Clean doc generation across all feature states, a `make test-feature-flags` target, and a CI job that tests feature isolation.
</objective>

<execution_context>
@./.claude/get-shit-done/workflows/execute-plan.md
@./.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/13-feature-flag-verification/13-RESEARCH.md
@crates/pmcp-tasks/src/store/mod.rs
@crates/pmcp-tasks/src/types/workflow.rs
@crates/pmcp-tasks/src/router.rs
@Makefile
@.github/workflows/ci.yml
</context>

<tasks>

<task type="auto">
  <name>Task 1: Fix all broken intra-doc links in pmcp-tasks</name>
  <files>
    crates/pmcp-tasks/src/store/mod.rs
    crates/pmcp-tasks/src/types/workflow.rs
    crates/pmcp-tasks/src/router.rs
  </files>
  <action>
Fix all broken `rustdoc::broken_intra_doc_links` warnings in the pmcp-tasks crate. There are two categories:

**Category A: Feature-gated doc-links in `store/mod.rs` (lines 26-30)**

The module doc-comment references `DynamoDbBackend` and `RedisBackend` via intra-doc links that resolve to nonexistent modules when those features are disabled. Convert these from link targets to plain backtick references:

- Line 26: Change `[`DynamoDbBackend`](crate::store::dynamodb::DynamoDbBackend)` to just backtick-only `` `DynamoDbBackend` `` (no link target). Add note: "Available behind the `dynamodb` feature flag."
- Line 29: Change `[`RedisBackend`](crate::store::redis::RedisBackend)` to just backtick-only `` `RedisBackend` `` (no link target). Add note: "Available behind the `redis` feature flag."

Also fix the `generic::GenericTaskStore` reference in the same file (line 11 area):
- Change `[`GenericTaskStore<B>`](generic::GenericTaskStore)` to `[`GenericTaskStore<B>`](crate::store::generic::GenericTaskStore)` (full crate path).

And fix the same `generic::GenericTaskStore` reference in the `TaskStore` trait doc-comment (around line 198):
- Change `[`GenericTaskStore<B>`](generic::GenericTaskStore)` to `[`GenericTaskStore<B>`](crate::store::generic::GenericTaskStore)`.

**Category B: Cross-crate doc-links in `types/workflow.rs` (lines 1-7)**

The module doc references `SequentialWorkflow` and the struct doc references `WorkflowStep` -- both are types from the parent `pmcp` crate, not in scope in `pmcp-tasks`. Convert to plain backtick references:

- Line 3: Change `[`SequentialWorkflow`]` to just `` `SequentialWorkflow` `` (backtick-only, no link resolution)
- Line 161: Change `[`WorkflowStep`]` to just `` `WorkflowStep` `` (backtick-only, no link resolution)

**Category C: Cross-crate doc-links in `router.rs` (lines 317-318)**

The doc-comment for `create_workflow_task` references `WorkflowProgress` and `WORKFLOW_PROGRESS_KEY` without link targets that resolve in the router module scope. Fix:

- Line 317: Change `[`WorkflowProgress`]` to `[`WorkflowProgress`](crate::types::workflow::WorkflowProgress)` (full crate path), OR if it still fails due to scope issues, use backtick-only `` `WorkflowProgress` ``.
- Line 318: Change `[`WORKFLOW_PROGRESS_KEY`]` to `[`WORKFLOW_PROGRESS_KEY`](crate::types::workflow::WORKFLOW_PROGRESS_KEY)` (full crate path), OR if it still fails, use backtick-only `` `WORKFLOW_PROGRESS_KEY` ``.

**Verification approach:** After all fixes, run `RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks --no-deps` for all 4 feature combinations to confirm zero doc-link warnings.

Do NOT change any non-doc-comment code. Only modify `//!` and `///` doc-comment lines.
  </action>
  <verify>
Run all 4 combinations with strict doc warnings:

```bash
RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks --no-deps --no-default-features
RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks --no-deps --features dynamodb
RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks --no-deps --features redis
RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks --no-deps --features "dynamodb,redis"
```

All four must succeed with zero warnings. Also run `cargo test -p pmcp-tasks --doc --features "dynamodb,redis"` to confirm doctests still pass.
  </verify>
  <done>
All broken intra-doc links in pmcp-tasks are fixed. `cargo doc` produces zero warnings across all 4 feature flag combinations when built with `-D warnings`. All existing doctests still pass.
  </done>
</task>

<task type="auto">
  <name>Task 2: Add feature-flag verification to Makefile and CI</name>
  <files>
    Makefile
    .github/workflows/ci.yml
  </files>
  <action>
**Makefile: Add `test-feature-flags` target**

Add a new `test-feature-flags` Makefile target that verifies all 4 feature combinations for the pmcp-tasks crate. Place it near the other test targets (after `test-integration`). The target should:

1. Run for each of the 4 combinations (no features, dynamodb only, redis only, both):
   - `cargo check -p pmcp-tasks $FLAGS` (compilation)
   - `cargo clippy -p pmcp-tasks $FLAGS -- -D warnings` (lint -- use same clippy allow list as the existing `lint` target for consistency, but since this is pmcp-tasks not pmcp, the simpler `-D warnings` suffices as the crate doesn't trigger the pedantic/nursery lints)
   - `cargo test -p pmcp-tasks $FLAGS --no-run` (test compilation)
   - `cargo test -p pmcp-tasks $FLAGS --doc` (doctest execution)
   - `RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks $FLAGS --no-deps` (doc-link verification)
2. Use `--no-default-features` for the "no features" combination
3. Print progress (1/4, 2/4, etc.) for each combination
4. Print success message when all pass

The 4 combinations and their FLAGS:
- No features: `--no-default-features`
- dynamodb only: `--features dynamodb`
- redis only: `--features redis`
- Both: `--features "dynamodb,redis"`

Also add `test-feature-flags` to the `help` target output under the Testing section.

**CI: Add feature-flags job to `.github/workflows/ci.yml`**

Add a new job `feature-flags` to the CI workflow, placed after the existing `test` job. The job should:

1. Use `ubuntu-latest` runner
2. Use `actions/checkout@v6`
3. Use `dtolnay/rust-toolchain@stable` with `components: clippy`
4. Use `actions/cache@v5` for cargo caching (same pattern as other jobs)
5. Run `make test-feature-flags`

This job does NOT need `cargo-llvm-cov`, `cargo-nextest`, or disk space cleanup -- it only tests the pmcp-tasks crate which is small.

Do NOT modify any existing CI jobs. Only add the new `feature-flags` job.
  </action>
  <verify>
Run the Makefile target locally:

```bash
make test-feature-flags
```

Must complete successfully for all 4 combinations. Also verify the CI YAML is valid:

```bash
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/ci.yml'))" 2>/dev/null || echo "YAML validation not available (non-blocking)"
```
  </verify>
  <done>
`make test-feature-flags` exists and successfully verifies all 4 feature flag combinations (check, clippy, test --no-run, test --doc, cargo doc with -D warnings). The CI workflow has a `feature-flags` job that runs this target on every push/PR to main.
  </done>
</task>

</tasks>

<verification>
After both tasks complete, verify the full phase goal:

1. `make test-feature-flags` passes (automated verification of all 4 combinations)
2. `cargo test -p pmcp-tasks --features "dynamodb,redis"` passes (no test regression)
3. `RUSTDOCFLAGS="-D warnings" cargo doc -p pmcp-tasks --no-deps --no-default-features` succeeds (doc-links clean without features)
4. CI YAML parses correctly and includes the `feature-flags` job
</verification>

<success_criteria>
- All 4 feature flag combinations compile, pass clippy, pass test compilation, pass doctests, and generate clean documentation
- Zero broken intra-doc links across all feature states
- `make test-feature-flags` Makefile target exists and passes
- `.github/workflows/ci.yml` includes a `feature-flags` job for regression prevention
- No existing tests broken by the doc-link fixes
</success_criteria>

<output>
After completion, create `.planning/phases/13-feature-flag-verification/13-01-SUMMARY.md`
</output>
