Commit Graph

43606 Commits

Author SHA1 Message Date
Gio Della-Libera
080e34a2c2 lint(oc-path): satisfy curly + unused-import rules 2026-05-09 01:48:35 -04:00
Gio Della-Libera
ac9418d206 refactor(oc-path): drop YAGNI grammar features
Removes four path-syntax features that added complexity without
enough real-world use:

- **Quoted-segment escape sequences**: kept quoted segments themselves
  (still needed for keys with `/` or `.`) but dropped `\"` and `\`
  escapes. Quoted content is now byte-literal, refused if it contains
  `"` or `\`. Simplifies scanBracketAware (drops the `escaped` state),
  unquoteSeg (no decode loop), quoteSeg (no escape encoding).

- **CSS-style predicate operators**: removed `*=` (substring), `^=`
  (prefix), `$=` (suffix). Predicate set is now `=`, `!=`, and the
  numeric `<` / `<=` / `>` / `>=`. Lint rules needing substring
  matching can use `findOcPaths(*)` + JS filter.

- **`$first` positional**: alias for index 0 (or first-declared key).
  Use the literal `0` instead.

- **`-N` negative index**: rarely useful beyond `-1`, which is already
  covered by `$last`. The "negative numeric key on object" case
  (Telegram supergroup IDs) still works — non-indexable containers
  fall through to literal-key lookup.

Behavior loss: zero in observed real workspace files. Tests for the
dropped features removed (15 tests).

Net: -22 LoC src + 15 fewer tests. Total package: 10,570 → 10,275 LoC.
2026-05-09 01:48:35 -04:00
Gio Della-Libera
71c855f244 refactor(oc-path): consolidate dispatch and trim comment surface
Substrate simplifications and broad comment cleanup:

**Walker collapse (find.ts)**: three near-parallel walkers
(walkJsonc, walkJsonl + walkJsonlInsideLine, walkMd + walkMdInsideBlock
+ walkMdInsideItem) shared the same segment-shape dispatch — union /
predicate / `*` / `**` / positional / literal — with different child
types. Extracted as a single `dispatchSeg<T>(ops, ...)` that takes a
per-kind `WalkOps<T>` table; each walker is a thin wrapper. The three
md walkers fold into one `walkMd(level, ...)` polymorphic on a
`MdLevel` discriminated union. JSONL routes the post-line-slot
descent through walkJsonc via a WeakMap-tagged ast holder.

**CLI (cli.ts)**: each command duplicated four times the same
try/catch/emit/exit dance — missing-arg check, parseOcPath try/catch,
OcEmitSentinelError catch. Extracted as `requireArg`, `tryParse`,
`catchSentinel`. Folded `RawPathOptions` into `PathCommandOptions`
(identical shape) and collapsed `.option(...)` chains via
`withCommonOpts`.

**universal.ts**: setJsoncLeaf and setJsonlLeaf were near-identical
(resolve, refuse root, coerce, set, wrap). Extracted as
`setStructuredLeaf<A, M>` with optional `onLine` for jsonl's
whole-line replacement. Inlined setMdLeaf (7-line passthrough) into
setOcPath. Dropped four `throw new Error("unreachable")` statements
TS exhaustive checking already covers.

**oc-path.ts**: 35 `throw new OcPathError(...)` sites compress through
a `fail()` helper. File-slot containment check (absolute, parent-dir,
control chars) extracted as `validateFileSlot` so parse + format share
the same defense. Three structural-nesting throws in formatOcPath
collapse into two. Three near-parallel string scanners
(`indexOfTopLevel`, `splitRespectingBrackets`, `validateBrackets`) fold
through one `scanBracketAware(s, onChar, onUnbalanced)` helper.

**jsonl/edit.ts**: pickLineIndex compressed; line-address dispatch
shares the value-line filter as a small helper.

**Internal review codes stripped**: P-NNN, F-NN, I-NN, H2-NN, OP-NN,
R-NN, T-NN, S-NN, BFJ-NN, RJC-NN, RJL-NN, FM-NN, A-NN, B-NN, CC-NN,
wave-NN — these were review-process artifacts (sprint identifiers,
finding IDs, pitfall taxonomy IDs) that mean nothing to a reader who
didn't participate in the originating review. Test names rewritten
human-readable; comments lose their P-NNN bookmarks; describe blocks
drop the wave-NN prefix.

**Pitfalls test consolidated**: `tests/scenarios/pitfalls.test.ts`
(637 LoC, organized by P-NNN) replaced by `security-and-limits.test.ts`
(288 LoC) — unique coverage migrates over with descriptive names;
duplicates of OP-/R-/etc. tests are dropped.

**Comment cleanup**: per CLAUDE.md "default to writing no comments;
add one only when the WHY is non-obvious", trimmed multi-paragraph
WHY-prose on every public export, running prose inside function
bodies that restated what the next line of code said, section-divider
comments in test files, and module-level doc-comments that paraphrased
the file name. Kept load-bearing context: NFC re-check after grow,
quote-aware split symmetry, multi-char operator precedence, sentinel
guard catch routes, WeakMap holder rationale.

**MdAst slimmed**: `tables` and `codeBlocks` fields removed — substrate
addressing doesn't go inside them, and markdown-it's tokenizer
already excludes them from heading/item misparse without
first-class AST modeling.

Net reduction across the 10 consolidation/cleanup commits: ~3,800 LoC.
2026-05-09 01:48:35 -04:00
Gio Della-Libera
7b7e65105b refactor(oc-path): markdown-it tokenizer + grammar relaxation
The hand-rolled MD parser is replaced with a markdown-it token-stream
walker. AstTable and AstCodeBlock are dropped from the AST — the
substrate doesn't address into table rows or fence content, and
markdown-it's tokenizer already handles "##/- inside fenced code
should not be a heading/item" correctly without first-class AST
modeling.

Grammar opinions move from parser to lint:
  - Indented `## foo` (1-3 spaces) is now a heading
  - Empty `## ` is a heading with empty slug
  - Ordered lists (`1. step`) become items
  - Nested sub-bullets become items at flat level

Each was previously a silent parser refusal — now they are recognized
shapes. Lint rules can flag them (`OC_HEADING_INDENTED`,
`OC_HEADING_EMPTY`, etc.) where authoring conventions require the
narrower shape.

Net: parse.ts drops 301 → 207 LoC; tables/code-blocks scenario tests
removed wholesale (-251 LoC of test surface that pinned dead AST
fields).
2026-05-09 01:48:35 -04:00
Gio Della-Libera
6283c8247c refactor(oc-path): drop YAML kind from substrate
The YAML AST/parser/emitter/edit-resolve module is removed. The
substrate now supports md / jsonc / jsonl. Walker, universal verbs,
CLI, and tests are stripped of yaml-kind branches; the `yaml` package
dependency is dropped.

Why: YAML editing was the most complex per-kind module (~750 LoC of
parse/emit/resolve plus walker scaffold) for the smallest surface area
in real-world usage — substrate consumers (lkg, gateway config, agent
metadata) all pivoted to jsonc / md / jsonl. Carrying yaml support
indefinitely was net cost.

Walker depth-cap test that previously relied on YAML's lack of a
parser-level depth cap is rewritten to construct a synthetic JSONC AST
chain by hand, exercising the walker's MAX_TRAVERSAL_DEPTH defense in
isolation from the parser's MAX_PARSE_DEPTH.

Net: -1467 LoC across substrate + tests.
2026-05-09 01:48:35 -04:00
Gio Della-Libera
30e69142f0 fix(oc-path): three followup fixes (sentinel guard, byte cap, walker parity)
Closes three load-bearing gaps in the substrate's defenses:

- **md sentinel defense-in-depth (I2)**: `setJsoncOcPath` and the jsonl
  finalize-via-render path both refuse sentinel-bearing values before
  they reach the AST. The md path was deferring entirely to round-trip
  echo through `emitMd`, which `acceptPreExistingSentinel` skips by
  default. Closes the cross-kind asymmetry.

- **jsonc byte-length cap (N3)**: pre-parse cap on input length, symmetric
  with the existing post-parse depth cap at `nodeToJsoncValue`. Without
  this, `parseTree` allocates the full tree before our walker notices.

- **md walker union + predicate parity (I3)**: jsonc walkers dispatched
  union and predicate at every slot; md dispatched only on
  wildcard/ordinal/positional/literal, so `oc://X.md/{Boundaries,Limits}/...`
  matched zero items where the same shape on jsonc would match both.
  Pins the parity.
2026-05-09 01:48:35 -04:00
Peter Steinberger
e3b33a26cd refactor: move oc-path into plugin 2026-05-09 01:48:35 -04:00
Peter Steinberger
9a151b248e test: tighten msteams continue callbacks 2026-05-09 06:48:16 +01:00
Peter Steinberger
094d0b88a5 test: tighten discord dispatch cfg assertions 2026-05-09 06:46:51 +01:00
Peter Steinberger
eb9f803ff1 test: tighten codex trajectory recorder assertion 2026-05-09 06:44:19 +01:00
Peter Steinberger
c85aaa6e47 test: tighten googlechat auth runtime callbacks 2026-05-09 06:42:46 +01:00
Peter Steinberger
3e1dc0f284 test: tighten googlechat auth transport assertions 2026-05-09 06:41:05 +01:00
Peter Steinberger
be1a1c4a6e test: tighten googlechat pairing text 2026-05-09 06:39:20 +01:00
Peter Steinberger
b34cf2f1a2 fix: externalize matrix plugin 2026-05-09 06:38:29 +01:00
Josh Avant
5fdef4c39e fix(codex): ignore account updates for turn liveness (#79667)
* fix codex app-server completion liveness

* docs changelog codex liveness fix
2026-05-09 00:38:22 -05:00
Peter Steinberger
bb95031ea5 test: tighten googlechat webhook body assertion 2026-05-09 06:38:00 +01:00
Peter Steinberger
ce843fe53d test: tighten googlechat pairing timestamp 2026-05-09 06:36:58 +01:00
Peter Steinberger
73cd9f4eb8 test: tighten qa runtime tool assertions 2026-05-09 06:35:35 +01:00
Peter Steinberger
c1ac243d0f test: tighten codex registration callbacks 2026-05-09 06:34:27 +01:00
Peter Steinberger
ba07111800 test: tighten slack dispatch cfg assertions 2026-05-09 06:33:07 +01:00
Peter Steinberger
0257a88df8 test: tighten slack action cfg assertions 2026-05-09 06:30:20 +01:00
Peter Steinberger
0d277e9533 test: tighten slack thread cfg assertions 2026-05-09 06:29:07 +01:00
Peter Steinberger
255f9648c0 test: tighten slack reaction cfg assertions 2026-05-09 06:27:15 +01:00
Peter Steinberger
f1c189cd19 test: tighten slack socket logger assertions 2026-05-09 06:24:17 +01:00
Peter Steinberger
9635d26c52 test: tighten slack reconnect timestamps 2026-05-09 06:23:07 +01:00
Peter Steinberger
d3a29110a0 test: tighten slack thread cache timestamp 2026-05-09 06:21:33 +01:00
Peter Steinberger
0e1ea080b8 test: tighten msteams conversation timestamps 2026-05-09 06:20:14 +01:00
Peter Steinberger
4b2e231bf4 test: tighten memory probe cache assertions 2026-05-09 06:18:10 +01:00
Peter Steinberger
0889223a07 fix: validate inline images against session agent model (#79416) 2026-05-09 01:18:04 -04:00
Peter Steinberger
3938328aa4 test: tighten voice outbound lifecycle assertions 2026-05-09 06:16:55 +01:00
Shakker
0d93faac54 test: fix telegram proxy send mock 2026-05-09 06:16:25 +01:00
Peter Steinberger
1a08e77ded test: tighten bonjour callback assertions 2026-05-09 06:15:09 +01:00
Peter Steinberger
63926e749d test: tighten mattermost dm retry assertion 2026-05-09 06:13:57 +01:00
Peter Steinberger
285283ce04 test: tighten app settings timing assertions 2026-05-09 06:12:29 +01:00
Peter Steinberger
951025ca9d test: tighten gateway client timing assertions 2026-05-09 06:10:43 +01:00
Peter Steinberger
0ed57bf337 test: tighten discord action option assertions 2026-05-09 06:08:42 +01:00
Peter Steinberger
6af6d166cd test: tighten voice response session assertions 2026-05-09 06:07:30 +01:00
Shakker
f8355a82f3 test: tighten live array assertions 2026-05-09 06:07:01 +01:00
Josh Avant
024528c937 fix(nextcloud-talk): detect missing bot response feature (#79657)
* fix(nextcloud-talk): detect missing bot response feature

* docs(changelog): note nextcloud talk response fix
2026-05-09 00:06:44 -05:00
Peter Steinberger
9202e74b11 test: tighten memory watcher error assertion 2026-05-09 06:06:05 +01:00
Peter Steinberger
12ebb97168 test: tighten voice runtime consult assertions 2026-05-09 06:05:09 +01:00
Peter Steinberger
b5def5dbdf test: tighten voice webhook handler assertion 2026-05-09 06:03:55 +01:00
Shakker
5c9755d347 test: tighten e2e array assertions 2026-05-09 06:03:18 +01:00
Peter Steinberger
98cc3d8839 test: tighten voice call tunnel spawn options 2026-05-09 06:01:49 +01:00
Shakker
d8537bffac test: tighten agent runtime array assertions 2026-05-09 06:00:40 +01:00
Peter Steinberger
e8c76de8e0 test: tighten qa web runtime options 2026-05-09 06:00:09 +01:00
Peter Steinberger
84273aebdb test: tighten approval handler runtime assertion 2026-05-09 05:58:40 +01:00
Shakker
0fef42ddcc test: tighten plugin extension array assertions 2026-05-09 05:58:17 +01:00
Peter Steinberger
dedbd8d6fd fix(google): canonicalize gemini pro dynamic ids 2026-05-09 05:57:18 +01:00
Shakker
e2d8b78b69 test: tighten daemon infra array assertions 2026-05-09 05:56:26 +01:00