Skip to content

feat(lane-f): persona-ts cognition deletion ratchet — PR-1 script#1401

Merged
joelteply merged 1 commit into
canaryfrom
feat/lane-f-pr1-persona-ts-ratchet-script
May 18, 2026
Merged

feat(lane-f): persona-ts cognition deletion ratchet — PR-1 script#1401
joelteply merged 1 commit into
canaryfrom
feat/lane-f-pr1-persona-ts-ratchet-script

Conversation

@joelteply
Copy link
Copy Markdown
Contributor

Summary

Lane F PR-1 per ALPHA-GAP-ANALYSIS §"Lane F: TS Cognition Deletion Ratchet". Mechanical local gate preventing the persona-cognition TypeScript layer from growing while the Rust runtime takes over.

  • LOC ratchet — total .ts LOC under each watched cognition dir must not exceed its committed baseline.
  • New-file ratchet — new .ts files in watched dirs must be in the baseline OR match a glob in the allowlist (generated, .types.ts, .schema.ts — NOT new cognition modules).
  • Baseline locks the existing deletion gains: 34 files, 8583 LOC across 6 watched cognition directories.
  • The ratchet only moves down. refresh regenerates the baseline after legitimate deletion.

PR-2 (persona-ts-ratchet-ci) wires this into pre-push + CI. PR-3 (forbidden-provider-scan) adds deprecated-provider scanning.

Test plan

8/8 test cases pass in scripts/ratchet/test-persona-ts-ratchet.sh:

  • clean baseline passes (exit 0)
  • LOC growth in existing file fails (exit 1)
  • new unallowed .ts file fails (exit 1)
  • new allowlisted generated file passes when total LOC fits
  • new .types.ts file passes when total LOC fits
  • deletion after refresh passes
  • missing baseline returns exit 2 (usage error, not silent pass)
  • refresh writes baseline deterministically (idempotent)

Run locally: scripts/ratchet/test-persona-ts-ratchet.sh

Design notes

Why Bash, not Rust: this is build infrastructure, not runtime behavior. Lane F's mandate is RUNTIME cognition migration. Build tooling lives in shell (peer to git-prepush.sh, main-promotion-gate.sh). The thing being enforced — that runtime logic must be Rust — is separate from the enforcer's language.

Why both LOC + new-file ratchets: new-file detection is easy and clean. LOC ratchet catches the "I just added 200 lines of cognition logic to an existing file" failure mode, which the new-file ratchet misses. Together they're complete.

Why allowlist via path-globs, not content classification: content classification is fragile (regexing for "verb-shaped class names" rots fast). Path discipline scales: generated goes in generated/, types end in .types.ts, schemas in schemas/. The allowlist file is small and reviewable.

🤖 Generated with Claude Code

Lane F PR-1 per ALPHA-GAP-ANALYSIS §"Lane F: TS Cognition Deletion
Ratchet". Mechanical local gate that prevents the persona-cognition
TypeScript layer from growing while Rust takes over runtime behavior.

Two ratchets, both enforced together:

  1. LOC ratchet — total .ts LOC under each watched cognition directory
     must not exceed its committed baseline (`persona-ts-baseline.txt`).
  2. New-file ratchet — new .ts files appearing under watched dirs must
     either be in the baseline file-set OR match a glob in the allowlist
     (`persona-ts-allowlist.txt` — generated artifacts, type-only files,
     schemas; explicitly NOT new cognition modules).

The ratchet only moves down. After legitimate TS deletion lands, run
`scripts/ratchet/persona-ts-ratchet.sh refresh` to tighten the baseline.

Current baseline (locks the existing deletion gains):
  34 files, 8583 LOC across 6 watched cognition directories.

Test suite (`test-persona-ts-ratchet.sh`) — 8 cases, all passing:
clean baseline · LOC growth fails · new unallowed file fails ·
new allowlisted generated passes · new types.ts passes · deletion
after refresh passes · missing baseline returns exit 2 (usage error,
not silent pass) · refresh is idempotent.

Why Bash and not Rust: this is build infrastructure, not runtime
behavior. Lane F's mandate is RUNTIME cognition migration. Build
tooling lives in shell (peer to git-prepush.sh, main-promotion-gate.sh).
The thing being enforced — that runtime logic must be Rust — is
separate from the enforcer's language.

PR-2 (`persona-ts-ratchet-ci`) wires this into pre-push + CI.
PR-3 (`forbidden-provider-scan`) adds the deprecated-provider scan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joelteply
Copy link
Copy Markdown
Contributor Author

Codex review/validation before merge:\n- scripts/ratchet/test-persona-ts-ratchet.sh: 8/8 passed\n- scripts/ratchet/persona-ts-ratchet.sh check: passed at 8583 LOC across 6 watched dirs\n- Scope is build ratchet only; no runtime TS/Node path added.\n\nMerging to canary to keep Lane F cadence moving.

@joelteply joelteply merged commit a996e13 into canary May 18, 2026
2 checks passed
@joelteply joelteply deleted the feat/lane-f-pr1-persona-ts-ratchet-script branch May 18, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant