Skip to content

cowork-bot: automated improvements (cowork/improve-configdrift)#43

Merged
Coding-Dev-Tools merged 10 commits into
mainfrom
cowork/improve-configdrift
Jul 20, 2026
Merged

cowork-bot: automated improvements (cowork/improve-configdrift)#43
Coding-Dev-Tools merged 10 commits into
mainfrom
cowork/improve-configdrift

Conversation

@Coding-Dev-Tools

Copy link
Copy Markdown
Owner

Automated improvement PR from the Cowork repo-improver rotation (one coherent senior-dev improvement per run; see individual commit messages). Subsequent runs push additional commits to this PR rather than opening new ones.

cowork-bot and others added 7 commits June 13, 2026 05:02
…startswith

Critical keys with embedded sensitive terms (db_password, jwt_token,
app_secret_key, mysql_auth_url, oauth_token, connection_endpoint,
main_api_key_id) were incorrectly classified as WARNING or INFO instead
of BREAKING.

Root cause: _infer_severity_{added,removed,changed}() used
key.lower().startswith(p) which only catches keys that *begin* with
a critical prefix. Real-world config keys overwhelmingly embed the
sensitive term (e.g. 'db_password', not 'password_db'), so the heuristic
almost always missed them.

Fix: change to substring check -- p in key.lower() -- so the severity
gate fires correctly for any key containing a critical term.

Non-sensitive keys (cache_ttl, log_level, port, retry_count) are
unaffected since none of the critical terms appear as substrings.

Regression tests: 11 new cases in TestSeveritySubstringMatch, including
an end-to-end diff_configs assertion that has_breaking fires.
114/114 tests pass; ruff clean.
…itical terms

Supersedes substring match (p in key.lower()) which:
- Fixed nested keys like services.database.password (TRUE positive)
- But over-flagged false positives: author->auth, secretary->secret, tokenizer->token

New algorithm splits flattened keys into words (dot/snake/kebab/camel) and
matches critical terms as contiguous word sequences. Also handles concatenated
forms for multi-word terms (apikey -> api_key).

+30 tests for word-boundary behavior: nested TRUE-positives,
concatenated TRUE-positives, and 10 false-positive regressions.
All 141 tests pass; ruff clean.
…ot on public PyPI); remove false PyPI badge
… names

Closes #37. Path.stem strips the final dotted segment of directory names,
causing silent collisions for dirs like "prod.v2" and "prod". Path.name
preserves the full basename.
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

🤖 Automated Code Review

✅ Ruff Lint — No issues

⚠️ Ruff Format — Formatting needed

Would reformat: src/configdrift/cli.py
Would reformat: src/configdrift/diff.py
Would reformat: src/configdrift/loader.py
Would reformat: tests/test_ci_workflow.py
Would reformat: tests/test_cli.py
Would reformat: tests/test_coverage_gaps.py
Would reformat: tests/test_diff.py
Would reformat: tests/test_loader.py
8 files would be reformatted, 2 files already formatted

✅ Secret Detection — Clean

✅ Large Files — Within limits

📊 Diff Stats — 3 file(s) changed

 .github/workflows/cowork-auto-pr.yml |  6 +++++-
 src/configdrift/cli.py               |  2 +-
 tests/test_cli.py                    | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+), 2 deletions(-)

Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge.

Automated by Coding-Dev-Tools/.github reusable workflow.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b6086caad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/configdrift/diff.py
Comment on lines +21 to +22
# Pre-compiled regex for camelCase splitting
_CAMEL_RE = re.compile(r"(?<=[a-z0-9])(?=[A-Z])")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Split leading acronyms before matching critical terms

For PascalCase keys that begin with an acronym, such as JWTToken or DBPassword, this regex finds no lowercase-to-uppercase boundary, leaving the whole key as jwttoken/dbpassword. The concatenated fallback intentionally skips single-word terms, so token and password do not match; a changed JWTToken is therefore only INFO, causing non-strict scan --output silent to exit successfully despite credential drift. Handle acronym-to-word boundaries as well (for example, JWTToken).

Useful? React with 👍 / 👎.

…auto-pr workflow

The default GITHUB_TOKEN may lack pull-requests:write in some org
configurations, causing the ensure-pr step to fail with exit code 1.
Add || echo fallback so the job stays green; the PR can be opened
externally by the orchestrator agent.
@Coding-Dev-Tools
Coding-Dev-Tools merged commit 12743f5 into main Jul 20, 2026
6 checks passed
@Coding-Dev-Tools
Coding-Dev-Tools deleted the cowork/improve-configdrift branch July 20, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant