Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/MCP_TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ Detect staleness and drift between the working tree and the Qdrant vector index.
| `path` | `string` | No | `.` | Directory or file to index into vector store. |
| `auto_sync` | `boolean` | No | `False` | Automatically re-index stale and newly added files. |
| `fail_on_drift` | `boolean` | No | `False` | Exit with code 1 if index drift or git commit divergence is detected. |
| `repo` | `string` | No | - | Managed repository in owner/name form to ingest. Repeat to specify more than one repository. |
| `json_output` | `boolean` | No | `False` | Output findings or metrics as JSON. |
| `dry_run` | `boolean` | No | `False` | Preview execution plan without mutating external state. |

Expand Down
1 change: 1 addition & 0 deletions docs/commands/ai.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/commands/roadmap.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion docs/roadmap/onboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ The command checks seven prerequisites in this order:
6. **The repository is in `service.repos`.** Local configuration must include the repository in `service.repos`. When missing, the command outputs the line for `config.yaml` and the stack deployment command. The command never edits `config.yaml`.
7. **The repository webhook posts the roadmap events to the Service.** The command reads `GET repos/<owner>/<name>/hooks` and compares each hook with `service.webhook_url`. The row is `present` when one active hook has that URL, the content type `json` and each event of `CONST_ROADMAP_WEBHOOK_EVENTS`. The hook can send more events: the Service acknowledges an event that no consumer takes (#5035). A hook with another URL or content type, or a hook that does not send each event of `CONST_ROADMAP_WEBHOOK_EVENTS`, is `wrong`, and the row names the field. With no hook the row is `missing`. An installation token with no administration read reports `not readable as <login>`. Every other state prints the step for a person: the URL, `application/json`, the events, and `devops config set service.webhook_secrets` for the secret. The row writes nothing and prints no secret.

## RAG rows

The command prints three RAG status rows after the prerequisite rows:

1. **`indexed`**: Whether both Qdrant collections (`code` and `docs`) hold points for this repository under the project name `owner/name`. The row reads `present` when both collections hold points, `missing` when they hold none, and `not readable` with the reason when Qdrant cannot be reached.
2. **`rag visibility`**: Whether Qdrant records the visibility of the points as `public` or `private`, verified against GitHub's `GET repos/<owner>/<name>`. An unscoped search excludes private repositories, so a mismatched visibility leaks or hides code.
3. **`rag schedule`**: Whether the scheduled ingestion pass includes the repository in `service.repos`. When missing, the command outputs the configuration line to add.

The RAG rows do not change the command exit code. The exit code stays on the seven prerequisite rows.

## Output and exit code

Each row shows its number, description, state (`present`, `missing`, or `not readable`), and optional reason or next step:
Expand All @@ -28,7 +38,7 @@ The command supports four modes:

- **Default**: Runs the check and prints a note that `--confirm` creates missing labels.
- `--plan`: Runs the check with no write.
- `--confirm`: Runs the check and creates missing labels on GitHub with `POST repos/<owner>/<name>/labels`. Differing labels are kept. No label is patched or deleted.
- `--confirm`: Runs the check and creates missing labels on GitHub with `POST repos/<owner>/<name>/labels`. Differing labels are kept. When `service.repos` holds the repository, it also runs the RAG ingestion pass for that repository alone and prints the point count for each collection.
- `--dry-run`: Makes zero requests to GitHub and renders the planned reads and writes.

You can pass at most one mode flag at a time.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-17
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Design

## Decisions

- **The three rows live in a new `rag_rows` field of the onboarding report, and `has_missing` and `not_readable_count` keep reading `rows`.**: The scheduled pass fills the index with no step from a person, so a fresh repository would exit 1 for one poll interval otherwise, and the existing tests keep their answer.
- **The confirmed start calls `run_ingest_pass(repo_filter=[repo], settings=settings)` in the same process.**: The command already holds the repository name and the loaded settings, the pass is the only writer to Qdrant, and a test doubles the pass at its seam instead of a subprocess.
- **The `indexed` row counts with `count_points` and the payload filter `{"project_name": repo}`.**: Qdrant counts on the server, so the client moves one number instead of every point, and the drift check already counts this way.
- **The visibility row compares the `visibility` of one point with the payload of the repository read that row 1 already makes, and reads `not indexed` with no point.**: One read serves both rows, the row sends no second request, and a wrong or absent value in the points shows as `mismatch` with both values.
- **The schedule row reads `settings.service.repos` and reuses the step line of row 6.**: The scheduled pass of #1653 runs the ingestion with no `--repo`, so it covers exactly the repositories of that list, and the command never writes `config.yaml`.
- **The drift check gets the project name in two steps: the `project` keyword of the detector first, then the `--repo` option of `drift_cmd` that passes it.**: Each step has a test in the module that exercises its own file, so the detector test and the command test both run in the group that writes them.
- **`devops ai rag drift` keeps the directory name when `--repo` is absent.**: The local `devops ai rag index` workflow of a checkout names the project from the directory, and the option is the way to name another project.
- **`plan_ai_rag_drift` keeps its signature and the dry-run branch of `drift_cmd` passes no project.**: The dry-run request list holds one scroll of the collection and no request that names the project, so a project argument would change no planned request.
- **The collection names come from one helper in `src/devops_cli/ai/rag/indexer.py` that `resolve_rag_components` also calls.**: `resolve_rag_components` builds an embedder that the rows do not need, and the naming rule stays in one place.
- **A `not readable` reason and a rendered row hold no Qdrant API key, and the test `test_onboard_rag_rows_print_no_qdrant_api_key` asserts it.**: The rows reach Qdrant with the configured key, and the command prints its rows to a terminal and to logs.

## Rejected alternatives

- **Read the local index cache to decide the indexed row.**: `docs/adr/0005-review-findings-come-from-tools-not-models.md` records that drift against the local cache looked like no drift after both collections were wiped, so the row reads Qdrant.
- **Run the pass with no repository narrowing.**: `src/devops_cli/ai/rag/ingest.py:381:` `cleanup_removed_repos(rag_dir, set(configured_repos), indexer)` runs over every configured repository, and the issue asks for one repository.
- **Name the project from the directory of the checkout.**: `src/devops_cli/ai/rag/drift.py:317:` `self.project = detect_project_name(self.root_dir, self.root_dir)` shows the directory name, and a worktree directory is not the repository name.
- **Keep the detector keyword and the command option in one group whose verify runs only the detector test.**: `tests/ai/rag/test_index_drift.py` imports neither `src/devops_cli/commands/rag.py` nor the option, so the option would be written with no test that runs it.
- **Fail the command on a missing or mismatch RAG row.**: A repository that waits one poll interval for its first pass would exit 1, and a script would read a fault.
- **Print the reason of a failed count with the endpoint and the key for diagnosis.**: `src/devops_cli/ai/rag/indexer.py` resolves the key with `get_qdrant_api_key`, and the row text goes to the terminal and the logs.

## Security

The `indexed` and `rag visibility` rows reach Qdrant with the API key that the settings resolve, so that key crosses from the local key store to the endpoint of `qdrant.url` on each count and scroll; the repository payload that the rows compare comes from the GitHub read of row 1 and stays local. A person must confirm that a `not readable` reason and a rendered row never hold the key or the endpoint, and that `--confirm` keeps the pass of #1389 as the only writer to Qdrant. The test `test_onboard_rag_rows_print_no_qdrant_api_key` in `tests/roadmap/test_roadmap_onboard.py` fails when the rendered report or a reason holds the configured key value.
Loading