• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 25441711719

06 May 2026 02:31PM UTC coverage: 92.915%. Remained the same
25441711719

push

github

web-flow
use sha pin (with comment) format for generated actions (#23312)

Per the GitHub Action best practices we recently enabled at #23249, we
should pin each action to a SHA so that the reference is actually
immutable.

This will -- I hope -- knock out a large chunk of the 421 alerts we
currently get from zizmor. The next followup would then be upgrades and
harmonizing the generated and none-generated pins.

Notice: This idea was suggested by Claude while going over pinact output
and I was surprised to see that post processing the yaml wasn't too
gross.

92206 of 99237 relevant lines covered (92.91%)

4.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.15
/src/python/pants/bsp/spec/compile.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from __future__ import annotations
2✔
4

5
from dataclasses import dataclass
2✔
6
from typing import Any
2✔
7

8
from pants.bsp.spec.base import BuildTargetIdentifier
2✔
9

10
# -----------------------------------------------------------------------------------------------
11
# Compile Request
12
# See https://build-server-protocol.github.io/docs/specification.html#compile-request
13
# -----------------------------------------------------------------------------------------------
14

15

16
@dataclass(frozen=True)
2✔
17
class CompileParams:
2✔
18
    # A sequence of build targets to compile.
19
    targets: tuple[BuildTargetIdentifier, ...]
2✔
20

21
    # A unique identifier generated by the client to identify this request.
22
    # The server may include this id in triggered notifications or responses.
23
    origin_id: str | None = None
2✔
24

25
    # Optional arguments to the compilation process.
26
    arguments: tuple[str, ...] | None = ()
2✔
27

28
    @classmethod
2✔
29
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
30
        return cls(
1✔
31
            targets=tuple(BuildTargetIdentifier.from_json_dict(x) for x in d["targets"]),
32
            origin_id=d.get("originId"),
33
            arguments=tuple(d["arguments"]) if "arguments" in d else None,
34
        )
35

36
    def to_json_dict(self) -> dict[str, Any]:
2✔
37
        result: dict[str, Any] = {"targets": [tgt.to_json_dict() for tgt in self.targets]}
1✔
38
        if self.origin_id is not None:
1✔
39
            result["originId"] = self.origin_id
×
40
        if self.arguments is not None:
1✔
41
            result["arguments"] = self.arguments
1✔
42
        return result
1✔
43

44

45
@dataclass(frozen=True)
2✔
46
class CompileResult:
2✔
47
    # An optional request id to know the origin of this report.
48
    origin_id: str | None
2✔
49

50
    # A status code for the execution.
51
    status_code: int
2✔
52

53
    # Kind of data to expect in the `data` field. If this field is not set, the kind of data is not specified.
54
    data_kind: str | None = None
2✔
55

56
    # A field containing language-specific information, like products
57
    # of compilation or compiler-specific metadata the client needs to know.
58
    data: Any | None = None
2✔
59

60
    @classmethod
2✔
61
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
62
        return cls(
1✔
63
            origin_id=d.get("originId"),
64
            status_code=d["statusCode"],
65
            data_kind=d.get("dataKind"),
66
            data=d.get("data"),
67
        )
68

69
    def to_json_dict(self) -> dict[str, Any]:
2✔
70
        result: dict[str, Any] = {
1✔
71
            "statusCode": self.status_code,
72
        }
73
        if self.origin_id is not None:
1✔
74
            result["originId"] = self.origin_id
×
75
        if self.data_kind is not None:
1✔
76
            result["dataKind"] = self.data_kind
×
77
        if self.data is not None:
1✔
78
            result["data"] = self.data  # TODO: Enforce to_json_dict available
×
79
        return result
1✔
80

81

82
@dataclass(frozen=True)
2✔
83
class CompileTask:
2✔
84
    target: BuildTargetIdentifier
2✔
85

86
    @classmethod
2✔
87
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
88
        return cls(target=BuildTargetIdentifier.from_json_dict(d["target"]))
×
89

90
    def to_json_dict(self) -> dict[str, Any]:
2✔
91
        return {"target": self.target.to_json_dict()}
1✔
92

93

94
@dataclass(frozen=True)
2✔
95
class CompileReport:
2✔
96
    # The build target that was compiled
97
    target: BuildTargetIdentifier
2✔
98

99
    # An optional request id to know the origin of this report.
100
    origin_id: str | None
2✔
101

102
    # The total number of reported errors compiling this target.
103
    errors: int
2✔
104

105
    # The total number of reported warnings compiling the target.
106
    warnings: int
2✔
107

108
    # The total number of milliseconds it took to compile the target.
109
    time: int | None = None
2✔
110

111
    # The compilation was a noOp compilation.
112
    no_op: bool | None = None
2✔
113

114
    @classmethod
2✔
115
    def from_json_dict(cls, d: dict[str, Any]) -> Any:
2✔
116
        return cls(
×
117
            target=BuildTargetIdentifier.from_json_dict(d["target"]),
118
            origin_id=d.get("originId"),
119
            errors=d["errors"],
120
            warnings=d["warnings"],
121
            time=d.get("time"),
122
            no_op=d.get("noOp"),
123
        )
124

125
    def to_json_dict(self) -> dict[str, Any]:
2✔
126
        result = {
1✔
127
            "target": self.target.to_json_dict(),
128
            "errors": self.errors,
129
            "warnings": self.warnings,
130
        }
131
        if self.origin_id is not None:
1✔
132
            result["originId"] = self.origin_id
×
133
        if self.time is not None:
1✔
134
            result["time"] = self.time
×
135
        if self.no_op is not None:
1✔
136
            result["noOp"] = self.no_op
×
137
        return result
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc