Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0068

ADR-0068: SPEC-110 in-memory review checks run on the ctok lossless layer and CPython ast, not LibCST

field value
Status Accepted — Accepted (ruling, Mohamed, 2026-10-06: "go with recommendatio . build s3'")
Date 2026-10-06
Register factory (docs/adr, 4-digit ids)
Source docs/adr/0068-spec-110-review-checks-run-on-ctok-and-cpython-ast-not-libcst.md — permalink at df3ec6936 (unchanged on master since that commit)
Wiki register entry ADR-0068 (wiki status: Accepted)

← ADR-0067 · ADR-0069 →

The record

Status: Accepted (ruling, Mohamed, 2026-10-06: "go with recommendatio . build s3'") · Date: 2026-10-06

Context

SPEC-110 (specs/110-codemod-engine/spec.md) FR-012 defines the in-memory review engine: 40 checks in 7 categories (REQ-110-033), three execution phases over the MUTATED forest (REQ-110-035), and a substrate clause, REQ-110-034, which reads verbatim:

REQ-110-034: All 40 checks SHALL operate on LibCST trees (no ast.parse, no subprocess.run, no external linters). Checks SHALL be implemented as CSTTransformer or CSTVisitor subclasses.

Measured in wt-SPEC-110 on 2026-10-06 (recorded in plans/spec-110-completion-plan.md §0):

REQ-110-034 is therefore unmeetable as worded: it mandates a library the project removed by a later, accepted requirement set. Building FR-012 on either reading without a ruling would be a self-issued spec amendment. Several of the 40 checks are lexical, not structural (line length, trailing whitespace, tab indentation, final newline, TODO/FIXME comments, 14 regex mock patterns, hardcoded-secret patterns): no AST visitor of any library can see them; they need the token array or raw text.

Decision (proposed)

Amend REQ-110-034 to read:

REQ-110-034: All 40 checks SHALL operate on the engine's in-memory lossless layer: the ctok token array (LosslessModule / TokenStream) and the CPython ast overlay the forest already holds (NodeIndex). No check SHALL re-parse source from disk, call subprocess.run, or invoke an external linter. Structural checks SHALL be implemented as ast.NodeVisitor subclasses over the MUTATED forest's ast overlay; lexical checks (line length, whitespace, tabs, final newline, comment and pattern scans) SHALL be implemented as scanners over the MUTATED forest's token array. A check SHALL reuse the matching verification/review/ check_* function where one exists rather than re-implement it.

REQ-110-033 and REQ-110-035 are unchanged. The spec file is edited only after this ADR is Accepted; until then FR-012 stays unbuilt (packet S3 of plans/spec-110-completion-plan.md is blocked on this ruling).

Alternatives rejected

Consequences

Provenance

No other ADR is named in this record.

Rulings cited

Specs cited