@shortlink-org/portolan 0.2.4 → 0.3.0
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/README.md +23 -0
- package/catalog/enum_test.go +46 -0
- package/catalog/evidence_test.go +35 -0
- package/catalog/model.go +1066 -0
- package/catalog/roundtrip_test.go +203 -0
- package/catalog/via_test.go +38 -0
- package/cli/init.test.mjs +6 -1
- package/cli/portolan.mjs +8 -0
- package/cli/portolan.test.mjs +49 -0
- package/go.mod +14 -0
- package/go.sum +20 -0
- package/internal/gocall/README.md +19 -0
- package/internal/gocall/analyze.go +189 -0
- package/internal/gocall/analyze_test.go +107 -0
- package/internal/gohttp/analyze.go +2562 -0
- package/internal/gohttp/destination.go +373 -0
- package/internal/gohttp/endpoints.go +1067 -0
- package/internal/gohttp/roots.go +320 -0
- package/internal/gohttp/typed.go +96 -0
- package/internal/goscan/constants.go +85 -0
- package/internal/goscan/goscan_test.go +227 -0
- package/internal/goscan/index.go +629 -0
- package/internal/goscan/index_test.go +66 -0
- package/internal/goscan/names.go +52 -0
- package/internal/goscan/parse_test.go +11 -0
- package/internal/goscan/source.go +37 -0
- package/internal/goscan/tree.go +284 -0
- package/internal/goscan/types.go +99 -0
- package/internal/wsdl/ids.go +127 -0
- package/internal/wsdl/ids_test.go +21 -0
- package/internal/wsdl/model.go +70 -0
- package/internal/wsdl/parse.go +949 -0
- package/internal/wsdl/parse_test.go +170 -0
- package/package.json +22 -10
- package/plugin/describe.go +118 -0
- package/plugin/describe_test.go +114 -0
- package/plugin/protocol.go +141 -0
- package/plugin/schematest/schematest.go +126 -0
- package/plugins/README.md +109 -46
- package/plugins/cmd/portolan-http-clients/main.go +19 -0
- package/plugins/extract-celery/extract.py +0 -2
- package/plugins/extract-celery/extract_test.py +1 -1
- package/plugins/extract-django/README.md +39 -17
- package/plugins/extract-django/domain.py +28 -17
- package/plugins/extract-django/extract.py +21 -7
- package/plugins/extract-django/extract_test.py +55 -2
- package/plugins/extract-django/lifecycle.py +2 -0
- package/plugins/extract-django/operations.py +1 -1
- package/plugins/extract-django/routing_test.py +109 -1
- package/plugins/extract-django/store.py +1 -1
- package/plugins/extract-django/transport.py +101 -55
- package/plugins/extract-django/verbs.py +241 -0
- package/plugins/extract-go/README.md +47 -0
- package/plugins/extract-http-clients/describe.go +19 -0
- package/plugins/extract-http-clients/describe_test.go +11 -0
- package/plugins/extract-http-clients/extract.go +740 -0
- package/plugins/extract-http-clients/extract_test.go +1561 -0
- package/plugins/extract-http-clients/main.go +41 -0
- package/plugins/extract-java/build/org/portolan/extract/Extract.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Protocol$Builder.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Protocol$Input.class +0 -0
- package/plugins/extract-java/build/org/portolan/extract/Protocol$Options.class +0 -0
- package/plugins/extract-python-kafka/extract.py +0 -2
- package/plugins/extract-python-kafka/extract_test.py +1 -1
- package/plugins/extract-ts/extract.test.ts +2 -2
- package/plugins/extract-ts/extract.ts +4 -5
- package/plugins/extract-ts/graphql.test.ts +1 -1
- package/plugins/openapi/ids.go +261 -0
- package/plugins/openapi/ids_test.go +98 -0
- package/plugins/portolan-go.wasm +0 -0
- package/plugins/pyplugin/protocol.py +1 -5
- package/portolan.json +3 -2
- package/schema/portolan.schema.json +34 -0
- package/scripts/README.md +18 -12
- package/scripts/catalog-sources.mjs +6 -0
- package/scripts/delivery-presets.mjs +21 -11
- package/scripts/diff.mjs +5 -1
- package/scripts/django-aggregates.test.mjs +58 -0
- package/scripts/gen-likec4.mjs +1 -1
- package/scripts/gen.mjs +118 -115
- package/scripts/go-discovery.test.mjs +30 -0
- package/scripts/history.mjs +186 -3
- package/scripts/history.test.mjs +1 -1
- package/scripts/host-plugins/fetch-git.mjs +77 -21
- package/scripts/host-plugins/fetch-git.test.mjs +62 -8
- package/scripts/local-api.mjs +71 -4
- package/scripts/local-api.test.mjs +63 -4
- package/scripts/local-discovery.mjs +82 -9
- package/scripts/manifest.mjs +5 -3
- package/scripts/manifest.test.mjs +24 -0
- package/scripts/output-diff.mjs +94 -0
- package/scripts/output-diff.test.mjs +36 -0
- package/scripts/package-smoke.mjs +62 -4
- package/scripts/plugin-host.mjs +22 -2
- package/scripts/plugin-host.test.mjs +9 -0
- package/scripts/plugin-wasm-worker.mjs +4 -1
- package/scripts/provenance.mjs +72 -0
- package/scripts/provenance.test.mjs +149 -0
- package/scripts/run-builtin.mjs +39 -5
- package/scripts/schema.mjs +29 -0
- package/scripts/warning-policy.mjs +161 -0
- package/scripts/warning-policy.test.mjs +56 -0
- package/src/app/Sidebar.tsx +3 -3
- package/src/catalog-docs.test.ts +64 -0
- package/src/catalog-docs.ts +35 -0
- package/src/catalog-error.test.ts +15 -0
- package/src/catalog-model.ts +48 -5
- package/src/catalog-validation.ts +9 -0
- package/src/chat/Starter.tsx +5 -11
- package/src/chat/tools.test.ts +27 -0
- package/src/chat/tools.ts +5 -9
- package/src/components/CatalogStamp.tsx +10 -8
- package/src/components/HTTPDestinationEvidence.test.tsx +23 -0
- package/src/components/HTTPDestinationEvidence.tsx +31 -0
- package/src/components/Integrations.tsx +1 -1
- package/src/components/MachineDocs.tsx +6 -5
- package/src/components/MethodRows.tsx +9 -2
- package/src/components/RelationEvidence.test.tsx +14 -0
- package/src/components/RelationEvidence.tsx +53 -0
- package/src/data.ts +25 -7
- package/src/enrich.test.ts +332 -1
- package/src/enrich.ts +206 -3
- package/src/flow/StepDetail.tsx +6 -0
- package/src/flow/evidence.test.ts +16 -0
- package/src/flow/evidence.ts +34 -0
- package/src/index.css +44 -0
- package/src/landing/DraggableReveal.tsx +3 -2
- package/src/landing/EvidencePipeline.tsx +105 -0
- package/src/landing/LandingPage.tsx +2 -59
- package/src/lib/catalog-diff.ts +1 -1
- package/src/lib/django-aggregates.d.mts +9 -0
- package/src/lib/django-aggregates.mjs +36 -0
- package/src/lib/django-aggregates.test.ts +29 -0
- package/src/lib/django-aggregates.ts +5 -0
- package/src/lib/local-api.ts +20 -2
- package/src/lib/setup-info.test.ts +17 -0
- package/src/lib/setup-info.ts +58 -0
- package/src/lib/warnings.test.ts +54 -0
- package/src/lib/warnings.ts +260 -0
- package/src/map/ContextMapGraph.tsx +76 -32
- package/src/merge.ts +16 -9
- package/src/pages/AggregatePage.tsx +8 -7
- package/src/pages/ContextPage.tsx +6 -5
- package/src/pages/ServicePage.tsx +4 -3
- package/src/pages/Settings.tsx +189 -41
- package/src/pages/settings/DjangoAggregateChoices.tsx +79 -0
- package/src/selection/DetailPanel.tsx +15 -0
- package/src/virtual-provenance.d.ts +11 -0
- package/vite.config.ts +5 -0
- package/scripts/vendor-lock.mjs +0 -58
- package/scripts/vendor-lock.test.mjs +0 -69
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
package gocall
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"context"
|
|
5
|
+
"os"
|
|
6
|
+
"path/filepath"
|
|
7
|
+
"reflect"
|
|
8
|
+
"strings"
|
|
9
|
+
"testing"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
func writeSource(t *testing.T, root, name, contents string) {
|
|
13
|
+
t.Helper()
|
|
14
|
+
file := filepath.Join(root, name)
|
|
15
|
+
if err := os.MkdirAll(filepath.Dir(file), 0755); err != nil {
|
|
16
|
+
t.Fatal(err)
|
|
17
|
+
}
|
|
18
|
+
if err := os.WriteFile(file, []byte(contents), 0644); err != nil {
|
|
19
|
+
t.Fatal(err)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func TestSharedFactsPreservePossibleTargetsAndSourcePositions(t *testing.T) {
|
|
24
|
+
root := t.TempDir()
|
|
25
|
+
writeSource(t, root, "go.mod", "module example.com/facts\n\ngo 1.24\n")
|
|
26
|
+
writeSource(t, root, "main.go", `package main
|
|
27
|
+
type Runner interface { Execute() }
|
|
28
|
+
type First struct{}
|
|
29
|
+
func (*First) Execute() {}
|
|
30
|
+
type Second struct{}
|
|
31
|
+
func (*Second) Execute() {}
|
|
32
|
+
func dispatch(r Runner) { r.Execute() }
|
|
33
|
+
func main() { dispatch(&First{}); dispatch(&Second{}) }
|
|
34
|
+
`)
|
|
35
|
+
result, err := Analyze(context.Background(), Options{Root: root})
|
|
36
|
+
if err != nil {
|
|
37
|
+
t.Fatal(err)
|
|
38
|
+
}
|
|
39
|
+
if !result.Complete || len(result.Diagnostics) != 0 {
|
|
40
|
+
t.Fatalf("unexpected partial result: %+v", result)
|
|
41
|
+
}
|
|
42
|
+
var dynamic []Edge
|
|
43
|
+
for _, edge := range result.Edges {
|
|
44
|
+
if strings.HasSuffix(edge.Caller.ID, ".dispatch") {
|
|
45
|
+
dynamic = append(dynamic, edge)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if len(dynamic) != 2 {
|
|
49
|
+
t.Fatalf("possible dispatch targets = %+v", dynamic)
|
|
50
|
+
}
|
|
51
|
+
for _, edge := range dynamic {
|
|
52
|
+
if edge.Kind != Possible || edge.Site.File != "main.go" || edge.Site.Line != 7 || edge.Site.Column == 0 {
|
|
53
|
+
t.Fatalf("lost evidence: %+v", edge)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Call sites on one line remain separate in the common representation.
|
|
57
|
+
var sites []int
|
|
58
|
+
for _, edge := range result.Edges {
|
|
59
|
+
if strings.HasSuffix(edge.Caller.ID, ".main") && strings.HasSuffix(edge.Callee.ID, ".dispatch") {
|
|
60
|
+
if edge.Kind != Static {
|
|
61
|
+
t.Fatalf("direct call is not static: %+v", edge)
|
|
62
|
+
}
|
|
63
|
+
sites = append(sites, edge.Site.Column)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if len(sites) != 2 || sites[0] == sites[1] {
|
|
67
|
+
t.Fatalf("call columns = %v", sites)
|
|
68
|
+
}
|
|
69
|
+
again, err := Analyze(context.Background(), Options{Root: root})
|
|
70
|
+
if err != nil {
|
|
71
|
+
t.Fatal(err)
|
|
72
|
+
}
|
|
73
|
+
if !reflect.DeepEqual(result, again) {
|
|
74
|
+
t.Fatal("typed facts are not deterministic")
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
func TestBrokenPackageDoesNotDiscardIndependentFacts(t *testing.T) {
|
|
79
|
+
root := t.TempDir()
|
|
80
|
+
writeSource(t, root, "go.mod", "module example.com/partial\n\ngo 1.24\n")
|
|
81
|
+
writeSource(t, root, "good/good.go", "package good\nfunc Run() { save() }; func save() {}\n")
|
|
82
|
+
writeSource(t, root, "broken/broken.go", "package broken\nvar value MissingType\n")
|
|
83
|
+
result, err := Analyze(context.Background(), Options{Root: root})
|
|
84
|
+
if err != nil {
|
|
85
|
+
t.Fatal(err)
|
|
86
|
+
}
|
|
87
|
+
if result.Complete || len(result.Diagnostics) == 0 {
|
|
88
|
+
t.Fatalf("missing partial diagnostic: %+v", result)
|
|
89
|
+
}
|
|
90
|
+
found := false
|
|
91
|
+
for _, edge := range result.Edges {
|
|
92
|
+
if strings.HasSuffix(edge.Callee.ID, ".save") {
|
|
93
|
+
found = true
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if !found {
|
|
97
|
+
t.Fatalf("independent edge lost: %+v", result)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func TestCanceledAnalysisDoesNotReturnCompleteFacts(t *testing.T) {
|
|
102
|
+
ctx, cancel := context.WithCancel(context.Background())
|
|
103
|
+
cancel()
|
|
104
|
+
if _, err := Analyze(ctx, Options{Root: t.TempDir()}); err == nil {
|
|
105
|
+
t.Fatal("canceled analysis succeeded")
|
|
106
|
+
}
|
|
107
|
+
}
|