Skip to content

fix: camelCase payload keys for Bricks API and detailed logging#39

Merged
Kaiohz merged 1 commit into
mainfrom
fix/bricks-publish-camelcase-logging
May 21, 2026
Merged

fix: camelCase payload keys for Bricks API and detailed logging#39
Kaiohz merged 1 commit into
mainfrom
fix/bricks-publish-camelcase-logging

Conversation

@Kaiohz
Copy link
Copy Markdown
Collaborator

@Kaiohz Kaiohz commented May 21, 2026

Changes

  • Fix publish_section_version payload keys: snake_case → camelCase (projectUniqueId, sectionKey, workflowId, workflowName, workflowMetadata) — was getting HTTP 400 MISSING_FIELDS
  • Add workflowMetadata generation (execution_id, executed_at, version)
  • Add detailed logging to BricksApiAdapter: GET/POST requests, response sizes, HTTP error bodies
  • Propagate original error messages in ToolError instead of swallowing them

Tests

  • Container rebuilt and deployed on cluster
  • Logs now show full request/response details on Bricks API calls

- Fix publish_section_version payload keys: snake_case → camelCase
  (projectUniqueId, sectionKey, workflowId, workflowName, workflowMetadata)
  to match Bricks API requirements (was getting HTTP 400 MISSING_FIELDS)
- Add workflowMetadata with execution_id, executed_at, version
- Add detailed logging to BricksApiAdapter (GET/POST requests, responses,
  error bodies) for debugging
- Propagate original error messages in ToolError instead of generic messages
@Kaiohz Kaiohz force-pushed the fix/bricks-publish-camelcase-logging branch from 30b700a to fe6038e Compare May 21, 2026 16:01
@Kaiohz Kaiohz merged commit e569f02 into main May 21, 2026
1 check passed
@Kaiohz Kaiohz deleted the fix/bricks-publish-camelcase-logging branch May 21, 2026 16:05
@Kaiohz
Copy link
Copy Markdown
Collaborator Author

Kaiohz commented May 21, 2026

Code Review — PR #39 🤖

Score : 7/10 — PR solide, le bug fix est clean et les tests suivent.

✅ Points positifs

  • Bug fix ciblé et correct — snake_case → camelCase, c'était clairement le problème bloquant (HTTP 400 MISSING_FIELDS).
  • Logging bien structuré — DEBUG pour les succès, ERROR pour les échecs, avec tailles et status codes. Utile en prod.
  • Gestion d'erreurs améliorée — Fini le from None qui avalait les erreurs. La différenciation PermissionError / ConnectionError / Exception générale est pertinente.
  • Tests à jour — Tous les tests reflètent les changements (camelCase, messages propagés, workflow_metadata non-null).

⚠️ Points à améliorer

1. Workflow metadata hardcodé (moyen)

"execution_id": f"run-{now.strftime('%Y-%m-%d')}-001",
"version": "1.0.0",

Le 001 est arbitraire et ne sera jamais unique si plusieurs runs le même jour. Le version: "1.0.0" est statique.
Suggéré : Générer un UUID pour execution_id, ou passer ces métadonnées en paramètre pour permettre la customisation.

2. Log du payload complet en INFO (risque de fuite)

logger.info("Publish payload: %s", json.dumps(payload, ...))

Le payload contient du contenu utilisateur (content). Logger ça en INFO en production = risque de fuite de données sensibles.
Suggéré : Passer en DEBUG, ou tronquer/masquer le champ content avant de logger.

3. Messages d'erreur trop verbeux côté client MCP

raise ToolError(str(e)) from e  # PermissionError / ConnectionError

str(e) peut exposer des détails internes (URLs, tokens).
Suggéré : Message utilisateur-friendly ("Authentication failed", "Service temporarily unavailable"), détails uniquement dans les logs.

4. Test partiel sur workflow_metadata

assert "execution_id" in call_args.kwargs["workflow_metadata"]

→ Un regex pattern check serait plus robuste.


Bonne PR dans l'ensemble. Les points 2 et 3 méritent un fix rapide avant de scaler en production.

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