Skip to content

docs: ADR-0003 extension architecture#110

Open
mrbrandao wants to merge 2 commits into
LobsterTrap:mainfrom
mrbrandao:adr/extension-architecture
Open

docs: ADR-0003 extension architecture#110
mrbrandao wants to merge 2 commits into
LobsterTrap:mainfrom
mrbrandao:adr/extension-architecture

Conversation

@mrbrandao
Copy link
Copy Markdown
Collaborator

@mrbrandao mrbrandao commented Apr 29, 2026

Summary

  • Add ADR-0003 documenting the extension architecture decision: 5 kinds (target, repo, runtime, source, scan), YAML manifests, stdin/stdout protocol with gRPC as future option
  • Add paired design doc with kind taxonomy Mermaid diagram, discovery flow, manifest schema, and hello world examples (bash target, Python repo extension)

Related Issues

Part of the Lola Go migration and extension platform architecture initiative.

Test Plan

  • ADR follows the project template format
  • Design doc Mermaid diagrams render correctly
  • Hello world extension examples are self-contained and runnable

AI Disclosure

AI-assisted with Claude Code

Summary by CodeRabbit

  • Documentation
    • Formalized extension architecture with five extension kinds and a standardized extension manifest format.
    • Added a developer guide describing discovery, lifecycle, protocol, and management commands for extensions.
    • Included transport-agnostic protocol guidance and two end-to-end "Hello World" examples demonstrating external extension behavior.

Add Architecture Decision Record for the extension
system with 5 kinds (target, repo, runtime, source,
scan), YAML manifests, and language-agnostic protocol.

Design doc includes kind taxonomy diagram, discovery
flow, manifest schema, and hello world examples.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
@mrbrandao mrbrandao added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0a181361-0aa3-42a2-9a5d-d7dd95296ae5

📥 Commits

Reviewing files that changed from the base of the PR and between 6469d92 and bcc5cec.

📒 Files selected for processing (1)
  • docs/dev-guide/design/extension-architecture.md
✅ Files skipped from review due to trivial changes (1)
  • docs/dev-guide/design/extension-architecture.md

📝 Walkthrough

Walkthrough

Adds formal documentation and a developer guide for a Lola extension system: defines five extension kinds, an extension.yaml manifest, built-in vs external extension models, an initial stdin/stdout transport-agnostic protocol, discovery/registration lifecycle, CLI management commands, and example Bash/Python extensions.

Changes

Cohort / File(s) Summary
ADR and design doc
docs/adr/0003-extension-architecture.md, docs/dev-guide/design/extension-architecture.md
New ADR and developer design guide defining the extension architecture: extension kinds (target, repo, runtime, source, scan), extension.yaml schema (name, kind, description, executable, version, author, license, etc.), built-in vs external extension patterns, discovery/registration lifecycle, stdin/stdout protocol (transport-agnostic), CLI commands (`lola ext add

Sequence Diagram(s)

sequenceDiagram
    participant CLI as Lola CLI
    participant Manager as Extension Manager
    participant Registry as Built-in Registry
    participant FS as Extensions Directory
    participant ExtProc as External Extension Process

    CLI->>Manager: start / ext command
    Manager->>Registry: load built-in factories
    Manager->>FS: scan for `extension.yaml` and `lola-ext-*` binaries
    FS-->>Manager: manifest files & binaries
    Manager->>ExtProc: spawn external extension (stdin/stdout)
    ExtProc-->>Manager: register via protocol (JSON messages)
    CLI->>Manager: invoke extension action (JSON request)
    Manager->>ExtProc: forward request
    ExtProc-->>Manager: JSON response
    Manager-->>CLI: return result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nibble specs by lantern light,

extensions sprout and take to flight,
Built-in burrows, external streams,
Lola hops through modular dreams,
Pipelines hum — a rabbit's delight! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding Architecture Decision Record 0003 that documents the extension architecture for the Lola project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (2)
docs/dev-guide/design/extension-architecture.md (2)

162-163: Add error handling for malformed JSON input.

The script parses stdin without handling potential JSON decode errors. While this is a "hello world" example, adding basic error handling would make it more robust and instructive.

♻️ Suggested enhancement
-request = json.loads(sys.stdin.read())
-action = request["action"]
+try:
+    request = json.loads(sys.stdin.read())
+    action = request["action"]
+except (json.JSONDecodeError, KeyError) as e:
+    print(json.dumps({"error": str(e)}), file=sys.stderr)
+    sys.exit(1)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/dev-guide/design/extension-architecture.md` around lines 162 - 163, The
code reads stdin and calls json.loads(sys.stdin.read()) then accesses
request["action"] without handling malformed input; update the block around
json.loads and the access to request["action"] (the request variable and action
lookup) to catch json.JSONDecodeError and KeyError (and optionally generic
Exception), emit a clear error to stderr (or process logger) and exit with a
non-zero status, and only proceed to use action when the JSON was parsed and the
"action" key exists.

93-94: Consider noting the jq dependency.

The script relies on jq for JSON parsing but doesn't document this dependency. For a "hello world" example meant to be runnable, noting this requirement would help users.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/dev-guide/design/extension-architecture.md` around lines 93 - 94, The
example uses jq in the line action=$(echo "$input" | jq -r '.action') but the
document doesn't mention jq as a prerequisite; update the text around the code
snippet to state that jq is required (or modify the example to check for jq at
runtime and print a friendly error if missing), and reference the two shell
lines (input=$(cat) and action=$(echo "$input" | jq -r '.action')) so readers
know exactly where the dependency is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/dev-guide/design/extension-architecture.md`:
- Around line 149-180: Add a brief setup note to the extension-architecture docs
that instructs users to make the example script my-catalog.py executable and to
ensure it contains the proper shebang (#!/usr/bin/env python3); specifically,
mention running chmod +x on the script and verifying the shebang line so the
script can be run directly as an executable.
- Around line 134-138: The fenced code block showing the directory structure
(the block starting with "~/.lola/extensions/my-catalog/") lacks a language
identifier; add "text" after the opening triple backticks so it becomes ```text
to improve rendering/tooling (update the fenced block that contains
extension.yaml and my-catalog.py).
- Around line 193-195: The fenced code block containing the protocol diagram
(the line starting with "Core → [write request to stdin] → Extension process →
[read response from stdout] → Core") lacks a language specifier; update the
opening fence from ``` to ```text so the block is rendered consistently (i.e.,
change the code fence for that protocol diagram to use the `text` language
identifier).
- Around line 71-75: Update the fenced code block showing the directory tree in
extension-architecture.md to include a language specifier (e.g., change the
opening ``` to ```text) so the block is rendered and highlighted correctly;
locate the block containing "~/.lola/extensions/hello-target/" and modify its
fence to use the "text" language identifier.
- Around line 170-176: The error branch in the resolve action prints an error
JSON but still exits with code 0; update the resolve handling (the branch where
action == "resolve" that looks up name in CATALOG and prints the error JSON) to
call sys.exit(1) after printing the error so the process returns a non-zero exit
code on failure; ensure sys is imported at the top if not already (reference the
resolve branch and the CATALOG/name lookup to locate the change).
- Around line 88-121: Add a brief "Setup" note immediately after the
hello-target.sh example that tells users to make the script executable before
running it; explicitly state they should set executable permissions on the
installed extension script (e.g., use chmod +x on the hello-target.sh /
installed extension file) so they don't hit "permission denied" errors when
invoking the script.

---

Nitpick comments:
In `@docs/dev-guide/design/extension-architecture.md`:
- Around line 162-163: The code reads stdin and calls
json.loads(sys.stdin.read()) then accesses request["action"] without handling
malformed input; update the block around json.loads and the access to
request["action"] (the request variable and action lookup) to catch
json.JSONDecodeError and KeyError (and optionally generic Exception), emit a
clear error to stderr (or process logger) and exit with a non-zero status, and
only proceed to use action when the JSON was parsed and the "action" key exists.
- Around line 93-94: The example uses jq in the line action=$(echo "$input" | jq
-r '.action') but the document doesn't mention jq as a prerequisite; update the
text around the code snippet to state that jq is required (or modify the example
to check for jq at runtime and print a friendly error if missing), and reference
the two shell lines (input=$(cat) and action=$(echo "$input" | jq -r '.action'))
so readers know exactly where the dependency is used.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 610836da-0f5c-4351-b75c-168e26d99fa5

📥 Commits

Reviewing files that changed from the base of the PR and between a343c6e and 6469d92.

📒 Files selected for processing (2)
  • docs/adr/0003-extension-architecture.md
  • docs/dev-guide/design/extension-architecture.md

Comment thread docs/dev-guide/design/extension-architecture.md Outdated
Comment thread docs/dev-guide/design/extension-architecture.md
Comment thread docs/dev-guide/design/extension-architecture.md Outdated
Comment thread docs/dev-guide/design/extension-architecture.md
Comment thread docs/dev-guide/design/extension-architecture.md
Comment thread docs/dev-guide/design/extension-architecture.md Outdated
- Add `text` language specifier to three bare fenced code blocks (MD040)
- Document `jq` prerequisite for bash target example
- Add `chmod +x` setup notes for both hello world examples
- Add try/except error handling for malformed JSON input in Python example
- Exit with code 1 when resolve action finds no matching module

Co-Authored-By: Claude <noreply@anthropic.com>
@mrbrandao
Copy link
Copy Markdown
Collaborator Author

@SecKatie @sergio-correia, this is also good to go, check out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant