Skip to content

chore: implement audit quick wins and architectural doc updates#5506

Merged
MarkusNeusinger merged 2 commits intomainfrom
fix/audit-quick-wins
Apr 27, 2026
Merged

chore: implement audit quick wins and architectural doc updates#5506
MarkusNeusinger merged 2 commits intomainfrom
fix/audit-quick-wins

Conversation

@MarkusNeusinger
Copy link
Copy Markdown
Owner

This PR addresses several quick wins identified in the recent audit:

  • Fix legacy Python 2 except syntax in scripts and plots
  • Update Claude model name to valid Anthropic identifier
  • Sync architectural docs and agentic commands with modular router structure
  • Complete Web Vitals reporting (added FCP and TTFB)
  • Fix typo in agentic command filename (dokument.md -> document.md)
  • Use settings.claude_max_tokens in scripts to avoid hardcoded limits
  • Optimize model routing in plan.py (Phase 1 uses small model)

- Fix legacy Python 2 except syntax in scripts and plots
- Update Claude model name to valid Anthropic identifier
- Sync architectural docs and agentic commands with modular router structure
- Complete Web Vitals reporting (added FCP and TTFB)
- Fix typo in agentic command filename (dokument.md -> document.md)
- Use settings.claude_max_tokens in scripts to avoid hardcoded limits
- Optimize model routing in plan.py (Phase 1 uses small model)
Copilot AI review requested due to automatic review settings April 27, 2026 14:10
Copy link
Copy Markdown
Contributor

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 implements a set of audit-driven “quick wins” across scripts, agentic workflows/commands, frontend analytics, and documentation to align the repository with the current architecture and configuration patterns.

Changes:

  • Replace hardcoded Claude token limits and update the default Claude model identifier in configuration and scripts.
  • Fix legacy Python 2 except syntax and update agentic workflow/command docs (including adding document.md).
  • Expand Web Vitals reporting to include FCP and TTFB in Plausible events, and refresh architecture documentation.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/upgrade_specs_ai.py Uses settings.claude_max_tokens instead of a hardcoded max token count.
scripts/evaluate-plot.py Uses settings.claude_review_max_tokens for review token limits.
plots/stereonet-equal-area/implementations/python/highcharts.py Fixes Python 2-style except syntax to Python 3 tuple form.
docs/reference/repository.md Updates API structure documentation to reflect modular routers and related modules.
core/config.py Updates default claude_model to a valid Anthropic model identifier.
automation/scripts/sync_to_postgres.py Fixes Python 2-style except syntax to Python 3 tuple form.
app/src/analytics/reportWebVitals.ts Adds FCP and TTFB reporting to Plausible via web-vitals.
agentic/workflows/plan.py Routes Phase 1 classification through the “small” model tier.
agentic/workflows/document.py Points the document workflow at the corrected agentic/commands/document.md template.
agentic/commands/refactor.md Updates documented repo structure to match current core/ and modular API layout.
agentic/commands/feature.md Updates documented repo structure to match current core/ and modular API layout.
agentic/commands/chore.md Updates documented repo structure to match current core/ and modular API layout.
agentic/commands/bug.md Updates documented repo structure to match current core/ and modular API layout.
agentic/commands/document.md Adds a new document-generation command template.
agentic/audits/latest.md Replaces prior audit content with the latest audit snapshot.
agentic/audits/2026-04-27-all.md Adds a dated audit snapshot file for 2026-04-27.

Comment on lines +19 to +22
| 1 | SyntaxError: Python 2 style 'except' blocks | ruff | `automation/scripts/sync_to_postgres.py`, `plots/stereonet-equal-area/implementations/python/highcharts.py` | Change `except E1, E2:` to `except (E1, E2):` |
| 2 | Critical Versioning Risk: Python 3.14 | manual | `pyproject.toml`, Dockerfiles, `.github/workflows/*.yml` | Downgrade to stable Python 3.12 or 3.13 |
| 3 | Invalid Claude Model Name | manual | `core/config.py` | Change `claude-sonnet-4-6` to `claude-3-5-sonnet-20240620` |
| 4 | Stale Agentic Commands / Docs | manual | `agentic/commands/*.md`, `docs/reference/*.md` | Update structure references to modular routers |
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This audit snapshot is added in the same PR that implements several of the listed quick wins (Python-2 except syntax, invalid claude_model, dokument→document). As written, the report will be stale/inaccurate immediately after merge. Please regenerate the report post-fix, or annotate that these findings were addressed by this PR.

Copilot uses AI. Check for mistakes.
Comment on lines 16 to +58
@@ -43,6 +43,26 @@ export function reportWebVitals() {
},
});
});

onFCP((metric) => {
window.plausible?.('FCP', {
props: {
...getAnalyticsAmbientProps(),
value: String(Math.round(metric.value / 100) * 100),
rating: metric.rating,
},
});
});

onTTFB((metric) => {
window.plausible?.('TTFB', {
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

reportWebVitals() now destructures and calls onFCP/onTTFB, but the existing reportWebVitals.test.ts mock for web-vitals only provides onLCP/onCLS/onINP. This will cause tests (and any environment with a partial mock) to throw TypeError: onFCP is not a function. Update the web-vitals mock to include onFCP and onTTFB (or add a defensive check before calling them).

Copilot uses AI. Check for mistakes.
Comment thread agentic/audits/latest.md
Comment on lines +19 to +22
| 1 | SyntaxError: Python 2 style 'except' blocks | ruff | `automation/scripts/sync_to_postgres.py`, `plots/stereonet-equal-area/implementations/python/highcharts.py` | Change `except E1, E2:` to `except (E1, E2):` |
| 2 | Critical Versioning Risk: Python 3.14 | manual | `pyproject.toml`, Dockerfiles, `.github/workflows/*.yml` | Downgrade to stable Python 3.12 or 3.13 |
| 3 | Invalid Claude Model Name | manual | `core/config.py` | Change `claude-sonnet-4-6` to `claude-3-5-sonnet-20240620` |
| 4 | Stale Agentic Commands / Docs | manual | `agentic/commands/*.md`, `docs/reference/*.md` | Update structure references to modular routers |
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This audit report still lists issues that this PR appears to fix (e.g. Python-2 except syntax and invalid claude_model), so agentic/audits/latest.md will be inaccurate after merge. Consider regenerating the audit after applying the quick wins, or add a clear note that the report reflects the pre-fix state.

Copilot uses AI. Check for mistakes.
- Update web-vitals mock and tests to include FCP/TTFB
- Annotate audit reports with post-fix status note
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MarkusNeusinger MarkusNeusinger merged commit 065875a into main Apr 27, 2026
9 checks passed
@MarkusNeusinger MarkusNeusinger deleted the fix/audit-quick-wins branch April 27, 2026 14:21
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