Skip to content

Improve content loading, TOML utilities, runtime setup, theme caching, and login throttle pruning#15

Open
remdui wants to merge 1 commit intomainfrom
codex/audit-repository-for-technical-debt
Open

Improve content loading, TOML utilities, runtime setup, theme caching, and login throttle pruning#15
remdui wants to merge 1 commit intomainfrom
codex/audit-repository-for-technical-debt

Conversation

@remdui
Copy link
Copy Markdown
Owner

@remdui remdui commented Mar 21, 2026

Motivation

  • Harden and simplify content loading and example scaffolding by centralizing TOML load/render helpers and adding strict validation support.
  • Prevent file-system traversal and stale/generated-file issues by validating entity IDs and pruning old login throttle records.
  • Ensure the runtime environment directories exist on startup and improve theme discovery caching by including static file signatures.

Description

  • Introduced mylonite.core.toml_utils with render_toml and load_toml_file and migrated TOML I/O to use these helpers across the codebase.
  • Added strict content-validation support to PortfolioContentLoader (strict_validation flag) plus ContentValidationError, changed validation to apply schema defaults for missing values, and surfaced validation errors via loader tracking.
  • Tightened content repository and scaffold behaviors by adding is_valid_entity_id checks and rejecting invalid/path-traversal object IDs, and switched scaffold code to use render_toml.
  • Added prune_stale_login_throttles and invoke it in throttle inspection and registration, and introduced PANEL_LOGIN_THROTTLE_RETENTION_SECONDS setting.
  • Introduced runtime path utilities (resolve_runtime_paths, RuntimePaths, ensure_runtime_directories) and ensure runtime dirs are created in manage.py and wsgi.py, and updated settings.py to use those paths and the new TOML loader.
  • Improved theme discovery signature in ThemeResolver to include per-file static signatures to avoid stale cache entries.
  • Updated view models, mapping and templates to expose an intro_markdown field and prefer owner.bio for hero bio when available.

Testing

  • Ran unit tests covering modified modules including tests/apps/panel/test_services.py, tests/apps/web/test_content.py, tests/apps/web/test_content_scaffold.py, tests/apps/web/test_architecture_extensions.py, tests/apps/web/test_view_models.py, and tests/mylonite/core/test_core_modules.py via pytest and all tests passed.

Codex Task

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.

1 participant