Skip to content

feat(review): review finding remediation, github project automation, and runtime duration formatting - #49

Merged
dan-petty merged 6 commits into
release/v0.2.12from
refactor/review-findings-session-164259
Sep 7, 2026
Merged

dan-petty merged 6 commits into
release/v0.2.12from
refactor/review-findings-session-164259

Conversation

@dan-petty

@dan-petty dan-petty commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Summary of Changes

This pull request implements comprehensive quality remediations across code review defenses, GitHub Projects v2 automation, release milestone lifecycle management, human-readable command duration formatting, submodule-aligned test organization, and DevContainer MCP lifecycle sync.


1. Code Review Finding Remediation & Verification Hardening

  • Dry-Run State Restoration: Wrapped dry-run execution in src/devops_cli/dry_run/decorator.py with original_dry_run = is_dry_run() and try...finally: set_dry_run(original_dry_run) to guarantee state restoration across both normal returns and exception paths.
  • Configuration Endpoint Secret Redaction: Implemented recursive dictionary sanitizer _redact_config_dict in src/devops_cli/server/routes/workspace.py supporting arbitrarily nested configurations and sensitive key patterns while explicitly preserving boolean configuration flags (such as ai.allow_private_network).
  • URI Credential Masking: Handled missing/empty usernames in mask_uri_credentials in src/devops_cli/security/sanitizer.py, rendering clean ***@host rather than :***@host, and required colon delimiters in the fallback regex to preserve usernames without passwords.
  • Cross-Module Import Symbol Grounding: Implemented _check_imported_module_for_symbol, _find_module_file_candidates, and _file_defines_symbol in src/devops_cli/ai/review/common_hallucinations.py to trace imported symbols across repository modules using AST inspection, prioritizing backticked code symbols.
  • Dynamic Authorization Header Verification: Added deterministic checks in src/devops_cli/ai/review/verification.py requiring evidence of both headers dictionary assignment and request dispatch (headers=headers) before falsifying missing-header claims.
  • Review Session Records & Prompts: Updated session finding statuses with verified evidence and refreshed system prompts (verify_finding_system.md, review.md) and knowledge base articles (ai_code_review.md).

2. GitHub Projects v2 & Milestone Lifecycle Automation

  • GitHub Projects v2 Sync & Scope Diagnostics: Added verify_project_auth_scopes() in src/devops_cli/github/projects.py to inspect token scopes for project / read:project and provide actionable guidance. Implemented sync_remote_project(), devops gh project sync --no-dry-run, and devops gh project link <number>.
  • Automated Milestone Closure: Implemented milestone closure domain logic and commands (devops gh milestones close <version>), integrated into release_tag automated execution and .github/workflows/release.yml with issues: write permissions.
  • Milestone Description Clean-Up: Refined extract_roadmap_milestones() in src/devops_cli/github/milestones.py to assign milestone descriptions strictly using the feature name, omitting redundant parenthesized roadmap status markers (e.g. (Scheduled) / (Completed)).
  • FastMCP Toolset: Registered gh_project_sync and gh_milestone_close on the FastMCP server.

3. Human-Readable Elapsed Duration Output

  • Scalar Formatter: Upgraded format_duration() in src/devops_cli/output/formatters/scalars.py to scale raw seconds into human-readable units across all operational ranges:
    • Microseconds (< 0.001s $\to$ 500µs, 3µs)
    • Milliseconds (< 1.0s $\to$ 50.0ms, 717.1ms)
    • Seconds (< 60.0s $\to$ 2.50s, 59.90s)
    • Minutes & Seconds (< 3600.0s $\to$ 1m 5s, 1m 16.33s, 2m)
    • Hours, Minutes & Seconds (< 86400.0s $\to$ 1h, 1h 1m 5s)
    • Days, Hours & Minutes ($\ge 86400.0\text{s}$ $\to$ 1d, 1d 1h 1m)
  • Command Output Integration: Integrated into the global CLI completion exit handler (src/devops_cli/main.py), CI summary tables (src/devops_cli/commands/ci.py), sandbox execution logs, AI benchmark reports, and review stages.
  • Review Message Templates: Updated review progress format strings in src/devops_cli/lang/en/messages.py to use {elapsed}.

4. Submodule-Aligned Test Organization & Agent Governance

  • Submodule Test Alignment: Enforced submodule-aligned test organization in AGENTS.md and docs/ROUTINE_TASKS.md, deprecating and eliminating arbitrary one-off test files.
  • Regression Suite Grouping: Grouped regression test cases strictly into canonical submodule test files:
    • tests/test_consolidation_dry_run_decorator.py
    • tests/test_server.py
    • tests/test_consolidation_security_sanitizer.py
    • tests/test_review_verification.py
    • tests/test_github_milestones.py
    • tests/test_github_projects.py
    • tests/test_output.py
  • Commit & Tracking Hygiene: Updated AGENTS.md prohibiting internal references/numeric IDs in commit messages and forbidding standalone commits containing solely agent tracking documentation.
  • DevContainer MCP Sync: Hardened devops devcontainer post-create and post-start to invoke _sync_mcp_configuration, ensuring on-demand tool discovery is fully provisioned before editor launch. Fixed branches_list FastMCP tool argument from --remote to --all.

Verification & Quality Gates

  • Submodule Unit & Invariant Tests: All targeted tests passing cleanly across modified modules, with cyclomatic complexity $\le 10$ and nesting depth $\le 5$ enforced by tests/test_architectural_invariants.py.
  • Pre-commit Hooks: Passed 100% across all hooks (ruff, ruff-format, trailing whitespace, end-of-file, large files, private keys, merge conflicts).
  • Comprehensive Quality Gate (uv run devops ci):
                CI Summary             
     Check           Result  Duration  
     python_version  ✓ pass  3µs       
     test            ✓ pass  1m 16.95s 
     coverage        ✓ pass  1m 16.95s 
     lint            ✓ pass  817.0ms   
     format          ✓ pass  792.8ms   
     typecheck       ✓ pass  3.39s     
     audit           ✓ pass  595.5ms   
     security        ✓ pass  8.89s     
     actionlint      ✓ pass  304.4ms   
     docs            ✓ pass  9.80s     
    Total Elapsed: 1m 16.96s (concurrent async execution)
    
    All 10 quality gates passed green with code coverage $\ge 90%$.

@dan-petty dan-petty added this to the v0.2.12 milestone Sep 7, 2026
Copilot AI lite review requested due to automatic review settings September 7, 2026 12:32
@dan-petty dan-petty added type/refactor Type refactor: a new structure, same behavior scope/ai AI review pipeline, personas, prompts, LLM client, or RAG scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault labels Sep 7, 2026

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.

🟡 Changes recommended

Multiple new verification/redaction heuristics are overly broad and can mis-handle non-secret settings and incorrectly invalidate real findings, so they should be tightened before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR remediates issues from review session 20260906-164259 and strengthens the AI review verification/self-improvement loop by adding deterministic invalidation for common hallucinations, tightening redaction/masking behavior, and expanding regression tests and documentation.

Changes:

  • Fix dry-run state leakage by restoring the prior dry-run state via try/finally in the dry-run decorator.
  • Add recursive config redaction for the server /config endpoint and improve URI credential masking edge-case handling.
  • Harden review verification by adding cross-module import symbol grounding, missing-header/missing-symbol hallucination invalidation, and updating the hallucinations catalog + prompts/docs/tests.
File summaries
File Description
tests/test_server.py Adds coverage for recursive config redaction helper behavior.
tests/test_review_findings_remediation_164259.py New end-to-end regression tests validating all remediations and deterministic invalidation rules.
tests/test_consolidation_security_sanitizer.py Expands credential-masking edge-case coverage (missing username + fallback).
tests/test_consolidation_dry_run_decorator.py Strengthens dry-run decorator tests for state restoration and exception paths.
src/devops_cli/server/routes/workspace.py Implements _redact_config_dict and secret-field predicate for /config sanitization.
src/devops_cli/security/sanitizer.py Refines mask_uri_credentials to avoid malformed :***@ output when username is empty.
src/devops_cli/dry_run/decorator.py Ensures dry-run state is restored after rendering (normal + exception paths).
src/devops_cli/ai/tasks/verify_finding_system.md Updates verification rules to require cross-module symbol and dynamic header grounding.
src/devops_cli/ai/tasks/review.md Updates review instructions to avoid missing-symbol and missing-header false positives.
src/devops_cli/ai/review/verification.py Adds deterministic pre-verification checks for missing-symbol and missing-header hallucinations.
src/devops_cli/ai/review/common_hallucinations.py Adds cross-module symbol resolution helpers and extends ground-truth verification logic.
src/devops_cli/ai/review/common_hallucinations.json Broadens missing-symbol signatures and adds a missing-header hallucination entry.
src/devops_cli/ai/personas/devsecops/prompt.md Updates security persona guidance to trace dynamic header configuration.
src/devops_cli/ai/knowledge_base/devops_cli/tasks/ai_code_review.md Documents new grounding behaviors for imported symbols and dynamic headers.
docs/LOG.md Adds a dated changelog entry summarizing the remediations and hardening work.
docs/agent/task.md Updates the WIP task list to reflect Phase 48.5 progress and next steps.
Review details

Suppressed comments (1)

src/devops_cli/ai/review/common_hallucinations.py:589

  • verify_ground_truth_hallucination treats the mere presence of the string "Authorization" as ground-truth that a missing-header claim is false. This can incorrectly invalidate real missing-header findings if the token appears in comments, constants, or unused code. Tighten the check to require evidence of assigning into a headers dict and passing that dict to a request (e.g. headers=headers).
        if "header" in entry.id.lower():
            raw_text = file_path.read_text(encoding="utf-8", errors="replace")
            return any(
                pattern in raw_text
                for pattern in (
                    'headers["Authorization"]',
                    "headers['Authorization']",
                    '"Authorization":',
                    "'Authorization':",
                )
            )
  • Files reviewed: 16/16 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/devops_cli/security/sanitizer.py Resolved
Upgrade format_duration to support microsecond, millisecond, second, minute, hour, and day formatting across CLI command completion, CI summaries, AI reviews, and benchmarks.
Ensure milestone descriptions extracted from roadmap use strictly the feature name without appending status strings in parentheses.
@dan-petty dan-petty changed the title refactor(review): address session 164259 findings and harden self-improvement loop feat(review): review finding remediation, github project automation, and runtime duration formatting Sep 7, 2026
@dan-petty
dan-petty merged commit 932c503 into release/v0.2.12 Sep 7, 2026
4 checks passed
@dan-petty
dan-petty deleted the refactor/review-findings-session-164259 branch September 7, 2026 14:35
@dan-petty dan-petty mentioned this pull request Sep 7, 2026
dan-petty added a commit that referenced this pull request Sep 7, 2026
* feat(devcontainer): automate PR devcontainer cleanup on PR merge in GHCR (#44)

* feat(devcontainer): automate PR devcontainer cleanup on PR merge in GHCR

- Add GitHub Actions workflow .github/workflows/cleanup-devcontainer.yml triggered on pull_request [closed] and workflow_dispatch
- Scope GHCR image pruning to pr-<number> or wildcard tags while preserving release tags (latest, v*, main)
- Reclaim multi-architecture storage via delete-untagged and delete-ghost-images
- Pin dataaxiom/ghcr-cleanup-action to commit SHA for supply chain security
- Enhance devops_cli.commands.gh token resolution (Keyring github.token and gh auth token) and use REST API for milestones
- Update agent instructions in AGENTS.md, ROUTINE_TASKS.md, docs/agent/README.md to leverage GitHub project integrations and issue tracking
- Sync roadmap milestones and track Phase 47.4 deliverables

Closes #39

* docs(task): update Phase 47.4 tracking with PR 44 and commit 21711bd

* fix(gh): support DEVOPS_CLI_GITHUB_TOKEN and add pagination to milestone api

- Address Copilot review comments on PR #44
- Check DEVOPS_CLI_GITHUB_TOKEN in _get_github_client()
- Pass --paginate and per_page=100 in _get_repo_milestones()
- Add regression tests in tests/test_gh_cmd.py

* feat(ci): pin GitHub Actions to immutable commit SHAs (#45)

* feat(ci): pin GitHub Actions to immutable commit SHAs

* docs(task): update Phase 48.1 tracking with PR 45

* docs(roadmap): update action SHA pinning status to completed

* docs(task): record Copilot review resolution on PR 45

* feat(security): isolate subprocess environment and enforce credential boundary (#46)

* feat(security): isolate subprocess environment and enforce credential boundary

* fix(security): normalize env var key case for cross-platform matching and ensure test determinism

* docs(task): update Phase 48.2 tracking with PR #46 and Copilot review resolution

* feat(k8s): cluster default-deny NetworkPolicies for monitoring and argocd namespaces (#47)

* feat(k8s): cluster default-deny NetworkPolicies for monitoring and argocd namespaces

* fix(k8s): address Copilot review on NetworkPolicy ingress comments, API server egress selector, and test assertions

* docs(task): record PR #47 and Copilot review remediation in Phase 48.3 tracking

* feat(security): qdrant vector database api key secret protection and clusterip default (#48)

* feat(security): qdrant vector database api key secret protection and clusterip default

* fix(review): address Copilot findings for stdin secret apply, fail-fast lifecycle, and debug logging

* docs(agent): update task tracking for PR #48 and Copilot review resolutions

* docs(agent): record Phase 48.4 PR #48 squash-merge and issue #43 closure

* feat(review): review finding remediation, github project automation, and runtime duration formatting (#49)

* refactor(review): address session 164259 findings and harden self-improvement loop

* docs(agent): mark Phase 48.5 task completed and PR 49 verified

* feat(github): remote project sync, automated milestone closure, and submodule test grouping

* feat(devcontainer): enhance mcp lifecycle sync and enforce commit message hygiene

* feat(output): format command elapsed duration in human readable units

Upgrade format_duration to support microsecond, millisecond, second, minute, hour, and day formatting across CLI command completion, CI summaries, AI reviews, and benchmarks.

* refactor(github): omit status from milestone description

Ensure milestone descriptions extracted from roadmap use strictly the feature name without appending status strings in parentheses.

* feat(valkey): valkey workstation caching, rate limiting, and v0.2.12 release preparation

- Implement pure-Python RESP2/RESP3 encoder and stream parser without C dependencies
- Add TCP socket client (ValkeyClient) with connection pooling, timeouts, and zero-trust SSRF validation
- Implement atomic token bucket rate limiter with embedded Lua script
- Implement distributed AI cache provider (ValkeyCacheProvider) for embeddings and review findings
- Implement devops valkey CLI command group (ping, info, stats, keys, get, set, flush, backup, cli)
- Register 6 FastMCP Valkey tools and dynamic system resource resource://valkey/status
- Bump package version to 0.2.12 and synchronize release documentation
- Pass all 10 devops ci quality gates with 95% test coverage

* docs(agents): codify strict release PR title convention feat(release): v<version>

* fix(review): remediate pull request review findings across valkey, output, and github subsystems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/refactor Type refactor: a new structure, same behavior

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants