Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>CodeLens | AI-Powered GitHub PR Reviews</title>
<meta name="author" content="Spraha Singh" />
<meta name="description" content="CodeLens is an AI-powered GitHub pull request review assistant that uses Retrieval-Augmented Generation (RAG) and historical review comments to generate context-aware, actionable code review feedback." />
<link rel="canonical" href="https://13-51-158-45.sslip.io/" />
<meta property="og:title" content="CodeLens | AI-Powered GitHub PR Reviews" />
Expand Down Expand Up @@ -573,6 +574,22 @@
color: var(--text-3);
font-family: var(--mono);
}
.footer-copy a {
color: inherit;
text-decoration: underline;
text-decoration-color: transparent;
text-underline-offset: 3px;
transition: color 0.15s, text-decoration-color 0.15s;
}
.footer-copy a:hover {
color: var(--text);
text-decoration-color: currentColor;
}
.footer-copy a:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 3px;
border-radius: 2px;
}
.footer-links {
display: flex;
gap: 20px;
Expand Down Expand Up @@ -851,7 +868,7 @@ <h2>Tested against real maintainers</h2>
<footer>
<div class="container">
<div class="footer-inner">
<span class="footer-copy">CodeLens · Built with Voyage AI, pgvector, Groq</span>
<span class="footer-copy">© 2026 CodeLens. Built by <a href="https://github.com/sprahasingh" target="_blank" rel="noopener noreferrer">Spraha Singh</a>.</span>
<ul class="footer-links">
<li><a href="https://github.com" target="_blank" rel="noopener">GitHub</a></li>
<li><a href="/health">Status</a></li>
Expand Down
51 changes: 50 additions & 1 deletion tests/test_social_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from html.parser import HTMLParser
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]


Expand Down Expand Up @@ -59,13 +58,37 @@ def handle_endtag(self, tag: str) -> None:
if tag == "head":
self.in_head = False


class FooterParser(HTMLParser):
def __init__(self) -> None:
super().__init__()
self.in_footer_copy = False
self.copy_text: list[str] = []
self.author_link: dict[str, str | None] | None = None

def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
attributes = dict(attrs)
if tag == "span" and "footer-copy" in (attributes.get("class") or "").split():
self.in_footer_copy = True
elif tag == "a" and self.in_footer_copy and attributes.get("href") == "https://github.com/sprahasingh":
self.author_link = attributes

def handle_data(self, data: str) -> None:
if self.in_footer_copy:
self.copy_text.append(data)

def handle_endtag(self, tag: str) -> None:
if tag == "span" and self.in_footer_copy:
self.in_footer_copy = False

def test_initial_html_has_fixed_social_metadata() -> None:
html = HTML_PATH.read_text(encoding="utf-8")
parser = HeadMetadataParser()
parser.feed(html)
metadata = parser.metadata

assert f"<title>{TITLE}</title>" in html
assert metadata[("name", "author")] == ["Spraha Singh"]
assert metadata[("name", "description")] == [DESCRIPTION]
assert metadata[("property", "og:title")] == [TITLE]
assert metadata[("property", "og:description")] == [DESCRIPTION]
Expand All @@ -83,6 +106,32 @@ def test_initial_html_has_fixed_social_metadata() -> None:
assert "similar past patterns matched" not in html.split("</head>", 1)[0]


def test_homepage_response_includes_metadata_and_footer_at_initial_load() -> None:
from fastapi.testclient import TestClient

from app.main import app

response = TestClient(app).get("/")
assert response.status_code == 200

metadata_parser = HeadMetadataParser()
metadata_parser.feed(response.text)
assert metadata_parser.metadata[("name", "author")] == ["Spraha Singh"]
assert metadata_parser.metadata[("property", "og:type")] == ["website"]
assert metadata_parser.metadata[("property", "og:title")] == [TITLE]
assert metadata_parser.metadata[("property", "og:description")] == [DESCRIPTION]
assert metadata_parser.metadata[("property", "og:image")] == [IMAGE_URL]
assert metadata_parser.canonical_urls == [PRODUCTION_URL]

footer_parser = FooterParser()
footer_parser.feed(response.text)
assert "".join(footer_parser.copy_text) == "© 2026 CodeLens. Built by Spraha Singh."
assert footer_parser.author_link is not None
assert footer_parser.author_link.get("target") == "_blank"
assert set((footer_parser.author_link.get("rel") or "").split()) == {"noopener", "noreferrer"}
assert "CodeLens · Built with Voyage AI, pgvector, Groq" not in response.text


def test_social_preview_is_a_1200_by_630_png() -> None:
image = IMAGE_PATH.read_bytes()
assert image.startswith(b"\x89PNG\r\n\x1a\n")
Expand Down
Loading