Skip to content

feat: finish meticulous REST endpoint expansion - #2

Merged
ioncache merged 3 commits into
mainfrom
meticulous-client-rest-endpoint-expansion
Jun 28, 2026
Merged

feat: finish meticulous REST endpoint expansion#2
ioncache merged 3 commits into
mainfrom
meticulous-client-rest-endpoint-expansion

Conversation

@ioncache

@ioncache ioncache commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Overview

Finish the REST endpoint expansion roadmap step for @shotlab/meticulous-client by confirming the remaining REST routes against the real machine, expanding the public client for the confirmed surface, and documenting the result.

Details

  • Added an opt-in integration harness with a single Zod-backed env/config boundary and separate read/write suites.
  • Confirmed the real-machine REST surface for machine, settings, history, profile, and action routes, then updated the protocol notes to match the verified behavior.
  • Expanded the public client with the confirmed helpers, including current/last history, last profile, profile load/get, settings update, and a dedicated preheat() helper.
  • Kept the guarded write suite non-brewing: it never calls start, and it performs best-effort stop cleanup after profile-load and preheat checks so the machine returns to a neutral state.
  • Updated the README and checked off the roadmap item because this PR completes the REST endpoint expansion step.
  • Validation used:
    • yarn workspace @shotlab/meticulous-client format:check
    • yarn workspace @shotlab/meticulous-client lint
    • yarn workspace @shotlab/meticulous-client test
    • METICULOUS_RUN_INTEGRATION=1 yarn workspace @shotlab/meticulous-client test:integration
    • METICULOUS_RUN_INTEGRATION=1 METICULOUS_ALLOW_WRITE_TESTS=1 yarn workspace @shotlab/meticulous-client test:integration:write

Related Tickets and/or Pull Requests

  • None.

Checklist

  • Tests added or updated
  • README and TSDoc updated if the public API changed
  • Breaking changes called out (if any)
  • Roadmap item checked off if this PR completes one

Summary by CodeRabbit

  • New Features

    • Expanded the client to support more REST actions, including history, profile, settings, and additional action requests.
    • Added optional integration test support for validating read-only and guarded write flows.
  • Documentation

    • Updated the protocol docs and client README to reflect newly confirmed endpoints and expanded usage examples.
    • Added a roadmap update and implementation plans for the broader REST rollout.
  • Tests

    • Added and expanded automated coverage for the new client methods and integration scenarios.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ioncache, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 3 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 73289e71-b193-4d19-ab18-8f71cdef6c66

📥 Commits

Reviewing files that changed from the base of the PR and between 06bd0e5 and acee932.

📒 Files selected for processing (9)
  • docs/plans/2026-06-28-meticulous-client-rest-endpoint-expansion.md
  • docs/protocol.md
  • packages/meticulous-client/README.md
  • packages/meticulous-client/integration/read.integration.test.ts
  • packages/meticulous-client/integration/write.integration.test.ts
  • packages/meticulous-client/src/index.test.ts
  • packages/meticulous-client/src/index.ts
  • packages/meticulous-client/src/integration-config.test.ts
  • packages/meticulous-client/src/integration-config.ts
📝 Walkthrough

Walkthrough

Expands @shotlab/meticulous-client with history, profile, settings, and action REST endpoints. Adds a Zod-based integration config parser, separates unit/integration Vitest configs, and introduces opt-in read and write integration test suites gated by environment variables. Protocol docs and README are updated to reflect confirmed and suspected endpoints.

Changes

REST Endpoint Expansion

Layer / File(s) Summary
MeticulousClient interface and implementation
packages/meticulous-client/src/index.ts
Adds JsonArray, HistoryResponse, Profile, Settings, ListProfilesOptions types; expands MeticulousClient with history/profile/settings/action methods; rewires createMeticulousClient internals with get, post, postJson helpers and URL-encoding for profile IDs.
Integration config parser
packages/meticulous-client/src/integration-config.ts, src/integration-config.test.ts, package.json
Adds Zod schemas parsing METICULOUS_RUN_INTEGRATION, METICULOUS_BASE_URL, METICULOUS_ALLOW_WRITE_TESTS, and METICULOUS_SETTINGS_PATCH_JSON into a typed config; exports readIntegrationConfig; adds zod devDependency. Tests cover valid and all invalid env inputs.
Vitest config split and package scripts
packages/meticulous-client/vitest.config.ts, vitest.integration.config.ts, package.json, tsconfig.build.json
Restricts default Vitest to src/**/*.test.ts; adds integration-only config targeting integration/**/*.test.ts with 30s timeout and ~ alias; adds test:integration and test:integration:write scripts; excludes integration-config.ts from build output.
Unit tests for expanded client methods
packages/meticulous-client/src/index.test.ts
Adds unit test cases for all new methods: getSettings, listProfiles (with/without full), getProfile (URL-encoding), getHistory, getCurrentHistory, getLastHistory, getLastProfile, loadProfile, updateSettings (POST JSON body), triggerAction, and preheat.
Read and write integration test suites
packages/meticulous-client/integration/read.integration.test.ts, integration/write.integration.test.ts
Read suite conditionally exercises all GET endpoints against a real machine. Write suite gates on allowWriteTests, derives a safe settings patch, and tests tare/loadProfile/updateSettings/preheat with beforeAll/afterAll lifecycle guards.
Protocol docs, README, and plan updates
docs/protocol.md, packages/meticulous-client/README.md, docs/plans/2026-06-28-meticulous-client-rest-endpoint-expansion.md, docs/ROADMAP.md, docs/plans/2026-06-27-*
Updates confirmed/suspected endpoint sections in protocol.md; expands README usage example and adds Integration Tests section; adds full implementation plan; marks roadmap item complete; removes stale agentic-worker instructions from prior plan docs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • ioncache/shotlab#1: Introduced the original createMeticulousClient scaffold with getMachine and tare; this PR builds directly on that client foundation to expand the REST surface.

Poem

🐇 Hippity-hop, new endpoints abound,
History and profiles and settings are found!
Zod guards the env with a watchful eye,
Integration tests opt-in — machines, stand by!
The roadmap is checked, the preheat's in place,
A well-documented client, what a jolly good pace! ☕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: completing meticulous-client REST endpoint expansion.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch meticulous-client-rest-endpoint-expansion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ioncache
ioncache marked this pull request as ready for review June 28, 2026 17:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
packages/meticulous-client/integration/read.integration.test.ts (1)

5-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse the exported client contract here. The local ReadClient shape plus as unknown as bypasses type checking against createMeticulousClient(). Import MeticulousClient and use Pick<MeticulousClient, ...> (or just type the variable directly) so API drift is caught at compile time.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/meticulous-client/integration/read.integration.test.ts` around lines
5 - 16, The local ReadClient type and the double cast are bypassing compile-time
checks against createMeticulousClient(), so replace the ad hoc shape with the
exported MeticulousClient contract. Update the integration test to import
MeticulousClient and type the client variable as MeticulousClient or
Pick<MeticulousClient, ...> for only the read methods used, so any API drift is
caught automatically; keep the existing method references like
getCurrentHistory, getHistory, getLastHistory, getLastProfile, getMachine,
getProfile, getSettings, and listProfiles aligned with the exported interface.
packages/meticulous-client/integration/write.integration.test.ts (1)

5-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use Pick<MeticulousClient, ...> for the write suite.

The local WriteClient duplicates the exported API, and the as unknown as cast sidesteps it, so signature changes can slip through here. Reuse the public client type instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/meticulous-client/integration/write.integration.test.ts` around
lines 5 - 15, The local WriteClient type is duplicating the public
MeticulousClient API and is being bypassed by the cast, so changes to the real
client signature may not be caught. Replace the ad hoc WriteClient definition in
write.integration.test.ts with a Pick<MeticulousClient, ...> covering the needed
write methods, and update the test setup to use that shared type instead of the
current as unknown as workaround. Refer to the WriteClient alias and the write
suite client variable when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/plans/2026-06-28-meticulous-client-rest-endpoint-expansion.md`:
- Around line 265-315: The plan’s protocol snippets are stale and conflict with
the current client/protocol contract. Update the Step 3/Step 4 examples in this
plan to match the verified symbols and endpoints used elsewhere in the PR,
especially `POST /action/preheat`, the suspected `GET /action/start`, `GET
/action/stop`, `GET /action/purge`, and the absence of `saveProfile`/`GET
/profile/save`. Make sure the referenced protocol examples are explicitly
superseded or rewritten so they can’t be copied back into `docs/protocol.md` as
the wrong contract.

In `@docs/protocol.md`:
- Around line 99-112: The subsection headings in the protocol markdown are
duplicated, which triggers MD024 and creates ambiguous anchors. Update the
repeated headings in the documented action/profile sections to unique names,
using the existing “Actions” and “Profiles” headings as the identifiers to
rename, so each subsection has a distinct anchor.

In `@packages/meticulous-client/src/index.ts`:
- Line 106: The triggerAction URL is using the raw dynamic action name, which
can alter the request path; update the triggerAction function in the client
index to encode the name segment before interpolating it into the action URL.
Follow the same pattern used by getProfile() and loadProfile(), and wrap name
with encodeURIComponent() so only the intended /action/<name> endpoint is
called.

In `@packages/meticulous-client/src/integration-config.ts`:
- Around line 11-16: The validation for METICULOUS_BASE_URL in
optionalTrimmedStringSchema should reject non-HTTP(S) values instead of only
checking generic URL parseability. Update the refine logic used by
optionalUrlStringSchema in integration-config.ts to require http:// or https://
schemes (while still allowing null/empty as currently intended), and keep the
existing error message or adjust it to reflect the stricter protocol
restriction.

---

Nitpick comments:
In `@packages/meticulous-client/integration/read.integration.test.ts`:
- Around line 5-16: The local ReadClient type and the double cast are bypassing
compile-time checks against createMeticulousClient(), so replace the ad hoc
shape with the exported MeticulousClient contract. Update the integration test
to import MeticulousClient and type the client variable as MeticulousClient or
Pick<MeticulousClient, ...> for only the read methods used, so any API drift is
caught automatically; keep the existing method references like
getCurrentHistory, getHistory, getLastHistory, getLastProfile, getMachine,
getProfile, getSettings, and listProfiles aligned with the exported interface.

In `@packages/meticulous-client/integration/write.integration.test.ts`:
- Around line 5-15: The local WriteClient type is duplicating the public
MeticulousClient API and is being bypassed by the cast, so changes to the real
client signature may not be caught. Replace the ad hoc WriteClient definition in
write.integration.test.ts with a Pick<MeticulousClient, ...> covering the needed
write methods, and update the test setup to use that shared type instead of the
current as unknown as workaround. Refer to the WriteClient alias and the write
suite client variable when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 111e3faa-7598-4221-90e4-4f94a559ac4b

📥 Commits

Reviewing files that changed from the base of the PR and between 206f037 and 06bd0e5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • docs/ROADMAP.md
  • docs/plans/2026-06-27-meticulous-client-rest-foundation.md
  • docs/plans/2026-06-27-repo-tooling-foundation.md
  • docs/plans/2026-06-28-meticulous-client-rest-endpoint-expansion.md
  • docs/protocol.md
  • packages/meticulous-client/README.md
  • packages/meticulous-client/integration/read.integration.test.ts
  • packages/meticulous-client/integration/write.integration.test.ts
  • packages/meticulous-client/package.json
  • packages/meticulous-client/src/index.test.ts
  • packages/meticulous-client/src/index.ts
  • packages/meticulous-client/src/integration-config.test.ts
  • packages/meticulous-client/src/integration-config.ts
  • packages/meticulous-client/tsconfig.build.json
  • packages/meticulous-client/vitest.config.ts
  • packages/meticulous-client/vitest.integration.config.ts
💤 Files with no reviewable changes (2)
  • docs/plans/2026-06-27-repo-tooling-foundation.md
  • docs/plans/2026-06-27-meticulous-client-rest-foundation.md

Comment thread docs/plans/2026-06-28-meticulous-client-rest-endpoint-expansion.md
Comment thread docs/protocol.md
Comment thread packages/meticulous-client/src/index.ts Outdated
Comment thread packages/meticulous-client/src/integration-config.ts
@ioncache
ioncache merged commit 164f0ef into main Jun 28, 2026
1 check passed
@ioncache ioncache changed the title [codex] finish meticulous REST endpoint expansion feat: finish meticulous REST endpoint expansion Jun 28, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jun 28, 2026
4 tasks
ioncache added a commit that referenced this pull request Jun 29, 2026
Finish the `REST endpoint expansion` roadmap step for
`@shotlab/meticulous-client` by confirming the remaining REST routes
against the real machine, expanding the public client for the confirmed
surface, and documenting the result.

- Added an opt-in integration harness with a single Zod-backed
env/config boundary and separate read/write suites.
- Confirmed the real-machine REST surface for machine, settings,
history, profile, and action routes, then updated the protocol notes to
match the verified behavior.
- Expanded the public client with the confirmed helpers, including
current/last history, last profile, profile load/get, settings update,
and a dedicated `preheat()` helper.
- Kept the guarded write suite non-brewing: it never calls `start`, and
it performs best-effort `stop` cleanup after profile-load and preheat
checks so the machine returns to a neutral state.
- Updated the README and checked off the roadmap item because this PR
completes the REST endpoint expansion step.
- Validation used:
  - `yarn workspace @shotlab/meticulous-client format:check`
  - `yarn workspace @shotlab/meticulous-client lint`
  - `yarn workspace @shotlab/meticulous-client test`
- `METICULOUS_RUN_INTEGRATION=1 yarn workspace
@shotlab/meticulous-client test:integration`
- `METICULOUS_RUN_INTEGRATION=1 METICULOUS_ALLOW_WRITE_TESTS=1 yarn
workspace @shotlab/meticulous-client test:integration:write`

- None.

- [x] Tests added or updated
- [x] README and TSDoc updated if the public API changed
- [x] Breaking changes called out (if any)
- [x] Roadmap item checked off if this PR completes one

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Expanded the client to support more REST actions, including history,
profile, settings, and additional action requests.
- Added optional integration test support for validating read-only and
guarded write flows.

- **Documentation**
- Updated the protocol docs and client README to reflect newly confirmed
endpoints and expanded usage examples.
- Added a roadmap update and implementation plans for the broader REST
rollout.

- **Tests**
- Added and expanded automated coverage for the new client methods and
integration scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

1 participant