Minimal web service for tracking model-based pull requests against Flexo/OpenMBEE MMS projects.
- Lists MMS projects and branches using the same basic selection flow already used in
sysmlv2viz - Stores pull requests and reviews in SQLite
- Tracks per-project pull requests with source and target branches, commit snapshots, status, and review history
- Supports review decisions:
COMMENTED,APPROVED, andCHANGES_REQUESTED - Generates source, target, and base commit URLs for LemonTree handoff
- Runs as a single Dockerized web service
- FastAPI backend
- Static HTML/CSS/JS frontend
- SQLite for PR metadata
python -m venv .venv
. .venv/Scripts/activate
pip install -r requirements.txt
uvicorn app.main:app --reloadOpen http://localhost:8080.
docker compose up --buildOpen http://localhost:8080.
Use unittest discovery:
python -m unittest discover -s testsThe repository currently has a single smoke-style test module, tests/test_smoke.py, which covers:
GET /api/health- Creating a pull request
- Adding one approval review and observing the resulting
APPROVEDstatus - Generating one source commit URL
python -m unittest by itself does not discover this suite in the current layout, so the discovery command above should be used in local development and CI.
Environment variables:
DATABASE_PATH: SQLite database location. Default/data/flexo-prs.dbDEFAULT_MMS_BASE_URL: Optional default MMS API base URL prefilled in the UIDEFAULT_BEARER_TOKEN: Optional default bearer token prefilled in the UILEMMONTREE_DIFF_URL_TEMPLATE: Optional 2-way LemonTree URL templateLEMMONTREE_MERGE_URL_TEMPLATE: Optional 3-way LemonTree URL template
Template placeholders:
{source},{target},{base}for raw commit URLs{sourceEncoded},{targetEncoded},{baseEncoded}for URL-encoded commit URLs
Example:
LEMMONTREE_DIFF_URL_TEMPLATE=https://lemmontree.example/diff?left={sourceEncoded}&right={targetEncoded}
LEMMONTREE_MERGE_URL_TEMPLATE=https://lemmontree.example/merge?base={baseEncoded}&source={sourceEncoded}&target={targetEncoded}
- The PR manager stores metadata only. It does not execute model diffs or merges itself.
- The
base_commit_idcurrently defaults to the target branch head at PR creation time so a 3-way tool can be handed a stable baseline snapshot.
The implemented functionality is broader than the current automated coverage. The highest-value missing tests are:
- API validation and error paths in
app/main.py: missing coverage for blankapiBase, identical source and target branches, unknown pull request IDs, and invalid status or review payloads rejected by FastAPI/Pydantic. - Pull request query behavior in
app/main.py: missing tests for project and status filtering, ordering byupdated_at, and the detail endpoint returning review history. - Review aggregation logic in
app/main.py: missing tests forsummarize_reviews()andcompute_pr_status()across mixed reviewer states, duplicate reviews from the same reviewer, comment-only reviews,CHANGES_REQUESTEDprecedence, and preservingCLOSEDorMERGED. - MMS client helpers in
app/mms.py: missing unit tests for bearer token normalization, HTTP error translation, empty JSON responses, project normalization, branch commit resolution from bothreferencedCommitandhead, branch sorting, and the 500-status fallback that readsdefaultBranchfrom the project record. - Database initialization in
app/db.py: missing tests thatinit_db()creates the parent directory, applies the schema successfully, and enables foreign-key behavior throughconnect(). - Settings and config exposure in
app/settings.pyand/api/config: missing tests that environment variables are trimmed and surfaced correctly to the frontend. - Static page routes in
app/main.py: missing tests for/and/pulls/newreturning the expected HTML files. - Frontend behavior in
app/static/index.htmlandapp/static/new-pr.html: there are no automated tests for project loading, branch selection, URL generation, LemonTree template interpolation, copy actions, status transitions, or pull-request creation flows.