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
4 changes: 2 additions & 2 deletions .githooks/identity-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ DENY_FILE="$(git config --get hooks.denyListPath 2>/dev/null || true)"
PATTERNS=$(grep -vE '^[[:space:]]*(#|$)' "$DENY_FILE" | paste -sd'|' -)
[ -n "$PATTERNS" ] || exit 0

# 0 when the identity text matches the denylist after the maintainer's allowed address is removed.
# 0 when the identity text matches the denylist.
matches() {
printf '%s\n' "$1" | tr '[:upper:]' '[:lower:]' | sed -E "s/$LEAK_ALLOW//g" | grep -qEi "$PATTERNS"
printf '%s\n' "$1" | tr '[:upper:]' '[:lower:]' | grep -qEi "$PATTERNS"
}

mode="${1:-}"
Expand Down
6 changes: 0 additions & 6 deletions .githooks/leak-patterns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,5 @@
# Generic, non-sensitive structural patterns (safe to commit):
LEAK_PATTERNS='/home/[A-Za-z0-9._-]+/|/Users/[A-Za-z0-9._-]+/|~/Development'

# Legitimate matches to ignore. The maintainer's email. Content scans drop it from added lines;
# identity-scan.sh strips it before matching the author/committer identity, so the maintainer's
# own commits pass a denylist that names the maintainer. (The npm manifests no longer carry it,
# since 1.3.0 — author "MetaObjects contributors" — so that was its original reason.)
LEAK_ALLOW='doug@dougmealing\.com'

# Diff filter: Added, Copied, Modified and Renamed (a `git mv` plus an edit is a rename).
LEAK_DIFF_FILTER='ACMR'
3 changes: 1 addition & 2 deletions .githooks/leak-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
# shellcheck source=leak-patterns.sh
. "$ROOT/.githooks/leak-patterns.sh"
PATTERNS="$LEAK_PATTERNS"
ALLOW="$LEAK_ALLOW"

DENY_FILE="$(git config --get hooks.denyListPath 2>/dev/null || true)"
[ -z "$DENY_FILE" ] && DENY_FILE="$ROOT/.githooks/deny-list.local"
Expand All @@ -39,7 +38,7 @@ fi
hits=$(printf '%s\n' "$DIFF" | awk '
/^\+\+\+ / { f=$2; sub(/^b\//,"",f); next }
/^\+/ && !/^\+\+\+/ { if (f !~ /^\.githooks\//) print f "\t" substr($0,2) }
' | grep -Ei "$PATTERNS" | grep -vEi "$ALLOW" || true)
' | grep -Ei "$PATTERNS" || true)

if [ -n "$hits" ]; then
echo "" >&2
Expand Down
3 changes: 1 addition & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
# shellcheck source=leak-patterns.sh
. "$ROOT/.githooks/leak-patterns.sh"
PATTERNS="$LEAK_PATTERNS"
ALLOW="$LEAK_ALLOW"

# Merge in private-name patterns from a denylist. Source priority:
# 1) git config hooks.denyListPath -> point at your private denylist file (kept in a private repo)
Expand All @@ -40,7 +39,7 @@ fi
hits=$(git diff --cached --diff-filter="$LEAK_DIFF_FILTER" -U0 --no-color 2>/dev/null | awk '
/^\+\+\+ / { f=$2; sub(/^b\//,"",f); next }
/^\+/ && !/^\+\+\+/ { if (f !~ /^\.githooks\//) print f "\t" substr($0,2) }
' | grep -Ei "$PATTERNS" | grep -vEi "$ALLOW")
' | grep -Ei "$PATTERNS" || true)

# The author/committer identity git would record must not match the denylist either.
if [ -x "$ROOT/.githooks/identity-scan.sh" ]; then
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/local-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ jobs:
fetch-depth: 0 # leak-scan diffs against origin/main
persist-credentials: false
- run: scripts/ci-local.sh --only gates --strict-toolchains
env:
# site-bijection lists the site repo through api.github.com; the token lifts it out of
# the anonymous rate limit.
GITHUB_TOKEN: ${{ github.token }}

# TS FAST lane — build+typecheck, conformance, completeness (the pure-code
# correctness signal). No docker/integration, so no sidecar.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ jobs:
- name: Gates
env:
MO_CI_LEAK_BASE: origin/${{ github.base_ref }}
# site-bijection lists the site repo through api.github.com; the token lifts it out of
# the anonymous rate limit.
GITHUB_TOKEN: ${{ github.token }}
run: scripts/ci-local.sh --only gates --strict-toolchains

ts:
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ git config core.hooksPath .githooks
git config hooks.denyListPath /path/to/your/private/denylist.txt
```

It blocks commits whose added lines match (`git commit --no-verify` bypasses, discouraged); the maintainer's email is the one allowed exception (it was the npm author field — no manifest has carried it since 1.3.0, whose author is "MetaObjects contributors"). Guard a new private name by editing that private denylist (single source of truth) — never add real names to this public repo or the committed hook.
It blocks commits whose added lines match (`git commit --no-verify` bypasses, discouraged). No address is exempt. Guard a new private name by editing that private denylist (single source of truth) — never add real names to this public repo or the committed hook.

**Pre-push typecheck gate** (`.githooks/pre-push`, same `core.hooksPath`): `bun test`
transpiles per-file and does NOT typecheck, so type-broken code can ship green on the
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ Each item below is described in full under Security, Added, Changed or Fixed; th
settings. It has no `verify`, so the rules gate does not run there.

Nothing is generated from the vocabulary yet: the enforcing service shells are later work
(ADR-0067), and `fixtures/codegen-noop/rules/` holds every generator to byte-identical output.
(ADR-0067: service generators an app chooses like any other, not a named set), and
`fixtures/codegen-noop/rules/` holds every generator to byte-identical output.
A model that declares none of it sees no change. See `docs/features/business-rules.md`.
ADR-0067 records the layering and service-seam design, and amends ADR-0045.
ADR-0067 records the layering and service-seam design (a layer is a generator an app chooses; the
actor is a type the app defines), and amends ADR-0045.
- **Rust port foundation, in preview (ADR-0065).** `server/rust/` is a Cargo workspace with a
pinned toolchain and one crate, `metaobjects`: the node model, the type registry and the
built-in providers (strict, sealed after bootstrap, the same `ERR_*` codes), and a JSON loader
Expand Down
8 changes: 5 additions & 3 deletions docs/features/business-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ The Rust preview port loads the vocabulary and runs the same loader rules; its `
codegen drift gate only, so the checks under "What `verify` reports" do not run there
([Rust port](../ports/rust.md)).
A requirement can claim an operation or a transition. Nothing is generated from the vocabulary
yet: the service shells that enforce these rules at run time are later work (ADR-0067). Until
they land, a model with this vocabulary generates byte-identical code to the same model
without it. The design is [ADR-0066](../../spec/decisions/ADR-0066-business-rules-operations-and-lifecycles.md).
yet: the service shells that enforce these rules at run time are later work (ADR-0067): service
generators an app adds to its generator list, as it adds any generator. A lifecycle in a project
that wires none will be advised by `verify` once that check lands; today the flat routes enforce
nothing and `verify` says nothing about it. Until the shells land, a model with this vocabulary
generates byte-identical code to the same model without it. The design is [ADR-0066](../../spec/decisions/ADR-0066-business-rules-operations-and-lifecycles.md).

**Experimental.** This vocabulary, its loader rules, its `verify` checks and its settings may
change in a MINOR, including removals and renames, until generated services run on it in an
Expand Down
4 changes: 2 additions & 2 deletions scripts/leak-scan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ describe("identity scan (author and committer vs the private denylist)", () => {
});
});

test("the maintainer's allowed address is not treated as a match", () => {
test("no address is exempt: an identity the denylist names is refused", () => {
const dir = identityFixture();
writeFileSync(join(tmp, "deny.txt"), "dougmealing\n");
const r = run(dir, ["staged"], {
GIT_AUTHOR_NAME: "Doug",
GIT_AUTHOR_EMAIL: "doug@dougmealing.com",
...good,
});
expect(r.status).toBe(0);
expect(r.status).toBe(1);
});
});
16 changes: 15 additions & 1 deletion scripts/site-bijection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ const OWNER = "metaobjectsdev";
const SITE_REPO = "metaobjectsdev.github.io";
const TIMEOUT = 20_000;

/**
* Headers for api.github.com. Unauthenticated calls share one 60-per-hour budget per source
* address, and a hosted runner's address is shared with other jobs, so the call answers 403
* (rate limit) at random. CI exports its token as GITHUB_TOKEN or GH_TOKEN, and sending it
* raises the budget. With neither set (a local run) the call stays anonymous. An unreachable
* tree still fails closed below.
*/
function githubHeaders(): Record<string, string> {
const headers: Record<string, string> = { accept: "application/vnd.github+json" };
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
if (token) headers.authorization = `Bearer ${token}`;
return headers;
}

/**
* Every `www/**\/*.html` on the live site's default branch.
*
Expand All @@ -31,7 +45,7 @@ const TIMEOUT = 20_000;
async function livePages(): Promise<string[]> {
const r = await fetch(
`https://api.github.com/repos/${OWNER}/${SITE_REPO}/git/trees/main?recursive=1`,
{ headers: { accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(TIMEOUT) });
{ headers: githubHeaders(), signal: AbortSignal.timeout(TIMEOUT) });
// Fail closed. An unreachable tree must never read as "no pages, therefore no orphans".
if (!r.ok) throw new Error(`could not list ${SITE_REPO} tree (HTTP ${r.status})`);
const body = (await r.json()) as { truncated?: boolean; tree?: { path?: string }[] };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ The gap survived because **no `@autoSet` scenario existed in `api-contract-confo

## Amendment 1 (2026-11-13): a generated service shell may hold the guarantee

ADR-0067 adds a `layered` generator set whose service layer enforces declared business rules
(ADR-0066). The transport of that set calls the service and holds no rules, so the decision
sentence above no longer describes it. It is replaced with:
ADR-0067 adds service generators, which an app chooses as it chooses any generator, and whose
service layer enforces declared business rules (ADR-0066). The transport of such a project calls
the service and holds no rules, so the decision sentence above no longer describes it. It is replaced with:

**The outermost generated write-path artifact an adopter deploys must guarantee every
metamodel-declared write semantic, either itself or by calling a generated service shell that
Expand All @@ -54,13 +54,13 @@ operation body is called by the shell, inside the guarantee, and is not such a s

The rest of the decision stands:

- The API surface stamps (item 1) in every set that has no service layer, which is the
`classic` set.
- The API surface stamps (item 1) in every project that wires no service generator, which is
today's flat generators.
- Persistence-layer stamping stays (item 2).
- Conformance gates the wire tier (item 3).

The first rejected alternative ("rewire the Kotlin controller to delegate to the generated
repository") was rejected because routing every controller through a lower layer "would churn
all generated output". The `layered` set does not do that. It is opt-in per package, and a
project that does not choose it keeps today's output byte for byte. So the objection does not
apply to it. It still applies to rewiring the `classic` set, which this amendment does not do.
all generated output". The service generators do not do that. They are separate generators an app adds, and a
project that does not add them keeps today's output byte for byte. So the objection does not
apply to them. It still applies to rewiring today's flat generators, which this amendment does not do.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ Attributes on operations:

- every operation;
- every transition that derives a command;
- in a layered service, every derived CRUD verb, when a setting turns that on.
- in a generated service, every derived CRUD verb, when an option of the service generator turns
that on. Its name is `<package>.<Entity>.<verb>`, and a transition that shares a verb's name on
an entity is refused when the model loads. (Designed here; it lands with the service generator,
and nothing in 1.3.0 reads it.)

The enforcing shell calls the project's policy with the point's permission name, the actor,
The enforcing shell calls the project's policy with the point's permission name, the actor (a type
the app defines, ADR-0067 §7),
the loaded row and the input, before anything is written. A type would only restate the
operation. The model adds two facts, the name and `@public`. Who holds a permission is data,
and what the policy decides is code. *The model names where a decision is needed, never what
Expand Down Expand Up @@ -271,7 +275,9 @@ will be the first to act on it, and the documentation says so until they do.

### 6. What the enforcing shell will guarantee, for every transition

The shells are later work. This is what they are held to:
The shells are later work: service generators that an app adds (ADR-0067). A project that declares
a lifecycle and wires no service generator will be told so by `verify`, as an advisory, once that check lands; today's flat
routes enforce nothing. This is what the shells are held to:

1. Load the row: 404 when it is absent.
2. Call the permission point: 403 `forbidden` when the policy refuses.
Expand All @@ -289,7 +295,7 @@ The shells are later work. This is what they are held to:
**The guarded update is part of the store-neutral storage contract** (§8). Every store
driver, including one an adopter writes, will be held to it by a persistence-conformance scenario.
That scenario does not exist yet: no file under `fixtures/persistence-conformance/` pins the
guarded update, so until it lands the contract is stated here and implemented, not yet gated.
guarded update, so until it lands the contract is stated here, not yet implemented or gated.

### 7. Events and invariants in 1.3.0

Expand Down
Loading
Loading