@flyingrobots/footprint 0.0.0-stage → 0.6.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/CHANGELOG.md +436 -0
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +128 -2
- package/RELEASE.md +12 -0
- package/package.json +47 -4
- package/schemas/footprint.blast_radius.schema.json +218 -0
- package/schemas/footprint.comment.schema.json +60 -0
- package/schemas/footprint.composition.schema.json +67 -0
- package/schemas/footprint.landing.schema.json +98 -0
- package/schemas/footprint.overlap.schema.json +489 -0
- package/skills/footprint/SKILL.md +237 -0
- package/src/args.ts +28 -0
- package/src/bound.ts +134 -0
- package/src/callsites.ts +204 -0
- package/src/cell.ts +11 -0
- package/src/classify.ts +48 -0
- package/src/cli.ts +331 -0
- package/src/comment.ts +291 -0
- package/src/exports.ts +356 -0
- package/src/footprint.ts +95 -0
- package/src/graft.ts +121 -0
- package/src/impact.ts +109 -0
- package/src/landing.ts +316 -0
- package/src/languages.ts +83 -0
- package/src/overlap.ts +274 -0
- package/src/pulls.ts +124 -0
- package/src/remote.ts +177 -0
- package/src/render.ts +604 -0
- package/src/report.ts +53 -0
- package/src/symbols.ts +551 -0
- package/src/systems.ts +175 -0
package/README.md
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
#
|
|
1
|
+
# footprint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
What a change actually touches.
|
|
4
|
+
|
|
5
|
+
`footprint` reads a diff and reports its composition — how many files, of what kind, and what share
|
|
6
|
+
of the change each kind accounts for — so you can tell at a glance whether the change is shaped the
|
|
7
|
+
way you think it is.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun src/cli.ts # compare the default branch to HEAD; JSON Lines on stdout
|
|
11
|
+
bun src/cli.ts origin/main # explicit base
|
|
12
|
+
bun src/cli.ts abc123..def456 # explicit range
|
|
13
|
+
bun src/cli.ts --human > report.md # the Markdown comment
|
|
14
|
+
bun src/cli.ts comment 42 --report report.md --change "First report" --reason "Pull request opened"
|
|
15
|
+
# post it as pull request 42's one Footprint comment, updated in place
|
|
16
|
+
bun src/cli.ts --help # what it emits, as JSON Lines
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
From a clone, run it with `bun src/cli.ts` as above. Once the package is on npm,
|
|
20
|
+
`bunx @flyingrobots/footprint` takes the same arguments; the package runs on Bun, not Node. On
|
|
21
|
+
macOS, do not type a bare `footprint`: `/usr/bin/footprint` is an unrelated Apple memory tool that
|
|
22
|
+
comes first on `PATH`. For an agent reviewing a pull request there is a skill that does all of
|
|
23
|
+
this: [`skills/footprint/SKILL.md`](skills/footprint/SKILL.md).
|
|
24
|
+
|
|
25
|
+
footprint speaks the [Parley output protocol](https://github.com/flyingrobots/parley): four
|
|
26
|
+
`result` lines on stdout — the composition with its gut check, structural summary and digest, then
|
|
27
|
+
the landing plan, the blast radius and the cross-pull-request overlap; errors on stderr as
|
|
28
|
+
structured lines; a receipt per run under `.parley/receipts/` with every
|
|
29
|
+
decision and the file listing. `--human` is the opt-in for prose. See
|
|
30
|
+
[`docs/topics/output/README.md`](docs/topics/output/README.md). `footprint comment` keeps one
|
|
31
|
+
Footprint comment per pull request, with a Changelog of its runs:
|
|
32
|
+
[`docs/topics/comment/README.md`](docs/topics/comment/README.md).
|
|
33
|
+
|
|
34
|
+
## How it lands
|
|
35
|
+
|
|
36
|
+
Merging is not landing, so footprint also reports what it takes to land a change: a **Before
|
|
37
|
+
merge** section of what the changed-file list itself shows — migrations and their ordering
|
|
38
|
+
constraint, generated files, a manifest whose lockfile is missing, and a loud warning when a source
|
|
39
|
+
change carries no migration, flag or version entry to gate or record it — and an **After merge**
|
|
40
|
+
section whose steps are *read out of the repository's own `RELEASE.md` and `AGENTS.md`*, each
|
|
41
|
+
citing the file and heading it came from. Where neither document declares any, it says so instead
|
|
42
|
+
of guessing; where a change touches no executable surface, it says there is nothing to do. The
|
|
43
|
+
guard rule behind the warning is documented path patterns, never a judgement:
|
|
44
|
+
[`docs/topics/landing/README.md`](docs/topics/landing/README.md).
|
|
45
|
+
|
|
46
|
+
## Why
|
|
47
|
+
|
|
48
|
+
Two reasons, both from real failures.
|
|
49
|
+
|
|
50
|
+
**Branches balloon without you noticing.** Working fast, a branch grows to hundreds of files and
|
|
51
|
+
nothing tells you. One glance at the composition does.
|
|
52
|
+
|
|
53
|
+
**Scrutiny should be proportional to blast radius**, and that judgment needs an instrument. A
|
|
54
|
+
documentation-only change and a migration are not the same risk, and "it looked small" is not
|
|
55
|
+
evidence.
|
|
56
|
+
|
|
57
|
+
## What it does not do
|
|
58
|
+
|
|
59
|
+
It reports; it does not judge. A large change is not automatically risky, and a one-line change to
|
|
60
|
+
an auth check outweighs a thousand lines of prose. Treat the output as input to a decision, never
|
|
61
|
+
as a gate — a gate gets gamed.
|
|
62
|
+
|
|
63
|
+
## Every figure is computed
|
|
64
|
+
|
|
65
|
+
Nothing here is estimated. Totals come from `git diff --numstat`, and the category rows are
|
|
66
|
+
required by test to sum to the reported total. This is the bug that made the original hand-written
|
|
67
|
+
version untrustworthy: a draft reported `+151` for a `+157` change, with hand-estimated shares.
|
|
68
|
+
|
|
69
|
+
## Blast radius: which exports moved
|
|
70
|
+
|
|
71
|
+
With graft available, a run also reports its **export surface**: the exported symbols the change
|
|
72
|
+
added, removed or re-signed, each with its file and name **and where it is called from**, as the
|
|
73
|
+
third result line (`footprint.blast_radius` 1.1.0) and a `## Blast radius` section in the Markdown
|
|
74
|
+
comment. A renamed export shows up as a removal and an addition. The symbols come from graft's CLI
|
|
75
|
+
contract `graft struct exports <base-ref> <head-ref> --json`, passed through verbatim; a three-dot
|
|
76
|
+
range is compared from the merge base. When graft cannot answer — absent, failing, or speaking a
|
|
77
|
+
contract version footprint does not read — the result says so with a reason instead of omitting the
|
|
78
|
+
section.
|
|
79
|
+
|
|
80
|
+
The **call sites** are footprint's own, because no graft contract answers with a call site's line:
|
|
81
|
+
every whole-word occurrence of the symbol's name in the tracked, non-binary files of the working
|
|
82
|
+
tree, which is `grep -w`'s rule and nothing cleverer. A symbol nothing references is listed with an
|
|
83
|
+
empty list rather than dropped. It counts the declaration, comments and prose, and it cannot see
|
|
84
|
+
dynamic dispatch or a re-export under another name — it is evidence a reviewer can check with one
|
|
85
|
+
`grep`, not a call graph, and the test suite checks it against exactly that.
|
|
86
|
+
See [`docs/topics/blast-radius/README.md`](docs/topics/blast-radius/README.md).
|
|
87
|
+
|
|
88
|
+
## Cross-pull-request overlap
|
|
89
|
+
|
|
90
|
+
A fourth result says which **open pull requests** change a file this change changes — by number and
|
|
91
|
+
title — and proposes an order the open pull requests could land in, as waves, with the shared files
|
|
92
|
+
named for every edge. Each shared file is also compared at the **symbol level**. Each side's changed
|
|
93
|
+
lines are attributed to the top-level symbols graft finds in the file, and the file is reported as
|
|
94
|
+
`symbol-disjoint` with the symbols named, as `symbol-overlapping`, or as `undetermined` with the
|
|
95
|
+
reason. A symbol-disjoint edge is reported, but it does not split two pull requests into different
|
|
96
|
+
waves. An undetermined edge splits them, as a file-level edge does. The
|
|
97
|
+
open pull requests come from `gh pr list`, their files from `gh pr diff --name-only`, and nothing
|
|
98
|
+
is merged or rebased: the order is a proposal, not a gate. When `gh` is absent or cannot answer,
|
|
99
|
+
the result says so with a code and `gh`'s own message and the run still succeeds, because an
|
|
100
|
+
omitted section would read as "nothing overlaps". See
|
|
101
|
+
[`docs/topics/overlap/README.md`](docs/topics/overlap/README.md).
|
|
102
|
+
|
|
103
|
+
## Structural analysis is optional
|
|
104
|
+
|
|
105
|
+
With [graft](https://github.com/flyingrobots/graft) available, the report adds what paths cannot
|
|
106
|
+
tell you — whether a source file's **symbols** actually moved, or whether the diff was only
|
|
107
|
+
formatting.
|
|
108
|
+
|
|
109
|
+
Both `bun install` and `npm install` get it. A transitive native dependency of graft has no
|
|
110
|
+
prebuild on newer Node, so this repo's `.npmrc` skips dependency install scripts — nothing on the
|
|
111
|
+
structural path needs that native module. graft is also declared optional, so even an install that
|
|
112
|
+
cannot read that `.npmrc` succeeds rather than failing.
|
|
113
|
+
|
|
114
|
+
If graft is genuinely unavailable, the report says the structural section is unavailable rather
|
|
115
|
+
than quietly omitting it. A degraded run should never read as a clean one.
|
|
116
|
+
|
|
117
|
+
## Status
|
|
118
|
+
|
|
119
|
+
**v0.5.0** — composition, the landing plan, the export-surface diff with the call sites of each
|
|
120
|
+
changed symbol grouped by system, the unanalysed languages, and the cross-pull-request overlap
|
|
121
|
+
down to the symbol level, all as JSON Lines through the Parley output protocol. Released on GitHub
|
|
122
|
+
when its tag is pushed; on npm as `@flyingrobots/footprint` once its first publish is done (see
|
|
123
|
+
[the release workflow](docs/workflows/release/README.md)).
|
|
124
|
+
|
|
125
|
+
Documentation: [`docs/README.md`](docs/README.md). Working agreement: [`AGENTS.md`](AGENTS.md).
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
[Apache-2.0](LICENSE). See [NOTICE](NOTICE).
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Releasing footprint
|
|
2
|
+
|
|
3
|
+
What to do once a pull request has merged to `main`. footprint reads this file and quotes the list
|
|
4
|
+
below back in the **After merge** section of its own report, so keep each step a top-level list
|
|
5
|
+
item under the heading. How to prepare a release before the merge, and what the release workflow
|
|
6
|
+
does, is in [`docs/workflows/release/README.md`](docs/workflows/release/README.md).
|
|
7
|
+
|
|
8
|
+
## After merge
|
|
9
|
+
|
|
10
|
+
- If the merged change moved `version` in `package.json`, tag the merge commit on `main` as `vX.Y.Z` with the same number and push the tag; `.github/workflows/release.yml` does the rest. If it did not, this is not a release and nothing below applies.
|
|
11
|
+
- Confirm the workflow's `sanity`, `release` and `publish` jobs all succeeded, and that the GitHub release and `npm view @flyingrobots/footprint version` name the same version.
|
|
12
|
+
- If `skills/footprint/` changed, reinstall the skill wherever your agents load skills from, so the installed copy matches the release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flyingrobots/footprint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "What a change actually touches: composition, blast radius, and how to land it",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"footprint": "src/cli.ts"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"schemas",
|
|
13
|
+
"skills",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"RELEASE.md",
|
|
16
|
+
"NOTICE"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"bun": ">=1.4"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "bun test"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@flyingrobots/parley-emit": "^0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"optionalDependencies": {
|
|
28
|
+
"@flyingrobots/graft": "^0.14.0"
|
|
29
|
+
},
|
|
30
|
+
"overrides": {
|
|
31
|
+
"zod": "^4.6.6"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/flyingrobots/footprint.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/flyingrobots/footprint#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/flyingrobots/footprint/issues"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"author": "James Ross",
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"ajv": "^8.20.0",
|
|
47
|
+
"ajv-formats": "^3.0.1"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://flyingrobots.dev/footprint/schemas/footprint.blast_radius/1.1.0",
|
|
4
|
+
"title": "footprint.blast_radius 1.1.0",
|
|
5
|
+
"description": "The export-surface diff of a footprint run: the exported symbols added, removed and signature-changed between the compared refs, each with the call sites of its name, and the changed files in languages that could not be analysed at all. Every symbol comes from graft's CLI contract `graft struct exports --json` (`graft.cli.struct_exports` 1.0.0); footprint derives the counts, the ordering, and the call sites. The call sites are footprint's own conservative whole-word identifier scan of the tracked files of the working tree -- no graft contract answers with a call site's line -- so they include the declaration itself and a mention in a comment, a string or prose, and they cannot see a call through dynamic dispatch or a re-export under another name. Each call site also names the system that contains it and carries a mitigation derived from reported facts alone, and exports.call_site_systems names the grouping rule, the mitigation derivation and every system with its call-site count. When graft is unavailable the exports section is stated as unavailable with a reason, never omitted, and the same holds for the scan. unanalysed_languages is independent of graft: it is present and empty when every changed file was in a supported language.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["event", "t", "seq", "run", "range", "exports", "unanalysed_languages", "digest", "_schema"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"event": { "const": "result" },
|
|
10
|
+
"t": { "type": "integer", "minimum": 0 },
|
|
11
|
+
"seq": { "type": "integer", "minimum": 1 },
|
|
12
|
+
"run": { "type": "string", "minLength": 1 },
|
|
13
|
+
"range": { "type": "string", "minLength": 1, "description": "The git range compared, as given to git diff" },
|
|
14
|
+
"exports": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["available"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"available": { "type": "boolean", "description": "False when graft could not be resolved, failed, or answered under a contract version footprint does not read" },
|
|
19
|
+
"reason": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"description": "Present when available is false: why the export surface could not be read",
|
|
22
|
+
"required": ["code", "detail"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"code": {
|
|
25
|
+
"enum": ["graft.not_resolved", "graft.exports_failed", "graft.output_unreadable", "graft.schema_mismatch", "range.unresolved"],
|
|
26
|
+
"description": "graft.not_resolved: no graft binary. graft.exports_failed: the subcommand exited non-zero. graft.output_unreadable: the answer was not JSON footprint could read. graft.schema_mismatch: a different _schema id or version. range.unresolved: the base of a three-dot range had no merge base."
|
|
27
|
+
},
|
|
28
|
+
"detail": { "type": "string", "minLength": 1, "description": "What happened, in enough words to act on" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"base": { "type": "string", "minLength": 1, "description": "The base ref passed to graft: the merge base for a three-dot range, the given base otherwise" },
|
|
32
|
+
"head": { "type": "string", "minLength": 1, "description": "The head ref passed to graft" },
|
|
33
|
+
"added": { "$ref": "#/$defs/symbols", "description": "Exported symbols present at head and absent at base" },
|
|
34
|
+
"removed": { "$ref": "#/$defs/symbols", "description": "Exported symbols present at base and absent at head" },
|
|
35
|
+
"signature_changed": { "$ref": "#/$defs/symbols", "description": "Exported symbols present at both ends whose signature differs; each carries previous_signature when graft reported one" },
|
|
36
|
+
"counts": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"description": "The length of each list, so a reader needs no arithmetic; computed from the lists and nothing else",
|
|
39
|
+
"required": ["added", "removed", "signature_changed"],
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"properties": {
|
|
42
|
+
"added": { "type": "integer", "minimum": 0 },
|
|
43
|
+
"removed": { "type": "integer", "minimum": 0 },
|
|
44
|
+
"signature_changed": { "type": "integer", "minimum": 0 },
|
|
45
|
+
"call_sites": { "type": "integer", "minimum": 0, "description": "Every symbol's call sites added up. Present only when the scan ran: a count of call sites nobody looked for is not a figure." }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"semver_impact": {
|
|
49
|
+
"type": ["string", "null"],
|
|
50
|
+
"description": "graft's own semver judgement for the surface change, passed through verbatim; null when graft reported none. footprint does not derive it."
|
|
51
|
+
},
|
|
52
|
+
"call_site_scan": {
|
|
53
|
+
"description": "How the call sites on the symbols above were found, or why they were not. `method` is `identifier_scan`: every whole-word occurrence of the symbol's name in a tracked, non-binary file of the working tree, where a word character is a letter, a digit or an underscore in any script (`[\\p{L}\\p{N}_]`) on both sides -- `grep -w`'s own rule, which is what makes the independent grep oracle in footprint's test suite exact for an ASCII symbol name. When `available` is false no symbol carries `call_sites` at all, so a scan that did not run can never be read as one that found nothing.",
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["available", "method"],
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"properties": {
|
|
58
|
+
"available": { "type": "boolean" },
|
|
59
|
+
"method": { "const": "identifier_scan" },
|
|
60
|
+
"files_scanned": { "type": "integer", "minimum": 0, "description": "Tracked files read and matched" },
|
|
61
|
+
"files_skipped": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"description": "Tracked files the scan did not match, each for a stated reason",
|
|
64
|
+
"required": ["binary", "unreadable"],
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"properties": {
|
|
67
|
+
"binary": { "type": "integer", "minimum": 0, "description": "Files holding a NUL byte in their first 8192, skipped exactly as `grep -I` skips them" },
|
|
68
|
+
"unreadable": { "type": "integer", "minimum": 0, "description": "Tracked files that could not be read, a file deleted from the working tree among them" }
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"reason": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"description": "Present when available is false: why there are no call sites to show",
|
|
74
|
+
"required": ["code", "detail"],
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"properties": {
|
|
77
|
+
"code": {
|
|
78
|
+
"enum": ["scan.not_run", "scan.ls_files_failed"],
|
|
79
|
+
"description": "scan.not_run: no scan was attached to this surface, so no tree was read. scan.ls_files_failed: `git ls-files -z` exited non-zero, so there was no file list to scan."
|
|
80
|
+
},
|
|
81
|
+
"detail": { "type": "string", "minLength": 1 }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"allOf": [
|
|
86
|
+
{ "if": { "properties": { "available": { "const": false } }, "required": ["available"] }, "then": { "required": ["available", "method", "reason"] } },
|
|
87
|
+
{ "if": { "properties": { "available": { "const": true } }, "required": ["available"] }, "then": { "required": ["available", "method", "files_scanned", "files_skipped"] } }
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"call_site_systems": {
|
|
91
|
+
"description": "How the call sites above group into systems, with the rule named on the record (flyingrobots/footprint#11). Present exactly when `call_site_scan.available` is true: a grouping of call sites nobody looked for is not a figure. The per-system `call_sites` counts sum to `counts.call_sites`, because every call site is in exactly one system, the unassigned group included.",
|
|
92
|
+
"type": "object",
|
|
93
|
+
"required": ["rule", "rule_detail", "mitigation_rule", "unassigned", "systems"],
|
|
94
|
+
"additionalProperties": false,
|
|
95
|
+
"properties": {
|
|
96
|
+
"rule": { "const": "path_prefix", "description": "The grouping rule: a system is the first path segment of a call site's repository-relative path" },
|
|
97
|
+
"rule_detail": { "type": "string", "minLength": 1, "description": "The rule in words, so the output explains its own grouping without a reader fetching this schema" },
|
|
98
|
+
"mitigation_rule": { "type": "string", "minLength": 1, "description": "How every row's mitigation was derived, in words, for the same reason" },
|
|
99
|
+
"unassigned": { "const": "(unassigned)", "description": "The group holding every call site in no system -- a file at the repository root. Named and listed last, never dropped." },
|
|
100
|
+
"systems": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"description": "One entry per system holding at least one call site, ordered by name with the unassigned group last so the grouping follows the tree rather than the order the scan found the sites in",
|
|
103
|
+
"items": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"required": ["system", "call_sites"],
|
|
106
|
+
"additionalProperties": false,
|
|
107
|
+
"properties": {
|
|
108
|
+
"system": { "type": "string", "minLength": 1, "description": "The first path segment, or \"(unassigned)\" for the call sites in no system" },
|
|
109
|
+
"call_sites": { "type": "integer", "minimum": 1 }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"contract": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"description": "The graft CLI contract that answered, so a reader knows which interface produced the list",
|
|
118
|
+
"required": ["id", "version"],
|
|
119
|
+
"additionalProperties": false,
|
|
120
|
+
"properties": {
|
|
121
|
+
"id": { "const": "graft.cli.struct_exports" },
|
|
122
|
+
"version": { "const": "1.0.0" }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"allOf": [
|
|
127
|
+
{
|
|
128
|
+
"if": { "properties": { "available": { "const": false } }, "required": ["available"] },
|
|
129
|
+
"then": { "required": ["available", "reason"] }
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"if": { "properties": { "available": { "const": true } }, "required": ["available"] },
|
|
133
|
+
"then": { "required": ["available", "base", "head", "added", "removed", "signature_changed", "counts", "semver_impact", "call_site_scan", "contract"] }
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"description": "A scan that ran lists every symbol's call sites, empty included: a symbol nothing references is never dropped, and the total is reported.",
|
|
137
|
+
"if": {
|
|
138
|
+
"required": ["call_site_scan"],
|
|
139
|
+
"properties": { "call_site_scan": { "required": ["available"], "properties": { "available": { "const": true } } } }
|
|
140
|
+
},
|
|
141
|
+
"then": {
|
|
142
|
+
"required": ["call_site_systems"],
|
|
143
|
+
"properties": {
|
|
144
|
+
"added": { "items": { "required": ["symbol", "file", "call_sites"] } },
|
|
145
|
+
"removed": { "items": { "required": ["symbol", "file", "call_sites"] } },
|
|
146
|
+
"signature_changed": { "items": { "required": ["symbol", "file", "call_sites"] } },
|
|
147
|
+
"counts": { "required": ["added", "removed", "signature_changed", "call_sites"] }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"description": "A scan that did not run carries no grouping at all, so an absent grouping can never be read as a change that reaches no system.",
|
|
153
|
+
"if": {
|
|
154
|
+
"required": ["call_site_scan"],
|
|
155
|
+
"properties": { "call_site_scan": { "required": ["available"], "properties": { "available": { "const": false } } } }
|
|
156
|
+
},
|
|
157
|
+
"then": { "not": { "required": ["call_site_systems"] } }
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"unanalysed_languages": {
|
|
162
|
+
"type": "array",
|
|
163
|
+
"description": "Changed source files in languages footprint does not recognise as one graft's grammars can parse, grouped by extension with a count (flyingrobots/footprint#12). Present and empty when every changed file was in a supported language -- never omitted. Independent of exports.available: a parse failure in a supported language is never counted here, because this is extension-only and does not depend on whether graft ran or what it returned.",
|
|
164
|
+
"items": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"required": ["extension", "count"],
|
|
167
|
+
"additionalProperties": false,
|
|
168
|
+
"properties": {
|
|
169
|
+
"extension": { "type": "string", "minLength": 1, "description": "The file extension, lowercase, dot included (e.g. \".hs\"); \"(none)\" when the changed file's basename carries none" },
|
|
170
|
+
"count": { "type": "integer", "minimum": 1 }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"digest": { "type": "string", "pattern": "^[0-9a-f]{64}$", "description": "SHA-256 over the canonical JSON of range, exports and unanalysed_languages (spec §7.1)" },
|
|
175
|
+
"_schema": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"required": ["id", "version"],
|
|
178
|
+
"additionalProperties": false,
|
|
179
|
+
"properties": { "id": { "const": "footprint.blast_radius" }, "version": { "const": "1.1.0" } }
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"$defs": {
|
|
183
|
+
"symbols": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"items": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"required": ["symbol", "file"],
|
|
188
|
+
"additionalProperties": false,
|
|
189
|
+
"properties": {
|
|
190
|
+
"symbol": { "type": "string", "minLength": 1, "description": "The exported symbol's name, as graft reported it" },
|
|
191
|
+
"file": { "type": "string", "minLength": 1, "description": "The file the symbol is exported from, repository-relative" },
|
|
192
|
+
"kind": { "type": "string", "minLength": 1, "description": "graft's kind for the symbol (function, interface, field, export, ...); graft's vocabulary, not footprint's" },
|
|
193
|
+
"signature": { "type": "string", "description": "The signature at head, verbatim from graft, newlines and all" },
|
|
194
|
+
"previous_signature": { "type": "string", "description": "The signature at base, present only on a signature change graft reported one for" },
|
|
195
|
+
"call_sites": {
|
|
196
|
+
"type": "array",
|
|
197
|
+
"description": "Where the symbol's name occurs as a whole word in the tracked, non-binary files of the working tree, ordered by file then line, one entry per line however many times it occurs on that line. Each one names the system that contains it and carries its row's mitigation. Empty means the scan found none, which is reported rather than dropped; absent means no scan ran, which `call_site_scan.reason` states.",
|
|
198
|
+
"items": {
|
|
199
|
+
"type": "object",
|
|
200
|
+
"required": ["file", "line", "system", "mitigation", "mitigation_basis"],
|
|
201
|
+
"additionalProperties": false,
|
|
202
|
+
"properties": {
|
|
203
|
+
"file": { "type": "string", "minLength": 1, "description": "Repository-relative path, as `git ls-files` printed it" },
|
|
204
|
+
"line": { "type": "integer", "minimum": 1, "description": "1-based line number, as `grep -n` would print it" },
|
|
205
|
+
"system": { "type": "string", "minLength": 1, "description": "The system containing this call site: the first path segment of `file`, or \"(unassigned)\" when it has none (flyingrobots/footprint#11)" },
|
|
206
|
+
"mitigation": { "type": "string", "minLength": 1, "description": "This row's mitigation, derived from two reported facts and nothing else -- whether the call site is in the symbol's own declaring file, and what footprint's classification calls the file. Exactly one of three forms: the literal \"None needed\"; \"Call site in <system>, outside the changed file.\"; or \"Call site outside every known system, outside the changed file.\". Never a judgement about importance, risk or coverage, and never advice: footprint reports and does not judge." },
|
|
207
|
+
"mitigation_basis": {
|
|
208
|
+
"enum": ["declaring_file", "test_file", "other_system", "unassigned"],
|
|
209
|
+
"description": "Which fact chose the mitigation, so the derivation is checkable from the record. declaring_file: the call site is in the very file the symbol is exported from. test_file: footprint's classification calls the call site's file a test. other_system: any other call site, inside a system. unassigned: any other call site, in no system. The first two are \"None needed\"."
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://flyingrobots.dev/footprint/schemas/footprint.comment/1.0.0",
|
|
4
|
+
"title": "footprint.comment 1.0.0",
|
|
5
|
+
"description": "What `footprint comment` did with the pull request's one Footprint comment: which comment it wrote, whether it created, updated or adopted it, and the Changelog row it appended. The comment's body is not repeated here; the comment itself is the record.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["event", "t", "seq", "run", "pull_request", "action", "adopted", "dry_run", "comment", "head_sha", "row", "changelog", "chars", "limit", "_schema"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"event": { "const": "result" },
|
|
11
|
+
"t": { "type": "integer", "minimum": 0 },
|
|
12
|
+
"seq": { "type": "integer", "minimum": 1 },
|
|
13
|
+
"run": { "type": "string", "minLength": 1 },
|
|
14
|
+
"pull_request": { "type": "integer", "minimum": 1 },
|
|
15
|
+
"action": { "enum": ["created", "updated"], "description": "created: no Footprint comment existed and one was posted. updated: an existing one was edited in place. Under --dry-run, what would have been done." },
|
|
16
|
+
"adopted": { "type": "boolean", "description": "True when the comment updated carried no marker: the most recent comment by the current gh user that opened with '## Footprint', which now carries the marker" },
|
|
17
|
+
"dry_run": { "type": "boolean", "description": "True under --dry-run: nothing was written" },
|
|
18
|
+
"comment": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"required": ["id", "url"],
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"properties": {
|
|
23
|
+
"id": { "type": ["integer", "null"], "description": "The comment's id; null only for a dry run that would have created one" },
|
|
24
|
+
"url": { "type": ["string", "null"], "description": "The comment's html_url as GitHub answered the write; null under --dry-run" }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"head_sha": { "type": "string", "pattern": "^[0-9a-f]{7}$", "description": "The first 7 characters of the pull request's head commit when the command ran, as gh pr view reported it" },
|
|
28
|
+
"row": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "The Changelog row appended, before cell escaping",
|
|
31
|
+
"required": ["timestamp", "sha", "change", "reason", "remarks"],
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"properties": {
|
|
34
|
+
"timestamp": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$", "description": "UTC, ISO-8601, to the second" },
|
|
35
|
+
"sha": { "type": "string", "pattern": "^[0-9a-f]{7}$" },
|
|
36
|
+
"change": { "type": "string" },
|
|
37
|
+
"reason": { "type": "string" },
|
|
38
|
+
"remarks": { "type": "string", "description": "As given, followed by a statement of adoption when the comment was adopted" }
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"changelog": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"required": ["rows", "carried", "dropped"],
|
|
44
|
+
"additionalProperties": false,
|
|
45
|
+
"properties": {
|
|
46
|
+
"rows": { "type": "integer", "minimum": 1, "description": "Rows the comment carries now, the new one included" },
|
|
47
|
+
"carried": { "type": "integer", "minimum": 0, "description": "Rows the comment carried before this run" },
|
|
48
|
+
"dropped": { "type": "integer", "minimum": 0, "description": "Older rows dropped to stay within the limit, this run's and every earlier run's, as the comment states" }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"chars": { "type": "integer", "minimum": 1, "description": "The length of the comment body written, in characters" },
|
|
52
|
+
"limit": { "const": 65536, "description": "GitHub's maximum comment body; chars is at most this" },
|
|
53
|
+
"_schema": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["id", "version"],
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"properties": { "id": { "const": "footprint.comment" }, "version": { "const": "1.0.0" } }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://flyingrobots.dev/footprint/schemas/footprint.composition/1.0.0",
|
|
4
|
+
"title": "footprint.composition 1.0.0",
|
|
5
|
+
"description": "The result of a footprint run: what the change touches, by file kind, with the gut check and the structural summary. Every figure is computed from git diff --numstat.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["event", "t", "seq", "run", "range", "composition", "gut_check", "structural", "digest", "_schema"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"event": { "const": "result" },
|
|
10
|
+
"t": { "type": "integer", "minimum": 0 },
|
|
11
|
+
"seq": { "type": "integer", "minimum": 1 },
|
|
12
|
+
"run": { "type": "string", "minLength": 1 },
|
|
13
|
+
"range": { "type": "string", "minLength": 1, "description": "The git range compared, as given to git diff" },
|
|
14
|
+
"composition": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["files", "added", "removed", "binaryFiles", "byCategory"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"files": { "type": "integer", "minimum": 0 },
|
|
19
|
+
"added": { "type": "integer", "minimum": 0 },
|
|
20
|
+
"removed": { "type": "integer", "minimum": 0 },
|
|
21
|
+
"binaryFiles": { "type": "integer", "minimum": 0 },
|
|
22
|
+
"byCategory": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"required": ["category", "files", "added", "removed", "share"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"category": { "enum": ["source", "test", "docs", "config", "ci", "generated", "assets"] },
|
|
29
|
+
"files": { "type": "integer", "minimum": 1 },
|
|
30
|
+
"added": { "type": "integer", "minimum": 0 },
|
|
31
|
+
"removed": { "type": "integer", "minimum": 0 },
|
|
32
|
+
"share": { "type": "number", "minimum": 0, "maximum": 100 }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"gut_check": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": ["headline", "flags"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"headline": { "type": "string", "minLength": 1 },
|
|
43
|
+
"flags": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Observations, never verdicts" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"structural": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["available"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"available": { "type": "boolean", "description": "False when graft could not be resolved or failed; the section is stated, never omitted" },
|
|
51
|
+
"structural": { "type": "integer", "minimum": 0 },
|
|
52
|
+
"formatting": { "type": "integer", "minimum": 0 },
|
|
53
|
+
"symbolsAdded": { "type": "integer", "minimum": 0 },
|
|
54
|
+
"symbolsRemoved": { "type": "integer", "minimum": 0 },
|
|
55
|
+
"symbolsChanged": { "type": "integer", "minimum": 0 },
|
|
56
|
+
"breakingChanges": { "type": "array", "items": { "type": "string" } }
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"digest": { "type": "string", "pattern": "^[0-9a-f]{64}$", "description": "SHA-256 over the canonical JSON of range, composition, gut_check and structural (spec §7.1)" },
|
|
60
|
+
"_schema": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"required": ["id", "version"],
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"properties": { "id": { "const": "footprint.composition" }, "version": { "const": "1.0.0" } }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|