Skip to content

Conversation

@MartinKolarik
Copy link
Member

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2025

Walkthrough

The ApiLogsTransport.log method now normalizes timestamps to ISO string format using new Date(timestamp as string).toISOString() instead of directly storing the raw timestamp value. Tests are updated to include a fixed timestamp constant ('2025-10-27 20:00:00 +01:00') passed via logger defaultMeta, with assertions verifying that emitted log payloads contain the timestamp field converted to ISO string format.

Possibly related PRs

Suggested reviewers

  • emmakhute65-source

Poem

⏰ Timestamps once wild and free,
Now march in ISO harmony,
Normalized and clean,
The prettiest they've been! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "fix: store log timestamps in ISO format" is fully related to the main change in the changeset. The primary modification in src/lib/api-logs-transport.ts normalizes timestamps to ISO format via new Date(timestamp as string).toISOString(), which is exactly what the title describes. The title is concise, specific, and clearly communicates the key purpose of the changes without being overly broad or vague.
Description Check ✅ Passed No pull request description was provided by the author. Since the check is lenient and is designed to catch descriptions that are completely off-topic or misleading, an absent description does not violate these criteria. An empty description is not unrelated to the changeset in a way that would confuse reviewers, which is the primary concern of this check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch log-timestamp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/unit/lib/api-logs-transport.test.ts (1)

11-11: Add test coverage for edge cases in timestamp handling.

The tests only cover the happy path where a valid timestamp is always provided. Consider adding tests for:

  • Logger without timestamp in defaultMeta (timestamp undefined)
  • Invalid timestamp formats that fail to parse
  • Null or malformed timestamp values

This would catch the missing error handling in the production code.

Example test to add:

it('should handle missing timestamp gracefully', async () => {
	const transport = new ApiLogsTransport({ isActive: true, sendInterval: 100, socket });
	const logger = winston.createLogger({ transports: [transport] }); // No defaultMeta
	
	logger.info('test');
	await sandbox.clock.tickAsync(1000);
	
	const payload = socket.emitWithAck.firstCall.args[1];
	expect(payload.logs[0]).to.have.property('timestamp');
	expect(payload.logs[0].timestamp).to.match(/^\d{4}-\d{2}-\d{2}T/); // ISO format
});

Also applies to: 24-24, 71-71, 135-135

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6159f0 and 0f6fda3.

📒 Files selected for processing (2)
  • src/lib/api-logs-transport.ts (1 hunks)
  • test/unit/lib/api-logs-transport.test.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{vue,ts,js}

⚙️ CodeRabbit configuration file

We use Nuxt with auto imports enabled. Don't warn about missing imports.

Files:

  • src/lib/api-logs-transport.ts
  • test/unit/lib/api-logs-transport.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Test docker / Publish Docker image
  • GitHub Check: Test code / Run tests (22.x)
  • GitHub Check: Test code / Run tests (20.x)
  • GitHub Check: Test code / Run e2e tests (20.x)
  • GitHub Check: Test code / Run tests (20.x)
  • GitHub Check: Test code / Run tests (18.x)
  • GitHub Check: Test code / Run e2e tests (20.x)
  • GitHub Check: Test docker / Publish Docker image

@MartinKolarik MartinKolarik merged commit 09c79cd into master Oct 28, 2025
13 checks passed
@MartinKolarik MartinKolarik deleted the log-timestamp branch October 28, 2025 12:08
@github-actions
Copy link

🎉 This PR is included in version 0.41.3 🎉

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