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
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ concurrency:

permissions:
contents: read
pages: write
Copy link

@cubic-dev-ai cubic-dev-ai bot Dec 19, 2025

Choose a reason for hiding this comment

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

P2: Permissions pages: write and id-token: write are set at workflow level, granting elevated permissions to all jobs including typos and ci which don't need them. Consider moving these permissions to job-level for only the coverage and deploy-coverage jobs to follow the principle of least privilege.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yaml, line 15:

<comment>Permissions `pages: write` and `id-token: write` are set at workflow level, granting elevated permissions to all jobs including `typos` and `ci` which don&#39;t need them. Consider moving these permissions to job-level for only the `coverage` and `deploy-coverage` jobs to follow the principle of least privilege.</comment>

<file context>
@@ -12,6 +12,8 @@ concurrency:
 
 permissions:
   contents: read
+  pages: write
+  id-token: write
 
</file context>
Fix with Cubic

id-token: write
Comment on lines 13 to +16
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The GitHub Pages permissions are added at the workflow level, which means they apply to all jobs including typos and ci jobs that don't need them. This violates the principle of least privilege. Consider moving these permissions to only the jobs that need them (coverage and deploy-coverage) using job-level permissions.

Copilot uses AI. Check for mistakes.

jobs:
typos:
Expand Down Expand Up @@ -59,3 +61,46 @@ jobs:

- name: Run Tests
run: nix develop --command just test

coverage:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
env:
STACKONE_API_KEY: ${{ secrets.STACKONE_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Setup Nix
uses: ./.github/actions/setup-nix

- name: Install dependencies
run: nix develop --command just install --all-extras
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The coverage job installs dependencies with --all-extras, which includes optional extras like 'examples' that may not be necessary for coverage calculation. This increases build time and could affect coverage measurements if optional dependencies have side effects. Consider using the same dependency installation approach as the ci job's matrix strategy to ensure consistency.

Suggested change
run: nix develop --command just install --all-extras
run: nix develop --command just install

Copilot uses AI. Check for mistakes.

- name: Run Tests with Coverage
run: nix develop --command just coverage

- name: Create Coverage Badge
uses: jaywcjlove/coverage-badges-cli@bd6ccbf422c0ed54c01f283019fd2bc648f58541 # v2.2.0
with:
source: coverage/coverage.json
output: coverage/badges.svg
jsonPath: totals.percent_covered

- name: Upload coverage artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v3.0.2
with:
path: coverage/

deploy-coverage:
needs: coverage
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
Comment on lines +96 to +106
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The deploy-coverage job could have concurrency issues. If multiple pushes to main happen in quick succession, the workflow cancellation strategy (cancel-in-progress: true) combined with the job dependency could result in incomplete deployments or race conditions. Consider adding a concurrency group specifically for the deployment jobs to ensure only one deployment runs at a time.

Copilot uses AI. Check for mistakes.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.pytest_cache
.python-version
__pycache__
.coverage
coverage/

.DS_Store

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![PyPI version](https://badge.fury.io/py/stackone-ai.svg)](https://badge.fury.io/py/stackone-ai)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/StackOneHQ/stackone-ai-python)](https://github.com/StackOneHQ/stackone-ai-python/releases)
[![Coverage](https://stackonehq.github.io/stackone-ai-python/badges.svg)](https://stackonehq.github.io/stackone-ai-python/html/)

StackOne AI provides a unified interface for accessing various SaaS tools through AI-friendly APIs.

Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ lint-fix:
test:
uv run pytest

# Run tests with coverage
coverage:
uv run pytest --cov --cov-report=term --cov-report=json --cov-report=html

# Run tool-specific tests
test-tools:
uv run pytest tests
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,26 @@ ignore_missing_imports = true
module = "mcp.*"
ignore_missing_imports = true
ignore_errors = true

[tool.coverage.run]
source = ["stackone_ai"]
branch = true
omit = [
"stackone_ai/__init__.py",
"**/py.typed",
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The omit pattern "**/py.typed" will match any py.typed file in any directory at any level, which could be overly broad if there are multiple packages or nested structures. Since stackone_ai/py.typed is already covered by the directory-specific omit pattern "stackone_ai/init.py", consider using a more specific pattern like "stackone_ai/py.typed" or removing this pattern if it's redundant.

Suggested change
"**/py.typed",
"stackone_ai/py.typed",

Copilot uses AI. Check for mistakes.
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"if typing.TYPE_CHECKING:",
]

[tool.coverage.json]
output = "coverage/coverage.json"

[tool.coverage.html]
directory = "coverage/html"