Skip to content

Commit c46a97a

Browse files
claude[bot]claude
andauthored
feat(devx): reach the INLINE literal expression at an object-literal code: (#14625)
The vocabulary gate reached a `code:` whose value is a quoted literal (`objlit`), a SCREAMING_SNAKE constant (`objlitconst`), a template (`objlittemplate`) or a helper parameter (`objlithelper`), but not an INLINE literal EXPRESSION — a ternary or a `||`/`??` chain written at the stamp with every branch already a literal. That is no site AND no unresolved: the one way the gate's "REPORTED as unresolved, never dropped" bound cannot notice itself failing, in a third stamp position. Adds the fifth object-literal shape, `objlitexpr`. It needs no resolver — `literalCodeValues` reduces the value text between `code:` and the property's terminating top-level comma directly, and `resolveIdent` is left at its default so an identifier limb keeps the expression unreducible, which is what keeps this shape out of the lower-case-LOCAL position that stays censused and open. Precision measured BEFORE implementing, over the gate's own population: of 902 `code:` tokens the shape reaches 346, three guards reject 130, 216 reach the reduction and 214 decline — including every type annotation — leaving 2 live positions, 5 values, 2 verdict rows and 0 unregistered wire codes hiding. The ALL-OR-NOTHING reduction IS the guard against the type-annotation noise the helper position pays per value stamp. Frozen in INLINE_LITERAL_EXPRESSION_CENSUS, printed in the bounds line, arithmetic pinned. The two rows the widening owes land in the same commit, after the widening, because the reconciliation runs in both directions: the ADR-0112 D6 field-addressed validation catalog in `domains/automation.ts`. They are reported here rather than delegated to check:error-code-casing because that gate needs a quoted literal beside the token `code` and an inline ternary has none — measured, and pinned against its real detector. Claude-Session: https://claude.ai/code/session_01WLJQhde67SeTccsmnBVarV Co-authored-by: Claude <noreply@anthropic.com>
1 parent a120885 commit c46a97a

2 files changed

Lines changed: 753 additions & 5 deletions

File tree

‎packages/runtime/src/dispatcher-error-vocabulary.ts‎

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,32 @@ export type CodeStampShape =
134134
* because a filter drawn around the inconvenient cases is an exemption
135135
* wearing a predicate's clothes.
136136
*/
137-
| 'objlithelper';
137+
| 'objlithelper'
138+
/**
139+
* [#13790] An INLINE literal EXPRESSION at an object-literal `code:` — a
140+
* ternary, or a `||`/`??` chain, written at the stamp itself with every
141+
* branch already a literal:
142+
*
143+
* ```ts
144+
* code: isProvisioning ? 'PROJECT_PROVISIONING' : 'PROJECT_NOT_FOUND'
145+
* ```
146+
*
147+
* The fifth object-literal position and, until #13790, the third one no
148+
* shape reached at all: `objlit` needs the quote immediately after the
149+
* colon and here the condition comes first, `objlitconst` needs a
150+
* SCREAMING_SNAKE identifier there, `objlittemplate` needs backticks, and
151+
* `objlithelper`'s candidate captures the CONDITION's identifier, which is
152+
* not a parameter, so it declines. No site AND no unresolved, again.
153+
*
154+
* ⭐ Unlike every other indirect shape it needs NO resolver: the gate
155+
* reduces the value text with `literalCodeValues` directly, and the
156+
* ALL-OR-NOTHING rule that drops an expression with one runtime limb is
157+
* also what keeps its precision high — 214 of the 216 candidate positions
158+
* on the tree it landed against are type annotations or runtime
159+
* expressions, and every one of them reduces to nothing without a single
160+
* position-specific test.
161+
*/
162+
| 'objlitexpr';
138163

139164
/**
140165
* Where the stamped code can end up. `dispatcher` is the door this card is
@@ -1180,6 +1205,62 @@ export const UNREGISTERED_CODE_SITES: readonly UnregisteredCodeSite[] = [
11801205
'It reaches `ApiError.details.fields[].code`, never `error.code`, so no ledger row can be owed ' +
11811206
'for it (ADR-0112 D6).',
11821207
},
1208+
1209+
// ── [#13790] the SAME D6 genre, arriving through the inline-expression ──
1210+
// ── shape rather than through a helper parameter ────────────────────────
1211+
//
1212+
// These two rows are the whole verdict cost of the `objlitexpr` widening on
1213+
// this tree, and they are owed for the reason the block above is owed:
1214+
// reconciliation runs in BOTH directions, so a newly derived site with no
1215+
// row is a red. What is NOT here is the point of the card — no
1216+
// `pending-registration` row, because the widening surfaced no unregistered
1217+
// WIRE code at all. The other live inline-expression position,
1218+
// `packages/rest/src/error-response.ts`, stamps `PROJECT_PROVISIONING` /
1219+
// `PROJECT_PROVISIONING_FAILED` / `PROJECT_NOT_FOUND` — all three already in
1220+
// `ERROR_CODE_LEDGER`, so the scan derives no site for them, and the value
1221+
// of the shape there is that it will derive one the day a fourth branch is
1222+
// added to that ternary. That file is the REST door itself.
1223+
//
1224+
// ⚠️ Reported HERE rather than delegated to `check:error-code-casing`, and
1225+
// that was measured rather than assumed. Every pattern that gate has needs
1226+
// a QUOTED literal beside the token `code`; at an inline ternary there is
1227+
// none — `findViolations()` returns ZERO findings for this file, while the
1228+
// literally-spelled `code: 'invalid_type'` a few lines up it DOES see and
1229+
// correctly skips as D6. A `casing-gate` delegation here would therefore be
1230+
// the seam this file's header describes, not a hand-off.
1231+
// flow definition + clone doors — domains/automation.ts
1232+
{
1233+
code: 'required',
1234+
file: 'packages/runtime/src/domains/automation.ts',
1235+
shape: 'objlitexpr',
1236+
door: 'none',
1237+
verdict: 'foreign-vocabulary',
1238+
why:
1239+
'The automation door builds `validationFailure(message, [{ field, code, message }])` and stamps ' +
1240+
'the field code as an INLINE ternary at the property itself — `code: body.name === undefined ? ' +
1241+
'\'required\' : \'invalid_type\'`. Both branches are ADR-0114 D2 `FieldErrorCode` members, and ' +
1242+
'`validationFailure` puts the record in `ApiError.details.fields[]` while `error.code` carries ' +
1243+
'the envelope\'s own VALIDATION_ERROR. The same D6 field-addressed catalog the record-validator ' +
1244+
'and query-param rows above carry, one stamp shape over (ADR-0112 D6).',
1245+
},
1246+
{
1247+
code: 'invalid_type',
1248+
file: 'packages/runtime/src/domains/automation.ts',
1249+
shape: 'objlitexpr',
1250+
door: 'none',
1251+
verdict: 'foreign-vocabulary',
1252+
why:
1253+
'The automation door builds `validationFailure(message, [{ field, code, message }])` and stamps ' +
1254+
'the field code as an INLINE ternary at the property itself — `code: body.name === undefined ? ' +
1255+
'\'required\' : \'invalid_type\'`. Both branches are ADR-0114 D2 `FieldErrorCode` members, and ' +
1256+
'`validationFailure` puts the record in `ApiError.details.fields[]` while `error.code` carries ' +
1257+
'the envelope\'s own VALIDATION_ERROR. The same D6 field-addressed catalog the record-validator ' +
1258+
'and query-param rows above carry, one stamp shape over (ADR-0112 D6). ⚠️ The gate derives this ' +
1259+
'row from the `name` ternary alone: two more instances of the identical stamp (the clone door\'s ' +
1260+
'`name` and `label` checks) sit behind a nested-template desync in the shared textual scanners ' +
1261+
'and are invisible to `enclosingOpeners`. Same values, same verdict; recorded so the count is ' +
1262+
'read as a lower bound.',
1263+
},
11831264
];
11841265

11851266
/**

0 commit comments

Comments
 (0)