Skip to content

Feat/sobiapicall#3

Merged
thiernodialloAFA merged 4 commits into
mainfrom
feat/sobiapicall
May 7, 2026
Merged

Feat/sobiapicall#3
thiernodialloAFA merged 4 commits into
mainfrom
feat/sobiapicall

Conversation

@thiernodialloAFA
Copy link
Copy Markdown
Collaborator

Green API Review Checklist (API Green Score)

Merci d’indiquer les mesures avant/après (payload/latence).

Data Exchange

  • DE11 – Pagination (size borné ≤100, validé)
  • DE08 – Filtrage via fields= (whitelist, champs coûteux off par défaut)
  • DE01/USXX – Format & compression (JSON/CBOR, Gzip activé & testé)
  • DE02/DE03 – Cache HTTP (Cache-Control + ETag/Last-Modified304 en test)
  • DE06/US04 – Delta (/changes?since=… ou sinceVersion)
  • 206 Partial Content (Range: bytes= pour ressources volumineuses)

Usage / Archi / Logs

  • US01 – Query params pour GET (page/size/fields)
  • US07 – Monitoring erreurs (Actuator/metrics)
  • AR02 – Efficacité (batch, agrégation, keyset pagination)
  • LO01 – Logs utiles (bytes, timeMs, 304) & rétention documentée
  • Rate limiting pour éviter rafales inutiles

Sécurité & robustesse

  • Validation inputs (bornes size, whitelist fields)
  • Idempotency‑Key sur POST critiques

Mesures

curl -s -w 'size=%{size_download} time=%{time_total}
' -o /dev/null <URL>
  • Avant : …
  • Après : …
  • Gain : … %

🌿 Green Score (automatique)

Le CI calculera automatiquement le Green Score /100 et postera un commentaire détaillé sur cette PR.
Consultez le dashboard : dashboard/index.html

Copilot AI review requested due to automatic review settings May 7, 2026 15:03
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🌿 Green API — Combined Report

🔴 Green API Score: 39/100 (Grade: D)

🔍 Endpoints: 22

🟢 🌱 Creedengo Éco-Design: 88/100 (Grade: A)

🐛 Issues: 140 | Règles violées: 2

📋 Top règles Creedengo (2)
Sévérité Règle Issues
⚪ MINOR GCI82 — Variable can be made constant 138
⚪ MINOR GCI76 — Avoid usage of static collections. 2

📅 2026-05-07T15:06:39.733Z

Copy link
Copy Markdown

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 adds an optional SobriIT reporting integration to publish Green Score / Creedengo results, and introduces a set of GitHub Copilot workspace assets (instructions, agents, prompts, skills) to standardize Green API / Creedengo reviews and fixes in the repository.

Changes:

  • Add an optional “send to SobriIT” flow in scripts and the interactive dashboard UI.
  • Introduce a standalone Python sender (sobriit_sender.py) for pushing analysis reports to SobriIT’s REST API.
  • Add .github/ Copilot instructions plus reusable agents/prompts/skills for Green API and Creedengo workflows.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
scripts/start.sh Adds SobriIT send step after analyses and refactors report path variables for reuse.
scripts/greenapianalyzer.sh Adds --send-to-sobriit CLI flag and a post-run SobriIT send step.
scripts/greenapianalyzer-server.py Adds optional SobriIT send on local analysis runs and returns SobriIT status to the UI.
scripts/sobriit_sender.py New module/CLI to push Green Score + Creedengo payloads to SobriIT.
dashboard/interactive.html Adds SobriIT configuration UI (remote + local tabs), payload fields, and status banners.
.github/copilot-instructions.md Repository-wide Copilot guidance for Green API + Creedengo patterns.
.github/README.md Documents the added Copilot assets and how to use them.
.github/agents/green-api-analyzer.md Adds a Green API-focused review/generation agent description.
.github/agents/global-green-analyzer.md Adds a combined Green API + Creedengo agent description.
.github/agents/creedengo-analyzer.md Adds a Creedengo-focused review/generation agent description.
.github/agents/api-design-reviewer.md Adds an OpenAPI/API-design reviewer agent description with green patterns.
.github/prompts/green-api-review.md New reusable prompt for Green API + Creedengo review output.
.github/prompts/green-api-fix.md New reusable prompt to apply Green API fixes.
.github/prompts/generate-green-endpoint.md New reusable prompt to generate a “green compliant” endpoint template.
.github/prompts/creedengo-fix.md New reusable prompt to fix Creedengo violations.
.github/prompts/optimize-query.md New reusable prompt to optimize DB access for eco-design.
.github/skills/green-api-score.md New skill: compute a Green API score breakdown.
.github/skills/green-api-fix.md New skill: apply Green API patterns to existing code.
.github/skills/validate-green-api-fix.md New skill: validate correctness and score impact of Green API fixes.
.github/skills/creedengo-scan.md New skill: scan for Creedengo violations and propose fixes.
.github/skills/validate-creedengo-fix.md New skill: validate Creedengo fixes for correctness and regressions.
.github/skills/add-pagination.md New skill: add DE11 pagination pattern.
.github/skills/add-field-filtering.md New skill: add DE08 fields pattern.
.github/skills/add-compression.md New skill: add DE01 compression pattern.
.github/skills/add-etag-304.md New skill: add DE02/DE03 ETag + 304 pattern.
.github/skills/add-delta-endpoint.md New skill: add DE06 delta/changes pattern.
.github/skills/add-rate-limiting.md New skill: add US07 rate limiting pattern.
.github/skills/add-health-endpoint.md New skill: add LO01 health endpoint pattern.

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

Comment thread scripts/start.sh
Comment on lines +1205 to +1209
# SobriIT integration — send results if --send-to-sobriit is set
###############################################################################
if [ "$SEND_TO_SOBRIIT" = true ]; then
echo ""
echo "━━━ 📤 Sending results to SobriIT ━━━"
Comment thread scripts/start.sh
Comment on lines +1212 to +1213
[ -f "$LATEST_REPORT" ] && SOBRIIT_CMD+=(--green-report "$LATEST_REPORT")
[ -f "$CREEDENGO_REPORT" ] && SOBRIIT_CMD+=(--creedengo-report "$CREEDENGO_REPORT")
Comment on lines +238 to +239
CREEDENGO_REPORT="$ROOT/reports/creedengo-report.json"
[ -f "$CREEDENGO_REPORT" ] && SOBRIIT_CMD+=(--creedengo-report "$CREEDENGO_REPORT")
Comment on lines +926 to +934
if payload.get("sendToSobriit"):
try:
sobriit_result = _sobriit_send(
appname=appname,
green_report=report,
creedengo_report=creedengo_report,
base_url=payload.get("sobriitBaseUrl"),
api_key=payload.get("sobriitApiKey"),
)
Comment on lines +930 to +934
green_report=report,
creedengo_report=creedengo_report,
base_url=payload.get("sobriitBaseUrl"),
api_key=payload.get("sobriitApiKey"),
)
Comment thread scripts/sobriit_sender.py
Comment on lines +151 to +160
# ── Step 1: Lookup or create application ──
app_id = None
quoted = urllib.request.quote(appname, safe='')

# Try lookup by name first, then by code via the search endpoint
for search_field in ("name", "code"):
status, resp = _api_call(
"GET",
f"{base_url}/api/v1/applications/search?{search_field}={quoted}",
api_key,
Comment thread scripts/sobriit_sender.py
Comment on lines +155 to +169
# Try lookup by name first, then by code via the search endpoint
for search_field in ("name", "code"):
status, resp = _api_call(
"GET",
f"{base_url}/api/v1/applications/search?{search_field}={quoted}",
api_key,
)
if status == 200 and isinstance(resp, dict):
items = resp.get("data") or []
# Exact match (search may return partial matches)
for item in items:
if isinstance(item, dict) and item.get("id"):
val = (item.get(search_field) or "").strip()
if val.lower() == appname.lower():
app_id = item["id"]
Comment thread scripts/sobriit_sender.py
green_total = gs.get("total")
green_max = gs.get("max")
green_grade = gs.get("grade")
score_normalised = round(green_total / green_max * 100, 2) if green_total and green_max else None
Comment on lines +970 to +984
// Restore from localStorage
try {
if (localStorage.getItem(lsPrefix + ".enabled") === "true") cb.checked = true;
if (urlEl) urlEl.value = localStorage.getItem(lsPrefix + ".url") || "";
if (keyEl) keyEl.value = localStorage.getItem(lsPrefix + ".key") || "";
} catch {}
const sync = () => {
fields.style.display = cb.checked ? "" : "none";
try { localStorage.setItem(lsPrefix + ".enabled", cb.checked); } catch {}
};
cb.addEventListener("change", sync);
sync();
if (urlEl) urlEl.addEventListener("input", () => { try { localStorage.setItem(lsPrefix + ".url", urlEl.value); } catch {} });
if (keyEl) keyEl.addEventListener("input", () => { try { localStorage.setItem(lsPrefix + ".key", keyEl.value); } catch {} });
}
@thiernodialloAFA thiernodialloAFA merged commit 8670d82 into main May 7, 2026
11 checks passed
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.

2 participants