@pipefy/pipefy-process-coder 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +33 -2
- package/LICENSE +202 -0
- package/NOTICE +11 -0
- package/README.md +6 -2
- package/dist/apply/adopt.js +52 -0
- package/dist/cli.js +14 -5
- package/dist/codec/pack.js +2 -0
- package/dist/codec/unpack.js +1 -0
- package/dist/commands/apply.js +25 -6
- package/dist/commands/context.js +40 -2
- package/dist/commands/diff.js +22 -20
- package/dist/commands/misc.js +55 -34
- package/dist/commands/plan.js +3 -1
- package/dist/commands/pull.js +54 -6
- package/dist/commands/verify.js +11 -32
- package/dist/diff/diff.js +28 -4
- package/dist/pipefy/agents.js +36 -27
- package/dist/pipefy/internal.js +201 -92
- package/dist/pipefy/ipaas.js +4 -3
- package/dist/pipefy/reconstruct.js +147 -39
- package/dist/pipefy/toolkit.js +27 -11
- package/dist/pipefy/toolkit_bearer.py +60 -14
- package/dist/report/run.js +2 -1
- package/dist/util/log.js +14 -4
- package/dist/util/tui.js +43 -2
- package/dist/version.js +18 -0
- package/dist/workspace/docs.js +1 -1
- package/dist/workspace/read.js +1 -0
- package/package.json +4 -3
package/AGENTS.md
CHANGED
|
@@ -83,6 +83,23 @@ webhooks", and conflating them licenses deleting a client's live integrations.
|
|
|
83
83
|
Applies to iPaaS flows identically: a pipe whose iPaaS is off gets `unknown`, and
|
|
84
84
|
its flows are not compared at all.
|
|
85
85
|
|
|
86
|
+
**Rows and columns are covered separately.** `coverage` says whether every *row*
|
|
87
|
+
of a group was read; `columns` (in `_meta.json`) whether every *column* was. A
|
|
88
|
+
GraphQL reconstruction reads every phase, field and label and still lacks
|
|
89
|
+
`color_uuid` or a label's `uuid`, so its rows are `complete` and its columns
|
|
90
|
+
`partial`. The diff reads them for different questions: a missing column on a
|
|
91
|
+
partial side is "unseen", never "set to null"; a missing *row* is only unseen
|
|
92
|
+
when the rows are partial, and only then is a create or delete held back. These
|
|
93
|
+
were once one flag, and a reconstruction marked everything `partial` — which,
|
|
94
|
+
while the snapshot download was failing on every pipe, left every pull able to
|
|
95
|
+
update and unable to create or delete anything.
|
|
96
|
+
|
|
97
|
+
**And a held-back create or delete stops the plan.** Between a workspace and its
|
|
98
|
+
own baseline each one is an edit someone made, so `plan` and `apply` refuse,
|
|
99
|
+
naming them, rather than apply the rest (`suppressedEdits`, `--force` to apply
|
|
100
|
+
the rest anyway). Applying 20 updates without the 2 phase creates they pointed
|
|
101
|
+
at would have left a pipe with no final phase.
|
|
102
|
+
|
|
86
103
|
### Refuse rather than guess, per column
|
|
87
104
|
|
|
88
105
|
`src/apply/registry.ts` records, for every entity and operation, whether a write
|
|
@@ -250,6 +267,11 @@ live running. Do not re-derive them. The shapes that bite most often:
|
|
|
250
267
|
| a field condition testing the field it hides | stored happily, and the **phase form stops opening**. The API validates none of this — not the self-reference, not the operation, not even `not_a_real_operation` |
|
|
251
268
|
| `automationVariables.active` | omitted for the life of the tool, so disabling an automation was a no-op that reported success |
|
|
252
269
|
| `updateAutomation` | works, across every field map dimension. The recipes' delete-and-recreate was inherited, not measured |
|
|
270
|
+
| internal `AutomationActionParams.aiBehaviorParams` | an **object** (`AiBehaviorParams`), the same type the public `aiAgents` read selects. Selected bare, the whole `loadAutomation` document fails validation — so *every* automation in the pipe loads without `action_params`, not only the AI ones. One selection, `AI_BEHAVIOR_PARAMS_SELECTION`, serves both reads |
|
|
271
|
+
| a snapshot's `signedUrl` | `app.pipefy.com/storage/v1/signed/…`, and it can answer **HTTP 500** with Pipefy's own error page while `createRepoSnapshot` and the `UPLOADED` status both succeed — measured on two unrelated pipes, old snapshots and new. A pull falls back to reconstruction rather than write a workspace with no pipe in it; `--no-fallback` refuses instead |
|
|
272
|
+
| internal `automations(organizationId:, repoId:)` | the organization must be **the pipe's own**. Asked under another organization the credential also belongs to, it answers `Couldn't find Repo with 'id'=…` about a pipe that exists — so a saved default org silently left every automation unknown on pipes from other orgs. The repo's `organization_id` wins; the default is only the fallback |
|
|
273
|
+
| `Pipe.pipe_relations` | **does not exist** publicly. The relations are `parentsRelations` and `childrenRelations`, and their `parent` / `child` are a **union** (`RepoTypes`: Pipe \| Table) — `{ id }` is refused until spread with `... on Pipe { id } ... on Table { id }`. The reconstruction asked for the missing field for its whole life, so pipe_relations was always `unknown` without a snapshot |
|
|
274
|
+
| reconstruction without a snapshot | every group the compiler can write now has a public read: `Phase.teamMembers`, `Pipe.preferences`, `Pipe.publicForm` (its `submitterEmailCollectionMethod` is the payload's `submitter_email_required`). With rows `complete`, a pull whose snapshot download fails supports the whole loop. Only read-only groups stay `unknown` |
|
|
253
275
|
| iPaaS `IMPORT_FLOW` | migrates the tree it is given; never use it |
|
|
254
276
|
| iPaaS connections | the host marks any credential `ACTIVE` **without validating it** |
|
|
255
277
|
| `POST /app-connections/{id}` | accepts `scope` and `projectIds` and returns 200 ignoring both |
|
|
@@ -308,11 +330,20 @@ way `pipe pull` would notice.
|
|
|
308
330
|
|
|
309
331
|
All three automation mutations are **public** and were being sent to the internal
|
|
310
332
|
endpoint — inherited from the Change Migrator recipes and never re-checked, which
|
|
311
|
-
made automations the one entity written through an unversioned endpoint
|
|
312
|
-
|
|
333
|
+
made automations the one entity written through an unversioned endpoint, for
|
|
334
|
+
no reason. Before adding anything to `registry.ts` with
|
|
313
335
|
`transport: 'internal'`, introspect the public schema for it. If it genuinely is
|
|
314
336
|
not there, say which public mutation is missing and how that was verified.
|
|
315
337
|
|
|
338
|
+
The internal endpoint is unversioned, but it **does** answer introspection
|
|
339
|
+
(`__type(name:)` worked on it live) — this file used to say it did not. So a
|
|
340
|
+
query sent there can be checked against its schema like any other. Every read
|
|
341
|
+
query the internal adapter sends lives in `READ_QUERIES` (internal.ts), and
|
|
342
|
+
`pipe doctor` validates each one with ids that match nothing: a document the
|
|
343
|
+
schema refuses comes back with `errors` and no `data`, a valid one with `data`
|
|
344
|
+
and a not-found. That is how the bare-`aiBehaviorParams` drift would have shown
|
|
345
|
+
up before a user's pull did. Add a new internal read there, never a write.
|
|
346
|
+
|
|
316
347
|
### Probing is not free on this platform
|
|
317
348
|
|
|
318
349
|
Two separate incidents from the same wrong assumption — that schema validation
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Pipefy Process Coder
|
|
2
|
+
Copyright 2026 Pipefy, Inc.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Pipefy (https://www.pipefy.com).
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
7
|
+
use the files in this repository except in compliance with the License.
|
|
8
|
+
|
|
9
|
+
The "Pipefy" name, logo, and brand assets are trademarks of Pipefy, Inc.
|
|
10
|
+
and are NOT licensed under the Apache License 2.0. Use of the Pipefy
|
|
11
|
+
trademarks is subject to Pipefy's brand guidelines and prior authorization.
|
package/README.md
CHANGED
|
@@ -697,7 +697,7 @@ research/snap.json the pipe <pipeId> fixture every test runs against
|
|
|
697
697
|
| `pipe doctor` | capabilities, missing mutations, internal-API status |
|
|
698
698
|
| `pipe skills` | the agent skills this install ships with; `install` hands off to `npx skills add` |
|
|
699
699
|
| `pipe create <name>` | create an empty pipe and pull it, ready to be built from files |
|
|
700
|
-
| `pipe pull <id>` | pull into a workspace; `--depth`, `--reuse-snapshot`, `--from-file` |
|
|
700
|
+
| `pipe pull <id>` | pull into a workspace; `--depth`, `--reuse-snapshot`, `--no-fallback`, `--from-file` |
|
|
701
701
|
| `pipe export <id>` | one repo as a single payload, no workspace, no token needed to consume |
|
|
702
702
|
| `pipe validate` | offline shape + integrity |
|
|
703
703
|
| `pipe diff` | baseline, live, or cross-repo; `--html`, `--open`, `--json` |
|
|
@@ -823,4 +823,8 @@ A successful pipe apply rewrites your files. It adopts each created entity's rea
|
|
|
823
823
|
[] - Check the baseline is not stale before planning: compare the pulled version id against the live one, and refuse to propose deletions when the pipe has moved since the pull. A stale baseline turns someone else's changes into a diff — seen live, where a verification diff listed five changes made elsewhere as deletions the workspace wanted
|
|
824
824
|
[] - pipe pull inside a workspace pulls the pipes automatically
|
|
825
825
|
[] - One design point worth stating
|
|
826
|
-
Each repo still applies independently — own plan file, own pre-apply snapshot, own verify. That's deliberate: they're separate repos with separate baselines, and a failure in one must not roll back or abandon another that already succeeded. So it's a loop over the real thing, not a merged mega-plan. Exit code is the worst of them. --plan and --resume stay single-repo, since a saved plan belongs to exactly one.
|
|
826
|
+
Each repo still applies independently — own plan file, own pre-apply snapshot, own verify. That's deliberate: they're separate repos with separate baselines, and a failure in one must not roll back or abandon another that already succeeded. So it's a loop over the real thing, not a merged mega-plan. Exit code is the worst of them. --plan and --resume stay single-repo, since a saved plan belongs to exactly one.
|
|
827
|
+
|
|
828
|
+
## License
|
|
829
|
+
|
|
830
|
+
Apache-2.0 — see [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE). Copyright 2026 Pipefy, Inc. The Pipefy name, logo and brand assets are trademarks of Pipefy, Inc. and are not covered by the license.
|
package/dist/apply/adopt.js
CHANGED
|
@@ -126,3 +126,55 @@ export const renderAdopted = (adopted) => {
|
|
|
126
126
|
lines.push(` …and ${adopted.length - 8} more`);
|
|
127
127
|
return lines;
|
|
128
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* The baseline after an apply that verified, when the read-back was not a
|
|
131
|
+
* snapshot: the workspace for every group the baseline could see, the old
|
|
132
|
+
* baseline for every group it could not.
|
|
133
|
+
*
|
|
134
|
+
* Without this only created ids reached the baseline (mergeAdoptedIntoBaseline),
|
|
135
|
+
* so every update and delete an apply had just made stayed "pending" in the
|
|
136
|
+
* next diff. An update resent is harmless; a delete resent is refused by the
|
|
137
|
+
* API, about a field the apply itself removed. Found on the first real apply
|
|
138
|
+
* after snapshot downloads started failing, when this became the only path.
|
|
139
|
+
*
|
|
140
|
+
* Why the workspace is safe to adopt here, when a reconstruction is not (see
|
|
141
|
+
* the post-snapshot branch in apply.ts): verify has just confirmed that the
|
|
142
|
+
* live pipe satisfies everything the workspace states, and the workspace
|
|
143
|
+
* carries every row the baseline did unless the author removed it — which the
|
|
144
|
+
* apply has also done. A group `unknown` on the baseline was never diffed, so
|
|
145
|
+
* an edit there was never applied, and adopting it would mark unapplied work
|
|
146
|
+
* done. Those groups keep the baseline's copy.
|
|
147
|
+
*/
|
|
148
|
+
/**
|
|
149
|
+
* Phases carry two folded groups that may be unknown on their own. The phase
|
|
150
|
+
* and field rows come from the workspace; a folded list the baseline could not
|
|
151
|
+
* see keeps the baseline's copy, matched by phase id.
|
|
152
|
+
*/
|
|
153
|
+
const advancePhases = (baseline, applied, jumpsSeen, teamSeen) => {
|
|
154
|
+
if (jumpsSeen && teamSeen)
|
|
155
|
+
return applied.phases;
|
|
156
|
+
const before = new Map(baseline.phases.map((ph) => [String(ph['id']), ph]));
|
|
157
|
+
return applied.phases.map((ph) => {
|
|
158
|
+
const old = before.get(String(ph['id']));
|
|
159
|
+
return {
|
|
160
|
+
...ph,
|
|
161
|
+
jump_target_ids: jumpsSeen ? ph.jump_target_ids : (old?.jump_target_ids ?? []),
|
|
162
|
+
team_member_ids: teamSeen ? ph.team_member_ids : (old?.team_member_ids ?? []),
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
export const advanceBaseline = (baseline, applied) => {
|
|
167
|
+
const seen = (...groups) => groups.every((g) => (baseline.meta.coverage[g] ?? 'unknown') !== 'unknown');
|
|
168
|
+
return {
|
|
169
|
+
...baseline,
|
|
170
|
+
repo: applied.repo,
|
|
171
|
+
phases: seen('phases', 'fields') ? advancePhases(baseline, applied, seen('phase_jumps'), seen('phase_team_memberships')) : baseline.phases,
|
|
172
|
+
automations: seen('automations') ? applied.automations : baseline.automations,
|
|
173
|
+
field_conditions: seen('field_conditions') ? applied.field_conditions : baseline.field_conditions,
|
|
174
|
+
labels: seen('labels') ? applied.labels : baseline.labels,
|
|
175
|
+
webhooks: seen('webhooks') ? applied.webhooks : baseline.webhooks,
|
|
176
|
+
pipe_relations: seen('pipe_relations') ? applied.pipe_relations : baseline.pipe_relations,
|
|
177
|
+
public_form: seen('public_forms') ? applied.public_form : baseline.public_form,
|
|
178
|
+
preferences: seen('repo_preferences') ? applied.preferences : baseline.preferences,
|
|
179
|
+
};
|
|
180
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -129,12 +129,9 @@ const main = async () => {
|
|
|
129
129
|
* question behind the version check.
|
|
130
130
|
*/
|
|
131
131
|
if (parsed.command === '--version' || parsed.command === '-V' || parsed.command === 'version') {
|
|
132
|
-
const { readFile } = await import('node:fs/promises');
|
|
133
132
|
const { fileURLToPath } = await import('node:url');
|
|
134
|
-
const {
|
|
135
|
-
|
|
136
|
-
const pkg = JSON.parse(await readFile(join(here, '..', 'package.json'), 'utf8'));
|
|
137
|
-
out(`${pkg.name} ${pkg.version}`);
|
|
133
|
+
const { PACKAGE_NAME, TOOL_VERSION } = await import("./version.js");
|
|
134
|
+
out(`${PACKAGE_NAME} ${TOOL_VERSION}`);
|
|
138
135
|
out(dim(` node ${process.version} (needs >=22.18 for native type stripping)`));
|
|
139
136
|
out(dim(` running ${fileURLToPath(import.meta.url)}`));
|
|
140
137
|
return 0;
|
|
@@ -164,6 +161,18 @@ const main = async () => {
|
|
|
164
161
|
const code = await cmd.run(parsed);
|
|
165
162
|
return typeof code === 'number' ? code : 0;
|
|
166
163
|
};
|
|
164
|
+
/**
|
|
165
|
+
* A reader that stops early — `pipe doctor | head`, a pager quit — closes the
|
|
166
|
+
* pipe, and the next write raised an unhandled EPIPE with a Node stack trace.
|
|
167
|
+
* The reader has what it wanted; there is no one left to tell.
|
|
168
|
+
*/
|
|
169
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
170
|
+
stream.on('error', (e) => {
|
|
171
|
+
if (e.code === 'EPIPE')
|
|
172
|
+
process.exit(process.exitCode ?? 0);
|
|
173
|
+
throw e;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
167
176
|
main()
|
|
168
177
|
.then((code) => {
|
|
169
178
|
process.exitCode = code;
|
package/dist/codec/pack.js
CHANGED
|
@@ -83,6 +83,8 @@ export const packEnvelope = (tree) => ({
|
|
|
83
83
|
readAt: tree.meta.readAt,
|
|
84
84
|
repoKind: tree.meta.repoKind,
|
|
85
85
|
coverage: tree.meta.coverage,
|
|
86
|
+
...(tree.meta.columns ? { columns: tree.meta.columns } : {}),
|
|
87
|
+
repo_columns: tree.meta.repo_columns,
|
|
86
88
|
notes: tree.meta.notes,
|
|
87
89
|
payload: pack(tree),
|
|
88
90
|
});
|
package/dist/codec/unpack.js
CHANGED
package/dist/commands/apply.js
CHANGED
|
@@ -10,7 +10,7 @@ import { unpack } from "../codec/unpack.js";
|
|
|
10
10
|
import { packEnvelope } from "../codec/pack.js";
|
|
11
11
|
import { upsertRepo, writeLock } from "../workspace/lock.js";
|
|
12
12
|
import { renderStamp, stampCreated } from "../workspace/stamp.js";
|
|
13
|
-
import { adoptCreatedIds, mergeAdoptedIntoBaseline, renderAdopted } from "../apply/adopt.js";
|
|
13
|
+
import { adoptCreatedIds, advanceBaseline, mergeAdoptedIntoBaseline, renderAdopted } from "../apply/adopt.js";
|
|
14
14
|
import { baselineFile, planFile, planFileFor, findPlanFile } from "../workspace/layout.js";
|
|
15
15
|
import { diffTrees } from "../diff/diff.js";
|
|
16
16
|
import { compile } from "../apply/compile.js";
|
|
@@ -19,7 +19,7 @@ import { execute } from "../apply/execute.js";
|
|
|
19
19
|
import { validateTree, blockingErrors } from "../validate/index.js";
|
|
20
20
|
import { connect, openWorkspace, resolveWorkspace } from "./context.js";
|
|
21
21
|
import { checkGit } from "../util/git.js";
|
|
22
|
-
import { loadBaseline, loadBaselineEnvelope, refFor } from "./diff.js";
|
|
22
|
+
import { loadBaseline, loadBaselineEnvelope, refFor, refuseSuppressedEdits } from "./diff.js";
|
|
23
23
|
import { loadPlan, renderPlan, warnUnverifiedSteps } from "./plan.js";
|
|
24
24
|
import { verifyRepo } from "./verify.js";
|
|
25
25
|
import { restoreToVersion } from "./misc.js";
|
|
@@ -438,6 +438,7 @@ const applyOneRepo = async (p) => {
|
|
|
438
438
|
}
|
|
439
439
|
rec?.before(await loadBaselineEnvelope(root, repo.id));
|
|
440
440
|
const changeSet = diffTrees(baseline, edited);
|
|
441
|
+
refuseSuppressedEdits(changeSet, bool(p, 'force'));
|
|
441
442
|
if (!changeSet.changes.length) {
|
|
442
443
|
/**
|
|
443
444
|
* The pipe half is clean. That is not the same as nothing to apply: flows
|
|
@@ -702,6 +703,7 @@ const applyOneRepo = async (p) => {
|
|
|
702
703
|
*/
|
|
703
704
|
const takeSnapshot = caps.snapshots && (bool(p, 'post-snapshot') || (await confirmPostSnapshot(p)));
|
|
704
705
|
const verified = await verifyRepo({
|
|
706
|
+
parsed: p,
|
|
705
707
|
net,
|
|
706
708
|
root,
|
|
707
709
|
lock,
|
|
@@ -710,8 +712,15 @@ const applyOneRepo = async (p) => {
|
|
|
710
712
|
idMap: result.idMap,
|
|
711
713
|
preferReconstruct: !takeSnapshot,
|
|
712
714
|
});
|
|
715
|
+
/**
|
|
716
|
+
* What was actually read, not what was asked for. A requested snapshot can
|
|
717
|
+
* come back as a reconstruction when the download fails (readLive), and
|
|
718
|
+
* everything below that adopts the read-back wholesale is only safe on a
|
|
719
|
+
* real snapshot — so it keys on this, never on takeSnapshot.
|
|
720
|
+
*/
|
|
721
|
+
const realRead = verified.envelope.source === 'snapshot';
|
|
713
722
|
if (!verified.ok) {
|
|
714
|
-
warn(
|
|
723
|
+
warn(realRead
|
|
715
724
|
? 'verification found differences between what was applied and what the workspace asks for:'
|
|
716
725
|
: 'a free, GraphQL-reconstructed comparison found differences — coverage gaps may hide more (see below):');
|
|
717
726
|
out(verified.render);
|
|
@@ -730,7 +739,7 @@ const applyOneRepo = async (p) => {
|
|
|
730
739
|
* GraphQL reconstruction's partial coverage risks the same "adopt an
|
|
731
740
|
* absence as a deletion" mistake the coverage doctrine exists to avoid.
|
|
732
741
|
*/
|
|
733
|
-
if (
|
|
742
|
+
if (realRead) {
|
|
734
743
|
const authored = await readTree(dir);
|
|
735
744
|
const previous = await loadBaselineEnvelope(root, repo.id);
|
|
736
745
|
const stamp = stampCreated(authored, unpack(verified.envelope), previous ? unpack(previous) : null);
|
|
@@ -754,10 +763,20 @@ const applyOneRepo = async (p) => {
|
|
|
754
763
|
await reportRun(rec, 'partial', `all ${result.done} steps applied, but verification found differences`);
|
|
755
764
|
return 1;
|
|
756
765
|
}
|
|
757
|
-
ok(
|
|
766
|
+
ok(realRead ? 'verified — the pipe now matches the workspace' : 'verified against a free GraphQL reconstruction — the pipe matches the workspace');
|
|
758
767
|
rec?.after(verified.envelope);
|
|
759
768
|
rec?.verified(true);
|
|
760
|
-
if (
|
|
769
|
+
if (!realRead) {
|
|
770
|
+
// The read-back is not adopted (see advanceBaseline); the verified
|
|
771
|
+
// workspace is, for every group the baseline could see.
|
|
772
|
+
const previousEnvelope = await loadBaselineEnvelope(root, repo.id);
|
|
773
|
+
if (previousEnvelope) {
|
|
774
|
+
const next = advanceBaseline(unpack(previousEnvelope), await readTree(dir));
|
|
775
|
+
await writeJson(baselineFile(root, repo.id), { ...packEnvelope(next), readAt: new Date().toISOString() });
|
|
776
|
+
info(dim(' baseline advanced to the applied workspace — the next diff starts from what is now live'));
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
if (realRead) {
|
|
761
780
|
/**
|
|
762
781
|
* Adopt the live state as both the workspace and the baseline —
|
|
763
782
|
* strictly more complete than the id-only adoption above, since it also
|
package/dist/commands/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
2
2
|
import { LIMITS, credentialProvider, readOrgId } from "../config.js";
|
|
3
3
|
import { exists } from "../util/fsx.js";
|
|
4
|
-
import { UserError, debug } from "../util/log.js";
|
|
4
|
+
import { UserError, debug, warn } from "../util/log.js";
|
|
5
5
|
import { PipefyClient } from "../pipefy/client.js";
|
|
6
6
|
import { InternalApi } from "../pipefy/internal.js";
|
|
7
7
|
import { SnapshotClient } from "../pipefy/snapshot.js";
|
|
@@ -10,7 +10,8 @@ import { IpaasClient } from "../pipefy/ipaas.js";
|
|
|
10
10
|
import { detect } from "../pipefy/capability.js";
|
|
11
11
|
import { paths } from "../workspace/layout.js";
|
|
12
12
|
import { readLock } from "../workspace/lock.js";
|
|
13
|
-
import { str } from "../cli/args.js";
|
|
13
|
+
import { bool, str } from "../cli/args.js";
|
|
14
|
+
import { fullCoverage } from "../model/payload.js";
|
|
14
15
|
export const connect = async (p) => {
|
|
15
16
|
/**
|
|
16
17
|
* One credential, shared by the public client and the internal adapter, and
|
|
@@ -77,3 +78,40 @@ export const openWorkspace = async (p, positionalIndex = 0) => {
|
|
|
77
78
|
return { root, lock, repo, repoDir: join(root, repo.dir) };
|
|
78
79
|
};
|
|
79
80
|
export const readConcurrency = () => LIMITS.readConcurrency;
|
|
81
|
+
/**
|
|
82
|
+
* Read one repo live: a snapshot when the endpoint has them and the caller
|
|
83
|
+
* wants one, a GraphQL reconstruction otherwise — and a reconstruction when
|
|
84
|
+
* the snapshot read fails.
|
|
85
|
+
*
|
|
86
|
+
* The fallback is the point. Pipefy's storage answered every signed snapshot
|
|
87
|
+
* URL with HTTP 500 for days while creation and the UPLOADED status were
|
|
88
|
+
* fine, and every command that read live through a snapshot — verify, diff
|
|
89
|
+
* --against live, a cross-repo diff, export — failed outright, after `pull`
|
|
90
|
+
* had already learned to carry on. Reconstruction says per group what it
|
|
91
|
+
* could not see, so falling back never makes absence look like deletion.
|
|
92
|
+
* `--no-fallback` keeps the old refusal.
|
|
93
|
+
*/
|
|
94
|
+
export const readLive = async (net, p, repoId, opts = {}) => {
|
|
95
|
+
const caps = await net.capabilities();
|
|
96
|
+
const reconstruct = () => net.reconstructor.reconstruct(repoId, { organizationId: opts.organizationId ?? net.organizationId, noInternal: opts.noInternal });
|
|
97
|
+
if (!caps.snapshots || opts.preferSnapshot === false)
|
|
98
|
+
return reconstruct();
|
|
99
|
+
try {
|
|
100
|
+
const { payload, versionId } = await net.snapshots.pull(repoId, opts.label);
|
|
101
|
+
return {
|
|
102
|
+
source: 'snapshot',
|
|
103
|
+
versionId,
|
|
104
|
+
readAt: new Date().toISOString(),
|
|
105
|
+
repoKind: opts.kind ?? 'pipe',
|
|
106
|
+
coverage: fullCoverage('complete'),
|
|
107
|
+
notes: [],
|
|
108
|
+
payload,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
if (bool(p, 'no-fallback'))
|
|
113
|
+
throw e;
|
|
114
|
+
warn(`snapshot read failed for repo ${repoId}: ${e.message} — reading it over GraphQL instead (--no-fallback to stop here)`);
|
|
115
|
+
return reconstruct();
|
|
116
|
+
}
|
|
117
|
+
};
|
package/dist/commands/diff.js
CHANGED
|
@@ -6,10 +6,10 @@ import { UserError, bold, dim, info, ok, out, warn } from "../util/log.js";
|
|
|
6
6
|
import { unpack } from "../codec/unpack.js";
|
|
7
7
|
import { readTree } from "../workspace/read.js";
|
|
8
8
|
import { baselineFile, repoDir } from "../workspace/layout.js";
|
|
9
|
-
import { diffTrees } from "../diff/diff.js";
|
|
9
|
+
import { diffTrees, suppressedEdits } from "../diff/diff.js";
|
|
10
10
|
import { renderChangeSet, toJson } from "../diff/render.js";
|
|
11
11
|
import { renderHtml } from "../diff/html.js";
|
|
12
|
-
import { connect, openWorkspace } from "./context.js";
|
|
12
|
+
import { connect, openWorkspace, readLive } from "./context.js";
|
|
13
13
|
import { diffFlowsFor } from "./flows.js";
|
|
14
14
|
import { renderFlowChanges } from "../diff/flow.js";
|
|
15
15
|
import { diffAgentsFor } from "./agents.js";
|
|
@@ -43,9 +43,7 @@ export const run = async (p) => {
|
|
|
43
43
|
const net = await connect(p);
|
|
44
44
|
const caps = await net.capabilities();
|
|
45
45
|
info(dim(`re-reading pipe ${repo.id} (${caps.snapshots ? 'snapshot' : 'GraphQL reconstruction'})`));
|
|
46
|
-
const env =
|
|
47
|
-
? await liveSnapshot(net, repo.id)
|
|
48
|
-
: await net.reconstructor.reconstruct(repo.id, { organizationId: lock.organizationId });
|
|
46
|
+
const env = await readLive(net, p, repo.id, { kind: repo.kind, organizationId: lock.organizationId });
|
|
49
47
|
baseline = unpack(env);
|
|
50
48
|
}
|
|
51
49
|
else if (against !== 'baseline') {
|
|
@@ -61,9 +59,9 @@ export const run = async (p) => {
|
|
|
61
59
|
}
|
|
62
60
|
else {
|
|
63
61
|
const net = await connect(p);
|
|
64
|
-
const caps = await net.capabilities();
|
|
65
62
|
info(dim(`reading pipe ${otherId} live for a cross-repo diff`));
|
|
66
|
-
|
|
63
|
+
// The other pipe's own organization, not this workspace's (readLive -> reconstruct).
|
|
64
|
+
const env = await readLive(net, p, otherId, { organizationId: null });
|
|
67
65
|
baseline = unpack(env);
|
|
68
66
|
}
|
|
69
67
|
}
|
|
@@ -219,6 +217,23 @@ export const run = async (p) => {
|
|
|
219
217
|
* report does not: a report keeps the payload verbatim so the run folder is a
|
|
220
218
|
* usable copy of the pipe, not a reshaped one.
|
|
221
219
|
*/
|
|
220
|
+
/**
|
|
221
|
+
* Refuse a plan that would apply only part of what the workspace asks for.
|
|
222
|
+
* See suppressedEdits. `--force` keeps its meaning elsewhere — apply what can
|
|
223
|
+
* be applied — and says out loud what it is leaving behind.
|
|
224
|
+
*/
|
|
225
|
+
export const refuseSuppressedEdits = (cs, force) => {
|
|
226
|
+
const left = suppressedEdits(cs);
|
|
227
|
+
if (!left.length)
|
|
228
|
+
return;
|
|
229
|
+
const list = left.map((s) => ` ${s.op} ${s.entity}: ${s.label}`).join('\n');
|
|
230
|
+
if (force) {
|
|
231
|
+
warn(`--force: ${left.length} create/delete(s) in the workspace are left out of this plan:\n${list}`);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
throw new UserError(`${left.length} create/delete(s) in the workspace cannot be planned, because the baseline read those rows only partially:\n${list}\n` +
|
|
235
|
+
'Planning the rest without them would apply part of what was asked for.', 're-pull to refresh the baseline, or pass --force to apply the rest anyway');
|
|
236
|
+
};
|
|
222
237
|
export const loadBaselineEnvelope = async (root, repoId) => {
|
|
223
238
|
try {
|
|
224
239
|
return await readJson(baselineFile(root, repoId));
|
|
@@ -246,19 +261,6 @@ export const loadBaselineQuiet = async (root, repoId) => {
|
|
|
246
261
|
return null;
|
|
247
262
|
}
|
|
248
263
|
};
|
|
249
|
-
const liveSnapshot = async (net, repoId) => {
|
|
250
|
-
const { payload, versionId } = await net.snapshots.pull(repoId);
|
|
251
|
-
const { fullCoverage } = await import("../model/payload.js");
|
|
252
|
-
return {
|
|
253
|
-
source: 'snapshot',
|
|
254
|
-
versionId,
|
|
255
|
-
readAt: new Date().toISOString(),
|
|
256
|
-
repoKind: 'pipe',
|
|
257
|
-
coverage: fullCoverage('complete'),
|
|
258
|
-
notes: [],
|
|
259
|
-
payload,
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
264
|
export const writeHtml = async (path, changeSet, workspace, plan) => {
|
|
263
265
|
const html = renderHtml({ changeSet, plan, workspace, generatedAt: new Date().toISOString() });
|
|
264
266
|
await writeFile(path, html);
|