Skip to content

Commit 1e0ed2e

Browse files
Claude-harness-botdevonartis
authored andcommitted
fix(ci): resolve lint errors, add pull-requests permission for gitleaks
- Auto-fixed 27 ruff errors (unused imports, f-string placeholders, sorting) - Excluded demo/, demo2/, tests/integration/ from ruff (separate track) - Added pull-requests: read permission for gitleaks secrets scan Ref: devonartis/agentwrit#31
1 parent 10db10a commit 1e0ed2e

9 files changed

Lines changed: 21 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: read
11+
pull-requests: read
1112

1213
jobs:
1314
lint:

demo/pipeline/runner.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import json
2121
import time
22-
from collections.abc import AsyncGenerator
2322
from dataclasses import dataclass, field
2423
from typing import Any
2524

@@ -34,11 +33,9 @@
3433
validate,
3534
)
3635
from agentauth.errors import AgentAuthError, AuthorizationError
37-
3836
from demo.pipeline.agents import billing, clinical, prescription
3937
from demo.pipeline.tools import (
4038
TOOLS,
41-
ToolResult,
4239
execute_tool,
4340
get_tools_for_role,
4441
scopes_for_tools,

demo/routes/api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
validate,
2626
)
2727
from agentauth.errors import AgentAuthError, AuthorizationError
28-
2928
from demo.config import DemoConfig
3029
from demo.data.patients import get_patient, list_patients
3130
from demo.pipeline.tools import TOOLS, execute_tool, scopes_for_tools
@@ -349,7 +348,7 @@ async def process_request(request: Request) -> JSONResponse:
349348
trace.append(TraceStep("token_validated",
350349
f"Old {category} token confirmed dead",
351350
{"valid": old_val.valid, "error": old_val.error,
352-
"context": "old_token_after_renewal"},
351+
"context": "old_token_after_renewal"},
353352
"success" if not old_val.valid else "warning"))
354353
except AgentAuthError:
355354
pass

demo/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def main() -> None:
6767
print("Admin authenticated.")
6868

6969
# Register the demo app
70-
print(f"\nRegistering MedAssist demo app with scope ceiling:")
70+
print("\nRegistering MedAssist demo app with scope ceiling:")
7171
for scope in APP_SCOPE_CEILING:
7272
print(f" - {scope}")
7373

@@ -90,7 +90,7 @@ def main() -> None:
9090
client_id = app_data["client_id"]
9191
client_secret = app_data["client_secret"]
9292

93-
print(f"\nApp registered successfully!")
93+
print("\nApp registered successfully!")
9494
print(f" app_id: {app_data['app_id']}")
9595
print(f" client_id: {client_id}")
9696
print(f" client_secret: {client_secret}")
@@ -104,7 +104,7 @@ def main() -> None:
104104
print(f"AGENTAUTH_CLIENT_ID={client_id}")
105105
print(f"AGENTAUTH_CLIENT_SECRET={client_secret}")
106106
print(f"AGENTAUTH_ADMIN_SECRET={ADMIN_SECRET}")
107-
print(f"OPENAI_API_KEY=<your-openai-key>")
107+
print("OPENAI_API_KEY=<your-openai-key>")
108108
print(f"{'='*60}")
109109

110110

demo2/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66

77
from __future__ import annotations
88

9-
import json
109
from pathlib import Path
1110

1211
from dotenv import load_dotenv
1312
from flask import Flask, Response, render_template, request, stream_with_context
1413
from openai import OpenAI
1514

1615
from agentauth import AgentAuthApp
17-
1816
from demo2.config import APP_SCOPE_CEILING, DemoConfig
1917
from demo2.data import QUICK_FILLS
2018
from demo2.pipeline import run_pipeline

demo2/pipeline.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
from openai import OpenAI
2121

2222
from agentauth import (
23-
Agent,
2423
AgentAuthApp,
2524
scope_is_subset,
2625
validate,
2726
)
2827
from agentauth.errors import AgentAuthError
29-
3028
from demo2 import data
3129
from demo2.tools import TOOLS, execute_tool, scopes_for_tools
3230

demo2/setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def main() -> None:
6060
print("Admin authenticated.")
6161

6262
# Register the demo app
63-
print(f"\nRegistering support ticket demo app with scope ceiling:")
63+
print("\nRegistering support ticket demo app with scope ceiling:")
6464
for scope in APP_SCOPE_CEILING:
6565
print(f" - {scope}")
6666

@@ -81,7 +81,7 @@ def main() -> None:
8181

8282
app_data = app_resp.json()
8383

84-
print(f"\nApp registered successfully!")
84+
print("\nApp registered successfully!")
8585
print(f" app_id: {app_data['app_id']}")
8686
print(f" client_id: {app_data['client_id']}")
8787
print(f" client_secret: {app_data['client_secret']}")
@@ -94,9 +94,9 @@ def main() -> None:
9494
print(f"AGENTAUTH_CLIENT_ID={app_data['client_id']}")
9595
print(f"AGENTAUTH_CLIENT_SECRET={app_data['client_secret']}")
9696
print(f"AGENTAUTH_ADMIN_SECRET={ADMIN_SECRET}")
97-
print(f"LLM_BASE_URL=<your-llm-base-url>")
98-
print(f"LLM_API_KEY=<your-api-key>")
99-
print(f"LLM_MODEL=<your-model>")
97+
print("LLM_BASE_URL=<your-llm-base-url>")
98+
print("LLM_API_KEY=<your-api-key>")
99+
print("LLM_MODEL=<your-model>")
100100
print(f"{'='*60}")
101101

102102

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ packages = ["src/agentauth"]
2929
[tool.ruff]
3030
target-version = "py310"
3131
line-length = 100
32-
exclude = ["tests/sdk-core"]
32+
exclude = ["tests/sdk-core", "tests/integration", "demo", "demo2"]
3333

3434
[tool.ruff.lint]
3535
select = ["E", "F", "I", "N", "W", "UP"]

tests/integration/test_acceptance_1_8.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def test_delegate_narrow_scope(
398398
delegate_to=agent_b.agent_id,
399399
scope=["read:data:partition-7"],
400400
)
401-
output.append(f" delegate() returned:")
401+
output.append(" delegate() returned:")
402402
output.append(f" access_token: {delegated.access_token[:30]}...")
403403
output.append(f" expires_in: {delegated.expires_in}s")
404404
output.append(f" chain_length: {len(delegated.delegation_chain)}")
@@ -582,7 +582,7 @@ def test_delegation_chain(
582582
delegate_to=agent_b.agent_id,
583583
scope=["read:data:partition-7", "read:data:partition-8"],
584584
)
585-
output.append(f" delegate() A→B returned:")
585+
output.append(" delegate() A→B returned:")
586586
output.append(f" access_token: {delegated_ab.access_token[:30]}...")
587587
output.append(f" expires_in: {delegated_ab.expires_in}s")
588588
output.append(f" chain_length: {len(delegated_ab.delegation_chain)}")
@@ -615,7 +615,7 @@ def test_delegation_chain(
615615
hop2_data = hop2_resp.json()
616616
delegated_bc_token = hop2_data["access_token"]
617617
delegated_bc_chain = hop2_data.get("delegation_chain", [])
618-
output.append(f" Hop 2 returned:")
618+
output.append(" Hop 2 returned:")
619619
output.append(f" access_token: {delegated_bc_token[:30]}...")
620620
output.append(f" expires_in: {hop2_data['expires_in']}s")
621621
output.append(f" chain_length: {len(delegated_bc_chain)}")
@@ -743,7 +743,7 @@ def test_delegate_all_scope(
743743
)
744744
broker_accepts = True
745745
output.append(" RESULT: Broker ACCEPTED full-scope delegation")
746-
output.append(f" delegate() returned:")
746+
output.append(" delegate() returned:")
747747
output.append(f" access_token: {delegated.access_token[:30]}...")
748748
output.append(f" expires_in: {delegated.expires_in}s")
749749
output.append(f" chain_length: {len(delegated.delegation_chain)}")
@@ -829,7 +829,7 @@ def test_scope_gating(self, client: AgentAuthApp) -> None:
829829
# Action 1: Read customer-artis (authorized)
830830
action_1 = ["read:data:customer-artis"]
831831
allowed_1 = scope_is_subset(action_1, agent.scope)
832-
output.append(f" Action: read customer-artis")
832+
output.append(" Action: read customer-artis")
833833
output.append(f" Scope check: {allowed_1}")
834834
if allowed_1:
835835
output.append(" PASS: Authorized action allowed")
@@ -842,7 +842,7 @@ def test_scope_gating(self, client: AgentAuthApp) -> None:
842842
# Action 2: Read ALL customers (NOT authorized)
843843
action_2 = ["read:data:all-customers"]
844844
allowed_2 = scope_is_subset(action_2, agent.scope)
845-
output.append(f" Action: read all-customers")
845+
output.append(" Action: read all-customers")
846846
output.append(f" Scope check: {allowed_2}")
847847
if not allowed_2:
848848
output.append(" PASS: Unauthorized action blocked by scope check")
@@ -855,7 +855,7 @@ def test_scope_gating(self, client: AgentAuthApp) -> None:
855855
# Action 3: Write to customer-artis (NOT authorized — agent has read only)
856856
action_3 = ["write:data:customer-artis"]
857857
allowed_3 = scope_is_subset(action_3, agent.scope)
858-
output.append(f" Action: write customer-artis")
858+
output.append(" Action: write customer-artis")
859859
output.append(f" Scope check: {allowed_3}")
860860
if not allowed_3:
861861
output.append(" PASS: Write blocked — agent has read-only scope")
@@ -1158,7 +1158,7 @@ def test_multiple_agents_isolated(
11581158
output.append(f" sub: {result.claims.sub}")
11591159
output.append(f" scope: {result.claims.scope}")
11601160
if result.claims.scope != agent.scope:
1161-
output.append(f" FAIL: Claims scope doesn't match agent scope")
1161+
output.append(" FAIL: Claims scope doesn't match agent scope")
11621162
passed = False
11631163
else:
11641164
output.append(f" FAIL: Token invalid — error={result.error}")
@@ -1313,7 +1313,7 @@ def test_validate_garbage_token(self, broker_url: str) -> None:
13131313
output.append(" FAIL: Broker accepted a garbage token")
13141314
passed = False
13151315
except Exception as e:
1316-
output.append(f" FAIL: SDK threw exception instead of returning ValidateResult")
1316+
output.append(" FAIL: SDK threw exception instead of returning ValidateResult")
13171317
output.append(f" Exception: {type(e).__name__}: {e}")
13181318
passed = False
13191319

@@ -1357,7 +1357,7 @@ def test_health_check(self, client: AgentAuthApp) -> None:
13571357
passed = True
13581358

13591359
health = client.health()
1360-
output.append(f" health() returned:")
1360+
output.append(" health() returned:")
13611361
output.append(f" status: {health.status}")
13621362
output.append(f" version: {health.version}")
13631363
output.append(f" uptime: {health.uptime}s")

0 commit comments

Comments
 (0)