Skip to content

Conversation

@vlussenburg
Copy link
Collaborator

@vlussenburg vlussenburg commented May 14, 2025

✨ PR Description

Purpose and impact:
This PR implements order history tracking and enhances error handling across multiple services.

Main changes:

  • Added timestamp to order data and created a response history list in the billing service
  • Implemented error logging (printStackTrace) in the Java order service
  • Removed 'admin' user from the authentication service and added a TODO for order history in frontend

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀

Copy link

@gitstream-cm gitstream-cm bot left a comment

Choose a reason for hiding this comment

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

This PR contains a TODO statement. Please check to see if they should be removed.

@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

This PR affects one or more sensitive files and requires review from the security team.

@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

Please mark which AI tools you used for this PR by checking the appropriate boxes:

  • GitHub Copilot
  • Cursor
  • ChatGPT
  • Tabnine
  • JetBrains AI Assistant
  • VSCode IntelliCode
  • Claude
  • Gemini
  • Other AI tool
  • No AI tools were used

Tip: If you want to avoid this comment in the future, you can add a label of the format 🤖 ai-* when creating your PR.

headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + token
"Authorization": "Bearer" + token
Copy link

Choose a reason for hiding this comment

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

Suggested change
"Authorization": "Bearer" + token
"Authorization": "Bearer " + token
payload.put("username", username);
payload.put("productId", productId);
payload.put("quantity", quantity);
payload.put("dats", Instant.now().toString());
Copy link

Choose a reason for hiding this comment

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

Suggested change
payload.put("dats", Instant.now().toString());
payload.put("date", Instant.now().toString());
[Route("billing")]
public class BillingController : ControllerBase
{
private static readonly List<object> responseHistory = new List<object>();
Copy link

Choose a reason for hiding this comment

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

Suggested change
private static readonly List<object> responseHistory = new List<object>();
private static readonly List<object> responseHistory = new List<object>(100); // Limit initial capacity
@gitstream-cm

This comment has been minimized.

@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

🥷 Code experts: cghyzel, amitmohleji

cghyzel, amitmohleji have most 👩‍💻 activity in the files.
cghyzel, amitmohleji have most 🧠 knowledge in the files.

See details

frontend/public/app.js

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR 33 additions & 0 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
amitmohleji: 100%

frontend/public/index.html

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR 20 additions & 0 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
amitmohleji: 100%

services/auth-python/app/auth.py

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR
FEB 33 additions & 0 deletions
JAN
DEC

Knowledge based on git-blame:
cghyzel: 100%

services/billing-csharp/Controllers/BillingController.cs

Activity based on git-commit:

cghyzel amitmohleji
MAY 45 additions & 0 deletions
APR
MAR
FEB
JAN
DEC

Knowledge based on git-blame:
cghyzel: 100%

services/orders-java/src/main/java/com/example/orders/controller/OrderController.java

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR 75 additions & 0 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
cghyzel: 100%

To learn more about /:\ gitStream - Visit our Docs

@gitstream-cm gitstream-cm bot requested review from amitmohleji and cghyzel May 14, 2025 03:30
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + token
"Authorization": "Bearer" + token
Copy link

Choose a reason for hiding this comment

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

Suggested change
"Authorization": "Bearer" + token
"Authorization": "Bearer " + token
payload.put("username", username);
payload.put("productId", productId);
payload.put("quantity", quantity);
payload.put("dats", Instant.now().toString());
Copy link

Choose a reason for hiding this comment

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

Suggested change
payload.put("dats", Instant.now().toString());
payload.put("date", Instant.now().toString());
[Route("billing")]
public class BillingController : ControllerBase
{
private static readonly List<object> responseHistory = new List<object>();
Copy link

Choose a reason for hiding this comment

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

Suggested change
private static readonly List<object> responseHistory = new List<object>();
private static readonly List<object> responseHistory = new List<object>(100); // Limited to last 100 entries
@gitstream-cm

This comment has been minimized.

@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

This PR is missing a Jira ticket reference in the title or description.
Please add a Jira ticket reference to the title or description of this PR.

@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

Hello vlussenburg 👋 Thanks for making your first PR, and welcome to our project!
Our mentor team has automatically been assigned to review this PR and guide you through the process.
Please reach out to that team if you have questions about the next steps.

@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

🥷 Code experts: cghyzel, amitmohleji

cghyzel, amitmohleji have most 👩‍💻 activity in the files.
cghyzel, amitmohleji have most 🧠 knowledge in the files.

See details

frontend/public/app.js

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR 33 additions & 0 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
amitmohleji: 100%

frontend/public/index.html

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR 20 additions & 0 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
amitmohleji: 100%

services/auth-python/app/auth.py

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR
FEB 33 additions & 0 deletions
JAN
DEC

Knowledge based on git-blame:
cghyzel: 100%

services/billing-csharp/Controllers/BillingController.cs

Activity based on git-commit:

cghyzel amitmohleji
MAY 45 additions & 0 deletions
APR
MAR
FEB
JAN
DEC

Knowledge based on git-blame:
cghyzel: 100%

services/orders-java/src/main/java/com/example/orders/controller/OrderController.java

Activity based on git-commit:

cghyzel amitmohleji
MAY
APR
MAR 75 additions & 0 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
cghyzel: 100%

To learn more about /:\ gitStream - Visit our Docs

[Route("billing")]
public class BillingController : ControllerBase
{
private static readonly List<object> responseHistory = new List<object>();
Copy link

Choose a reason for hiding this comment

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

Suggested change
private static readonly List<object> responseHistory = new List<object>();
private static readonly List<object> responseHistory = new List<object>(100); // Limit size to prevent memory issues
@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

✨ PR Review

General Feedback

The PR introduces several significant issues that should be addressed before merging. The most concerning issues include: an authentication header formatting issue in the frontend code (which was not fixed despite being identified in previous reviews), a data field name mismatch in the Java service ("dats" vs expected "date"), and an unbounded memory growth concern in the C# billing service. While the PR adds useful features like timestamp tracking between services and improved error logging with stack traces, these critical issues need to be resolved to ensure proper service interaction. The frontend changes also introduce a TODO comment about order history functionality which aligns with the new response history tracking in the backend.

File: frontend/public/app.js
Bug - Authentication Error

Details

Problem: Authentication Error - The Authorization header is missing a space between "Bearer" and the token value. This violates the OAuth 2.0 Bearer Token standard and will cause authentication failures.
Fix: Add a space between "Bearer" and token in the Authorization header
Why: The header format violates the OAuth 2.0 Bearer Token standard which requires a space after "Bearer"

headers: { "Content-Type": "application/json", - "Authorization": "Bearer" + token + "Authorization": "Bearer " + token }, body: JSON.stringify({ productId, quantity }),

File: services/orders-java/src/main/java/com/example/orders/controller/OrderController.java
Bug - Data Key Mismatch

Details

Problem: Data Key Mismatch - The Java service sends a timestamp with the key "dats" while the C# BillingController expects it with the key "date", causing the timestamp information to be lost between services.
Fix: Correct the key name from "dats" to "date" in the OrderController to match the C# controller's expected property name
Why: The inconsistent property naming between services will cause data loss and potential errors in date handling

payload.put("productId", productId); payload.put("quantity", quantity); - payload.put("dats", Instant.now().toString()); + payload.put("date", Instant.now().toString()); HttpEntity<String> entity = new HttpEntity<>(payload.toString(), headers);

File: services/billing-csharp/Controllers/BillingController.cs
Performance - Memory Leak

Details

Problem: Memory Leak - The static responseHistory list grows unbounded with each request, storing all response payloads in memory without any cleanup mechanism, which will eventually cause the application to run out of memory.
Fix: Implement a size limit for the history list or use a more appropriate data structure like a circular buffer
Why: Storing unlimited response data in a static collection will consume increasing amounts of memory as the application runs

public class BillingController : ControllerBase { - private static readonly List<object> responseHistory = new List<object>(); + private static readonly List<object> responseHistory = new List<object>(100); // Limit size to prevent memory issues private readonly string EXPECTED_SECRET = Environment.GetEnvironmentVariable("BILLING_SECRET");

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀

[Route("billing")]
public class BillingController : ControllerBase
{
private static readonly List<object> responseHistory = new List<object>();
Copy link

Choose a reason for hiding this comment

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

Suggested change
private static readonly List<object> responseHistory = new List<object>();
private static readonly List<object> responseHistory = new List<object>(100); // Limited capacity
private const int MAX_HISTORY_SIZE = 100;
@gitstream-cm
Copy link

gitstream-cm bot commented May 14, 2025

✨ PR Review

General Feedback

The PR introduces several changes across the microservices architecture with mixed quality. The most concerning issues include the misspelling of a field name in the Java OrderController ("dats" instead of "date"), which will cause data transfer issues between services, and the Authentication header format problem in the frontend that was addressed in previous reviews but seems to have been re-introduced. The C# BillingController now includes a static response history collection without size limitations which could lead to memory issues. While tracking API responses can be useful for debugging, implementing it without proper memory management is problematic. The new exception printing could expose sensitive information in production.

File: services/orders-java/src/main/java/com/example/orders/controller/OrderController.java
Bug - Data Field Mismatch

Details

Problem: Data Field Mismatch - The OrderController puts a timestamp into the payload with key "dats", but the BillingController expects "date". This mismatch will cause the date information to be lost between services, potentially breaking functionality that relies on this timestamp data.
Fix: Rename the field from "dats" to "date" to match the name expected by the BillingController
Why: The inconsistent property naming between services will cause data loss and prevent the proper timestamp handling

payload.put("productId", productId); payload.put("quantity", quantity); - payload.put("dats", Instant.now().toString()); + payload.put("date", Instant.now().toString()); HttpEntity<String> entity = new HttpEntity<>(payload.toString(), headers);

File: frontend/public/app.js
Bug - Authentication Error

Details

Problem: Authentication Error - The Authorization header is missing a space between "Bearer" and the token, which violates the OAuth 2.0 Bearer Token specification and will cause authentication failures.
Fix: Add a space between "Bearer" and the token value in the Authorization header
Why: The header format violates the Bearer token standard which requires a space after "Bearer"

headers: { "Content-Type": "application/json", - "Authorization": "Bearer" + token + "Authorization": "Bearer " + token }, body: JSON.stringify({ productId, quantity }),

File: services/billing-csharp/Controllers/BillingController.cs
Performance - Memory Leak

Details

Problem: Memory Leak - The BillingController uses a static List to store all response payloads without any size limit or cleanup mechanism. This will lead to unbounded memory growth over time as the application handles more requests.
Fix: Implement a size limit for the history list or use a more memory-efficient data structure like a circular buffer
Why: Storing unlimited response data in a static collection will eventually consume all available memory as the application runs

public class BillingController : ControllerBase { - private static readonly List<object> responseHistory = new List<object>(); + private static readonly List<object> responseHistory = new List<object>(100); // Limited capacity + private const int MAX_HISTORY_SIZE = 100; private readonly string EXPECTED_SECRET = Environment.GetEnvironmentVariable("BILLING_SECRET");

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀

@vlussenburg vlussenburg deleted the code-update-quality branch May 14, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment