Skip to content

Fix Weekly Index: make LOG_* env vars optional#10

Merged
Gabrielebattimelli merged 3 commits into
mainfrom
add-agent-skill
Jun 2, 2026
Merged

Fix Weekly Index: make LOG_* env vars optional#10
Gabrielebattimelli merged 3 commits into
mainfrom
add-agent-skill

Conversation

@Gabrielebattimelli
Copy link
Copy Markdown
Member

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

  • Make `LOG_FILENAME`, `LOG_FILEMODE`, `LOG_LEVEL` optional with defaults (the actual fix — `os.environ.get(...)`).
  • Parse module docstring array and render as Markdown.
  • Add sitemap, robots.txt, changelog, DB setup docs; expand `.gitignore`.

After merge, re-trigger with `gh workflow run weekly-index.yml` to confirm green.

Copilot AI review requested due to automatic review settings June 2, 2026 07:29
@Gabrielebattimelli Gabrielebattimelli merged commit 8049295 into main Jun 2, 2026
2 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_LEVEL optional in database/__main__.py to prevent import-time KeyError in 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) {
Comment thread README_DB.md
@@ -0,0 +1,47 @@
# Istruzioni per il ripristino del database

Questo archivio contiene due componenti del database di LeanSearch:
Comment thread README_DB.md
Comment on lines +12 to +13
- PostgreSQL 18
- Python 3.13+ con ChromaDB installato (tramite `uv sync`)
Comment thread README_DB.md
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants