From 488e4a825fa322f255db405ed34b1685d487c198 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Tue, 24 Nov 2026 21:47:01 -0800 Subject: [PATCH] fix(workflow-code): scope the check's W_JSON_REF_UNTYPED to fields that store a reference anew The offline check reported W_JSON_REF_UNTYPED on every untyped bare reference of a block whose digest changed since the get. Renaming a block's display name changes its key, so the block and every block reading it compiled to a new digest, and each untouched untyped reference in them was reported although its field stores exactly what it stored. The server compares per field, through the apply's renames, and stays quiet there. A get or apply now records in .sim/stored-edges.json the JSON fields of the printed source that hold untyped references (the text each stores and those references; CompileResult.untypedJsonFields), and the compile reads them back as CompileInput.storedUnreadUntypedFields beside the lock. Such a reference stays quiet while its field compiles to the same text through the lock's renames, as one the stored workflow holds does against `stored`. A field whose text changed, or a reference that was typed when printed (a Start input or a Function's code an edit changed), is reported. Without the record or the catalog the source was printed with, the check keeps the block-level rule; --strict still reports every one. --- apps/docs/content/docs/cli/reference.mdx | 4 +- apps/docs/content/docs/cli/workflows.mdx | 2 +- apps/docs/content/docs/cli/workspaces.mdx | 2 +- .../src/commands/protocol/source-check.ts | 46 +++++--- .../src/commands/protocol/stored-edges.ts | 79 ++++++++----- .../protocol/workflow-source-check.test.ts | 103 +++++++++++++++++ packages/workflow-code/src/compile/index.ts | 107 ++++++++++++------ packages/workflow-code/src/index.ts | 1 + 8 files changed, 263 insertions(+), 81 deletions(-) diff --git a/apps/docs/content/docs/cli/reference.mdx b/apps/docs/content/docs/cli/reference.mdx index 70baa565ffb..9d740bd6ba2 100644 --- a/apps/docs/content/docs/cli/reference.mdx +++ b/apps/docs/content/docs/cli/reference.mdx @@ -8732,7 +8732,7 @@ Compiles workflow.ts (and the function files it names) with the compiler the ser Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog (run the get once). With --output json, stdout is one document that also lists every finding under diagnostics. -These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the edit added or changed, including an unedited block that an edit elsewhere makes compile differently, and with --strict on every block. +These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported, as the server reports it, only on a field the edit made store the reference anew: one whose text differs from what the printed source stored, through block renames, or where the reference was typed then, as when an edit elsewhere (a Start input, a Function's code) changes its type. Without the record or that catalog, it is reported on every block the edit added or changed; with --strict, on every block. Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished. @@ -10117,7 +10117,7 @@ Compiles every workflows/<key>/workflow.ts (and the function files each na Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog that could not be downloaded (a check downloads it once when none is cached, with the profile's credentials; 13 when there is no login to download it with). With --output json, stdout is one document that also lists every finding under diagnostics. -These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the edit added or changed, including an unedited block that an edit elsewhere makes compile differently, and with --strict on every block. +These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported, as the server reports it, only on a field the edit made store the reference anew: one whose text differs from what the printed source stored, through block renames, or where the reference was typed then, as when an edit elsewhere (a Start input, a Function's code) changes its type. Without the record or that catalog, it is reported on every block the edit added or changed; with --strict, on every block. Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished. diff --git a/apps/docs/content/docs/cli/workflows.mdx b/apps/docs/content/docs/cli/workflows.mdx index 3be98c5f423..2db4c32aecb 100644 --- a/apps/docs/content/docs/cli/workflows.mdx +++ b/apps/docs/content/docs/cli/workflows.mdx @@ -1526,7 +1526,7 @@ Compiles workflow.ts (and the function files it names) with the compiler the ser Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog (run the get once). With --output json, stdout is one document that also lists every finding under diagnostics. -These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the edit added or changed, including an unedited block that an edit elsewhere makes compile differently, and with --strict on every block. +These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported, as the server reports it, only on a field the edit made store the reference anew: one whose text differs from what the printed source stored, through block renames, or where the reference was typed then, as when an edit elsewhere (a Start input, a Function's code) changes its type. Without the record or that catalog, it is reported on every block the edit added or changed; with --strict, on every block. Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished. diff --git a/apps/docs/content/docs/cli/workspaces.mdx b/apps/docs/content/docs/cli/workspaces.mdx index 80bb3ade2cd..c2d428879a1 100644 --- a/apps/docs/content/docs/cli/workspaces.mdx +++ b/apps/docs/content/docs/cli/workspaces.mdx @@ -790,7 +790,7 @@ Compiles every workflows/<key>/workflow.ts (and the function files each na Exit codes: 0 no errors; 1 errors (each printed as file:line:column with its frame and hint), or no cached catalog that could not be downloaded (a check downloads it once when none is cached, with the profile's credentials; 13 when there is no login to download it with). With --output json, stdout is one document that also lists every finding under diagnostics. -These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported only on blocks the edit added or changed, including an unedited block that an edit elsewhere makes compile differently, and with --strict on every block. +These warnings, which an apply saves as written, fail the check as errors on every block the lock does not bind (a block added since the get, or every block of a new workflow): W_REQUIRED_MISSING, W_UNKNOWN_OPTION, W_UNKNOWN_OUTPUT_PATH, W_VALUE_KIND, W_OUT_OF_RANGE, W_LITERAL_SECRET, W_TABLE_UNKNOWN_COLUMN, W_CHILD_INPUT_UNKNOWN, W_CHILD_RESULT_PATH, W_BRANCH_UNWIRED, W_UNRESOLVED_REF, W_REF_OUT_OF_SCOPE, W_LOOP_CONDITION_SYNTAX. --strict fails on them in every block, except W_BRANCH_UNWIRED on a block the lock binds (the stored workflow may hold it, and the server then stays quiet); --no-strict fails on none of them. In every mode, as the server refuses them: W_REF_OUT_OF_SCOPE is the error E_APPLY_REF_OUT_OF_SCOPE in any file of a block the edit added or changed; W_LOOP_CONDITION_SYNTAX is the error E_APPLY_LOOP_CONDITION_SYNTAX in any file of a block the edit added or changed; W_UNKNOWN_OPTION is the error E_APPLY_INVALID_SUBBLOCK_FIELD in workflow.ts on a block the edit added or changed; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in workflow.ts on a block the edit added or changed; W_UNKNOWN_BLOCK_TYPE is the error E_APPLY_INVALID_BLOCK_TYPE in workflow.ts on a block the edit added or changed; W_TYPE_NOT_ADDABLE is the error E_APPLY_TYPE_NOT_ADDABLE in workflow.ts on a block the edit added or changed; W_UNRESOLVED_REF is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_UNKNOWN_OUTPUT_PATH is the error E_APPLY_UNRESOLVED_REF in a function file changed since the get; W_CODE_FILE_REF_SYNTAX is the error E_APPLY_CODE_FILE_REF_SYNTAX in a function file changed since the get. A block counts as changed when the lock does not bind it, when the source moved it into another container, or when it compiles differently than in the source the last get or apply printed (.sim/stored-edges.json records a digest of each block). That last comparison needs the catalog the source was printed with in the cache: without it, a bound block that did not move counts as unchanged, so the server may refuse what the check passes. A $ref in a function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. W_JSON_REF_UNTYPED is reported, as the server reports it, only on a field the edit made store the reference anew: one whose text differs from what the printed source stored, through block renames, or where the reference was typed then, as when an edit elsewhere (a Start input, a Function's code) changes its type. Without the record or that catalog, it is reported on every block the edit added or changed; with --strict, on every block. Exit 10 (busy, retry): another sim workspaces source or workflows source command is using this directory or a workflow folder in it (SOURCE_DIR_BUSY); nothing was read or written. Run this one again once it finished. diff --git a/packages/sim-cli/src/commands/protocol/source-check.ts b/packages/sim-cli/src/commands/protocol/source-check.ts index c5dbdc4f922..0ad00525272 100644 --- a/packages/sim-cli/src/commands/protocol/source-check.ts +++ b/packages/sim-cli/src/commands/protocol/source-check.ts @@ -71,6 +71,7 @@ import { compiledWithChildResults, readStoredBlockDigests, readStoredEdges, + readStoredUntypedFields, } from './stored-edges' import { lockRecoveryHint, readSourceFiles } from './workflow-dir' import { @@ -103,12 +104,14 @@ const STRICT_CODES: ReadonlySet = new Set(STRICT_FINDINGS.keys()) const STORED_EXEMPT_CODES: ReadonlySet = new Set(['W_BRANCH_UNWIRED']) /** - * Warnings a check reports only on a block the edit added or changed (see `changed` in - * {@link checkWorkflowDir}), and on every block with `--strict`: printed source holds them on - * blocks nobody edited, and the server, which compares with the stored workflow, reports them only - * for a field that compiles differently than it stores. A block whose own source is untouched - * still counts when it compiles differently, as when an edit elsewhere changes how it stores a - * reference. `W_JSON_REF_UNTYPED`: a bare reference nothing types, in a JSON field. + * Warnings a check reports, as the server does, only on a JSON field the edit made store a + * reference anew: the compile reads what the source the last get or apply printed held from + * `.sim/stored-edges.json`. A field counts when its text differs from what it held, through the + * lock's renames, or when the reference was typed then, as when an edit elsewhere (a Start input, + * a Function's code) changes how it is typed. Without that record, or the catalog the source was + * printed with, they are reported only on a block the edit added or changed (see `changed` in + * {@link checkWorkflowDir}); with `--strict`, on every block. `W_JSON_REF_UNTYPED`: a bare + * reference nothing types, in a JSON field. */ const EDIT_SCOPED_CODES: ReadonlySet = new Set(['W_JSON_REF_UNTYPED']) @@ -165,9 +168,11 @@ not move counts as unchanged, so the server may refuse what the check passes. A function file to a block the lock binds that the source no longer declares stays a warning, unless a warning cap left findings out: the server may infer that block was renamed and rewrite the reference, and refuses it otherwise. -${[...EDIT_SCOPED_CODES].join(', ')} is reported only on blocks the edit added or changed, -including an unedited block that an edit elsewhere makes compile differently, and with --strict -on every block.` +${[...EDIT_SCOPED_CODES].join(', ')} is reported, as the server reports it, only on a field the +edit made store the reference anew: one whose text differs from what the printed source stored, +through block renames, or where the reference was typed then, as when an edit elsewhere (a Start +input, a Function's code) changes its type. Without the record or that catalog, it is reported on +every block the edit added or changed; with --strict, on every block.` } /** Adds the `--strict` / `--no-strict` pair to a check command. */ @@ -478,24 +483,32 @@ function declarationFindings( async function compileWorkflowDir( dir: string, workspaceCatalog: BlockCatalog, - envNames?: ReadonlySet + envNames?: ReadonlySet, + { everyUntypedRef = false }: { everyUntypedRef?: boolean } = {} ) { const lockText = await readSourceText(dir, SOURCE_LOCK_FILE) const parsedLock = lockText === null ? null : parseWorkflowLock(lockText) const lock = parsedLock?.lock - const [files, storedEdges, storedBlocks, printedWith] = await Promise.all([ + const [files, storedEdges, storedBlocks, storedUntypedFields, printedWith] = await Promise.all([ readSourceFiles(dir, lock ?? null), readStoredEdges(dir), readStoredBlockDigests(dir), + readStoredUntypedFields(dir), cachedSourceCatalog(dir), ]) const catalog = printedWith ?? workspaceCatalog + // Compiled against another catalog than the source was printed with, a field may store a + // reference differently with no edit, so the record says nothing of what the edit changed. + const untypedFields = printedWith && !everyUntypedRef ? storedUntypedFields : undefined const input: CompileInput = { ...folderCompileInput(files[SOURCE_ENTRY_FILE], files, lock, catalog), ...(storedEdges ? { storedUnreadEdges: storedEdges } : {}), + ...(untypedFields ? { storedUnreadUntypedFields: untypedFields } : {}), ...(envNames ? { envNames, envDeclaredIn: KIND_DIRS.secret } : {}), } return { + /** Whether the compile reports `W_JSON_REF_UNTYPED` only where a field stores it anew. */ + untypedScoped: untypedFields !== undefined, lock, lockProblems: parsedLock?.diagnostics ?? [], files, @@ -652,14 +665,18 @@ export async function checkWorkflowDir( } ): Promise<{ findings: CheckFinding[]; entry: string; unlisted: UnlistedCounts }> { const { declarations } = options + const everyUntypedRef = options.strict === 'all' const untyped = - (options.key === undefined ? undefined : declarations?.compiledWorkflows.get(options.key)) ?? - (await compileWorkflowDir(dir, catalog, declarations?.envNames)) + (options.key === undefined || everyUntypedRef + ? undefined + : declarations?.compiledWorkflows.get(options.key)) ?? + (await compileWorkflowDir(dir, catalog, declarations?.envNames, { everyUntypedRef })) const compiledDir = { ...untyped, compiled: compiledWithChildResults(untyped.input, untyped.compiled, declarations?.childResults), } - const { lock, lockProblems, files, compiled, storedBlocks, printedWith } = compiledDir + const { lock, lockProblems, files, compiled, storedBlocks, printedWith, untypedScoped } = + compiledDir const entryText = files[SOURCE_ENTRY_FILE] const locate = (block: string, param: string, names: string | undefined) => { const prefix = encodeAnchor({ kind: 'param', block, param: '' }) @@ -737,6 +754,7 @@ export async function checkWorkflowDir( !( EDIT_SCOPED_CODES.has(code) && options.strict !== 'all' && + !untypedScoped && blockKey !== undefined && !changed(blockKey) ) diff --git a/packages/sim-cli/src/commands/protocol/stored-edges.ts b/packages/sim-cli/src/commands/protocol/stored-edges.ts index b1f04aac306..749f32dfcc3 100644 --- a/packages/sim-cli/src/commands/protocol/stored-edges.ts +++ b/packages/sim-cli/src/commands/protocol/stored-edges.ts @@ -14,6 +14,7 @@ import { type StoredEdgeRef, setOwn, stableStringify, + type UntypedJsonField, } from '@sim/workflow-code' import { SOURCE_BASE_FILE, SOURCE_ENTRY_FILE, SOURCE_LOCK_FILE } from '@sim/workflow-code/limits' import { KIND_DIRS } from '@sim/workspace-code' @@ -61,13 +62,14 @@ function printedInput(answer: PrintedAnswer, catalog: BlockCatalog): CompileInpu /** * The `.sim/stored-edges.json` write (at `folder`) of a printed source compiled as `compiled`: its - * edges and a digest of each block ({@link blockDigest}, by key), tagged with its base fingerprint. + * edges, its JSON fields holding untyped references, and a digest of each block + * ({@link blockDigest}, by key), tagged with its base fingerprint. * `null` when the answer has no fingerprint; the record left on disk then names an older * fingerprint, which a check ignores. */ function storedEdgesRecord( answer: PrintedAnswer, - { edges, workflow }: CompileResult, + { edges, workflow, untypedJsonFields }: CompileResult, folder: string ): readonly [string, string] | null { const { fingerprint } = toRecord(answer.base) @@ -79,6 +81,7 @@ function storedEdgesRecord( version: 1, fingerprint, edges, + untypedJsonFields, ...(workflow ? { blocks: Object.fromEntries( @@ -232,26 +235,55 @@ function isStoredEdge(value: unknown): value is StoredEdgeRef { ) } +function isUntypedJsonField(value: unknown): value is UntypedJsonField { + return ( + isRecordLike(value) && + typeof value.block === 'string' && + typeof value.param === 'string' && + typeof value.value === 'string' && + Array.isArray(value.refs) && + value.refs.every((ref) => typeof ref === 'string') + ) +} + /** - * The stored edges recorded for the base `dir` holds now, or `undefined` when none are: no - * record, one another base wrote, or a malformed one. + * The stored-edges record of the base `dir` holds now, or an empty record when there is none: no + * record, or one another base wrote. */ -export async function readStoredEdges(dir: string): Promise { +async function currentRecord(dir: string): Promise> { const [record, base] = await Promise.all([ readSourceJson(dir, SOURCE_STORED_EDGES_FILE), readSourceJson(dir, SOURCE_BASE_FILE), ]) - const { version, fingerprint, edges } = toRecord(record) - if ( - version !== 1 || - typeof fingerprint !== 'string' || - fingerprint !== toRecord(base).fingerprint || - !Array.isArray(edges) || - !edges.every(isStoredEdge) - ) { - return undefined - } - return edges + const { version, fingerprint } = toRecord(record) + return version === 1 && + typeof fingerprint === 'string' && + fingerprint === toRecord(base).fingerprint + ? toRecord(record) + : {} +} + +/** + * The stored edges recorded for the base `dir` holds now, or `undefined` when none are: no + * record, one another base wrote, or a malformed one. + */ +export async function readStoredEdges(dir: string): Promise { + const { edges } = await currentRecord(dir) + return Array.isArray(edges) && edges.every(isStoredEdge) ? edges : undefined +} + +/** + * The JSON fields holding untyped references recorded for the base `dir` holds now (see + * {@link storedEdgesWrite}), or `undefined` when none are: no record, one another base wrote, or + * a malformed one. + */ +export async function readStoredUntypedFields( + dir: string +): Promise { + const { untypedJsonFields } = await currentRecord(dir) + return Array.isArray(untypedJsonFields) && untypedJsonFields.every(isUntypedJsonField) + ? untypedJsonFields + : undefined } /** @@ -262,19 +294,8 @@ export async function readStoredEdges(dir: string): Promise | undefined> { - const [record, base] = await Promise.all([ - readSourceJson(dir, SOURCE_STORED_EDGES_FILE), - readSourceJson(dir, SOURCE_BASE_FILE), - ]) - const { version, fingerprint, blocks } = toRecord(record) - if ( - version !== 1 || - typeof fingerprint !== 'string' || - fingerprint !== toRecord(base).fingerprint || - !isRecordLike(blocks) - ) { - return undefined - } + const { blocks } = await currentRecord(dir) + if (!isRecordLike(blocks)) return undefined const digests = new Map() for (const [key, value] of Object.entries(blocks)) { if (typeof value !== 'string') return undefined diff --git a/packages/sim-cli/src/commands/protocol/workflow-source-check.test.ts b/packages/sim-cli/src/commands/protocol/workflow-source-check.test.ts index c94696c6401..ebb0fa6f105 100644 --- a/packages/sim-cli/src/commands/protocol/workflow-source-check.test.ts +++ b/packages/sim-cli/src/commands/protocol/workflow-source-check.test.ts @@ -721,6 +721,109 @@ describe('sim workflows source check', () => { expect(untyped()).toEqual([expect.stringContaining('')]) }) + describe('an untyped JSON reference the printed source already stored', () => { + const PRINTED = `// @sim-sdk 1 +import { api, fn, trigger, workflow } from '@sim/workflow-sdk' + +export default workflow('W', {}, () => { + const start = trigger.start('Start', {}) + const calc = fn('Calc', { code: 'return 1' }) + const call = api('Call', { url: 'https://x', method: 'POST', body: { n: calc.result.deep } }) + start.to(calc) + calc.to(call) +}) +` + /** Writes the lock and stored-edges record of `printed`, as a get leaves the directory. */ + function writePrinted(printed = PRINTED): void { + cacheCatalog() + writeLock(['start', 'calc', 'call']) + printedWithFixture() + const record = storedEdgesWrite( + { + files: { 'workflow.ts': printed }, + lock: JSON.parse(readFileSync(join(dir, '.sim/lock.json'), 'utf8')), + base: { fingerprint: 'sf1:a' }, + }, + JSON.parse(readFileSync(FIXTURE_CATALOG, 'utf8')) + ) + if (!record) throw new Error('no stored-edges record') + writeFileSync(join(dir, record[0]), record[1]) + } + const untyped = () => + ((result().diagnostics ?? []) as Array<{ code: string; message: string }>) + .filter((finding) => finding.code === 'W_JSON_REF_UNTYPED') + .map((finding) => finding.message) + + it('stays quiet when the block holding it and the block it reads are renamed', async () => { + writePrinted() + writeFileSync( + join(dir, 'workflow.ts'), + PRINTED.replace("fn('Calc',", "fn('Compute',").replace("api('Call',", "api('Call API',") + ) + + await check() + + expect(result()).toMatchObject({ errors: 0 }) + expect(untyped()).toEqual([]) + }) + + it('stays quiet when another field of its block is edited', async () => { + writePrinted() + writeFileSync( + join(dir, 'workflow.ts'), + PRINTED.replace("url: 'https://x'", "url: 'https://y'") + ) + + await check() + + expect(untyped()).toEqual([]) + }) + + it('is reported once its field is edited, with the reference the edit added', async () => { + writePrinted() + writeFileSync( + join(dir, 'workflow.ts'), + PRINTED.replace('{ n: calc.result.deep }', '{ n: calc.result.deep, m: calc.result.other }') + ) + + await check() + + expect(untyped()).toEqual([ + expect.stringContaining(''), + expect.stringContaining(''), + ]) + }) + + it('is reported where the Function it reads typed it until an edit of its code', async () => { + const typed = PRINTED.replace("code: 'return 1'", "code: 'return [1, 2]'").replace( + '{ n: calc.result.deep }', + '{ n: calc.result.deep, all: calc.result }' + ) + writePrinted(typed) + writeFileSync(join(dir, 'workflow.ts'), typed) + await checkIn(dir, '--strict') + expect(untyped()).toEqual([expect.stringContaining('')]) + + writeFileSync( + join(dir, 'workflow.ts'), + typed.replace("code: 'return [1, 2]'", "code: 'return input.items'") + ) + + await check() + + expect(untyped()).toEqual([expect.stringContaining('')]) + }) + + it('is reported with --strict', async () => { + writePrinted() + writeFileSync(join(dir, 'workflow.ts'), PRINTED.replace("api('Call',", "api('Call API',")) + + await checkIn(dir, '--strict') + + expect(untyped()).toEqual([expect.stringContaining('')]) + }) + }) + it('fails on an iteration reference a new block reads outside its loop, and on one a move left behind', async () => { cacheCatalog() const source = (echo: string) => `// @sim-sdk 1 diff --git a/packages/workflow-code/src/compile/index.ts b/packages/workflow-code/src/compile/index.ts index d482d233487..176314acb9e 100644 --- a/packages/workflow-code/src/compile/index.ts +++ b/packages/workflow-code/src/compile/index.ts @@ -29,6 +29,7 @@ import type { CanonicalWorkflow, CanonicalWorkflowMeta, PortKey, + SubBlockId, VarKey, } from '../model' import { getOwn, setOwn } from '../records' @@ -92,6 +93,14 @@ export interface CompileInput { * be stored. */ storedUnreadEdges?: ReadonlyArray + /** + * With `storedUnread`, the JSON fields that held a bare reference nothing types when that lock + * was written, by lock key (a get's printed source compiled: `CompileResult.untypedJsonFields`). + * Such a reference reports no `W_JSON_REF_UNTYPED` while its field compiles to the text it held, + * through the lock's renames, as one the stored workflow holds does against `stored`. Absent, + * every untyped reference is reported. + */ + storedUnreadUntypedFields?: ReadonlyArray /** * Stored block keys the source renamed, stored key → source key (`lockIdentRenames`, which the * server computes against `stored`; with `storedUnread` the compile computes them itself). An @@ -156,6 +165,19 @@ export interface CompileResult { * `CompileInput.storedUnreadEdges`. */ edges: StoredEdgeRef[] + /** + * Every JSON field holding a bare reference nothing types, reported or not, by block key: what + * an offline check records of a get's printed source as `CompileInput.storedUnreadUntypedFields`. + */ + untypedJsonFields: UntypedJsonField[] +} + +/** A JSON field holding bare references nothing types: the text it stores and those references. */ +export interface UntypedJsonField { + block: BlockKey + param: SubBlockId + value: string + refs: string[] } /** One edge as `CompileInput.storedUnreadEdges` names it: block keys and the port's `portKey`. */ @@ -464,47 +486,58 @@ function emptyResult(reporter: Reporter, sdkMajor: number | null): CompileResult sdkMajor, envReferences: [], edges: [], + untypedJsonFields: [], } } const BYTE_ORDER_MARK = '\uFEFF' /** - * The stored workflow as the source names it: `block` looks a block up by its source key (under - * that key in a stored model re-keyed by the renames, else under its stored key) and `holds` says - * whether a param holds `value` already, both through the block renames of the apply (`renamed`, - * stored key → source key), whose reference rewrites are no edit of the source. + * Whether a bare reference nothing types (`token`, in JSON field `param` of source block `key`, + * which now stores `value`) is one the stored workflow already holds that way, through the block + * renames of the apply (`renamed`, stored key → source key), whose reference rewrites are no edit + * of the source. Against `stored`, the field stores `value` already and the reference reads no + * Function whose stored code typed it: one that now returns something unreadable where it returned + * a number makes the same bare token break the JSON. Against what an offline check recorded of the + * printed source (`unread`), the field held `value` and this reference, untyped, when the lock was + * written. */ -interface StoredView { - block(key: BlockKey): CanonicalBlock | undefined - holds(key: BlockKey, param: string, value: string): boolean -} - -function storedView( +function untypedRefHeld( stored: CanonicalWorkflow | undefined, + unread: ReadonlyArray | undefined, renamed: ReadonlyMap -): StoredView { +): (key: BlockKey, param: SubBlockId, value: string, token: string) => boolean { const storedKeyOf = new Map([...renamed].map(([from, to]) => [to, from])) const rewrite = renamedReferenceRewriter([...renamed].map(([from, to]) => ({ from, to }))) - const block = (key: BlockKey) => { - if (!stored) return undefined + /** `lookup` of the source key, else of the stored key it was renamed from. */ + const throughRenames = (key: BlockKey, lookup: (key: BlockKey) => T | undefined) => { const storedKey = storedKeyOf.get(key) - return ( - getOwn(stored.blocks, key) ?? - (storedKey === undefined ? undefined : getOwn(stored.blocks, storedKey)) - ) + return lookup(key) ?? (storedKey === undefined ? undefined : lookup(storedKey)) } - return { - block, - holds: (key, param, value) => { + if (stored) { + const block = (key: BlockKey) => + throughRenames(key, (candidate) => getOwn(stored.blocks, candidate)) + return (key, param, value, token) => { const held = block(key) const storedParam = held ? getOwn(held.params, param) : undefined return ( storedParam?.kind === 'value' && typeof storedParam.value === 'string' && - rewrite(storedParam.value) === value + rewrite(storedParam.value) === value && + referencedResultKind(token, block) === undefined ) - }, + } + } + const fields = new Map( + (unread ?? []).map((field) => [`${field.block}\u0000${field.param}`, field]) + ) + return (key, param, value, token) => { + const field = throughRenames(key, (candidate) => fields.get(`${candidate}\u0000${param}`)) + return ( + field !== undefined && + rewrite(field.value) === value && + field.refs.some((ref) => rewrite(ref) === token) + ) } } @@ -724,7 +757,11 @@ function compileEntry( const renamed = new Map([...unreadRenames, ...(input.renamedKeys ?? [])]) checkCodeFileRefs(ctx, renamed) checkUnresolvedTags(ctx, renamed) - const stored = storedView(input.stored, renamed) + const heldUntyped = untypedRefHeld( + input.stored, + storedUnread && input.storedUnreadUntypedFields, + renamed + ) const refTypes: RefTypeScope = { catalog: input.catalog, @@ -735,20 +772,21 @@ function compileEntry( const isString = (token: string) => refValueKind(token, refTypes) === 'string' /** Bare references nothing types, reported once the unknown paths are known (see below). */ const untyped: Array<{ token: string; range: Range; blockKey: BlockKey }> = [] + const untypedJsonFields: UntypedJsonField[] = [] for (const { params, id, tree, refs } of ctx.jsonFields) { const value = jsonFieldText(tree, isString) setOwn(params, id, { kind: 'value', value }) - for (const ref of refs) { - if (refValueKind(ref.token, refTypes) !== 'untyped') continue - // An unchanged field stays quiet only while what it reads is too: a Function that now - // returns something unreadable where it returned a number makes the same bare token break - // the JSON. - if ( - stored.holds(ref.blockKey, id, value) && - referencedResultKind(ref.token, stored.block) === undefined - ) { - continue - } + const untypedRefs = refs.filter((ref) => refValueKind(ref.token, refTypes) === 'untyped') + const [first] = untypedRefs + if (!first) continue + untypedJsonFields.push({ + block: first.blockKey, + param: id, + value, + refs: untypedRefs.map((ref) => ref.token), + }) + for (const ref of untypedRefs) { + if (heldUntyped(ref.blockKey, id, value, ref.token)) continue untyped.push({ token: ref.token, range: ref.range, blockKey: ref.blockKey }) } } @@ -837,5 +875,6 @@ function compileEntry( sdkMajor: parsed.sdkMajor, envReferences: [...ctx.envReferences].sort(compareStrings), edges: sortedEdges.map((edge) => ({ from: edge.from, port: portKey(edge.port), to: edge.to })), + untypedJsonFields, } } diff --git a/packages/workflow-code/src/index.ts b/packages/workflow-code/src/index.ts index 08e51782f2b..83c55f63d51 100644 --- a/packages/workflow-code/src/index.ts +++ b/packages/workflow-code/src/index.ts @@ -51,6 +51,7 @@ export { type CompileResult, compileWorkflow, type StoredEdgeRef, + type UntypedJsonField, } from './compile' export { codePointLabel, scriptName } from './compile/characters' export { didYouMean, suggestBuilder } from './compile/hints'