Skip to content

fix(plugin-security): a write's tenant options never reach past the caller's organization wall #111

fix(plugin-security): a write's tenant options never reach past the caller's organization wall

fix(plugin-security): a write's tenant options never reach past the caller's organization wall #111

# Upgrade-source gate — the v18 → v19 SOURCE upgrade, walked the way a real
# 18.x user walks it, against this checkout's packed tarballs, with no model key.
#
# Every upgrade-path defect found on the GA path passed its own unit tests and
# was caught only by a hand-run acceptance: the migration tool's tests use
# stacks written as literals, while a user's project is the template's
# `exportsOf(…)` wiring over barrels, with a database an 18.x install wrote.
# The two neighbouring gates cover other ground: `scaffold-e2e.yml` builds and
# boots a NEW scaffold, and `upgrade-harness-optin.yml` boots an 18.0 DATABASE
# on main; neither runs the source migration.
#
# The job and its assertions live in `packages/qa/upgrade-source/run.mjs`
# (header: what is walked, and how an assertion that waits on an open card is
# reported); the committed 18.6.0 project and the database the PUBLISHED 18.6.0
# CLI wrote for it sit beside it, with their provenance. The install step is
# scaffold-e2e.yml's: this checkout's publishable packages packed with
# `scripts/publish-smoke-pack.mjs`, and the project's `@objectstack/*` pins
# moved to that version and resolved through the project's own pnpm overrides.
#
# NOT a required check, and green: no assertion waits on an open card. A red
# reads UNEXPECTED unless its `waitsOn` card is open and the red is that card's
# own failure (run.mjs header). It joins the required set only by a later,
# deliberate edit of `scripts/check-required-contexts.mjs`.
#
# Every step below is part of an install/build/migrate/boot pipeline, not a
# named local verification script a dev pre-runs with `pnpm check:x` — there is
# no check family here to discover, deliberately (the scaffold-e2e.yml shape):
# dispatch-gates: no-check-families -- steps are an e2e pipeline, not named local checks
name: Upgrade Source Gate
on:
pull_request:
# Every input the walk runs through, by the step that reads it. A step's
# code missing here lets a PR change what the walk asserts without the walk
# running on it.
paths:
# `os migrate meta` (--write, --stored), `os migrate apply`, `os migrate
# protocol`, the source writer, and the schema migration they share.
- 'packages/cli/**/migrate*'
- 'packages/cli/**/migrate*/**'
- 'packages/cli/src/utils/authored-source-*'
- 'packages/cli/src/utils/schema-migrate.ts'
# `os validate` / `os build`, and the protocol-range check both run.
- 'packages/cli/src/commands/validate.ts'
- 'packages/cli/src/commands/build.ts'
- 'packages/cli/src/commands/compile.ts'
- 'packages/cli/src/utils/protocol-version-gap.ts'
# T2: the dry run's own-field-row list (`ownFieldRowNarrowing`).
- 'packages/cli/src/utils/own-field-row-narrowing.ts'
# The ADR-0087 conversion table (its entries, `conversions/entries/NN/*`)
# and the migration chain and registry that replay it.
- 'packages/spec/src/conversions/**'
- 'packages/spec/src/**/migrations/**'
# The stored-row conversion `--stored` and the boot apply to sys_metadata.
- 'packages/metadata-protocol/src/stored-migration.ts'
- 'packages/metadata-protocol/src/protocol-stored-*'
# B5 and B6: the runtime field axis the boot's reads and writes go through
# (the set's own field row against viewAllFields / Modify All).
- 'packages/plugins/plugin-security/src/permission-evaluator.ts'
- 'packages/plugins/plugin-security/src/field-masker.ts'
- 'packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts'
- 'packages/core/src/security/effective-object-permissions.ts'
# The template a user's project starts from.
- 'packages/cli/src/commands/init.ts'
- 'packages/create-objectstack/**'
# How the walk installs this checkout: the packer and the workspace setup.
- 'scripts/publish-smoke-pack.mjs'
- '.github/actions/setup-workspace/**'
# The gate itself.
- 'packages/qa/upgrade-source/**'
- '.github/workflows/upgrade-source-gate.yml'
schedule:
- cron: '41 4 * * *'
workflow_dispatch:
permissions:
contents: read
# A newer run for the same pull request supersedes this one; the schedule and
# dispatch runs share a group keyed on their own event and wait for each other
# (scaffold-e2e.yml's shape).
concurrency:
group: upgrade-source-gate-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.after || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
upgrade-source:
name: v18 → v19 source upgrade
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup workspace
uses: ./.github/actions/setup-workspace
- name: Setup turbo cache
uses: actions/cache@v6
with:
path: .turbo/cache
key: ${{ runner.os }}-turbo-${{ github.job }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-${{ github.job }}-
${{ runner.os }}-turbo-
# The runner's pure judgements, on fixtures, before anything is built.
- name: Self-test the runner
run: node packages/qa/upgrade-source/run.mjs --self-test
# The build set is read off the fixture's own package.json, never a hand
# list: each `@objectstack/*` dependency it declares, with turbo's
# `^build` bringing that package's workspace dependencies along.
- name: Build the framework the fixture depends on
run: |
FILTERS=$(node -p '
const pkg = require("./packages/qa/upgrade-source/fixture-18.6.0/package.json");
const names = [pkg.dependencies, pkg.devDependencies]
.flatMap((deps) => Object.keys(deps ?? {}))
.filter((name) => name.startsWith("@objectstack/"));
if (names.length === 0) throw new Error("the fixture declares no @objectstack/* dependency");
names.map((name) => "--filter=" + name).join(" ");
')
echo "turbo run build $FILTERS"
# shellcheck disable=SC2086 # FILTERS is a word list on purpose.
pnpm exec turbo run build $FILTERS
- name: Pack this checkout's publishable packages
run: node scripts/publish-smoke-pack.mjs "$RUNNER_TEMP/tarballs"
# Template wiring (migrate meta --write, re-run, range, validate, build),
# the 18.6.0 database (migrate apply, the protocol-19 switch, --stored),
# the boot and its reads, then the helper-built wiring. The summary lists
# every assertion, and names the card each red waits on.
# GITHUB_TOKEN reads (only) the state of each card an expected red waits
# on: a red is excused only while its card reads open.
- name: Walk the v18 → v19 upgrade
env:
GITHUB_TOKEN: ${{ github.token }}
run: node packages/qa/upgrade-source/run.mjs --tarballs "$RUNNER_TEMP/tarballs" --work "$RUNNER_TEMP/upgrade-source"
- name: Upload the walk's logs
if: always()
uses: actions/upload-artifact@v7
with:
name: upgrade-source-logs
path: |
${{ runner.temp }}/upgrade-source/logs
${{ runner.temp }}/upgrade-source/results.json
if-no-files-found: ignore
retention-days: 14