Repository navigation
Organise the API into domain directories with explicit exports - #69
Merged
Merged
Conversation
This was referenced Nov 1, 2026
scripts/route_dump.py follows main.osl's router setup through the route functions and prints each route with its middleware chain, sorted, plus the method order per path, so a reorganisation can be diffed.
A pure git mv so history follows each file. Imports are fixed in the next commit.
main.osl now composes the app: it imports each src/<domain> directory, runs startup, builds the router and calls one register function per domain. Configuration moves to src/config, each global cache moves next to the code that uses it, and each domain's routes move to its own routes.osl in their original order, with the same paths, methods, middleware and limits. opal.json marks the project root so tests can import across directories. r2Client is declared as *s3.Client because an auto global loses its type in other files.
Each file now exports only the names that code in another directory, main.osl or a test elsewhere uses. Everything else is private to its directory, so main.osl can only reach a domain through that surface.
The README describes the src/<domain> layout and the check, test, build, route dump and smoke commands. The workflow installs OSL 3.0, type checks, runs the tests, compiles and runs the smoke test, which now fails on any server error.
…ke the README an overview CI now builds OSL from a fixed commit instead of whatever main is, so a compiler change can't turn it red or test against a different compiler than production. The smoke test seeds an agreement, so accepting it is exercised instead of returning 400, and it now unshares the project before deleting it, checking both the refusal and the delete. The README's reference material moved to the Backend section of the MistWarp docs.
scripts/check_conventions.py rejects code comments and em dashes in added lines of OSL and Python files, with a scanner that ignores // inside strings. It runs in CI on pull requests and as opal's conventions script. AGENTS.md covers the src/<domain> layout, the /v1 contract and the tools that guard it, the OSL 3.0 traps that changed behaviour in this migration, and the checks to run.
…opal.json git.rotur.dev answers 500 for archive downloads, so CI clones OSL and checks out the pinned commit instead. The conventions check uses Python's tokenize for Python files, so trailing comments are caught and # inside strings is not, and it scans Go files too. Like the JavaScript check, it compares comment text against removed lines, so editing a line with an existing comment does not flag it. opal.json keeps its original formatting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #68. Merge MistWarp/docs#18 alongside it: the README now links to the Backend section that PR adds.
The API was 140 files at the repo root sharing one namespace: 1,418 functions and 463 globals, each file imported into
main.oslin an order that mattered, and every route in one 600-line list. It's now organised by domain:export {...}block listing what other directories use: 491 of 1,605 top-level names. The rest are private.routes.osl(registerProjectRoutes(api)and so on), andmain.oslcalls them in the same order as before.git mvin a commit of its own, sogit log --followworks.Tooling
opal.jsonholds the usual commands..github/workflows/test.yml) type-checks, tests, compiles and runs the smoke test on every PR, with OSL pinned to a commit and built from a clone.scripts/route_dump.pyprints every route with its middleware.scripts/check_conventions.pyrejects code comments and em dashes in added lines. A linter written in OSL will replace it in a follow-up.Docs. The README is now an overview. Its 250 lines of reference material moved to the Backend section of the docs (MistWarp/docs#18).
AGENTS.mdtells coding agents the layout, the/v1contract, the OSL 3.0 traps and the checks.Behaviour is unchanged
osl testpasses 45/45.main(old compiler), Build on OSL 3.0 #68 and this branch.An independent review confirmed it's a pure move and checked the startup order, the deploy layout (compiling from the repo root,
build.sh,go.mod,native/, relativedata/paths) and CI. Its findings are addressed.There is no visible change.