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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
- name: Shell tests
run: |
failed=0
for t in check-wasm-optimized justfile-hygiene doctor-kegs doctor-sdk codeowners licence audit-public publish-plugins; do
for t in check-wasm-optimized justfile-hygiene doctor-kegs doctor-sdk codeowners licence audit-public record-engine-build publish-plugins; do
echo "::group::$t"
./scripts/$t.test.sh || failed=1
echo "::endgroup::"
Expand Down
4 changes: 4 additions & 0 deletions Sources/VGraph/Domain/Attributes/Attribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ private func splitElements(_ body: String) -> [String] {
var escaped = false
for ch in body {
if escaped {
// Values stored before escaping existed may hold a bare `\`; only the
// two characters the encoder escapes lose theirs.
if ch != "\\" && ch != "," { current.append("\\") }
current.append(ch)
escaped = false
} else if ch == "\\" {
Expand All @@ -142,6 +145,7 @@ private func splitElements(_ body: String) -> [String] {
current.append(ch)
}
}
if escaped { current.append("\\") }
elements.append(current)
return elements.map { $0.trimmingCharacters(in: " \t\n\r") }.filter { !$0.isEmpty }
}
Expand Down
5 changes: 5 additions & 0 deletions Tests/VGraphTests/AttributeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ struct AttributeTests {
#expect(try Attributes.Node.wrappedText.value(fromString: stored.stringValue) == lines)
}

@Test("A backslash that escapes nothing is read as written, as values stored before escaping were")
func strayBackslashesSurvive() throws(VError) {
#expect(try [String].fromString("[C:\\temp,x\\]") == ["C:\\temp", "x\\"])
}

@Test("A problem message that contains a comma stays one message")
func messagesKeepTheirCommas() throws(VError) {
let problems = TypedAttributeDefinition<[MessageWithSeverity]>(
Expand Down
20 changes: 12 additions & 8 deletions VGraphWasm/Tests-Browser/obsidian/smoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,25 @@ test('the same blocks render in the dark theme, in dark colours', async () => {
// Obsidian 1.13+ indexes `settingItems` for its settings search and renders the
// tab from the same definitions; a tab that only implements display() has neither.
test('the settings tab is declared, so settings search can find it', async () => {
const tab = await page.evaluate(async () => {
const entries = ['Syntax guide', 'Notations gallery', 'Sponsor on GitHub'];
await page.evaluate(() => {
app.setting.open();
app.setting.openTabById('vithanco');
await new Promise((r) => setTimeout(r, 300));
});
const read = () => page.evaluate(() => {
const t = app.setting.pluginTabs.find((p) => p.id === 'vithanco');
const names = (items) => items.flatMap((i) => [i.name, ...names(i.items ?? [])]).filter(Boolean);
const result = {
return {
indexed: names(t?.settingItems ?? []),
rendered: [...t.containerEl.querySelectorAll('.setting-item-name')].map((e) => e.textContent),
rendered: [...(t?.containerEl.querySelectorAll('.setting-item-name') ?? [])].map((e) => e.textContent),
};
app.setting.close();
return result;
});
expect(tab.indexed).toEqual(expect.arrayContaining(['Syntax guide', 'Notations gallery', 'Sponsor on GitHub']));
expect(tab.rendered).toEqual(expect.arrayContaining(['Syntax guide', 'Notations gallery', 'Sponsor on GitHub']));
try {
await expect.poll(async () => (await read()).indexed).toEqual(expect.arrayContaining(entries));
await expect.poll(async () => (await read()).rendered).toEqual(expect.arrayContaining(entries));
} finally {
await page.evaluate(() => app.setting.close());
}
});

test('no uncaught errors in the window', async () => {
Expand Down
2 changes: 2 additions & 0 deletions build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ awk '
mv ../website/Package/platforms/browser.js.tmp ../website/Package/platforms/browser.js

cd ..
# This build replaced website/Package, so it also writes the record of its source.
"$SCRIPT_DIR/scripts/record-engine-build.sh" website/Package
echo "WASM build completed in $(( SECONDS - STEP_START ))s"

# Show final size
Expand Down

This file was deleted.

52 changes: 44 additions & 8 deletions docs/adr/0036-releases-stay-on-the-maintainers-machine.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# 36. Releases stay on the maintainer's machine

Date: 2026-11-08
Date: 2026-11-08 (revised 2026-11-12)

## Status

Accepted. Supersedes [0035](./0035-a-release-is-a-tag-started-from-the-maintainers-machine.md).
Accepted. Absorbs 0035, which had a VGraph tag start each plugin's build on
GitHub and was replaced before any release used it.

## Context

0035 had a VGraph tag start each plugin's build on GitHub and open a bump PR there.
That left the release half on GitHub and half local, and finishing it on GitHub
would have needed either publish credentials in public repositories or OIDC
trust granted to them. Neither is wanted.
The plugins live in their own repositories and do not rebuild when the engine
changes. GitHub offers no way for one repository's workflow to start another's
without a token that can write to the other repository, and VGraph keeps no such
secret in CI: it is public. Finishing a release on GitHub would also need either
publish credentials in public repositories or OIDC trust granted to them. Neither
is wanted.

## Decision

Expand All @@ -20,9 +23,25 @@ maintainer's own credentials: `just plugins-release`, `just release`, then
`just publish-all` or the `publish-*` recipes it runs. No repository holds a
publish or cross-repository credential.

`just plugins-release` builds the optimized engine itself before bumping, since
each plugin's `release.sh` copies `website/Package` in and a fresh checkout has
none. Every engine build records the commit it built from and the wasm's hash in
`website/Package/VGRAPH_BUILD` (`scripts/record-engine-build.sh`, run by
`build-wasm.sh`), because that folder is not tracked and each build replaces it.

The engine ships inside both plugins, so a release must say which source it came
from. `publish-plugins` names the recorded commit in both releases, and refuses
when it cannot fetch `origin/main`, when VGraph has uncommitted changes, when the
build was made from uncommitted changes or from a commit not on `origin/main`,
when the engine sources changed between that commit and HEAD, or when either
plugin's wasm is not the recorded one. A version-bump commit after the build is
expected and allowed.

GitHub only checks. VGraph's CI builds the optimized engine on every change, and
each plugin's CI builds against VGraph's `main`, so an engine change that breaks a
plugin shows before a release rather than during one.
each plugin's CI builds against VGraph's `main` from the ref it checks out
(`scripts/ci-engine.sh`, inside the container named by that ref's
`.swift-version`), so an engine change that breaks a plugin shows before a release
rather than during one, and a Swift bump in VGraph needs no change in the plugins.

## Consequences

Expand All @@ -31,3 +50,20 @@ through a PR like any other change, because `main` takes no direct pushes.

`publish-plugins` refuses a plugin checkout that is not on `main`: it tags and
pushes whatever is checked out.

The Obsidian plugin commits its copy of the engine, the wasm and its `vendor/Package`
glue, because Obsidian's directory builds that repository on its own.
`publish-plugins` commits both under the release tag so they cannot disagree.

An engine build costs minutes on each new VGraph ref in plugin CI, and is cached
by commit.

## Alternatives considered

- **A `v*` tag pushed by `just release-engine` starts each plugin's workflow**
through the maintainer's `gh` login; the workflow builds the engine from the
tag, builds the plugin and opens a bump PR (0035). Rejected because it left the
release half on GitHub and half local, and a tag pushed by hand started nothing.
- **Scheduled polling in each plugin for new VGraph tags.** Rejected because
GitHub disables schedules after 60 days without activity, which quiet plugin
repositories can reach.
65 changes: 58 additions & 7 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ test filter='': build
./scripts/doctor-kegs.test.sh
./scripts/doctor-sdk.test.sh
./scripts/embedded-unicode.test.sh
./scripts/record-engine-build.test.sh
./scripts/codeowners.test.sh
./scripts/licence.test.sh
./scripts/audit-public.test.sh
Expand Down Expand Up @@ -443,6 +444,10 @@ plugins-release bump='patch' plugin='':
patch|minor|major) ARG="--{{bump}}" ;;
*) ARG="{{bump}}" ;;
esac
# Each plugin's release.sh copies website/Package in, and fails on a fresh
# checkout without it; a stale or debug copy would ship instead.
./build-wasm.sh --release --skip-smoke
./scripts/check-wasm-optimized.sh website/Package/VGraphWasm.wasm
./release-plugins.sh "$ARG" {{plugin}}

# Internal: fail with a helpful hint if a plugin repo isn't cloned.
Expand Down Expand Up @@ -537,6 +542,50 @@ publish-plugins: _require-maintainer (_require-plugin "obsidian-vithanco") (_req
# this the recipe discovers problems halfway through — and since Obsidian is
# published first, a late failure leaves one plugin released and the other not.
FAIL=0
# Both plugins ship the engine, so a release must come from a VGraph commit
# that main holds, and say which one: the one build-wasm.sh recorded.
if [ -n "$(git status --porcelain)" ]; then
echo "Preflight: VGraph has uncommitted changes — the engine would ship from code no commit holds." >&2
FAIL=1
fi
if ! git fetch -q origin main 2>/dev/null; then
echo "Preflight: could not fetch VGraph's origin/main to check against." >&2
FAIL=1
elif ! git merge-base --is-ancestor HEAD origin/main 2>/dev/null; then
echo "Preflight: VGraph $(git rev-parse --short HEAD) is not on origin/main — push and merge it first." >&2
FAIL=1
fi
# What build-wasm.sh reads. A version-bump commit after the build is expected.
ENGINE_PATHS=(Sources Package.swift Package.resolved .swift-version build-wasm.sh
scripts/wasm-sdk.sh scripts/embedded-unicode.sh VGraphWasm/Package.swift
VGraphWasm/Package.resolved VGraphWasm/Sources VGraphWasm/VGraphEditor VGraphWasm/scripts)
BUILT=""
if [ ! -f website/Package/VGRAPH_BUILD ]; then
echo "Preflight: no record of which commit built website/Package — rebuild it ('just release' or 'just plugins-release')." >&2
FAIL=1
else
read -r BUILT BUILT_SUM < website/Package/VGRAPH_BUILD
if [ "$BUILT" = unknown ]; then
echo "Preflight: the engine was built from an unknown commit — git could not read the checkout. Rebuild it here." >&2
FAIL=1
elif [ "${BUILT%-dirty}" != "$BUILT" ]; then
echo "Preflight: the engine was built from uncommitted changes on ${BUILT:0:12} — commit, then run 'just plugins-release' again." >&2
FAIL=1
elif ! git merge-base --is-ancestor "$BUILT" origin/main 2>/dev/null; then
echo "Preflight: the engine was built from ${BUILT:0:12}, which is not on origin/main." >&2
FAIL=1
elif ! git diff --quiet "$BUILT" HEAD -- "${ENGINE_PATHS[@]}"; then
echo "Preflight: the engine sources changed since the build at ${BUILT:0:12} — run 'just plugins-release' again." >&2
FAIL=1
fi
for w in website/Package obsidian-vithanco vscode-vithanco; do
if [ "$(shasum -a 256 < "$w/VGraphWasm.wasm" | cut -d' ' -f1)" != "$BUILT_SUM" ]; then
echo "Preflight: $w/VGraphWasm.wasm is not the engine built at ${BUILT:0:12}." >&2
FAIL=1
fi
done
fi
ENGINE="VGraph ${BUILT:0:12}"
for spec in "obsidian-vithanco:main.js" "vscode-vithanco:vithanco-${OBS_V}.vsix"; do
DIR=${spec%%:*}; ASSET=${spec#*:}
BRANCH=$(git -C "$DIR" branch --show-current)
Expand All @@ -561,11 +610,11 @@ publish-plugins: _require-maintainer (_require-plugin "obsidian-vithanco") (_req
# just website/Package: that is what shipped as a 115 MB main.js in 1.0.9.
./scripts/check-wasm-optimized.sh website/Package/VGraphWasm.wasm \
obsidian-vithanco/VGraphWasm.wasm vscode-vithanco/VGraphWasm.wasm || FAIL=1
# main.js carries the engine as base64 (~4/3), so this also catches a bundle
# built before the engine was replaced.
# main.js carries the engine gzipped, so this also catches a bundle built
# before the engine was replaced. Obsidian Sync's Standard plan skips files over 5 MB.
MAIN_BYTES=$(wc -c < obsidian-vithanco/main.js)
if [ "$MAIN_BYTES" -gt 30000000 ]; then
echo "Preflight: obsidian-vithanco/main.js is $MAIN_BYTES bytes — built from a debug engine. Rebuild it." >&2
if [ "$MAIN_BYTES" -gt 5000000 ]; then
echo "Preflight: obsidian-vithanco/main.js is $MAIN_BYTES bytes, over 5 MB — a debug engine, or an old bundle. Rebuild it." >&2
FAIL=1
fi
if [ "$FAIL" -ne 0 ]; then
Expand All @@ -579,12 +628,14 @@ publish-plugins: _require-maintainer (_require-plugin "obsidian-vithanco") (_req
# Obsidian
( cd obsidian-vithanco
# main.js is gitignored in this repo — it ships as a GitHub release asset (below), not a commit.
git add manifest.json package.json versions.json styles.css VGraphWasm.wasm
# vendor/Package is the engine's glue for that wasm: Obsidian's directory
# builds this repo alone, and new wasm with old glue would not run.
git add manifest.json package.json versions.json styles.css VGraphWasm.wasm vendor/Package
# The bump may already be committed; then there is nothing to add.
git diff --cached --quiet || git commit -m "chore: release $OBS_V"
git tag "$OBS_V"
git push origin HEAD "$OBS_V"
gh release create "$OBS_V" --title "$OBS_V" --notes "Release $OBS_V" main.js manifest.json styles.css )
gh release create "$OBS_V" --title "$OBS_V" --notes "Release $OBS_V, engine $ENGINE" main.js manifest.json styles.css )
# VS Code
( cd vscode-vithanco
VSIX="vithanco-${VSC_V}.vsix"
Expand All @@ -596,7 +647,7 @@ publish-plugins: _require-maintainer (_require-plugin "obsidian-vithanco") (_req
git diff --cached --quiet || git commit -m "chore: release $VSC_V"
git tag "$VSC_V"
git push origin HEAD "$VSC_V"
gh release create "$VSC_V" --title "$VSC_V" --notes "Release $VSC_V" "$VSIX" )
gh release create "$VSC_V" --title "$VSC_V" --notes "Release $VSC_V, engine $ENGINE" "$VSIX" )
echo ""
echo "✓ Plugins pushed + tagged + GitHub releases created at v$OBS_V."
echo ""
Expand Down
Loading
Loading