Skip to content

Conversation

@gocanto
Copy link
Collaborator

@gocanto gocanto commented Oct 13, 2025

Summary

  • add detailed console logs when building SEO metadata for posts
  • expand diagnostics during SEO image preparation to ease troubleshooting

Testing

  • make format
  • go test ./... (hangs locally, aborted)

https://chatgpt.com/codex/tasks/task_e_68ecc5088a8883339b415ea0f86e6120

Summary by CodeRabbit

  • New Features
    • Added more detailed, human-readable logging during SEO post generation and image processing, including post slug/title, canonical path, sanitized alt text, safely truncated description previews, chosen image candidate, and outcomes of image preparation (dimensions, saved location, MIME type).
    • Improved error and fallback messages when cover images are missing or processing fails, making troubleshooting clearer without exposing sensitive details.

@gemini-code-assist
Copy link

Summary of Changes

Hello @gocanto, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the observability of the SEO metadata generation process for posts by introducing comprehensive debugging logs. The added logging covers both the general post metadata construction and the intricate steps involved in preparing and processing post cover images, aiming to streamline troubleshooting and provide clearer insights into potential issues.

Highlights

  • Enhanced Debugging Logs for SEO Post Generation: Detailed console logs have been added to provide more insight into the process of building SEO metadata for posts, including post slug, title, canonical path, and image details.
  • Expanded Diagnostics for SEO Image Preparation: The image preparation process now includes expanded diagnostic logs, making it easier to troubleshoot issues related to cover image fetching, resizing, and saving.
  • New truncateForLog Utility Function: A helper function truncateForLog was introduced to limit the length of log messages, ensuring cleaner and more readable output.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds verbose runtime logging to SEO post generation and image preparation, including safe log string truncation and detailed metadata/image processing traces. No changes to control flow or exported APIs.

Changes

Cohort / File(s) Summary
SEO generator logging
metal/cli/seo/generator.go
Introduces truncateForLog helper; logs post slug/title in GeneratePosts; adds detailed BuildForPost logs for metadata prep, description preview, preferred image candidate, and image preparation results/fallbacks.
Image processing logging
metal/cli/seo/pictures.go
Adds granular logs in preparePostImage for missing cover, start/end steps, SPA dir resolution, fetch bounds, resize dimensions, directory creation, save failures, relative path computation, and final path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

testing

Poem

I thump my paw—log lines in a row,
Tracing every pixel’s ebb and flow.
Slugs and titles, neatly shown,
Images resized, their journeys known.
With dots … to trim the chatter tight,
A rabbit ships the logs just right. 🐇✨

✨ 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 gus/add-debug-console-logs-for-seo-posts-2025-10-13

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53f023a and df05abf.

📒 Files selected for processing (2)
  • metal/cli/seo/generator.go (2 hunks)
  • metal/cli/seo/pictures.go (3 hunks)

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.

@gocanto gocanto merged commit c0963d7 into main Oct 13, 2025
3 of 4 checks passed
@gocanto gocanto deleted the gus/add-debug-console-logs-for-seo-posts-2025-10-13 branch October 13, 2025 09:31
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds detailed logging to the SEO post generation process to aid in debugging. The changes are mostly good and add valuable diagnostic information. I've pointed out a couple of areas for improvement: one is to make a new utility function more robust against potential panics, and the other is to remove redundant error logging to keep the logs clean and avoid noise. Overall, a good addition for improving observability.

Comment on lines +462 to +476
func truncateForLog(value string) string {
const maxRunes = 80

cleaned := strings.TrimSpace(value)
if cleaned == "" {
return "(empty)"
}

if utf8.RuneCountInString(cleaned) <= maxRunes {
return cleaned
}

runes := []rune(cleaned)
return string(runes[:maxRunes-3]) + "..."
}

Choose a reason for hiding this comment

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

medium

The truncateForLog function could panic if maxRunes is set to a value less than 3. While it's a constant set to 80 for now, it's good practice to make utility functions robust against such changes. I'd suggest adding a check to handle small values of maxRunes gracefully.

func truncateForLog(value string) string {
	const maxRunes = 80

	cleaned := strings.TrimSpace(value)
	if cleaned == "" {
		return "(empty)"
	}

	if utf8.RuneCountInString(cleaned) <= maxRunes {
		return cleaned
	}

	runes := []rune(cleaned)
	if maxRunes < 3 {
		return string(runes[:maxRunes])
	}
	return string(runes[:maxRunes-3]) + "..."
}


spaImagesDir, err := g.spaImagesDir()
if err != nil {
cli.Errorln(fmt.Sprintf("Could not determine SPA images directory: %v", err))

Choose a reason for hiding this comment

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

medium

This error log is redundant. The error is returned and logged by the caller in BuildForPost, which is the correct place to handle and log it. Logging in both places creates unnecessary noise. Please remove this line.

This applies to the other new error logs in this function on lines 65, 71, and 77 as well.

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