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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m
`docs/RELEASE-PROCESS.md` §8.

## Unreleased
- fix(platform-link): **going live, the toolkit project IS the Team Server copy (#765)**: an app built with the toolkit went live through a separate Team Server working copy with no `.mxtk`, so every later change skipped the exec gate, snapshots and BUILD-LOG, and nothing said so. `skills/platform-link.md` §3 now states the rule and adds a six-step recovery for a copy that already split off (fetch it in, take its model whole, `mxcli fix hashes` + gate, adopt with `-X ours` and push without force, sync the metadata notes, retire the extra copy; the `mprname` trap, ContentsHash after a checkout, and the model-aware merge path needing mxcli ≥ 0.30); one-line pointers from the runbook's Stage 6 and `deploy-to-sandbox.md`. `bin/status.sh` WATCHes, local git only and exit code unchanged, at Stage 6+ when no remote URL names Team Server, and when a fetched Team Server ref is in no local branch ("Team Server has commits made outside the toolkit"). New `tests/wave2/test-status-teamserver.sh` — greenfield field run, 2026-11-13
- fix(marketplace-check, portability): **`bin/exec.sh` on a domain-model script no longer stops at the marketplace check on macOS `/bin/bash` 3.2 (#763)**: `_mkt_locate` ran `case "$m" in *"refusing to guess"*) ...` inside `$( ... )`, and bash 3.2 read the pattern's `)` as the end of the substitution (the #552 class, `bash -n` blind to it). The pattern now uses the POSIX leading paren `(pat)`; a sweep of `bin/`, `bin/lib/`, `project-bin/` and `claude-hooks/` found no other. New `bin/check-portability.sh` rule 3 (`bin/lib/case-in-subst.awk`, multi-line) flags a case pattern without a leading `(` inside `$( )`, so a third one cannot land; fixture `tests/wave2/test-case-in-subst.sh` — thanarat
- fix(intake,interview-protocol): **the intake preamble and `interview-protocol.md` now state the Stage P answer form for `Interview mode: auto`, `Assumed (auto-mode): <default> — rejected: <alt>`, colon right after the parenthesis (#766)**: the preamble listed only `Answered (CONFIRMED):` and `Unverified — how to verify:`, and the protocol said "recorded `ASSUMED` as above", pointing at the register shape the intake gate rejects, so an auto-mode kickoff learned the accepted form only from the FAIL message. Text only: the gate matcher and Q9 are unchanged, and existing intakes are not re-synced. Proof: `tests/wave2/test-stage-p.sh` T12 (fails on master's template) — field report from a greenfield auto-mode build, relayed by the maintainer
- process(poc-build): **POC test cadence cut to what finds bugs (#770)**: per page one LOOK at 1280 and one polish round (390 on the first page only); once at the end one journey with the happy path, one negative step per business rule and per must-have and one cross-user refusal per role, ending in a logout, run 2× (warm, then cold after one restart on the used DB) instead of 3 cold runs, then the broken control without a restart and one LOOK pass at 1280 + 390 over every page. "Done when" updated; status stays EXPERIMENTAL and says the new cadence is unmeasured. The open-session-count assertion after each run is a follow-up. — POC light-mode experiment (#729/#730), 2026-11
Expand Down
32 changes: 31 additions & 1 deletion bin/status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,42 @@ if git -C "$PROJECT_DIR" rev-parse --git-dir >/dev/null 2>&1; then
[ -n "$LINT_UNVERSIONED" ] && LINT_UNVERSIONED="lint debt is not versioned: git-ignored $LINT_UNVERSIONED — use '/.claude/*' plus '!/.claude/<file>' lines"
fi

# --- platform home: the toolkit project IS the Team Server copy (#765) ----------------------
# A greenfield app built with the toolkit went live through a SEPARATE Team Server working copy
# with no .mxtk; every later change skipped the exec gate, snapshots and BUILD-LOG, and nothing
# said so (field 2026-11-13). A copy without the toolkit cannot flag itself, so the watch runs
# here. Local git only — remote URLs and the refs the last fetch left; no network, ever. Two
# WATCH items, never a verdict: (1) Stage 6 or later with no remote whose URL names Team Server;
# (2) a fetched Team Server ref that no local branch contains (HEAD first; any local branch also
# counts, so the subtree route's ts-export branch is not a false alarm). Repos read: the project
# root, plus app/ when that is its own repository (two-tree layout). skills/platform-link.md §3.
TS_WATCH=""; _ts_remotes=0; _ts_ahead=""
for _gd in "$PROJECT_DIR" "$PROJECT_DIR/app"; do
[ "$_gd" = "$PROJECT_DIR/app" ] && [ ! -e "$_gd/.git" ] && continue
git -C "$_gd" rev-parse --git-dir >/dev/null 2>&1 || continue
for _r in $(git -C "$_gd" config --get-regexp '^remote\..*\.url$' 2>/dev/null \
| awk '{ u = tolower($2); if (u ~ /git\.api\.mendix\.com|teamserver/) { k = $1; sub(/^remote\./, "", k); sub(/\.url$/, "", k); print k } }'); do
_ts_remotes=$((_ts_remotes + 1))
for _ref in $(git -C "$_gd" for-each-ref --format='%(refname)' "refs/remotes/$_r/" 2>/dev/null); do
case "$_ref" in */HEAD) continue ;; esac
git -C "$_gd" merge-base --is-ancestor "$_ref" HEAD 2>/dev/null && continue
[ -n "$(git -C "$_gd" for-each-ref --contains "$_ref" --count=1 refs/heads 2>/dev/null)" ] && continue
_ts_ahead="${_ts_ahead:+$_ts_ahead, }${_ref#refs/remotes/}"
done
done
done
_cur="$(printf '%s\n' "$STAGE_LINE" | grep -oE 'Stage [0-9P]' | head -1 | sed 's/^Stage //')"
case "$_cur" in 6|7) [ "$_ts_remotes" -eq 0 ] && \
TS_WATCH="no Team Server remote at Stage $_cur: the toolkit project should BE the Team Server copy, never a second working copy (skills/platform-link.md §3)" ;;
esac
[ -n "$_ts_ahead" ] && TS_WATCH="${TS_WATCH:+$TS_WATCH · }Team Server has commits made outside the toolkit: $_ts_ahead (as of the last fetch) is in no local branch — recover per skills/platform-link.md §3"

# --- print ----------------------------------------------------------------------------------
TK="toolkit $TK_COMMIT_NOW"; [ -n "$TK_COMMIT_REG" ] && [ "$TK_COMMIT_REG" != "$TK_COMMIT_NOW" ] && TK="$TK (register says $TK_COMMIT_REG)"
[ -n "$TK_UPD" ] && TK="$TK · updates: $TK_UPD"
WATCH=""
for _w in "${APPROVED_OVER:+APPROVED OVER A FAILING GATE: $APPROVED_OVER}" "$DONE_STALL" "${BP_STALE%% (*}" \
"$( [ "${PH_TOTAL:-0}" -gt 0 ] && [ "$EAC" = 0 ] && echo "agent slots unfilled: $PH_TOTAL in $PH_FILES file(s)" )" "$PACK_GAP" "$LINT_UNVERSIONED"; do
"$( [ "${PH_TOTAL:-0}" -gt 0 ] && [ "$EAC" = 0 ] && echo "agent slots unfilled: $PH_TOTAL in $PH_FILES file(s)" )" "$PACK_GAP" "$LINT_UNVERSIONED" "$TS_WATCH"; do
[ -n "$_w" ] && WATCH="${WATCH:+$WATCH · }$_w"
done
if [ "$BRIEF" = 1 ]; then
Expand Down
2 changes: 2 additions & 0 deletions skills/conversion-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ cited as evidence.*
> owns what, which parts run standalone, and what a missing part must report (degrade loudly, never
> silently). Whether a result *means* anything is decided by the skills above, not by the scripts.

**Going live, every entry mode:** deploy from this project as the Team Server copy, never a second working copy (`platform-link.md` §3).

### Stage 7 — Cutover

Migration-specific — greenfield builds have no legacy system to cut over from and skip this stage. Runs **after** Stage 6, deliberately: don't migrate real production data and flip users onto an app that hasn't passed its E2E gate yet.
Expand Down
2 changes: 2 additions & 0 deletions skills/deploy-to-sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ prerequisite, never a substitute, and never a reason to skip.

## Step 1 — enumerate what the deployment does NOT have

**Deploy from the toolkit project itself** — it is the Team Server copy, never a second working copy without `.mxtk` (`skills/platform-link.md` §3, "Going live"; recovery recipe there if one already split off).

**Before building a package or deploying:** run `bin/demo-login-tiles.sh --remove`, then `bin/demo-login-tiles.sh --check --strict` must exit 0 (the tiles' password file is static content any host can fetch).

Before touching the harness, list what the target lacks relative to localhost. Do not guess it;
Expand Down
39 changes: 39 additions & 0 deletions skills/platform-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ identity for its first 144 commits; the owner's verdict on discovering that the
clone held none of the artefacts was "*let's do that from the start next time*". Do.
`bin/init-project.sh` scaffolds beside whatever `.mpr` it finds — point it at the root.

**Going live: the toolkit project IS the Team Server copy — never a second working copy.** To
deploy, add Team Server as a remote of the project you built in and push from there (adoption
below). Do not create a fresh Studio Pro or `git clone` checkout to deploy from: it has no
`.mxtk`, so every change made in it skips the exec gate, snapshots and BUILD-LOG, and nothing on
the toolkit side notices (field, 2026-11-13). `bin/status.sh` WATCHes at Stage 6+ when no remote
names Team Server, and when a fetched Team Server ref is in no local branch. A copy that has
already split off: **Recovering a split-off Team Server copy** at the end of this step.

**Everything from here to the end of this step is the retrofit path** for a project that
already grew up two-tree. **Team Server expects the Mendix project at the repository ROOT.** Verify by looking at the
template repo the platform just created: it holds `App.mpr`, `mprcontents/`, `theme/`,
Expand Down Expand Up @@ -414,6 +422,37 @@ force: the merge above costs one commit and destroys nothing.
is an ancestor of the next — but its output never contains the merge commits made on your side, so
a bare `git subtree push` is rejected as non-fast-forward. Re-merge each time.

**Recovering a split-off Team Server copy** (`status.sh`: *"Team Server has commits made outside
the toolkit"*). The Team Server copy moved on without the toolkit; make the toolkit project carry
its model and become the only copy again. Single-tree layout shown; two-tree, do it in `app/`.

1. **Fetch it in.** `git remote add teamserver <url>` if missing, `git fetch teamserver`, then
`git log --oneline HEAD..teamserver/main` — those are the outside commits.
2. **Take its model whole**, never file by file, on a side branch (`git checkout -b ts-recover`):
`git rm -rq mprcontents`, then
`git checkout teamserver/main -- App.mpr mprcontents javasource theme` (whatever model folders
it holds). Removing first is what drops units Team Server deleted; a checkout over the old
folder leaves them on disk, unregistered. **`mprname` trap:** keep Team Server's filename —
`mprcontents/mprname` must name the `.mpr` on disk (trap 6b); if the toolkit side used another
name, `git rm` that `.mpr` and update whatever derives from it, in the same commit.
3. **`mxcli fix hashes -p App.mpr`, then pass the gate.** A checkout rewrites `mprcontents/`
without the `.mpr`'s ContentsHash index; exit 1 means run it with `--repair`, then again to
exit 0. Then `mx check` 0 errors and the module count you expect. Commit (explicit paths).
4. **Adopt with `-X ours`, push without force:** `git merge -X ours --no-edit teamserver/main`
(add `--allow-unrelated-histories` if the copy began as a Portal blank app); `git diff --stat
HEAD^1 HEAD` must print nothing; `git merge-base --is-ancestor teamserver/main HEAD` must pass;
`git push teamserver ts-recover:main` with no `+` in `--dry-run`. Then merge `ts-recover` into
your main line.
**Both sides changed the model** since the split? Step 2 discards the toolkit side's model
changes: replay those scripts through `./bin/exec.sh` on top, or merge with the model-aware
`mxcli git merge teamserver/main` — **mxcli ≥ 0.30 only** (absent in v0.28/v0.29), per
`skills/parallel-builds.md` §4–5, never a plain `git merge` of the model.
5. **Sync the metadata notes:** `"$PY" bin/mx-metadata-note.py sync teamserver` (trap 6c), so
Studio Pro reads the right version and History lists the changes.
6. **Retire the extra copy.** Confirm with `git ls-remote teamserver main`, record the Team Server
remote in `PROJECT.md`, then delete the other checkout (or archive it read-only). Anyone who
needs Studio Pro opens this project.

### 4. Deploy

**It depends entirely on whether the app is a Free App**, and that is not a detail — it decides
Expand Down
98 changes: 98 additions & 0 deletions tests/wave2/test-status-teamserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/usr/bin/env bash
# test-status-teamserver.sh — bin/status.sh WATCHes when a project going live has no Team Server
# remote, or when Team Server holds commits the toolkit project does not (#765).
#
# Usage: bash tests/wave2/test-status-teamserver.sh bin/status.sh
#
# The defect: an app built with the toolkit went live through a SEPARATE Team Server working copy
# with no .mxtk, so every later change skipped the exec gate, snapshots and BUILD-LOG, and no
# toolkit screen said so (field 2026-11-13).
#
# T1 Stage 6, git repo, no remote -> WATCH "no Team Server remote at Stage 6"
# T2 Stage 5, no remote -> no Team Server WATCH (not going live yet)
# T3 Stage 6, teamserver remote, ref == HEAD -> no Team Server WATCH (the clean case)
# T4 Stage 6, fetched Team Server ref ahead of HEAD -> WATCH "commits made outside the toolkit"
# T5 the ref is contained in a local branch (subtree route's ts-export) -> no WATCH
# T6 two-tree: app/ is its own repo carrying the remote -> no "no remote" WATCH
# T7 exit code stays 0 with both WATCH items; the full screen carries them too
#
# GOLDEN INPUT: PROJECT.md is the real bin/init-project.sh scaffold; refs are real git objects in
# temp repos (a "fetch" is simulated with update-ref — no network). gate-check.sh is stubbed silent.
export MXTK_LEAKGUARD_DENYFILE="${TMPDIR:-/tmp}/mxtk-fixture-denylist.$$"
export MXTK_NO_GUIDE=1 MXTK_SYNC_SKIP_CLONE_CHECK=1
export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
set -uo pipefail
SUT="${1:?usage: test-status-teamserver.sh /path/to/bin/status.sh}"
case "$SUT" in /*) ;; *) SUT="$PWD/$SUT" ;; esac
SRC="$(cd "$(dirname "$SUT")/.." && pwd)"

W="$(mktemp -d "${TMPDIR:-/tmp}/statusts.XXXXXX")" || exit 2
trap 'rm -rf "$W"; rm -f "$MXTK_LEAKGUARD_DENYFILE"' EXIT
PASS=0; FAIL=0
ok() { PASS=$((PASS+1)); printf ' ok %s\n' "$1"; }
bad() { FAIL=$((FAIL+1)); printf ' FAIL %s\n' "$1"; [ -n "${2:-}" ] && printf '%s\n' "$2" | sed 's/^/ FAIL-detail: /'; }

mkdir -p "$W/tk"
(cd "$SRC" && tar --exclude=.git --exclude=node_modules -cf - .) | (cd "$W/tk" && tar -xf -)
cp "$SUT" "$W/tk/bin/status.sh"
printf '#!/usr/bin/env bash\nexit 0\n' > "$W/tk/bin/gate-check.sh"
TS_URL="https://git.api.mendix.com/00000000-0000-0000-0000-000000000000.git"

setstage() { # setstage <dir> <N>: replace the scaffold's **Stage ...** line under ## Current stage
MXTK_L="**Stage $2 — fixture**" awk '/^## Current stage/{f=1} f && /^\*\*Stage/ && !d {print ENVIRON["MXTK_L"]; d=1; next} {print}' \
"$1/PROJECT.md" > "$1/p.new" && mv "$1/p.new" "$1/PROJECT.md"
}
mkproj() { # mkproj <name> <stage>: scaffolded project, one commit
local d="$W/proj-$1"; mkdir -p "$d"; : > "$d/Fixture.mpr"
"$W/tk/bin/init-project.sh" "$d" >/dev/null 2>&1
setstage "$d" "$2"
git -C "$d" init -q; git -C "$d" add . >/dev/null 2>&1; git -C "$d" commit -qm base
echo "$d"
}
tswatch() { bash "$W/tk/bin/status.sh" "$1" --brief 2>&1 | grep '^WATCH' | grep -i 'team server'; }

echo "== bin/status.sh Team Server WATCH (#765) =="
grep -q '^\*\*Stage 6 — fixture' "$(mkproj probe 6)/PROJECT.md" && ok "setup: stage line rewritten" || bad "setup: no **Stage line in the scaffold"

P1="$(mkproj noremote6 6)"
w="$(tswatch "$P1")"
case "$w" in *"no Team Server remote at Stage 6"*"platform-link.md"*) ok "T1 Stage 6, no remote: WATCH points at platform-link" ;;
*) bad "T1 want the no-remote WATCH" "$(bash "$W/tk/bin/status.sh" "$P1" --brief 2>&1)" ;; esac

P2="$(mkproj noremote5 5)"
[ -z "$(tswatch "$P2")" ] && ok "T2 Stage 5, no remote: no Team Server WATCH" || bad "T2 Stage 5 must not WATCH" "$(tswatch "$P2")"

P3="$(mkproj clean 6)"
git -C "$P3" remote add teamserver "$TS_URL"
git -C "$P3" update-ref refs/remotes/teamserver/main HEAD
git -C "$P3" symbolic-ref refs/remotes/teamserver/HEAD refs/remotes/teamserver/main
[ -z "$(tswatch "$P3")" ] && ok "T3 remote present, ref == HEAD: no WATCH" || bad "T3 clean must not WATCH" "$(tswatch "$P3")"

P4="$(mkproj ahead 6)"
git -C "$P4" remote add origin "$TS_URL"
_tree="$(git -C "$P4" rev-parse 'HEAD^{tree}')"
_ext="$(printf 'outside\n' | git -C "$P4" commit-tree "$_tree" -p HEAD)" # a commit made in the other copy
git -C "$P4" update-ref refs/remotes/origin/main "$_ext" # what a fetch would leave
w="$(tswatch "$P4")"
case "$w" in *"Team Server has commits made outside the toolkit: origin/main"*) ok "T4 fetched ref ahead of HEAD: WATCH names origin/main" ;;
*) bad "T4 want the outside-commits WATCH" "$(bash "$W/tk/bin/status.sh" "$P4" --brief 2>&1)" ;; esac
case "$w" in *"no Team Server remote"*) bad "T4 a Team Server remote exists: no no-remote WATCH" "$w" ;; *) ok "T4 no no-remote WATCH beside it" ;; esac

git -C "$P4" branch ts-export "$_ext"
[ -z "$(tswatch "$P4")" ] && ok "T5 ref contained in a local branch: no WATCH" || bad "T5 subtree branch must silence it" "$(tswatch "$P4")"

P6="$(mkproj twotree 6)"
mkdir -p "$P6/app"; git -C "$P6/app" init -q; : > "$P6/app/App.mpr"
git -C "$P6/app" add App.mpr; git -C "$P6/app" commit -qm app
git -C "$P6/app" remote add teamserver "$TS_URL"
[ -z "$(tswatch "$P6")" ] && ok "T6 two-tree: remote on app/ counts" || bad "T6 app/ remote must count" "$(tswatch "$P6")"

P7="$(mkproj both 7)"
git -C "$P7" remote add teamserver "$TS_URL"
git -C "$P7" update-ref refs/remotes/teamserver/main "$(printf 'x\n' | git -C "$P7" commit-tree "$(git -C "$P7" rev-parse 'HEAD^{tree}')" -p HEAD)"
bash "$W/tk/bin/status.sh" "$P7" --brief >/dev/null 2>&1; rc=$?
[ "$rc" -eq 0 ] && ok "T7 exit 0 while warning" || bad "T7 exit code changed: $rc"
full="$(bash "$W/tk/bin/status.sh" "$P7" 2>&1)"
grep -q '^WATCH .*Team Server has commits made outside the toolkit' <<<"$full" && ok "T7 full screen carries the WATCH" || bad "T7 full screen lacks it" "$full"

echo "-- $PASS passed, $FAIL failed"; [ "$FAIL" -eq 0 ]
Loading