Back to Lowdefy

Error Tracing Test Configs

code-docs/test-configs/errors/README.md

5.2.012.5 KB
Original Source

Error Tracing Test Configs

Test configurations for validating error tracing functionality (Issue #1940). These configs help developers test that errors show proper config location links.

Build-Time Error Tests (Automated)

Location: packages/build/src/tests/errors/

End-to-end tests for all build-time errors are automated in packages/build/src/index.errors.test.js. Each error type has its own fixture directory with documented YAML files.

Run the tests:

bash
cd packages/build
pnpm test -- --testPathPattern='index.errors.test.js'

Test Coverage

CodeError TypeLevelTest Fixture
A1Invalid connection typeErrorA1-invalid-connection-type/
A2Missing connection idErrorA2-missing-connection-id/
A3Duplicate connection idErrorA3-duplicate-connection-id/
B1Auth config not objectErrorB1-auth-not-object/
B2Auth provider missing idErrorB2-auth-provider-missing-id/
B3Public/protected conflictErrorB3-public-protected-conflict/
B4Missing NextAuth secretErrorB4-missing-nextauth-secret/
C1Duplicate menu idErrorC1-duplicate-menu-id/
C2Menu link to missing pageWarnC2-menu-missing-page/
D1Duplicate page idErrorD1-duplicate-page-id/
E1Invalid action typeErrorE1-invalid-action-type/
E2Invalid block typeErrorE2-invalid-block-type/
E3Missing block idErrorE3-missing-block-id/
E4Block id not stringErrorE4-block-id-not-string/
E5Block type not stringErrorE5-block-type-not-string/
F1Invalid request referenceWarn Dev, Error ProdF1-invalid-request-reference/
F2Request missing idErrorF2-request-missing-id/
F3Duplicate request idErrorF3-duplicate-request-id/
F4Request id with periodErrorF4-request-id-with-period/
F5Invalid request typeErrorF5-invalid-request-type/
F6Non-existent connectionIdErrorF6-nonexistent-connection/
F7Non-existent connection (ignored)SuppressedF7-nonexistent-connection-ignored/
G1Invalid page linkWarn Dev, Error ProdG1-invalid-page-link/
G2Duplicate action idErrorG2-duplicate-action-id/
G3Missing action idErrorG3-missing-action-id/
G4Action type not stringErrorG4-action-type-not-string/
G5Events not arrayErrorG5-events-not-array/
H1Operator typo (_staet)WarnH1-operator-typo-state/
H2Operator typo (_iff)WarnH2-operator-typo-if/
H3Operator typo (ignored)SuppressedH3-operator-typo-ignored/
H4Action type (ignored)SuppressedH4-action-type-ignored/
H5Block type (ignored)SuppressedH5-block-type-ignored/
H6Connection type (ignored)SuppressedH6-connection-type-ignored/
H7Request type (ignored)SuppressedH7-request-type-ignored/
I1Missing _ref fileErrorI1-missing-ref-file/
I2Circular _refErrorI2-circular-ref/
J1Undefined state referenceWarnJ1-undefined-state/
J2Undefined state (ignored)SuppressedJ2-undefined-state-ignored/
J3Undefined state in requestWarnJ3-undefined-state-in-request/
J4Undefined state in ref defaultWarnJ4-undefined-state-in-ref-default/
J5State dot-notation childWarnJ5-state-dot-notation-child/
J6_state in request propertiesWarn Dev, Error ProdJ6-state-in-request-properties/
J7_state in request props (no dup)Warn Dev, Error ProdJ7-state-in-request-properties-no-duplicate/
K1Undefined payload referenceWarnK1-undefined-payload/
K2Undefined payload (ignored)SuppressedK2-undefined-payload-ignored/
L1Undefined step referenceWarnL1-undefined-step/
L2Undefined step (ignored)SuppressedL2-undefined-step-ignored/
M1_ref var wrong locationErrorM1-ref-var-wrong-location/
M2_ref var (ignored)SuppressedM2-ref-var-ignored/
M3_ref nunjucks templateErrorM3-ref-njk-template/
M4_ref nunjucks (ignored)SuppressedM4-ref-njk-ignored/
N1Dedup warnings same pageWarnN1-dedup-warnings/
N2Dedup warnings multi-fileWarnN2-dedup-multi-file/
S1Ignore all checksSuppressedS1-ignore-all-checks/
S2Ignore specific slugSuppressedS2-ignore-specific-slug/
S3Ignore inheritedSuppressedS3-ignore-inherited/
S4Ignore invalid slugErrorS4-ignore-invalid-slug/
S5Ignore old property migrationSuppressedS5-ignore-old-property-migration/
S6Ignore not matchingWarnS6-ignore-not-matching/
S7Ignore cascades into _refSuppressedS7-ignore-cascades-into-ref/
S8Ignore cascades into _ref arraySuppressedS8-ignore-cascades-into-ref-array/
-Multi-file error trackingErrormulti-file-error/
-Multi-page errorsErrormulti-page-errors/
-Multi-page schema errorsErrormulti-page-schema-errors/
-Multi-validation errorsErrormulti-validation-errors/

Each fixture includes YAML comments documenting the expected error message and line number.

Runtime Error Tests (Manual)

The following test configs require manual testing with a running dev server.

Usage

Copy a test file to app/lowdefy.yaml and run the dev server:

bash
cp code-docs/test-configs/errors/lowdefy-client-errors.yaml app/lowdefy.yaml
pnpm dev

lowdefy-client-errors.yaml

Tests runtime client-side errors during operator parsing. Check browser console (F12) for errors.

SectionError TypeHow to TestImplemented
B1-B3Logic operators (_and, _or, _if_none)Uncomment blocks - expects array✓ with location
C1-C4Math operators (_sum, _product, _divide, _math.*)Uncomment blocks - expects array/number✓ with location
D1-D2String operators (_string.*)Uncomment blocks - invalid method or type✓ with location
E1-E2Array operators (_array.*)Uncomment blocks - invalid method or non-array✓ with location
F1-F2Object operators (_object.*)Uncomment blocks - invalid method or non-object✓ with location
G1-G2Regex operators (_regex)Uncomment blocks - pattern errors✓ with location
H1-H2Type operators (_type)Uncomment blocks - type errors✓ with location
I1-I2Nested operator errorsUncomment blocks - errors in chains✓ with location
J1-J4Expression context errorsUncomment blocks - style/visible/required errors✓ with location
K1-K4Action/event errorsClick buttons - Throw action, operator in params✓ with location
L1Block-level errorsThrow block renders error✓ with location

lowdefy-server-errors.yaml

Tests runtime server-side errors during request execution:

Error TypeHow to TestExpected OutputImplemented
HTTP 500Click "Trigger 500" button[Service Error] Http response "500:...✓ no location
HTTP 404Click "Trigger 404" button[Config Error] with location✓ with location
TimeoutClick "Trigger Timeout" button[Service Error] network error✓ no location
Operator error in requestClick operator error button[Config Error] with location✓ with location
Transformation errorClick transform error button[Config Error] with location✓ with location

Error Format

All errors follow this format:

[Config Error] <error message>
  <file>:<line> at <config path>
  <absolute path for VSCode click>

Example:

[Config Error] Action type "NonExistentAction" was used but is not defined.
  pages/home.yaml:25 at root.pages[0:home].blocks[0:button].events.onClick.try[0:action:NonExistentAction]
  /Users/dev/myapp/pages/home.yaml:25

Service vs Config Errors

  • Config Error: Issue with Lowdefy configuration (shows file location)
  • Service Error: External service issue like network timeout, HTTP 5xx (no location shown)

DX Enhancements

"Did you mean?" Suggestions

Type errors (A1, E1, E2, F5, H1-H2) now include suggestions for similar valid types:

[Config Error] Block type "Buton" was used but is not defined. Did you mean "Button"?
  pages/home.yaml:15 at root.pages[0:home].blocks[0:Buton]

Circular Reference Chain Display

Circular _ref errors now show the full chain of files:

Circular reference detected: fileA.yaml -> fileB.yaml -> fileC.yaml -> fileA.yaml