Fix Weekly Index: make LOG_* env vars optional#10
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a failure in the scheduled Weekly Index workflow by making logging-related env vars optional, and also improves how module docstrings are surfaced and rendered in the UI (plus adds some SEO/supporting docs/assets).
Changes:
- Make
LOG_FILENAME/LOG_FILEMODE/LOG_LEVELoptional indatabase/__main__.pyto prevent import-timeKeyErrorin cron workflows. - Join/parse module docstring “sections” server-side and render them as simple Markdown-ish blocks client-side.
- Add SEO/support files (sitemap, robots.txt) and documentation/gitignore updates.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
database/__main__.py |
Uses os.environ.get(...) defaults to avoid workflow crashes when LOG_* vars are unset. |
server.py |
Adds a Pydantic validator to normalize module docstrings (array/section handling) before returning them via the API. |
frontend/src/components/ModuleDocstring.tsx |
New component to render docstrings with headings/bullets and LaTeX support. |
frontend/src/app/browse/[...slug]/page.tsx |
Switches module docstring rendering to ModuleDocstring. |
frontend/src/app/sitemap.ts |
Adds sitemap generation with static + module-derived routes. |
frontend/public/robots.txt |
Adds robots.txt referencing the sitemap. |
README_DB.md |
Adds DB restore instructions. |
changelog/2026-04-15.md |
Adds a dated changelog entry. |
.gitignore |
Ignores DB exports, paper drafts, screenshots, and pnpm lockfile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+23
| function Paragraph({ text }: { text: string }) { | ||
| const lines = text.trim().split("\n"); | ||
| const first = lines[0]; | ||
|
|
||
| const h3 = first.match(/^### (.+)/); | ||
| if (h3) return <h3 className="font-semibold text-foreground/80 text-sm mt-3">{h3[1]}</h3>; | ||
|
|
||
| const h2 = first.match(/^## (.+)/); | ||
| if (h2) return <h2 className="font-semibold text-foreground/85 mt-3 first:mt-0">{h2[1]}</h2>; | ||
|
|
||
| const h1 = first.match(/^# (.+)/); | ||
| if (h1) return <h2 className="font-semibold text-foreground/90 mt-3 first:mt-0">{h1[1]}</h2>; | ||
|
|
||
| const isAllBullets = lines.every((l) => l.startsWith("- ")); | ||
| if (isAllBullets) { |
| @@ -0,0 +1,47 @@ | |||
| # Istruzioni per il ripristino del database | |||
|
|
|||
| Questo archivio contiene due componenti del database di LeanSearch: | |||
Comment on lines
+12
to
+13
| - PostgreSQL 18 | ||
| - Python 3.13+ con ChromaDB installato (tramite `uv sync`) |
Comment on lines
+34
to
+35
| Copia la cartella `chroma/` nella radice del progetto LeanSearch (accanto al file `.env`). | ||
| La variabile `CHROMA_PATH = "chroma"` nel file `.env` punta già a questa posizione, quindi non serve modificarla. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The scheduled Weekly Index workflow runs against `ref: main` and has been failing at the Create/update schema step:
```
File ".../database/main.py", line 11, in
filename=os.environ["LOG_FILENAME"] or None,
KeyError: 'LOG_FILENAME'
```
`database/main.py` read logging config via subscript access (`os.environ["LOG_FILENAME"]`), which raises `KeyError` when the var is unset. The workflow never defines `LOG_FILENAME` / `LOG_FILEMODE` / `LOG_LEVEL`, so the module crashed on import before `schema` ran. The fix exists on `add-agent-skill` but had not yet reached `main`, where the cron job runs.
What
After merge, re-trigger with `gh workflow run weekly-index.yml` to confirm green.