Skip to content

feat(service-logs): format JSON object messages - #3012

Merged
rmnbrd merged 4 commits into
stagingfrom
feat/service-logs-json-format
Sep 24, 2026
Merged

rmnbrd merged 4 commits into
stagingfrom
feat/service-logs-json-format

Conversation

@RemiBonnet

@RemiBonnet RemiBonnet commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

https://qovery.atlassian.net/browse/QOV-1349

  • Detect valid JSON object messages in Service Logs.
  • Format structured messages with two-space indentation while preserving the existing log metadata row.
  • Keep arrays, primitives, invalid JSON, and plain-text messages unchanged.
  • Preserve search highlighting, selection, and copy behavior.

Screenshots / Recordings

Screenshot 2026-09-24 at 17 49 17

Testing

  • Changes tested locally in the relevant Console pages and Storybooks
  • Focused Jest tests for Service Logs
  • Prettier check on affected files
  • ESLint on affected files

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible
  • I only kept necessary comments, written in English
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code

@nx-cloud

nx-cloud Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7ec1797

Command Status Duration Result
nx run console:build --parallel=3 --configurati... ✅ Succeeded 1m 7s View ↗
nx affected --target=test --parallel=3 --config... ✅ Succeeded 31s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded 2m 32s View ↗
nx-cloud record -- yarn nx format:check ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-24 15:57:17 UTC

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@RemiBonnet
RemiBonnet force-pushed the feat/service-logs-json-format branch from f6594ac to 3ba648e Compare September 24, 2026 14:51
@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.51724% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.11%. Comparing base (bb6c995) to head (7ec1797).
⚠️ Report is 1 commits behind head on staging.

Files with missing lines Patch % Lines
...logs/row-service-logs/format-object-log-message.ts 87.01% 2 Missing and 8 partials ⚠️
...service-logs/row-service-logs/row-service-logs.tsx 97.43% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #3012      +/-   ##
===========================================
+ Coverage    51.73%   52.11%   +0.37%     
===========================================
  Files         1356     1280      -76     
  Lines        29434    28184    -1250     
  Branches      8714     8554     -160     
===========================================
- Hits         15227    14687     -540     
+ Misses       11711    11071     -640     
+ Partials      2496     2426      -70     
Flag Coverage Δ
unittests 52.11% <90.51%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 4 files (changes from recent commits).

Confidence score: 4/5

  • In format-object-log-message.ts, Unicode case folding can shift matchIndex for text after characters such as İ, causing search highlights to point at the wrong rendered text; use an index-preserving case-insensitive matcher or retain an index mapping.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="libs/domains/service-logs/feature/src/lib/list-service-logs/row-service-logs/format-object-log-message.ts">

<violation number="1" location="libs/domains/service-logs/feature/src/lib/list-service-logs/row-service-logs/format-object-log-message.ts:121">
P2: Unicode case folding can make `matchIndex` no longer index `rawMessage`, so searches after characters such as `İ` highlight the wrong rendered text. Use an index-preserving case-insensitive matcher or retain a mapping from normalized offsets back to original offsets.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

const ranges: HighlightRange[] = []
const normalizedSearchTerm = searchTerm.toLowerCase()
const searchableMessage = sourceMap ? rawMessage : message
const normalizedMessage = searchableMessage.toLowerCase()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Unicode case folding can make matchIndex no longer index rawMessage, so searches after characters such as İ highlight the wrong rendered text. Use an index-preserving case-insensitive matcher or retain a mapping from normalized offsets back to original offsets.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At libs/domains/service-logs/feature/src/lib/list-service-logs/row-service-logs/format-object-log-message.ts, line 121:

<comment>Unicode case folding can make `matchIndex` no longer index `rawMessage`, so searches after characters such as `İ` highlight the wrong rendered text. Use an index-preserving case-insensitive matcher or retain a mapping from normalized offsets back to original offsets.</comment>

<file context>
@@ -1,13 +1,140 @@
+  const ranges: HighlightRange[] = []
+  const normalizedSearchTerm = searchTerm.toLowerCase()
+  const searchableMessage = sourceMap ? rawMessage : message
+  const normalizedMessage = searchableMessage.toLowerCase()
+  let matchIndex = normalizedMessage.indexOf(normalizedSearchTerm)
+
</file context>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

@rmnbrd rmnbrd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me 👍

Maybe it's worth considering using an external lib instead of having our custom formatter if we ever encounter some odd edge cases.

@rmnbrd
rmnbrd merged commit 2e2dff1 into staging Sep 24, 2026
9 checks passed
@rmnbrd
rmnbrd deleted the feat/service-logs-json-format branch September 24, 2026 16:02
@RemiBonnet

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 1.363.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants