Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/app-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: App Integration

# RouterOS /app integration (#245 Phase 2): boots a fresh disposable CHR per
# leg (x86 + arm64), runs the README's own /app/add block against it, and
# completes a real MCP session through the app's ui-url. All logic lives in
# scripts/app-integration.ts so local (`make app-integration`) and CI runs are
# identical — this file only adds runner setup.
#
# Dispatch-only: release gating is #246's job. Dispatch with the candidate
# image and its release version, e.g.:
#
# gh workflow run app-integration.yml \
# -f image=ghcr.io/tikoci/rosetta:sha-abc123 -f version=0.12.0
#
# A green run proves the HTTP port-redirect path only (use-https=no): it says
# nothing about certificate issuance or the reverse-proxy/SNI path. Each leg
# logs host arch, guest arch, the accelerator actually selected, and the
# container platform; a skipped leg is not a pass (fail-fast is off and there
# are no leg conditions).

on:
workflow_dispatch:
inputs:
image:
description: "Candidate image ref, e.g. ghcr.io/tikoci/rosetta:sha-abc123 or :v0.12.0"
required: true
ros_version:
description: "RouterOS version for both legs (one stable >= 7.22)"
required: false
default: "7.25"
version:
description: "Expected release version for provenance (e.g. 0.12.0); required for floating/sha tags"
required: false
default: ""

permissions:
contents: read

jobs:
leg:
name: App integration (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
# x86 CHR needs KVM: the Bun binary SIGILLs under TCG (Phase 1), and
# hosted x64 runners ship /dev/kvm. quickchr auto-selects it.
- arch: x86
runs-on: ubuntu-latest
timeout: 30
step-timeout: 20
# Hosted arm64 has no usable KVM (quickchr integration.yml: 12/12
# runs fell back), so this leg is same-arch TCG and gets the long
# budget. Same-arch TCG is much faster than the cross-arch TCG the
# Mac rehearsal used, but still the slow leg.
- arch: arm64
runs-on: ubuntu-24.04-arm
timeout: 60
step-timeout: 50
runs-on: ${{ matrix.runs-on }}
timeout-minutes: ${{ matrix.timeout }}
steps:
- uses: actions/checkout@v7

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- run: bun install --frozen-lockfile

- name: Install QEMU
run: |
set -eo pipefail
sudo apt-get update
sudo apt-get install -y qemu-system-x86 qemu-system-arm qemu-utils qemu-efi-aarch64

# The x86 leg needs KVM: the Bun binary SIGILLs under TCG (Phase 1), and
# hosted x64 runners ship /dev/kvm without runner write access — without
# this step quickchr falls back to TCG and the leg fails at the harness
# accel gate instead of running.
- name: Enable KVM (x86 leg)
if: matrix.arch == 'x86'
run: |
set -eo pipefail
ls -la /dev/kvm || { echo "::error::No /dev/kvm on this runner — the x86 leg needs nested KVM"; exit 1; }
sudo chmod 666 /dev/kvm
ls -la /dev/kvm

# Pinned to match QUICKCHR_PIN in scripts/app-integration.ts (the script
# asserts the pin; src/app-integration.test.ts asserts they agree).
- name: Install pinned quickchr
run: bun install -g @tikoci/quickchr@0.5.4

- name: Run integration leg
timeout-minutes: ${{ matrix.step-timeout }}
env:
APP_IMAGE: ${{ inputs.image }}
APP_ROS_VERSION: ${{ inputs.ros_version }}
APP_VERSION: ${{ inputs.version }}
run: |
set -eo pipefail
bun scripts/app-integration.ts --arch "${{ matrix.arch }}" \
--image "$APP_IMAGE" --ros-version "$APP_ROS_VERSION" \
--version "$APP_VERSION"

- name: Upload diagnostics bundle
if: always()
uses: actions/upload-artifact@v7
with:
name: app-integration-${{ matrix.arch }}
path: app-integration-*.json
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ coverage/lcov.info
# Experimental CLI-Reference extraction (experiments/cliref-*.ts) — regenerable
experiments/cliref.db
experiments/out/

# /app integration evidence bundles (scripts/app-integration.ts) — CI uploads as artifacts
app-integration-*.json
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ uses [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Fixed

- The README `/app` install steps now cover the storage-disk prerequisite (`/app/setup` or `/app/settings`, with sizing guidance): without a selected disk `/app/add` succeeds but the app sits idle with no error. The steps also note that the inline YAML's inner quotes must stay backslash-escaped. Phase 1 of #245.

## [0.12.0] — 2026-10-30

### Added
Expand Down
30 changes: 30 additions & 0 deletions MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,36 @@ docker run --rm -p 8080:8080 ghcr.io/tikoci/rosetta:latest

These are the same images used by the [MikroTik /app install](README.md#install-on-mikrotik-app). Tags: `latest`, version (e.g., `v0.2.1`), and `sha-<commit>`.

### Disk sizing for /app installs

The `/app` install needs its storage disk to have room to spare (see the README prerequisites). Measured on CHR (RouterOS 7.25, `v0.12.0` image):

- Extracted app footprint: ~1 GB on x86, ~600 MB on arm64.
- First start copies the ~415 MB database aside (the image layer is read-only, so the first write duplicates the file into writable storage). The disk needs that much free *beyond* the extracted size: with under ~250 MB free the container crash-loops (`attempt to write a readonly database` is the symptom — the underlying failure is out-of-space on that copy), while ~450 MB free was enough. A 4 GB app disk leaves comfortable headroom on both architectures.
- A swap file roughly matching RAM (~500 MB on a 512 MB CHR, ~1 GB on a 1 GB CHR) may also be created on the app disk automatically; allow for it.
- No LAN bridge is required: without one the app runs on an internal NAT network with automatic port redirects to the container's port 8080.
- With `use-https=no` the endpoint is plain HTTP through those redirects, not through the reverse proxy (which only serves `use-https=yes` apps).

### App integration runs (local + CI)

`scripts/app-integration.ts` (#245) proves the README install end to end: it boots a fresh disposable CHR, runs the README's own `/app/add` block (exactly two substitutions: `use-https=no` for CHR, the candidate image ref), and completes a real MCP session through the app's ui-url. The same script runs locally and in CI (`app-integration.yml`); the workflow only adds runner setup. Local prerequisites: QEMU with `qemu-img`, Bun, and exactly quickchr 0.5.4 (`bun install -g @tikoci/quickchr@0.5.4` — the script asserts the pin).

```sh
make app-integration ARCH=x86 IMAGE=ghcr.io/tikoci/rosetta:v0.12.0
make app-integration ARCH=arm64 IMAGE=ghcr.io/tikoci/rosetta:sha-abc123 VERSION=0.12.0
```

`ARCH` is `x86` or `arm64` (one leg per invocation); `ROS_VERSION` defaults to 7.25. `VERSION` is required for floating/sha tags (it is the provenance the smoke asserts) and defaults to the version parsed from a `vX.Y.Z` tag. Each run writes `app-integration-<machine>.json` (redacted evidence bundle: digests, timings, app/container state, smoke output) and removes its VM unless `--keep` is passed.

Dispatch CI from the Actions tab or:

```sh
gh workflow run app-integration.yml \
-f image=ghcr.io/tikoci/rosetta:sha-abc123 -f version=0.12.0
```

Both legs (x86 on `ubuntu-latest` with KVM, arm64 on `ubuntu-24.04-arm` with TCG) must run and pass; a skipped leg is not a pass. The workflow is dispatch-only — release gating is #246's job. A green run proves the HTTP port-redirect path only (see Disk sizing above): it says nothing about certificate issuance or the reverse-proxy path, which need a real router with `/ip/cloud`.

## MCP Resources

If your MCP client supports resources, rosetta exposes datasets and supplemental content:
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ VERSION ?=
extract-hardware-catalog search browse serve \
typecheck lint test preflight verify \
db-doctor db-sync \
install setup clean eval eval-update eval-self eval-self-update
install setup clean eval eval-update eval-self eval-self-update \
app-integration

# ── Development ──

Expand Down Expand Up @@ -87,6 +88,21 @@ extract-hardware-catalog:

# ── Quality ──

# RouterOS /app integration leg (#245): boots a fresh disposable CHR, runs the
# README's own /app/add block against it, and completes a real MCP session
# through the app's ui-url. Same script CI runs (app-integration.yml).
# Requires quickchr 0.5.4 and QEMU (see MANUAL "App integration runs").
# Example: make app-integration ARCH=arm64 IMAGE=ghcr.io/tikoci/rosetta:v0.12.0
ARCH ?= x86
IMAGE ?=
ROS_VERSION ?= 7.25
VERSION ?=
app-integration:
ifndef IMAGE
$(error IMAGE is required, e.g. make app-integration ARCH=x86 IMAGE=ghcr.io/tikoci/rosetta:v0.12.0)
endif
bun run scripts/app-integration.ts --arch $(ARCH) --image $(IMAGE) --ros-version $(ROS_VERSION) $(if $(VERSION),--version $(VERSION))

typecheck:
bun run typecheck

Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ After reboot:

See MikroTik's [Container documentation](https://manual.mikrotik.com/docs/containers/) for full prerequisites and troubleshooting.

### 2. Add the rosetta app
### 2. Give /app a storage disk

The `/app` system cannot install anything until a storage disk is selected: without one, `/app/add` succeeds but the app sits idle with no status and no error. Run MikroTik's setup wizard (WebFig: App → Setup, or `/app/setup` on the CLI) and pick a disk, or point `/app/settings` at an already-mounted disk directly:

```routeros
/app/settings/set disk=<disk-name>
```

Allow at least 2 GB of free space on that disk — the extracted app is up to ~1 GB, and RouterOS copies the ~415 MB database aside when the container first writes to it. No LAN bridge is required: without one the app runs on an internal NAT network with automatic port redirects. (On CHR, attach a second disk first — the system disk cannot be used for `/app` storage.)

### 3. Add the rosetta app

```routeros
/app/add use-https=yes disabled=no yaml="name: rosetta
Expand All @@ -74,9 +84,9 @@ services:
"
```

That's it. RouterOS downloads the container image, configures networking and firewall redirects, and starts the MCP server. The `auto-update: true` setting pulls the latest image on each boot.
The inner double quotes must stay backslash-escaped, as shown — an unescaped `"` ends the `yaml` string early and the command fails. With storage configured, that's it: RouterOS downloads the container image, configures networking and firewall redirects, and starts the MCP server. The `auto-update: true` setting pulls the latest image on each boot.

### 3. Get the MCP endpoint URL
### 4. Get the MCP endpoint URL

The URL to use with your AI assistant is shown as **UI URL** in WebFig (App → rosetta), or from the CLI:

Expand All @@ -86,7 +96,7 @@ The URL to use with your AI assistant is shown as **UI URL** in WebFig (App →

This URL includes the `/mcp` path and is ready to paste into any MCP client that supports HTTP transport. With `use-https=yes`, the URL uses HTTPS with a MikroTik-managed `*.routingthecloud.net` certificate.

### 4. Configure your AI assistant
### 5. Configure your AI assistant

Point any HTTP-capable MCP client at the URL from the previous step:

Expand Down
2 changes: 2 additions & 0 deletions VALIDATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Tasks in `tasks/` reference these IDs in their `validation:` frontmatter. When a
| V-bunx-upgrade | An explicitly shared `DB_PATH` holds a real `bunx`-installed DB seeded from the previously-published version on the same dist-tag auto-refreshes to the just-published version on an explicit-tag invocation (`@latest`/`@next`, no `--refresh`); a warm bare `bunx` serves its cache and is deliberately not gated (decision B, #226). `ROSETTA_OFFLINE=1` against that same stale DB degrades gracefully instead of crashing (#76/#23) | `bunx-upgrade-smoke` matrix (macOS/Linux/Windows) in `release-smoke.yml`; skipped (not failed) when no prior publish exists yet on that channel | blocking (when a previous version exists) | #226 |
| V-stdio-handshake | MCP stdio handshake completes against a real `@modelcontextprotocol/sdk` client; no stdout pollution | `bun test src/mcp-stdio-client.test.ts` in `.github/workflows/test.yml` | blocking | — |
| V-http-handshake | MCP HTTP handshake + multi-session lifecycle works end-to-end | `src/mcp-http.test.ts` | blocking | — |
| V-app-mcp-x86 | The README `/app` install works end to end on x86: a fresh CHR runs the README's own `/app/add` (HTTP leg) and serves a real MCP session (initialize → tools/list → provenance match → nonempty search) through its ui-url | `app-integration.yml` x86 leg (`scripts/app-integration.ts --arch x86`); unit + workflow-structure pins in `src/app-integration.test.ts` | non-blocking (manual dispatch) | #245 |
| V-app-mcp-arm64 | Same on arm64 CHR | `app-integration.yml` arm64 leg (`scripts/app-integration.ts --arch arm64`) | non-blocking (manual dispatch) | #245 |
| V-tui-mcp-parity | Every MCP tool reachable via a `.routeros_*` dot-command in `browse` | `src/browse-parity.test.ts` via `bun test` in `.github/workflows/test.yml` | blocking | — |
| V-cli-flag-uniformity | CLI flags documented in `MANUAL.md` match `bun src/mcp.ts --help` output | `src/cli-help.test.ts` via `bun test` in `.github/workflows/test.yml` | blocking | — |
| V-cli-once-json | `browse --once .<tool>` prints exactly one JSON document to stdout (diagnostics on stderr) and exits non-zero when the dot-command fails | `src/browse-once.test.ts` via `bun test` in `.github/workflows/test.yml` | blocking | — |
Expand Down
5 changes: 5 additions & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ easyops
ebusy
editsection
eexist
efi
EIRP
elif
elr
Expand Down Expand Up @@ -186,6 +187,7 @@ HPACD
HPD
hpn
htb
hvf
hwcat
hwmp
idx
Expand Down Expand Up @@ -213,6 +215,7 @@ joineui
kbd
kne
kpps
kvm
laravel
ldf
ldp
Expand Down Expand Up @@ -417,6 +420,7 @@ slugified
sma
smips
smsc
sni
snmp
snp
socksify
Expand Down Expand Up @@ -448,6 +452,7 @@ sxtsq
syntaxhighlighter
syscap
tabl
tcg
tek
thirdparty
tik
Expand Down
Loading
Loading