Skip to content

Commit 18221ee

Browse files
SisyphusZhengDevBot
andauthored
refactor(autoflow): shrink policy registry to OE-specific invariants (#1229 B2.7) (#1295)
Co-authored-by: DevBot <devbot@openelement.dev>
1 parent e833077 commit 18221ee

6 files changed

Lines changed: 31 additions & 32 deletions

File tree

.githooks/pre-commit

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/sh
22
#
3-
# openElement pre-commit hook.
4-
# AutoFlow3 is the single local gate controller; this tier stays fast and
5-
# delegates gate policy to tools/autoflow/policy.ts.
3+
# openElement pre-commit hook. Format/lint are owned by the Deno toolchain
4+
# directly (ADR-0144, #1229); AutoFlow3 keeps only OE-specific dev-tier gates.
65
#
76
# Install: deno task hooks:install
87

98
set -e
109

10+
deno fmt --check
11+
deno lint
12+
1113
echo "[autoflow:dev] pre-commit"
1214
deno task autoflow:dev || {
1315
echo ""

.githooks/pre-push

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
#!/bin/sh
22
#
3-
# openElement pre-push hook.
4-
# AutoFlow3 owns the push tier gate selection.
3+
# openElement pre-push hook. Format/lint/type-graph/Markdown are owned by the
4+
# pinned OSS tools directly (ADR-0144, #1229); AutoFlow3 owns only the
5+
# OE-specific push-tier gate selection.
56
#
67
# Install: deno task hooks:install
78

89
set -e
910

1011
BRANCH=$(git rev-parse --abbrev-ref HEAD)
12+
13+
deno fmt --check
14+
deno lint
15+
deno task lint:markdown
16+
deno task typecheck
17+
1118
echo "=== pre-push: autoflow:push for '$BRANCH' ==="
1219

1320
deno task autoflow:push || {

.github/workflows/autoflow-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ jobs:
6868
tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
6969
/tmp/gitleaks git --redact --verbose .
7070
- uses: ./.github/actions/setup-deno-workspace
71+
# ADR-0144 / #1229 (B2.7): generic toolchain gates are pinned OSS tool steps, not AutoFlow gates.
72+
- run: deno fmt --check
73+
- run: deno lint
74+
- run: deno task lint:markdown
75+
- run: deno task typecheck
7176
- name: Install Playwright browsers
7277
# All three engines up front: the gate's fixture:request-time:gate
7378
# runs the request-time fixture suite on Chromium, Firefox and WebKit.

deno.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"fullstack:boundary-check": "deno run --allow-read --allow-run tools/check-fullstack-boundary.ts",
7171
"fullstack:migrations-check": "deno run --allow-read tools/check-supabase-migrations.ts",
7272
"fullstack:workspace-qualification": "deno task --cwd examples/supabase-cloudflare-starter build && deno task --cwd examples/supabase-cloudflare-starter nitro:build && deno run --allow-read --allow-write --allow-env --allow-sys --allow-net=127.0.0.1,localhost --allow-run=node,deno tools/qualify-workspace-runtime.ts",
73-
"fullstack:notes-qualification": "deno task fullstack:workspace-qualification",
7473
"fullstack:evidence-freshness": "deno run --allow-env --allow-net=api.github.com tools/check-evidence-freshness.ts",
7574
"fullstack:cloudflare-config-check": "deno test --allow-read tools/render-cloudflare-async-config.test.ts && deno task --cwd examples/supabase-cloudflare-starter build && deno task --cwd examples/supabase-cloudflare-starter nitro:build && deno run --allow-read --allow-write tools/render-cloudflare-async-config.ts examples/supabase-cloudflare-starter/wrangler.jsonc examples/supabase-cloudflare-starter/.wrangler-async.generated.json && deno run --allow-run=deno tools/run-wrangler-dry-run.ts examples/supabase-cloudflare-starter/.wrangler-async.generated.json && rm examples/supabase-cloudflare-starter/.wrangler-async.generated.json",
7675
"arch:check": "deno run --allow-read --allow-run tools/check-architecture-contract.ts",

tools/autoflow/__tests__/policy.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,16 @@ Deno.test('policy: minor release with approved plan can execute', () => {
5050
assert(decision.requiredEvidence.includes('approval:ADR-0101/docs-current-v040'));
5151
});
5252

53-
Deno.test('policy: dev tier remains fast', () => {
54-
const gates = selectGates('dev', ['packages/core/src/index.ts']).map((gate) => gate.name);
55-
assertEquals(gates, ['fmt:check', 'lint']);
53+
Deno.test('policy: generic toolchain concerns are not AutoFlow gates (ADR-0144, #1229)', () => {
54+
// Deno fmt/lint/check and markdownlint-cli2 own these as CI steps and hook calls.
55+
for (const tier of ['dev', 'push', 'ci', 'release'] as const) {
56+
const names = selectGates(tier, ['packages/element/src/index.ts']).map((gate) => gate.name);
57+
for (const generic of ['fmt:check', 'lint', 'typecheck', 'lint:markdown']) {
58+
assertFalse(names.includes(generic), `${generic} must not be an AutoFlow ${tier} gate`);
59+
}
60+
}
61+
// The dev tier carries no gates at all for a package-source-only change.
62+
assertEquals(selectGates('dev', ['packages/core/src/index.ts']).map((gate) => gate.name), []);
5663
});
5764

5865
Deno.test('policy: push tier stays fast for package source changes', () => {

tools/autoflow/policy.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,9 @@ export function isCI(): boolean {
2525
return Deno.env.get('CI') === 'true';
2626
}
2727

28+
// ADR-0144 / #1229: fmt/lint/type-graph/Markdown are owned by Deno fmt, deno
29+
// lint, deno check and markdownlint-cli2 as autoflow-ci.yml steps and .githooks calls.
2830
const GATES: readonly GateDefinition[] = [
29-
{
30-
name: 'fmt:check',
31-
command: ['deno', 'task', 'fmt:check'],
32-
tiers: ['dev', 'push', 'ci', 'release'],
33-
},
34-
{
35-
name: 'lint',
36-
command: ['deno', 'task', 'lint'],
37-
tiers: ['dev', 'push', 'ci', 'release'],
38-
},
39-
{
40-
name: 'typecheck',
41-
command: ['deno', 'task', 'typecheck'],
42-
tiers: ['push', 'ci', 'release'],
43-
},
4431
{
4532
name: 'graph:check',
4633
command: ['deno', 'task', 'graph:check'],
@@ -326,14 +313,6 @@ const GATES: readonly GateDefinition[] = [
326313
tiers: ['ci', 'release'],
327314
triggers: [/^packages\/(element|ui|app)\/src\//],
328315
},
329-
{
330-
// #1156 (B2.6): markdownlint-cli2 owns Markdown structure per ADR-0144
331-
// (thin .markdownlint-cli2.jsonc config; no bespoke checker).
332-
name: 'lint:markdown',
333-
command: ['deno', 'task', 'lint:markdown'],
334-
tiers: ['push', 'ci', 'release'],
335-
triggers: [/\.md$/, /^\.markdownlint-cli2\.jsonc$/, /^deno\.json$/],
336-
},
337316
{
338317
name: 'text-integrity:check',
339318
command: ['deno', 'task', 'text-integrity:check'],

0 commit comments

Comments
 (0)