Skip to content

test(connectors): cover methodLines, docSection and snakeId (#264) - #284

Merged
juancguerrerodev merged 9 commits into
DojoCodingLabs:mainfrom
mir-ashiq:test/connectors-derive
Dec 6, 2026
Merged

juancguerrerodev merged 9 commits into
DojoCodingLabs:mainfrom
mir-ashiq:test/connectors-derive

Conversation

@mir-ashiq

Copy link
Copy Markdown
Contributor

What and why

Closes #264

Adds a describe block for each of the three helpers packages/connectors/src/connect/derive.ts reads a service's API docs with, importing methodLines, docSection and snakeId from ../src/connect/derive.ts, with a made-up doc:

  • methodLines finds both METHOD /path lines of the doc, with the trailing . dropped from the path, accepts spaces before the method, and skips a lower case method, a method in the middle of a sentence and a method it doesn't know (HEAD);
  • docSection gives the heading line before the method, the method line and what follows, stopping before the next endpoint's heading, runs the last endpoint's section to the end of the doc, and gives "" for a method or a path that isn't there;
  • snakeId turns names into snake case with accents dropped (Café Ñandú gives cafe_nandu), prefixes a name that doesn't start with a letter, gives the fallback when there is no letter at all, pads a one letter id, and cuts a long name to 40 characters with no _ at the end.

It also pins today's docSection behaviour the issue names: the line just before the next method line is always treated as that endpoint's heading, so docSection("GET /a\nx\nPOST /b", "GET", ["/a"]) gives "GET /a".

Tests only: packages/connectors/src/connect/derive.ts is unchanged, and the doc, names, paths and fallback in the tests are all made up.

Vision fit

Principle 7, "Small, typed and tested": packages are plain TypeScript behind ports, tested on Node. The three helpers decide what a drafted connector may read and how it is named, so their behaviour is pinned by tests that call each by name instead of only through whole drafts.

Non-negotiables

  • This keeps every non-negotiable in AGENTS.md as it is.
  • Or it changes one, and this is the accepted RFC: n/a

Checklist

  • It closes one issue, linked above, or it's a small fix (a typo, a broken link, a wrong comment). A feature has an accepted proposal.
  • I wrote the failing test first. It fails without this change and passes with it. Each new test was also broken on purpose, one expectation at a time, and seen to fail before being put back.
  • These pass: pnpm check:privacy, pnpm typecheck, pnpm lint, pnpm test and node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt.
  • No new network call, telemetry, analytics, ads or crash reporting. (A new request in an app adapter is explained below, with its host, skill and risk.)
  • No new dependency, or the reason for each one is below.
  • Every UI string is in packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes. (No UI string in this change.)
  • Tests, fixtures and screenshots use made-up data only.

One step of the gates I could not complete in this sandbox, named as AGENTS.md asks: a full pnpm install does not finish on this machine (it is killed for memory, and the Expo dependencies fill the disk), so apps/mobile's typecheck and tests, and with them the single full-repo pnpm typecheck and pnpm test, did not run locally. This change touches one test file in packages/connectors and nothing in apps/mobile; CI runs the full set. Everything else ran locally:

  • pnpm --filter @hermit/connectors test: 358 passed (345 existing + 13 new, connect-derive.test.ts now 23).
  • pnpm -r --if-present --filter '!@hermit/mobile' test: 16 projects, 4,218 tests passed.
  • pnpm --filter @hermit/connectors typecheck: passed.
  • node --test scripts/*.test.mjs scripts/devices/*.test.mjs: 93 passed.
  • pnpm lint: passed.
  • pnpm check:privacy: passed.
  • node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt: guard: ok. 1 changed files checked against origin/HEAD.

Model path

  • This doesn't touch the model path: packages/model, agent, skills or eval, the prompt, the router, tool descriptions, normalizers, examples or the model file.
  • It does. The eval numbers from before and after are below, run as docs/evals.md says. No held-out case was tuned on. n/a

Screenshots

  • No UI change.
  • UI change. Each changed screen is below, in both themes and both languages, with made-up data. n/a

New dependencies and network calls

n/a

AI agents

  • No AI agent wrote any part of this.
  • An AI agent helped. Which one, and what it did: Claude (an AI coding agent) wrote the thirteen tests from the issue's spec, checked that each can fail, and ran the checks listed above.
  • I read and ran everything in this pull request, and I can explain it.

Copilot AI balanced review requested due to automatic review settings December 6, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@juancguerrerodev
juancguerrerodev merged commit 0302149 into DojoCodingLabs:main Dec 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connectors: test methodLines, docSection and snakeId

6 participants