Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
292f2dd
debt_ratchet.py is only the CI entry; the pinned audit owns every mea…
trissim Oct 29, 2026
79e389e
The pinned audit's place is pinned_audit's; the lock test reads its o…
trissim Oct 29, 2026
9931791
agent-comms declares its own measured project; the entry only names it
trissim Oct 29, 2026
16aee66
A carry step's base may be any class of the Carry family; pin the sou…
trissim Oct 29, 2026
db41b7f
The pinned audit is reached through pinned_audit's package, never by …
trissim Oct 29, 2026
0893030
The client check reads audit's decoded findings; the moved module typ…
trissim Oct 29, 2026
b1d6c5f
The carry family is its members' MROs; the client check's unread patt…
trissim Oct 29, 2026
19de7bc
Absent reader and absent pin are answers, not git crashes
trissim Oct 29, 2026
c6a40f2
P924: AgentCommsProject declares absence_boundaries; carried lookup r…
trissim Oct 29, 2026
bf4b76f
P924 review: carried lookup builds one ModuleScope per module
trissim Oct 29, 2026
2f6a1c9
P872/P924: pin refactor-audit to its #7 merge (d7401d67)
trissim Oct 29, 2026
5e67dfb
Merge remote-tracking branch 'origin/main' into refactor/audit-owns-r…
trissim Oct 29, 2026
bfe7c2a
Stored formats: the measured project declares its reader; no silent e…
trissim Oct 29, 2026
ae672cc
Merge remote-tracking branch 'origin/main' into refactor/audit-owns-r…
trissim Oct 29, 2026
bff583d
Stored formats: required keys are a set where they are made, encoded …
trissim Oct 29, 2026
a8be648
Merge remote-tracking branch 'origin/main' into refactor/audit-owns-r…
trissim Oct 29, 2026
4d88427
Ratchet: a measured revision runs beside the audit it pinned
trissim Oct 30, 2026
7f7464f
Merge remote-tracking branch 'origin/main' into refactor/audit-owns-r…
trissim Oct 30, 2026
f25539d
Ratchet: one stored-format record, fresh type counts, carried controls
trissim Oct 30, 2026
af79c6f
Merge remote-tracking branch 'origin/main' into refactor/audit-owns-r…
trissim Oct 30, 2026
cf4b58f
Ratchet review round 7: one versioned-record answer, no forwarder, ca…
trissim Oct 30, 2026
86585ec
Pin refactor-audit 8659f6032d8e31beb6add0f18ff0cbf84c106e26: stored f…
trissim Oct 30, 2026
49420ec
Merge remote-tracking branch 'origin/main' into refactor/audit-owns-r…
trissim Oct 30, 2026
69b27c4
Pin refactor-audit c69c4daf: audit main with #11 merged
trissim Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions src/agent_comms/phase_evidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
from agent_comms.declared_family import DeclaredFamily
from agent_comms.field_codec import FieldCodec
from agent_comms.head_review import HeadReview
from agent_comms.pinned_audit import ForeignAbsenceProbe, GodFunction, ParsedModule
import agent_comms
from agent_comms import skills
from agent_comms.pinned_audit import SKILL, ForeignAbsenceProbe, GodFunction, ParsedModule, audit
from agent_comms.private_path import FileObservation, FileRevision
from agent_comms.repo import GitCommandError, Repo

Expand Down Expand Up @@ -100,6 +102,12 @@ def matching_lines(self, pattern: str, paths: tuple[str, ...]) -> frozenset[tupl
)
)

def pinned(self, path: str) -> MainTree:
"""The tree of the submodule this commit pins at ``path``: another repository's tree,
read at exactly the commit its gitlink names, from that repository's own objects."""
commit = Repo.git(self.repo.checkout, "rev-parse", f"{self.commit}:{path}").strip()
return MainTree(Repo.of(self.repo.checkout / path), commit)

def module(self, path: str) -> ParsedModule:
blob, = Repo.blobs(self.repo.checkout, f"{self.commit}:{path}")
source = blob.decode()
Expand Down Expand Up @@ -412,6 +420,27 @@ def describe(self) -> str:
return f"{self.pattern!r} in {' '.join(self.paths)} on main"


@dataclass(frozen=True)
class AuditPatternPresent(PatternPresent):
"""A pattern in the audit package of the refactor-audit main pins, at the commit it pins:
code this repository runs from that repository. Where the submodule sits and where its
package sits inside it are pinned_audit's, read from the loaded skill."""

def read(self, main: MainTree) -> bool:
# The skills package's place under the source root, read from the loaded package.
installed = Path(skills.__path__[0]).relative_to(Path(agent_comms.__path__[0]).parent)
submodule = Path(main.repo.source, installed, SKILL.name)
package = Path(audit.__path__[0]).relative_to(SKILL)
if not main.has(submodule.as_posix()):
# A commit that pins no audit holds none of its patterns.
return self.satisfied(0)
pinned = main.pinned(submodule.as_posix())
return self.satisfied(pinned.count(self.pattern, (package.as_posix(),)))

def describe(self) -> str:
return f"{self.pattern!r} in the audit package of the refactor-audit main pins"


@dataclass(frozen=True)
class DocumentPatternPresent(PatternPresent):
"""A recorded document fact, rather than executable Python source."""
Expand Down Expand Up @@ -683,7 +712,7 @@ def read(self, main: MainTree) -> bool:
)

def describe(self) -> str:
return f"{self.name} in {self.path} at most {GodFunction.threshold} lines on main"
return f"{self.name} in {self.path} at most {GodFunction.threshold()} lines on main"


@dataclass(frozen=True)
Expand All @@ -696,7 +725,7 @@ class NoAbsenceProbes(MainEvidence):
def read(self, main: MainTree) -> bool:
"""Every node is offered to the probe, whose own pattern decides what it counts."""
return not any(
ForeignAbsenceProbe.count(node)
ForeignAbsenceProbe.occurrences(node)
for module in main.present_modules(self.paths)
for node in ast.walk(module.tree)
)
Expand Down
5 changes: 3 additions & 2 deletions src/agent_comms/pinned_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

from agent_comms import skills

SCRIPTS = Path(str(files(skills) / "refactor-audit" / "scripts"))
SKILL = Path(str(files(skills) / "refactor-audit"))
SCRIPTS = SKILL / "scripts"
if str(SCRIPTS) not in sys.path:
sys.path.insert(0, str(SCRIPTS))

import audit as audit # noqa: E402
from audit.findings import GodFunction as GodFunction # noqa: E402
from audit.findings import ParsedModule as ParsedModule # noqa: E402
from audit.measures import ForeignAbsenceProbe as ForeignAbsenceProbe # noqa: E402
from audit.source_measures import ForeignAbsenceProbe as ForeignAbsenceProbe # noqa: E402
5 changes: 3 additions & 2 deletions src/agent_comms/plan_phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from agent_comms.field_codec import Id128, MessageId, NominalSpelling, NominalText
from agent_comms.phase_evidence import (
AllEvidence,
AuditPatternPresent,
BusStorageAbsent,
ClassFlagsAbsent,
QualifiedName,
Expand Down Expand Up @@ -551,7 +552,7 @@ class PlainStrIdRatchetPhase(Id128NominalPhase):
"""2: no file gains a plain ``str`` annotation on an id-named field or parameter."""

after = (NominalIdTypePhase,)
evidence = PatternPresent(r"^class PlainStrIdAnnotation\(", ("tools/debt_ratchet.py",))
evidence = AuditPatternPresent(r"^class PlainStrIdAnnotation\(")


class ClaimIdsPhase(Id128NominalPhase):
Expand Down Expand Up @@ -1019,7 +1020,7 @@ class MaintenanceInWritePhase(StoreGuardsPhase):
class LockCensusPhase(StoreGuardsPhase):
"""5: the debt ratchet counts lock calls outside the store owners and refuses growth."""

evidence = PatternPresent(r"^class StoreLockCalls\(", ("tools/debt_ratchet.py",))
evidence = AuditPatternPresent(r"^class StoreLockCalls\(")


class ScopedReadsPhase(StoreGuardsPhase):
Expand Down
Loading
Loading