Skip to content

docs: add top-level ARCHITECTURE.md with mermaid diagrams - #855

Open
Tenny150 wants to merge 3 commits into
MettaChain:mainfrom
Tenny150:fix/784-architecture-md
Open

docs: add top-level ARCHITECTURE.md with mermaid diagrams#855
Tenny150 wants to merge 3 commits into
MettaChain:mainfrom
Tenny150:fix/784-architecture-md

Conversation

@Tenny150

Copy link
Copy Markdown
Contributor

Summary

Fixes #784

docs/ARCHITECTURE_INDEX.md existed but was not discoverable from the repo root. New contributors had no one-click path to understand the system architecture.

Changes

ARCHITECTURE.md (new — 366 lines)

Top-level architecture document with:

  1. System Overview — Mermaid graph showing all three layers (Core, Finance, Infrastructure) and their external actors (dApp, Admin, Oracle).
  2. Contract Map — Table of all 27 contracts with their crate name and primary responsibility.
  3. Component Interaction Diagrams (three sequence diagrams):
    • Property Purchase Flow (identity → factory → token → escrow)
    • Lending & Liquidation Flow (borrower → lending → oracle → admin)
    • Insurance Premium & Claims Flow (policyholder → insurance → risk pool)
  4. Cross-Contract Data Flow — graph of how propchain-traits, propchain-lib, oracle, bridge, and governance connect.
  5. Layer Breakdown — four-layer architecture diagram (user-facing → business logic → registry → data/infra → shared foundation).
  6. Key Design Principles — reentrancy protection, two-step admin rotation, saturating arithmetic, basis-point precision, formal verification, modular crates.
  7. Security Model — table of threats and mitigations.
  8. Further Reading — index linking all per-contract docs.

README.md

Added ARCHITECTURE.md as the first entry (marked START HERE) in the Architecture Documentation section, making it one click away from the repo root.

.github/workflows/smoke-ci.yml

Added a Python link-check step that verifies all relative links in ARCHITECTURE.md resolve to real files, catching broken references on every PR.

Acceptance Criteria (from issue)

  • Mermaid diagrams for system, contract, and data flow
  • Linked from README (first entry, marked START HERE)
  • Rendered in cargo doc workflow (pure Markdown, renders in GitHub)
  • CI lint catches broken links (Python link-check step in smoke-ci.yml)

…#784)

Author ARCHITECTURE.md at the repo root with four mermaid diagrams:
  1. System overview (all layers: clients, core, finance, infra)
  2. Contract map table (all 27 contracts with crate names)
  3. Three sequence diagrams:
     - Property purchase flow (identity → factory → token → escrow)
     - Lending & liquidation flow (borrower → lending → oracle → admin)
     - Insurance premium & claims flow (policyholder → insurance → pool)
  4. Cross-contract data flow (traits, lib, governance, oracle, bridge)
  5. Four-layer architecture diagram (user-facing → business → registry → infra)
  6. Security model summary table
  7. Further reading index linking all per-contract docs

Also:
- README.md: add ARCHITECTURE.md as first entry (START HERE) in the
  Architecture Documentation section, satisfying the one-click
  discoverability requirement from the issue.
- smoke-ci.yml: add a Python link-check step that verifies all relative
  links in ARCHITECTURE.md resolve to real files, catching broken
  references on every PR.

Closes MettaChain#784
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Tenny150 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Tenny150 added 2 commits July 28, 2026 21:15
ARCHITECTURE.md introduced links to DEVELOPMENT.md, CONTRIBUTING.md,
and docs/penalty_drift.md which did not exist, causing the CI
'Check Markdown Internal Links' step to fail with exit code 1.

Changes:
- Add CONTRIBUTING.md (contributing workflow, code style, PR guidelines)
- Add DEVELOPMENT.md (dev environment setup, toolchain, testing commands)
- Add docs/penalty_drift.md (resolution of insurance 5% vs 10% penalty drift)
- Add rustfmt.toml (format_macro_matchers=true for ink! macro formatting, MettaChain#783)
- Add rustdoc headers to three mod tests blocks in lending/src/lib.rs (MettaChain#785)
- Update lending/README.md with Test Module Layout section (MettaChain#785)

Fixes: CI 'Check Markdown Internal Links (ARCHITECTURE.md)' step
Closes MettaChain#784 MettaChain#785 MettaChain#783
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.

Author a top-level ARCHITECTURE.md with diagrams

1 participant