Skip to content

Fix/code quality issues#416

Merged
stranske merged 2 commits intomainfrom
fix/code-quality-issues
Jan 1, 2026
Merged

Fix/code quality issues#416
stranske merged 2 commits intomainfrom
fix/code-quality-issues

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Jan 1, 2026

No description provided.

- Fix tomlkit isinstance checks - use hasattr for duck typing (#3)
- Add type validation for python_version before str() conversion (#6)
- Fix redundant ternary operators in agents-guard.yml (3 instances) (#1)
- Fix authorIsCodeowner indentation in agents-guard.js (#4)
- Fix inconsistent array indentation in agents-guard.js (#5)
- Remove redundant instructions=[] reassignment in agents-guard.js (#7)
- Fix typo in keepalive_loop.js numbered list comment (#9)

All fixes applied to both main files and templates/consumer-repo.
See docs/CODE_QUALITY_ISSUES.md for issue tracking.
Copilot AI review requested due to automatic review settings January 1, 2026 06:52
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@agents-workflows-bot
Copy link
Copy Markdown
Contributor

⚠️ Action Required: Unable to determine source issue for PR #416. The PR title, branch name, or body must contain the issue number (e.g. #123, branch: issue-123, or the hidden marker ).

@stranske stranske temporarily deployed to agent-high-privilege January 1, 2026 06:52 — with GitHub Actions Inactive
@github-actions github-actions bot added the autofix Opt-in automated formatting & lint remediation label Jan 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 1, 2026

Status | ✅ no new diagnostics
History points | 1
Timestamp | 2026-01-01 06:53:09 UTC
Report artifact | autofix-report-pr-416
Remaining | 0
New | 0
No additional artifacts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 1, 2026

Automated Status Summary

Head SHA: 331c418
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / Enforce agents workflow protections
Required: core tests (3.11): ⏳ pending, core tests (3.12): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 92.21%
Baseline 85.00%
Delta +7.21%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/workflow_health_check.py 62.6% 28
scripts/classify_test_failures.py 62.9% 37
scripts/ledger_validate.py 65.3% 63
scripts/mypy_return_autofix.py 82.6% 11
scripts/ledger_migrate_base.py 85.5% 13
scripts/fix_cosmetic_aggregate.py 92.3% 1
scripts/coverage_history_append.py 92.8% 2
scripts/workflow_validator.py 93.3% 4
scripts/update_autofix_expectations.py 93.9% 1
scripts/pr_metrics_tracker.py 95.7% 3
scripts/generate_residual_trend.py 96.6% 1
scripts/build_autofix_pr_comment.py 97.0% 2
scripts/aggregate_agent_metrics.py 97.2% 0
scripts/fix_numpy_asserts.py 98.1% 0
scripts/sync_test_dependencies.py 98.3% 1

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@stranske stranske merged commit 13db5ac into main Jan 1, 2026
42 checks passed
@stranske stranske deleted the fix/code-quality-issues branch January 1, 2026 06:54
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 1, 2026

🤖 Keepalive Loop Status

PR #416 | Agent: Codex | Iteration 0/5

Current State

Metric Value
Iteration progress [----------] 0/5
Action wait (missing-agent-label)
Gate success
Tasks 0/0 complete
Keepalive ❌ disabled
Autofix ❌ disabled

🔍 Failure Classification

| Error type | infrastructure |
| Error category | resource |
| Suggested recovery | Confirm the referenced resource exists (repo, PR, branch, workflow, or file). |

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses multiple code quality issues identified from previous Copilot reviews and other sources. The changes focus on improving code maintainability by removing redundant code, fixing type checking issues, and correcting formatting inconsistencies.

  • Replaced redundant ternary operators with direct Number() calls in rate limit handling
  • Fixed tomlkit type checking using duck typing instead of isinstance(dict) checks
  • Removed redundant code and corrected indentation issues in agents-guard.js

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/resolve_mypy_pin.py Replaced isinstance(dict) checks with duck typing using hasattr for tomlkit compatibility, and added type validation before string conversion
templates/consumer-repo/.github/workflows/agents-guard.yml Simplified redundant ternary operators in rate limit header parsing
templates/consumer-repo/.github/scripts/agents-guard.js Removed redundant array initialization and fixed indentation inconsistencies
.github/workflows/agents-guard.yml Simplified redundant ternary operators (same fix as template)
.github/scripts/agents-guard.js Removed redundant array initialization and fixed indentation (same fix as template)
.github/scripts/keepalive_loop.js Updated comment to clarify numbered list examples
docs/archive/CODE_QUALITY_ISSUES_2026-01-01.md Documentation file tracking all code quality issues and their resolution status

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +110 to +120
| Issue | File | Priority | Status |
|-------|------|----------|--------|
| Redundant ternary (×3) | agents-guard.yml | Low | ✅ Fixed |
| withApiRetry duplication | agents-guard.yml | Medium | ⬚ Open |
| tomlkit isinstance (×2) | resolve_mypy_pin.py | High | ✅ Fixed |
| Missing indentation | agents-guard.js | Low | ✅ Fixed |
| Inconsistent array indentation | agents-guard.js | Low | ✅ Fixed |
| Type validation python_version | resolve_mypy_pin.py | Medium | ✅ Fixed |
| Redundant instructions reassignment | agents-guard.js | Low | ✅ Fixed |
| Typo in numbered list comment | issue_scope_parser.js | Low | ⬚ N/A (not found) |
| Same typo in keepalive_loop.js | keepalive_loop.js | Low | ✅ Fixed |
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The table formatting is incorrect. The first pipe character should be at the start of each line, not preceded by a space. The proper markdown table format should have pipes aligned at the beginning of the line.

Copilot uses AI. Check for mistakes.
// Match bullet points (-, *, +) or numbered lists (1., 2), 3.)

// Should be:
// Match bullet points (-, *, +) or numbered lists (e.g. 1., 2., 3))
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The comment example shows "2]" which appears to be a typo. However, the corrected version in line 173 shows "e.g. 1., 2., 3))" which has an extra closing parenthesis. The correct format should be "e.g. 1., 2., 3.)" or "(e.g. 1., 2., 3.)" to match the pattern description.

Suggested change
// Match bullet points (-, *, +) or numbered lists (e.g. 1., 2., 3))
// Match bullet points (-, *, +) or numbered lists (e.g. 1., 2., 3.)

Copilot uses AI. Check for mistakes.

const updated = lines.map((line) => {
// Match bullet points (-, *, +) or numbered lists (1., 2), 3.)
// Match bullet points (-, *, +) or numbered lists (e.g. 1., 2., 3))
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The comment has an extra closing parenthesis at the end. It should be "e.g. 1., 2., 3.)" to match the pattern described, or remove the trailing parenthesis entirely for clarity.

Suggested change
// Match bullet points (-, *, +) or numbered lists (e.g. 1., 2., 3))
// Match bullet points (-, *, +) or numbered lists (e.g. 1., 2., 3.)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autofix Opt-in automated formatting & lint remediation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants