Skip to content

refactor: architecture cleanup — OCP-compliant CSS, data-driven nav, test suite#85

Merged
ronaldtse merged 1 commit into
mainfrom
refactor/architecture-cleanup
Jun 5, 2026
Merged

refactor: architecture cleanup — OCP-compliant CSS, data-driven nav, test suite#85
ronaldtse merged 1 commit into
mainfrom
refactor/architecture-cleanup

Conversation

@ronaldtse
Copy link
Copy Markdown
Contributor

Summary

Architecture cleanup implementing all 8 recommendations from the code quality audit.

Changes

OCP-compliant CSS (~90 selectors → 6 generic rules)

  • Replaced per-type/per-stage CSS selectors with inline CSS custom properties (--stage-color, --doctype-color, --badge-color, --cat-color)
  • Templates set variables via Liquid; CSS consumes them generically
  • Adding a new stage or doctype = adding a CSS variable, zero CSS rule changes

Data-driven navigation

  • Extracted _data/navigation.yml as single source of truth for categories and draft stages
  • Header, footer, and home page all iterate from this data
  • Drafts page uses stage_filter_name: draft_stages instead of hardcoded stage list

JSON Schema for data contract

  • Added _data/schemas/documents.schema.json defining the expected shape of aggregated document data
  • Rake task rake validate_schema validates _data/documents.json against the schema

RSpec test suite (26 examples)

  • config_spec — Jekyll config structure, excludes, keep_files
  • rake_spec — all Rake tasks defined
  • schema_spec — document data satisfies JSON Schema, field assertions
  • data_integrity_spec — navigation ↔ data consistency, document ID uniqueness
  • template_spec — no references to archived layouts/includes, data-driven nav wired correctly

Cleanup

  • Archived unused layouts (toc.html, toc-type.html, document.html) and includes (toc-*, disqus_comments, feedback, script, find-doc) to _archive/
  • Removed dead documents collection from _config.yml
  • Updated .gitignore to exclude entire public/ directory
  • Removed stale public/assets/relaton.css

Verification

  • Full rake build succeeds (aggregate → Vite → Jekyll)
  • All 5 listing pages render with correct document counts
  • Home page renders data-driven category cards
  • CSS variables correctly applied on all document cards
  • 26 RSpec examples pass

…test suite

Architectural changes:
- CSS: Replace ~90 per-type/per-stage selectors with 6 generic variable-driven
  rules (--stage-color, --doctype-color, --badge-color, --cat-color) for
  Open/Closed Principle compliance
- Navigation: Extract _data/navigation.yml as single source of truth for
  categories and draft stages; header, footer, and home page all consume it
- Config: Remove dead 'documents' collection, add proper excludes for
  _archive/, spec/, _data/schemas/
- Layouts: doc-type layout supports stage_filter_name for data-driven filtering

Quality assurance:
- Add JSON Schema (documents.schema.json) for aggregated document data contract
- Add RSpec suite: 26 examples covering config, rake tasks, schema validation,
  data integrity, and template references
- Add json_schemer gem for schema validation, rspec for test framework

Cleanup:
- Archive unused layouts (toc.html, toc-type.html, document.html) and includes
  (toc-*, disqus_comments, feedback, script, find-doc)
- Remove generated relaton.css from public/
- Update .gitignore to exclude entire public/ directory
@ronaldtse ronaldtse merged commit 740ea92 into main Jun 5, 2026
2 checks passed
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.

1 participant