Skip to content

Commit 06abf5a

Browse files
committed
fix(lint): rework r1 — the changeset states the renamed code shipped in 18.3.0; the non-record flow warning is pinned on a start and an edge
- Changeset: replace the "Supersedes, in the same release" paragraph. `@objectstack/formula@18.3.0` / `@objectstack/mcp@18.3.0` already serve `type-mismatch` + `params.outcome: 'fail-closed'` (shipped without a changelog line); this release renames that arm and removes `outcome`. - Lint test: the non-record-triggered case now covers a flow with no `triggerType` and a `schedule` flow, start and edge condition each; the inert-node case is its own test. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfu5kYQW45XjsF79Rp
1 parent 61a4cdb commit 06abf5a

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎.changeset/29926-type-mismatch-outcome-per-role.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Skills-docs: updated here — `content/docs/data-modeling/formulas.mdx` (the typ
2323

2424
**FROM → TO.** Flow condition `name > 5` on a text field → `size(name) > 5` for its length, `score > 5` on a number field for a value, or `double(name) > 5` only when every value is numeric text. A boolean: `active > 0` → `active == true`. A consumer keyed to the code: `type-mismatch` with `params.outcome === 'fail-closed'` → `type-mismatch-fail-closed`.
2525

26-
**Supersedes, in the same release.** The #29904 changeset (`29904-type-mismatch-fail-closed.md`) says the refusal's `params` carry `outcome: 'fail-closed'`, and that flow conditions keep the warning. Both are replaced here: the fail-closed refusal is served as `type-mismatch-fail-closed` with no `outcome` param, and a record-triggered flow's start and edge conditions are refused as above.
26+
**The renamed code shipped in 18.3.0.** `@objectstack/formula@18.3.0` and `@objectstack/mcp@18.3.0` already serve #29904's fail-closed refusal as `type-mismatch` with `params.outcome: 'fail-closed'` (the `outcome` param is in the 18.3.0 `ExpressionRefusalParams` type), although 18.3.0's changelog has no line for it: its changeset (`29904-type-mismatch-fail-closed.md`) was not consumed by that release. This release renames that arm `type-mismatch-fail-closed` and removes the `outcome` param, so a consumer keyed to 18.3.0's `type-mismatch` + `outcome` moves to the new code (FROM → TO above). The same changeset also says flow conditions keep the warning; a record-triggered flow's start and edge conditions are now refused, as above.

‎packages/lint/src/validate-expressions.test.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,34 @@ describe('validateStackExpressions (ADR-0032 build-time)', () => {
10041004
expect(found[0].message).toMatch(/`size\(title\)`/);
10051005
});
10061006

1007-
it('keeps the warning on a flow that is not record-triggered, and on an inert node condition (#29926)', () => {
1007+
it('keeps the warning on a flow that is not record-triggered: start and edge conditions (#29926)', () => {
1008+
// No `triggerType` (the shape the pre-existing flattened-flow pin uses)
1009+
// and a `schedule` start: neither is `record_change`, so the ledger
1010+
// declares no outcome there and the verdict stays the warning.
1011+
for (const [name, startConfig] of [
1012+
['plain_flow', {}],
1013+
['sched_flow', { schedule: '0 * * * *' }],
1014+
] as const) {
1015+
const issues = validateStackExpressions({
1016+
objects: [{ name: 'crm_opportunity', fields: { title: { type: 'text', required: true } } }],
1017+
flows: [{
1018+
name,
1019+
nodes: [
1020+
{ id: 'start', type: 'start', config: { objectName: 'crm_opportunity', condition: 'title * 2 > 10', ...startConfig } },
1021+
{ id: 'end', type: 'end' },
1022+
],
1023+
edges: [{ id: 'e1', source: 'start', target: 'end', condition: 'title > 5' }],
1024+
}],
1025+
});
1026+
const found = typeMismatches(issues);
1027+
expect(found.map(i => [i.where, i.severity]), name).toEqual([
1028+
[`flow '${name}' · node 'start' (start) condition`, 'warning'],
1029+
[`flow '${name}' · edge 'e1' (start→end) condition`, 'warning'],
1030+
]);
1031+
}
1032+
});
1033+
1034+
it('keeps the warning on an inert node condition of a record-triggered flow (#29926)', () => {
10081035
const issues = validateStackExpressions({
10091036
objects: [{ name: 'crm_opportunity', fields: { title: { type: 'text', required: true } } }],
10101037
flows: [{

0 commit comments

Comments
 (0)