Add a Loom <-> Galaxy-flavored-markdown adapter for Pages sync#144
Open
dannon wants to merge 12 commits into
Open
Add a Loom <-> Galaxy-flavored-markdown adapter for Pages sync#144dannon wants to merge 12 commits into
dannon wants to merge 12 commits into
Conversation
adds loomToGalaxyMarkdownRich -- an async push variant that emits a visible \`\`\`galaxy invocation_outputs directive next to each hidden carrier, but only when the invocation id validates against the connected server. the validator is injected (InvocationValidator interface) so tests stay pure/offline. graceful degrade: invalid ids skip the directive and fall back to carrier-only, so a bad id never 400s the whole page push. round-trip identity holds: pull strips the three directive lines and restores the carrier exactly.
Switches both push content projections (create and update paths) from loomToGalaxyMarkdown to loomToGalaxyMarkdownRich so synced Galaxy pages get validated ```galaxy directive blocks instead of just the hidden carrier comment. Updates the import accordingly -- the non-rich variant is no longer needed here.
…g carrier syntax survives pull
… comments as visible text)
stripGalaxyDirectiveBlocks removed every ```galaxy fence on pull, so a directive a human wrote (or a co-author added on the Galaxy side) round-tripped to empty -- silent data loss, and the exact inverse of the carrier-in-prose case we already defend against. Loom always emits its directive immediately above the invocation's carrier with no blank line, so a ```galaxy block is ours iff a carrier line follows its close. Strip runs before carrier decoding so that check stays exact. Anything else is preserved verbatim. Added tests for a standalone authored fence surviving and for an authored fence sitting next to a real Loom directive.
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.
PR #114 wired up Loom <-> Galaxy Page sync (the
loom-galaxy-pagebinding block,the
/synccommand, and the push/pull/link tools) but deliberately left the pagecontent untransformed: push stripped the binding block and sent everything else
verbatim. So a synced page mirrored the notebook's raw markdown --
loom-invocationblocks showed up as inert YAML fences instead of native Galaxy embeds, and pull had
no defined way to reconstruct them. This adds the content adapter #114 left as a
follow-up.
What it does
notebook.mdstays canonical; the Galaxy page is a faithful, reconstructable projection.Push -- each
loom-invocationblock becomes:invocation_outputs(invocation_id=...)directive (inside agalaxyfenced block),so the page renders a real invocation embed.
Narrative (prose, plan sections, anchors, checkboxes, tables) passes through untouched.
Pull / resume -- restores the original
loom-invocationfences from the carriers(every field intact, including
notebook_anchor, so no network re-derive) and stripsthe directives, since Loom owns the projection and regenerates it on each push.
Two things the live server decided for us
entire page, so the directive is gated -- emitted only when the id validates,
otherwise just the carrier goes out (graceful degrade, never a 400).
survive storage but Galaxy's renderer escapes them to visible text. A CommonMark
reference definition (
[loom-invocation:v1]: #loom "<base64>") renders to nothing andis pure markdown, so the page stays clean while the carrier round-trips byte-for-byte.
Verification
happens to mention carrier syntax, the validated-vs-degraded rich push, and the wired
push path through
pushNotebookToGalaxy.carrier-only page, byte-identical reconstruction) and the rendered output --
invocation_outputsrenders the outputs table and the carriers are invisible,confirmed on single- and multi-invocation pages.
Full test suite green; root and Orbit typechecks clean.
Notes for review
chore: normalize ... to 2-spacecommits are pure prettier/eslint reformatting oftwo files that predated the formatter -- split out so the behavioral diffs stay
readable (the lint-staged hook reformats them on any touch anyway).
server (not a block's own
galaxy_server_url), and pull stays remote-wins (the losslessround-trip removes the silent-corruption risk). Symmetric reconcile, a Galaxy-canonical
mode, and richer directive coverage (datasets, workflows) are deferred.