Skip to content

release: v0.3.2 - #134

Closed
mohanagy wants to merge 13 commits into
mainfrom
development
Closed

release: v0.3.2#134
mohanagy wants to merge 13 commits into
mainfrom
development

Conversation

@mohanagy

@mohanagy mohanagy commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Fixes #127

Release promotion

Promotes the validated development commit d65f3f16db35d5b5c0ae37b6f0992ec8840d7766 to main for @lubab/miftah v0.3.2.

Included fixes

Evidence before promotion

  • Release preparation PR chore: prepare v0.3.2 release #133 merged after its exact head passed Linux quality (full test suite, coverage, build, CLI smoke, package check), Linux/macOS/Windows Node 20/22/24 core+CLI, Verify, and CodeRabbit.
  • All review threads were empty.

After this promotion PR is green and merged, I will tag this exact main commit and create GitHub Release v0.3.2; the protected OIDC workflow will perform npm publish --provenance.

Summary by CodeRabbit

  • New Features
    • Added safer, origin-restricted classification for PostHog command-wrapper requests.
    • Route previews now include policy enforcement status and clearer audit evidence.
  • Bug Fixes
    • Improved shutdown cleanup when transport closing fails.
    • Invalid or unrecognized command forms now fail closed as destructive.
    • Updated esbuild to 0.28.1 to address a known security advisory.
  • Documentation
    • Clarified routing previews, risk classification, annotations, security boundaries, and release information.
  • Chores
    • Released version 0.3.2.

mohanagy added 6 commits July 20, 2026 22:27
* fix: always close upstreams after server close errors

* test: preserve containment close error identity
* test: diagnose Windows descendant readiness boundary

* test: diagnose cold Windows provider helper settlement

* test: share provider readiness wait helper
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 29b332e5-e873-4526-ae03-f85f563d9ba4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The release adds origin-pinned PostHog command classification, shared preview enforcement, resilient shutdown cleanup, synchronized Windows provider tests, and version 0.3.2 release and toolchain updates.

Changes

Security and policy flow

Layer / File(s) Summary
PostHog command classification
src/policy/*, tests/posthog-command-wrapper.test.ts
A bounded command grammar classifies supported PostHog commands and treats malformed or unsupported input as destructive.
Preview enforcement and adapter integration
src/mcp/server/*, src/policy/*, docs/*, tests/mcp-wrapper.test.ts, tests/risk-classification-docs-contract.test.ts, tests/fixtures/fake-upstream.mjs
Route preview uses argument-aware risk metadata and shared enforcement results, while canonical PostHog wrapper behavior and audit output are tested and documented.
Shutdown and provider lifecycle containment
src/mcp/server/miftah-server.ts, tests/mcp-wrapper.test.ts, tests/fixtures/fake-secret-provider.mjs, tests/secret-providers.test.ts
Shutdown continues upstream cleanup after transport-close failures, and Windows provider tests synchronize on an explicit readiness signal.
Release and toolchain contracts
CHANGELOG.md, package.json, docs/presets-and-clients.md, tests/package-contract.test.ts, tests/preset-docs-contract.test.ts, tests/release-version.test.ts
Release metadata moves to 0.3.2, esbuild is pinned to 0.28.1, and related artifact assertions are updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MiftahServer
  participant OperationPipeline
  participant PosthogCommandClassifier
  Client->>MiftahServer: request miftah_route_preview
  MiftahServer->>PosthogCommandClassifier: classify bounded command metadata
  PosthogCommandClassifier-->>MiftahServer: return risk and provenance
  MiftahServer->>OperationPipeline: evaluate policy enforcement
  OperationPipeline-->>MiftahServer: return allowed or POLICY_BLOCKED
  MiftahServer-->>Client: return preview and enforcement
Loading

Possibly related issues

  • mohanagy/miftah issue 127 — Directly covers the version 0.3.2 release preparation and included PostHog, containment, and esbuild changes.
  • mohanagy/miftah issue 107 — Relates to the changelog contract test changes for independent historical issue-entry validation.
  • mohanagy/miftah issue 125 — Relates to the shared Windows provider-entry readiness helper and its test call sites.

Possibly related PRs

  • mohanagy/miftah#109 — Implements the same PostHog command-wrapper classification and preview enforcement path.
  • mohanagy/miftah#118 — Updates shutdown to complete upstream containment after downstream close errors.
  • mohanagy/miftah#126 — Pins esbuild to 0.28.1 and validates the resolved package version.

Poem

A rabbit reviews the guarded route,
Where shell-like tricks are sent en route.
The upstream sleeps when closing starts,
While clean signals guide test hearts.
“0.3.2!” the bunny sings,
With pinned tools and safer things.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Docstring Coverage ❌ Error Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description summarizes the release but omits the required Summary, Security impact, and Validation template sections. Reformat the PR description to include the required template sections and fill in the validation checklist with exact commands and results.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: promoting v0.3.2 for this release PR.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch development

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

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/mcp/server/miftah-server.ts (1)

476-502: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Solid containment fix; consider surfacing all close failures, not just the first.

Each shutdown step now runs regardless of earlier failures, which correctly fixes the containment gap. closeFailure ??= { error } only preserves the first error though — if unsubscribeResourceSubscriptions and upstreams.close() both fail, the second failure is silently dropped.

♻️ Optional: aggregate all close failures
-    let closeFailure: { readonly error: unknown } | undefined;
-    try {
-      await this.unsubscribeResourceSubscriptions(() => true);
-    } catch (error) {
-      closeFailure = { error };
-    }
-    try {
-      await this.server.close();
-    } catch (error) {
-      closeFailure ??= { error };
-    }
-    try {
-      await this.upstreams.close();
-    } catch (error) {
-      closeFailure ??= { error };
-    }
-    if (closeFailure !== undefined) throw closeFailure.error;
+    const closeErrors: unknown[] = [];
+    try {
+      await this.unsubscribeResourceSubscriptions(() => true);
+    } catch (error) {
+      closeErrors.push(error);
+    }
+    try {
+      await this.server.close();
+    } catch (error) {
+      closeErrors.push(error);
+    }
+    try {
+      await this.upstreams.close();
+    } catch (error) {
+      closeErrors.push(error);
+    }
+    if (closeErrors.length > 0) throw new AggregateError(closeErrors, "Failed to close one or more shutdown resources");
🤖 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 `@src/mcp/server/miftah-server.ts` around lines 476 - 502, Update close() to
collect every error thrown by unsubscribeResourceSubscriptions, server.close,
and upstreams.close instead of retaining only the first via closeFailure. After
all shutdown steps complete, surface the aggregated failures while preserving
the existing execution order and lifecycle audit behavior.
🤖 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 `@tests/secret-providers.test.ts`:
- Around line 412-437: Update the test around waitForProviderEntered, observed,
and commandSettled to enforce the two-phase handshake: make the fixture block
immediately after writing the provider-entry marker, assert commandSettled is
still false before releasing that block, then release the fixture and await the
existing settlement race. Preserve the current success and rejection assertions
after the release.

---

Outside diff comments:
In `@src/mcp/server/miftah-server.ts`:
- Around line 476-502: Update close() to collect every error thrown by
unsubscribeResourceSubscriptions, server.close, and upstreams.close instead of
retaining only the first via closeFailure. After all shutdown steps complete,
surface the aggregated failures while preserving the existing execution order
and lifecycle audit behavior.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c91b685a-a456-40ce-89d5-257a25ccd173

📥 Commits

Reviewing files that changed from the base of the PR and between 77a8bcc and d65f3f1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • CHANGELOG.md
  • docs/architecture.md
  • docs/config.md
  • docs/presets-and-clients.md
  • docs/security.md
  • package.json
  • src/mcp/server/miftah-server.ts
  • src/mcp/server/operation-pipeline.ts
  • src/policy/policy-types.ts
  • src/policy/posthog-command-wrapper.ts
  • src/policy/risk-classifier.ts
  • src/policy/risk-name-patterns.ts
  • tests/fixtures/fake-secret-provider.mjs
  • tests/fixtures/fake-upstream.mjs
  • tests/mcp-wrapper.test.ts
  • tests/package-contract.test.ts
  • tests/posthog-command-wrapper.test.ts
  • tests/preset-docs-contract.test.ts
  • tests/release-version.test.ts
  • tests/risk-classification-docs-contract.test.ts
  • tests/secret-providers.test.ts

Comment thread tests/secret-providers.test.ts Outdated
Comment on lines +412 to +437
let commandSettled = false;
const observed = pending.then(
(result) => {
commandSettled = true;
return { status: "fulfilled" as const, result };
},
(error: unknown) => {
commandSettled = true;
return { status: "rejected" as const, error };
}
);
let settlementTimer: NodeJS.Timeout | undefined;

try {
await waitForProviderEntered(providerReadyPath, "the cold fake provider to enter through the Windows helper");
const outcome = await Promise.race([
observed,
new Promise<{ status: "pending" }>((resolve) => {
settlementTimer = setTimeout(() => resolve({ status: "pending" }), 2_000);
})
]);
if (outcome.status === "pending") {
throw new Error("The provider entered through the Windows helper but the helper did not settle within 2000ms");
}
if (outcome.status === "rejected") throw outcome.error;
expect(outcome.result.stdout.toString("utf8")).toBe("fixture-provider-secret");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Assert the required provider-entry/settlement ordering.

This can pass when observed settled while waitForProviderEntered() was polling: commandSettled is tracked but never checked before the race. Use a two-phase fixture handshake—block after writing the entry marker—then assert the command is pending before releasing the fixture and awaiting settlement.

🤖 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 `@tests/secret-providers.test.ts` around lines 412 - 437, Update the test
around waitForProviderEntered, observed, and commandSettled to enforce the
two-phase handshake: make the fixture block immediately after writing the
provider-entry marker, assert commandSettled is still false before releasing
that block, then release the fixture and await the existing settlement race.
Preserve the current success and rejection assertions after the release.

@mohanagy

Copy link
Copy Markdown
Owner Author

Superseded by a fresh v0.3.2 promotion PR after #135 and #137 merged into development. This PR retains historic CI/review state from the earlier release head, including a CodeRabbit changes-requested decision, so it will not be used for release. The replacement will be reviewed and validated against the exact current development head before any merge to main.

@mohanagy mohanagy closed this Jul 21, 2026
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