Skip to content

Release 0.8.19: Brainstorm community, the worker on edge.osc.earth, server config from Infisical - #627

Merged
neuromechanist merged 17 commits into
mainfrom
develop
Oct 27, 2026
Merged

neuromechanist merged 17 commits into
mainfrom
develop

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Promotes develop to main: the Brainstorm community and fixes to the shared forum, MATLAB and page tools; the production worker mounted on edge.osc.earth/osa; the server .env rendered from Infisical; and the account-independence work that prepares the move of OSA's Cloudflare resources to the SCCN account.
Six merged pull requests (#609, #612, #620, #622, #624, #626), plus CI-owned version bumps.

What reaches production

  • Brainstorm community (feat: add Brainstorm community; generalize Discourse, MATLAB and page tools #609): 108 wiki tutorials, the Brainstorm forum (daily), GitHub issues and MATLAB function help for brainstorm3, bst-users and bst-duneuro, and four reference papers.
    neuroimage.usc.edu is allowed in backend CORS and in the worker. The worker's generated list widens it to *.usc.edu, as scripts/sync_worker_cors.py already does for *.readthedocs.io and *.nwb.org; the backend's platform-origin check still requires the exact host.
  • Forum, MATLAB and page tools, for every community that uses them (feat: add Brainstorm community; generalize Discourse, MATLAB and page tools #609):
    • Discourse syncs are scheduled at all (they never ran before): Brainstorm daily at 05:15 UTC, BIDS (NeuroStars, tag bids, its first sync ever) daily at 05:45, MNE weekly on Monday at 05:30. They honor tags, read likes and categories, and fail instead of passing when they missed topics.
    • MATLAB help after the function line is indexed, and docstrings removed upstream are pruned.
    • HTML docs are parsed with lxml, and the widget's page reader returns the page's main content, not its scripts.
    • HED loses its NeuroStars forum (3 topics, never synced) and the search_hed_forum tool.
  • The production worker is mounted on edge.osc.earth/osa (Mount the OSA worker on edge.osc.earth #622): the browser-facing worker gets a host that follows the <role>.<domain>/<project> convention.
    widget.osc.earth/osa stays, because other sites embed it, and api.osc.earth/osa stays the backend for key-authenticated clients.
    The routes attach when this merges: sync-worker-cors.yml deploys the production worker on a push to main that touches workers/osa-worker/.
    The edge.osc.earth record exists, and the dev routes on it have served since Mount the OSA worker on edge.osc.earth #622 merged.
  • No Cloudflare account is pinned in code (Decouple OSA from the personal Cloudflare account #620): wrangler.toml has no account_id; deploys pass CLOUDFLARE_ACCOUNT_ID.
    The Pages CNAME targets read PAGES_DEMO_HOST, PAGES_NOTEBOOK_HOST and PAGES_DASH_HOST, defaulting to today's names, and the move checklist is in .context/deployment-checklist.md.
  • Dead osa-demo.pages.dev origins are gone (Drop dead osa-demo.pages.dev origin allowlist entries #626) from the backend CORS defaults, the platform origins, the worker, the CORS sync script and the notebook's frame-ancestors.
    The demo redirects any pages.dev visit to demo.osc.earth before it calls the API, so nothing real used them.
  • The server .env comes from Infisical (Render the server .env from Infisical before each deploy #624): deploy/sync-env.sh renders it (mode 0600) from project osc, prod /osa/server before a deploy script replaces a container, keeps the existing file when Infisical is unreachable, and the scripts refuse to replace a running container when there is no .env at all.
    This is already live on the server: its checkout tracks develop and runs these deploy scripts for both containers, which were redeployed through it with identical values.
  • CI (ci: cut CI waste in tests, deploys and timeouts #612): fewer duplicate runs, timeouts everywhere, one dev deploy per merge, and a five-minute per-test timeout (pytest-timeout). Required checks report under the same names.

Compatibility

  • No API or configuration schema change. The widget's code changes (Drop dead osa-demo.pages.dev origin allowlist entries #626 narrows its pages.dev redirect pattern) but behaves the same for embedding sites and keeps calling widget.osc.earth/osa; its SRI hash changes, hence the re-pin below.
  • A community config that sets sync.discourse now actually syncs on its schedule.
  • POST /sync/trigger with all now includes Discourse and can run for hours.

Review

One integration-scoped Sonnet review (the six feature PRs were reviewed individually). No code findings.

  • Description fixes, applied above: BIDS's first forum sync and the MNE schedule clash, the widget file changing, the *.usc.edu widening, and develop's green run being the bump-commit shim.
  • Verified: on the merge tree scripts/sync_worker_cors.py reports no changes, and the worker file is identical to what it generates. The merge push touches workers/osa-worker/, so sync-worker-cors.yml runs the production deploy even with no CORS diff. That is the only production worker deploy; a failed one is retried with "Re-run failed jobs".
  • Verified: no PAGES_*_HOST or LEGACY_WORKERS_DEV_HOST repository variables are set, so the defaults equal today's names and no CNAME changes. pytest-timeout is dev-only and not in the image.

Version

src/version.py carries the .devN suffix. ensure-stable-version.yml strips it on main; it is not hand-bumped.

Before merge

  • This PR's own checks are green (db4612f is a bump commit, so develop's runs on it were the skip shim)
  • The dev worker answers on edge.osc.earth/osa-dev, and its CORS preflight answers demo.osc.earth, develop-demo.osc.earth and nemar.org with themselves and osa-demo.pages.dev with the demo.osc.earth fallback
  • The server .env files render from Infisical and both containers are healthy

After merge

  • sync-worker-cors.yml deploys the production worker; edge.osc.earth/osa/health and widget.osc.earth/osa/health answer, and edge.osc.earth/osa-dev/ still reaches dev
  • ensure-stable-version.yml sets 0.8.19, tag-release.yml tags it, the release is published, and docker-build.yml moves latest
  • https://api.osc.earth/osa/health reports 0.8.19 after the hourly pull
  • A Brainstorm question answers in production; its first forum sync runs at 05:15 UTC (about 2 hours)
  • BIDS's first NeuroStars sync runs at 05:45 UTC and stores topics
  • MNE gets its one-time full forum resync: osa sync discourse -c mne --full (about 1.7 hours), started well away from its Monday 05:30 UTC schedule so two syncs never write the MNE database at once
  • widget-route-health.yml reports edge.osc.earth/osa/health healthy (a run that fires before the worker deploy finishes can fail once)
  • The widget on the sites that embed it is re-pinned to v0.8.19 with the SRI hash in the release notes
  • sync-develop.yml opens its PR into develop

github-actions Bot and others added 17 commits October 11, 2026 00:15
…p-after-v0.8.18

chore: sync develop with main after v0.8.18
… tools (#609)

* fix: convert HTML pages with unclosed paragraphs whole

Parse documentation pages with lxml instead of html.parser, which nested
everything after an unclosed <p> and lost most of a MoinMoin wiki page.
Recognize MoinMoin's div#content as the page body. Every existing MNE page
converts identically.

* fix: index MATLAB help that follows the function definition

The parser read only the comments before a function line (EEGLAB style) and
missed the help after it, MATLAB's own convention used by FieldTrip and
Brainstorm. Help stops at a license or copyright notice, %{ %} license blocks
and separator lines are not taken for help, and a classdef file's header is
its help.

* feat: generalize and schedule Discourse forum sync

- Honor the configured tags (alone or within categories); they were ignored,
  so a shared forum such as NeuroStars would have been synced whole.
- Read likes from actions_summary and category names from /site.json.
- On forums without accepted answers, fall back to the first substantive
  staff reply; the asker's own liked reply is the last resort.
- Run sync.discourse schedules and accept discourse in POST /sync/trigger,
  which now runs syncs off the event loop.
- Record the sync start as the last sync so long runs miss nothing.

* feat: add Brainstorm community

Tutorials from the Brainstorm wiki (108 pages, two preloaded), the user
forum, issues and MATLAB help from brainstorm3, bst-users and bst-duneuro,
and the four reference papers. Maintained by tmedani.


* fix: read the main content of the page the widget is embedded on

fetch_current_page kept the text of every script and read the whole page, so
on a Brainstorm tutorial the model saw analytics code instead of the
tutorial. Reuse the documentation fetcher's conversion.

* feat: schedule Discourse sync for BIDS and HED

Both had NeuroStars tags configured but no schedule, so their forums were
never synced. A test now fails when a forum has no sync.discourse schedule.

* chore: remove NeuroStars from HED

HED does not use NeuroStars as a source. Its forum config and schedule are
removed, and with them the search_hed_forum tool.

* fix: delete docstrings that are gone from the source

The docstring sync only inserted and updated, so removed or renamed
functions, deleted files, and text the parser no longer takes for help
stayed searchable. Prune each parsed file's stale symbols, and the files
missing from a complete repository listing.

* fix: fail a Discourse sync that could not read every listing

A listing page that failed (forum down, or a configured tag or category that
does not exist) ended quietly, moved the last-sync time past topics never
seen, and counted as a successful job. Such a sync now stores what it read,
keeps the last-sync time, and raises DiscourseSyncError, which the scheduler
tracks as a failure and the CLI reports. Database errors stop the sync, a
non-JSON answer is logged and skipped, and a listing may run to 1,000 pages.

* fix: correct example tool calls in five community prompts

retrieve_x_docs takes only a url and search_x_discussions has no status
filter, so the EEGLAB, FieldTrip, MetaBCI, MNE and Brainstorm prompts taught
calls that fail. A test now checks every example call in every prompt
against the tool it names. Also clarifies Brainstorm config comments.

* test: cover docstring pruning end to end in the required CI suite

Moves the pruning tests out of tests/test_integration, which the required
check skips, and tests sync_repo_docstrings against GitHub served over
respx: removed files, truncated listings and failed downloads. Logs the
deletions and corrects parser comments.

* fix: report a page without readable text; sync worker CORS list

The widget page reader now reports a page with no text in its HTML instead
of returning an empty success. The worker CORS list is regenerated with
scripts/sync_worker_cors.py. Changelog and registry notes updated.


Co-authored-by: Claude <[email protected]>
* ci: merge the two Tests workflows into one

tests.yml and test.yml were both named "Tests" and both ran Lint, the
Python suite, Frontend Tests (including the live-nemar Chrome checks)
on every pull request into and push to main. tests.yml now carries the
union: workflow_dispatch with the model input, ruff check over the
whole repository, Python 3.13 on main-bound runs, the Integration Tests
job, the Codecov token, and a pytest selection that equals the union
of the two old ones (checked by collecting both: 5,310 node ids).

The required check names Lint, Test (3.11) and Test (3.12) are
unchanged. test.yml's skip for the strip-dev-suffix commit is dropped:
it tested github.actor, which is the CI_ADMIN_TOKEN owner on that push,
so it never matched. tests/test_frontend_job_parity.py compared the
two copies of the frontend job and has nothing left to compare.

Tested: actionlint clean; uv run pytest tests/ -m "not network and
not llm" passes locally.

* ci: let documentation-only changes pass Tests

Documentation-only pull requests relied on the skip-ci marker in both
the branch commit and the title, so no workflow ran, the required Lint
and Test (3.12) never reported, and an admin had to merge them.

A new changes job classifies the pull request (its merge commit against
the base) or the push (against the previous head). When only
documentation changed, Lint and the Test legs still run and report
success under their exact names, skipping their steps except
test_embed_snippet_hygiene.py, which scans every tracked text file for
widget embed snippets. Frontend Tests, not required, skips at job
level. The required jobs skip at step level because a matrix job
skipped by a job-level if reports as "Test", not "Test (3.12)".
Anything the job cannot classify, or a failure of the job, runs
everything.

Tested: actionlint clean; the classify script run against 14 real and
synthetic pushes and merge commits gives the expected outputs.

* ci: stop re-running Tests on bot version commits

Every develop merge was followed by auto-bump-dev's "Bump version to"
commit, and every release by ensure-stable-version's strip commit; each
re-ran the whole Tests workflow (68 of 140 develop push runs in the
forensics window were bump commits) on code tested one commit earlier.

The changes job now marks a push of that commit alone, identified by
author and committer github-actions[bot], the message, and a push diff
of exactly src/version.py, so Lint and the Test legs report success
without running their steps. github.actor cannot identify these pushes:
it is the CI_ADMIN_TOKEN owner. Pull requests are never skipped, so
sync-develop's pull request, which ends in a bump commit, still runs.

Tested: actionlint clean; classify script cases for a lone bump, a lone
strip, a bump pushed with a code commit, a human version-only push and
a bump-headed pull request all give the expected outputs.

* ci: cancel superseded pull request runs

Tests, the Cloudflare preview deploys, the notebook site check, the
Worker CORS check and the preview DNS cleanup had no concurrency, so
every push to a pull request left the older runs going: release pull
request #562 collected 139 runs from its own synchronize events.

Each now groups pull request runs by workflow and pull request number
and cancels the older one. Push, schedule and dispatch runs get a group
of their own (the run id), so runs on develop and main are never
cancelled or queued. docker-build.yml already cancels its pull request
runs and keeps its own group. claude.yml is left alone: each review
comment there is a separate request, not a newer version of one.

Tested: actionlint reports no new findings on the six workflows.

* ci: give every workflow job a timeout

No job had timeout-minutes, apart from one Chrome step, so a hung job
ran to the 360-minute limit: nine Tests runs on 09-29 did (36528208246,
Test (3.11) stuck in "Run tests"), and 36802838547 and 36802842185 sat
for about 24 hours.

Each job now gets about twice its p95 duration over its recent
successful runs, rounded up, with a floor of 10 minutes. That is 10
everywhere except the Test legs, 21 (3.12 p95 10.2 min, 3.11 8.3), and
claude.yml's @claude job, 30: two successful runs are too few to
measure, and an agent session should not be cut off mid-change.

Tested: actionlint reports no new findings; every job in the 21
workflows parses with a timeout-minutes value.

* test: fail any single test after five minutes

The 09-29 hang was inside pytest: Test (3.11) of run 36528208246
printed tests/test_core/test_litellm_chat.py::TestTagsBecomeCitations::
test_a_streamed_reply PASSED at 06:05:33 and nothing more until the
6-hour cancel. The job timeout now bounds the job; this bounds the test,
so a hang fails that one test with its traceback and the run goes on.

pytest-timeout joins the dev dependency group (uv add --dev), with
timeout = 300 in [tool.pytest.ini_options]. The slowest passing tests,
tests/test_api/test_sync.py's trigger tests, take about 70 s on CI at
most (measured from six recent Test job logs) and 4 to 52 s locally.
uv 0.13.0, the version CI installs, writes the lockfile as revision 5.

Tested: uv run pytest tests/ -m "not network and not llm" passes
locally (5,295 passed, 14 skipped) with the timeout active.

* ci: deploy develop once per merge, after the bump

A develop merge built and pushed the dev image twice: once for the
merge commit, then, seconds later, for auto-bump's version commit, and
the development host (auto-update-dev.sh, every 15 minutes) could pull
either. After each release, TestPyPI also got two dev versions: the
sync merge's X.dev0, then the bump's X.dev1.

docker-build.yml and publish-testpypi.yml no longer run on a push to
develop. auto-bump-dev.yml gains a deploy job that runs after the bump
and dispatches both once: the image from the head of develop (the bump
commit), and TestPyPI for the bump commit's sha, so the image and the
package carry the version develop ends at. With no bump (skip-bump, no
.devN, a lost push race, a failed bump) it dispatches for the pushed
commit, so nothing that deployed before goes undeployed. It skips only
the bump commit's own push. publish-testpypi.yml takes a sha input and
publishes only from develop, as before.

The bump commit keeps no skip-ci marker: develop's head is a release
pull request's head commit, and GitHub skips a pull request's workflows
when its head commit carries the marker.

Tested: actionlint clean on both changed workflows (publish-testpypi.yml
keeps its 12 pre-existing shellcheck notes); tests/test_latest_tag_
policy.py passes.

* ci: build the PR image only when inputs change

docker-build.yml built and smoke-tested the image on every pull request
into develop or main, documentation and frontend-only ones included.
deploy/Dockerfile copies only src/, pyproject.toml, uv.lock and
README.md (the hed-lsp stage clones a pinned commit), so 30 of the 88
develop merges between 09-24 and 10-13 would have built an image
identical to the base.

The pull_request trigger now has a paths filter on those inputs, the
Dockerfile, .dockerignore and the workflow itself. That is safe at
trigger level because no job here is a required check. Push, tag,
release and dispatch builds are unchanged.

Tested: actionlint clean; tests/test_latest_tag_policy.py passes.

* ci: keep network tests out of docs-only runs

The docs-only path ran the whole embed hygiene file, which holds a network test that fetches jsDelivr. A jsDelivr outage would have failed every docs-only pull request. It now uses the same marker filter as the full run. Tested by running the file with the filter locally.

* ci: let the optional 3.13 leg fail alone

Test (3.13) is not a required check, but it shares a matrix with the required legs. With the default fail-fast, a 3.13-only failure cancelled Test (3.11) and Test (3.12) and blocked release pull requests. Set fail-fast to false. Tested by parsing the workflow and running actionlint.

* ci: count only listed Markdown as documentation

The classifier denied a list of code directories and let any other file under docs/, .context/ and .rules/ pass, so a future script there would skip lint. Allow only Markdown in those directories, root-level Markdown and LICENSE; any other path runs everything. Tested with 15 sample paths, including nested, renamed-type and new-directory cases.

* ci: dispatch both develop deploys before failing

Under bash -e a failed image dispatch skipped the TestPyPI dispatch. Try both and fail at the end. Also correct the comment: the build uses the head of develop when it is dispatched, not when it starts. Tested with actionlint; the dispatch itself cannot run before merge.

* ci: publish to TestPyPI only commits on develop

The ref check covered the dispatch ref but not the sha input, so a commit from another branch could publish. Require the sha to be identical to or behind develop, and say in the input description that a sha is needed to republish an older version. Tested the compare call on real commits: identical, behind and ahead.

* docs: use skip-bump for documentation merges

GitHub reads the skip-ci marker from a pull request's head commit, so a documentation merge that left it as the head of develop would make the next release pull request run no checks. Tell authors to put skip-bump in the title instead and state the cost.

* docs: fix stale test.yml and sha-tag references

test.yml was merged into tests.yml, and only the final commit of each develop merge now gets a sha image tag. Update the comments, the notebook README, the ADR sentence and the rollback instructions to match. Documentation and comments only.
Restate the two-round review cap and the fix-on-PR-branch rule. Documentation only.
* Mount the worker on edge.osc.earth/osa, dev at /osa-dev

Adds the edge.<domain>/<project> routes for both environments, keeping the
#500 route pair, and strips /osa-dev for the dev worker on the shared edge
host (mountPrefixFor). widget.osc.earth stays as an alias (#621).
test-routing.js: 158 passed; test-mounted-hosts.js: 33 passed and catches a
dev edge route mounted at the wrong prefix.

* Probe edge.osc.earth in the route health check; changelog

The schedule runs from main, so the probes go live with the release that
deploys the production edge routes (#621). YAML parses.

* Require the edge routes in both environments; health report

Review fixes (#621): test-mounted-hosts.js asserts edge.osc.earth is routed
in production and dev by name, so deleting the dev edge routes now fails
(verified: 2 failures; it passed before). The health job name and likely
causes cover the edge host. Tests: mounted-hosts 37, routing 158 passed.
* Take the worker's Cloudflare account from CLOUDFLARE_ACCOUNT_ID

Drop the hard-coded account_id from wrangler.toml and pass the org secret
to both worker deploy steps, so moving accounts is a secret change (#619).
Verified the secret is populated in CI (masked in the Pages deploy log).

* Read the Pages projects' pages.dev names from repository variables

PAGES_DEMO_HOST, PAGES_NOTEBOOK_HOST and PAGES_DASH_HOST default to today's
names; a project created in another account gets a suffixed name (#619).
YAML parses; behaviour unchanged while the variables are unset.

* Match suffixed pages.dev names when detecting the environment

The demo redirect, widget endpoint and dashboard API base accept
osa-demo-<suffix>.pages.dev / osa-dash-<suffix>.pages.dev and their branch
previews (#619). test-endpoint-resolution.js: 17 passed.

* Stop naming the account-scoped workers.dev host in tests and probes

test-routing.js uses a placeholder host; the health probe reads the legacy
host from LEGACY_WORKERS_DEV_HOST ("none" disables it once
nemarOrg/website#343 closes) (#619). test-routing.js: 147 passed.

* Changelog: no Cloudflare account named in the code (#619)

* List the per-account move steps; do not overclaim

Review fixes (#619): the account is no longer pinned in code, but the
RATE_LIMITER_KV ids, the worker secrets (Infisical osc /osa/edge), the
dashboard's CORS origin (CORS_ORIGINS, not a wider wildcard) and
LEGACY_WORKERS_DEV_HOST are per-account steps, now in the deployment
checklist. Tests: endpoint 17, routing 147, mounted-hosts 18 passed.

* Fill the notebook step's env in the workflow mapping test

The step now reads PAGES_NOTEBOOK_HOST from its env block, which the test
ran without under set -u. Resolve each vars.X || 'default' to its default,
as GitHub does with the variable unset, and check pages_target too.
Tested: tests/test_scripts/test_build_notebook_site.py, 58 passed.

Refs #619
* Render the server .env from Infisical before each deploy

deploy/sync-env.sh renders .env (0600) from Infisical (project osc,
prod /osa/server), keeping the existing file on any failure, with 60s
timeouts and key validation. The deploy scripts call it through bash
before replacing a container; deploy.sh and auto-update-dev.sh now check
for .env before stopping the running container instead of after.
Tested on the server in a scratch dir: same 22 values as the live file
minus the retired OpenRouter keys and two empty Langfuse keys; failure
paths keep the previous file.

Refs #623

* Document the Infisical-generated server .env

Refs #623

* Log keys a render drops; note rollback and lock behaviour

Refs #623
* fix: drop osa-demo.pages.dev from backend CORS and widget origins

frontend/index.html redirects every osa-demo.pages.dev visit to the
osc.earth custom domains before any script calls the API, and the
pages.dev name is account-scoped. Keep osa-dash.pages.dev for dashboard
PR previews. Tests assert the removed origins are refused.

Refs #625

* fix: drop osa-demo.pages.dev from the worker origin check

Also from the sync_worker_cors.py template that regenerates it, so a
sync does not restore it. The routing test now checks the preflight
refuses both names and still allows the demo hosts.

Refs #625

* fix: drop osa-demo.pages.dev from notebook frame-ancestors

Refs #625

* Update ADR 0012, the changelog and a context note for the dropped origins

Refs #625
@github-actions

Copy link
Copy Markdown
Contributor

Dashboard Preview

Name Link
Preview URL https://develop.osa-dash.pages.dev
Branch develop
Commit 4df2d94

This preview will be updated automatically when you push new commits.

@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://develop-demo.osc.earth
Branch develop
Commit 4df2d94

This preview will be updated automatically when you push new commits.

@neuromechanist
neuromechanist merged commit 5536634 into main Oct 27, 2026
29 checks passed

This branch was previously deployed

1 inactive deployment
testpypi — db4612f4 Deployed Oct 27, 2026 by github-actions[bot] via Publish to TestPyPI #173
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.

1 participant