Skip to content

Adopt pm-cli 2026.7.28 and replace hand-rolled api doubles with the real SDK test harness - #49

Merged
unbraind merged 2 commits into
mainfrom
chore/adopt-2026-7-28-and-real-sdk-harness
Jul 28, 2026
Merged

unbraind merged 2 commits into
mainfrom
chore/adopt-2026-7-28-and-real-sdk-harness

Conversation

@unbraind

@unbraind unbraind commented Jul 28, 2026 •

Copy link
Copy Markdown
Owner

Bumps pm-cli to 2026.7.28 (peer >=2026.7.28, dev ^2026.7.28) across package.json, manifest.json, and the module version constant, and migrates the activation tests off hand-rolled api doubles.

Both test/smoke.test.ts and test/atomic.test.ts constructed a fake api object and called activate(api) directly, which asserts the extension against itself: the real pm host can reject a registration outright and the suite stays green while the shipped extension is broken. pm-cli 2026.7.28 makes the real harness hard-fail on host-owned flag collisions, so migrating to createExtensionTestHarness converts a silent production break into a red test.

  • smoke.test.ts: the capabilities test now activates through pm's real engine via createExtensionTestHarness, asserting activation.failed is empty plus the linear sync/linear validate command contracts, the linear/linear-sync importers, the linear exporter, the preflight override, the schema item fields, and the importer/exporter flags.
  • atomic.test.ts: the captureImporter hand-rolled double is replaced with harness.runImporter so the linear-sync importer is exercised through real dispatch.

All existing behavioural assertions are preserved (migration, not rewrite).

Closes pm-linear-itg9. See https://github.com/unbraind/pm-linear/blob/main/.agents/pm/chores/pm-linear-itg9.toon

Summary by Sourcery

Adopt pm-cli 2026.7.28 and migrate extension activation/importer tests to the official pm-cli SDK test harness for real host-engine validation.

Build:

  • Bump pm-linear extension version to 2026.7.28 and align pm-cli peer/dev dependency constraints and manifest metadata with pm-cli 2026.7.28.

Documentation:

  • Roll the changelog forward to 2026.7.28 with a note about eliminating any via real Linear GraphQL and SDK handler types.

Tests:

  • Replace hand-rolled activation api doubles in smoke tests with createExtensionTestHarness, asserting clean activation and the expected commands, schema fields, importers, exporter, preflight override, and flags.
  • Exercise the linear-sync importer through createExtensionTestHarness.runImporter instead of a custom capture helper so dry-run behavior is validated against the real dispatch engine.

Chores:

  • Record the pm-linear-itg9 chore artifacts under .agents/pm/ for tracking this change.

Summary by cubic

Upgrades to @unbrained/pm-cli 2026.7.28 and replaces hand-rolled API doubles with the real SDK test harness to validate activation and importer dispatch end to end. Regenerates the 2026.7.28 changelog after closing pm-linear-itg9 and widens .gitattributes JSON merge fence to fix CI and reduce merge conflicts.

  • Dependencies

    • Bump @unbrained/pm-cli to peer >=2026.7.28 and dev ^2026.7.28.
    • Update extension version to 2026.7.28 in package.json, manifest.json, and the module constant.
  • Refactors

    • Migrate tests to createExtensionTestHarness:
      • smoke.test.ts: activate via the real engine; assert clean activation; verify linear sync/linear validate command contracts, linear/linear-sync importers, linear exporter, preflight override, schema fields, and importer/exporter flags.
      • atomic.test.ts: replace the importer double with harness.runImporter to exercise linear-sync through real dispatch; confirm --dry-run never writes.

Written for commit 9d40ee3. Summary will update on new commits.

Review in cubic

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@sourcery-ai sourcery-ai 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.

Sorry @unbraind, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The extension is bumped to version 2026.7.28, requires pm-cli 2026.7.28, and migrates atomic and activation tests from manual API doubles to the real SDK test harness.

Changes

Extension release and harness migration

Layer / File(s) Summary
Release metadata and pm-cli update
.agents/pm/..., CHANGELOG.md, index.ts, manifest.json, package.json
Updates release versions, pm-cli requirements, changelog entries, and chore history for 2026.7.28.
Atomic importer harness execution
test/atomic.test.ts
Runs the linear-sync dry-run test through the SDK harness and verifies the returned dry-run result.
Activation contract verification
test/smoke.test.ts
Uses the SDK harness to validate activation and registered extension capabilities.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • unbraind/pm-linear#36: Updates atomic linear-sync dry-run coverage using the real extension test harness.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the main change: upgrading pm-cli and replacing hand-rolled API doubles with the real SDK test harness.
Description check ✅ Passed The description directly matches the code changes, covering the pm-cli bump and test harness migration.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/adopt-2026-7-28-and-real-sdk-harness

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.

@sourcery-ai

sourcery-ai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates the extension to pm-cli 2026.7.28 and migrates activation and importer tests from hand-rolled ExtensionApi mocks to the real pm-cli SDK test harness, ensuring registration and importer behavior are validated against the actual host engine.

Sequence diagram for activation and importer tests using the pm-cli SDK harness

sequenceDiagram
    actor Test
    participant PmCliHarness
    participant Extension

    Test->>PmCliHarness: createExtensionTestHarness
    PmCliHarness-->>Test: harness (activation, runImporter)

    rect rgb(235, 245, 255)
        Test->>PmCliHarness: activation
        PmCliHarness->>Extension: activate
        Extension-->>PmCliHarness: activation.failed
        PmCliHarness-->>Test: activation.failed (assert empty)
    end

    rect rgb(235, 255, 235)
        Test->>PmCliHarness: runImporter
        PmCliHarness-->>Test: importer result (assert behaviour)
    end
Loading

File-Level Changes

Change Details Files
Migrate smoke tests from a hand-rolled ExtensionApi mock to the real pm-cli extension test harness.
  • Replace custom api object and direct extension.activate calls with createExtensionTestHarness from @unbrained/pm-cli/sdk/testing.
  • Introduce a shared ExtensionTestHarness instance (linearHarness) created once per test run and reused in assertions.
  • Assert activation failures are empty via activation.failed to catch host-side registration rejections.
  • Use harness helpers to assert command contracts for 'linear sync' and 'linear validate'.
  • Use harness helpers to assert schema item fields, importers, exporter, preflight override, and importer/exporter flag wiring.
test/smoke.test.ts
Migrate the linear-sync dry-run atomic test from a captured importer mock to the real harness-based importer dispatch.
  • Remove captureImporter helper that built a fake ExtensionApi and intercepted registerImporter.
  • Introduce a lazily-initialized ExtensionTestHarness (getAtomicHarness) created via createExtensionTestHarness with commands, schema, importers, and preflight capabilities.
  • Assert harness activation has no failures before running importer tests.
  • Use harness.runImporter to execute the 'linear-sync' importer, providing pmRoot and options instead of hand-calling the handler.
  • Adjust result access to use the runImporter result shape while preserving dry-run and no-writes behavioral assertions.
test/atomic.test.ts
Bump the extension and pm-cli versions to 2026.7.28 across metadata and dependencies.
  • Update the extension version in package.json, manifest.json, and the module export in index.ts from 2026.7.27 to 2026.7.28.
  • Raise the @unbrained/pm-cli peerDependency floor to ">=2026.7.28" and devDependency to "^2026.7.28" in package.json.
  • Regenerate package-lock.json to align with the new pm-cli version.
package.json
manifest.json
index.ts
package-lock.json
Changelog and pm chore metadata updates for the pm-linear-itg9 task.
  • Roll the 'Unreleased' changelog section into a tagged 2026.7.28 release entry with date and additional note about eliminating source any with real Linear GraphQL/SDK types.
  • Add pm-linear-itg9 tracking artifacts under .agents/pm/chores and .agents/pm/history to document the chore completion.
CHANGELOG.md
.agents/pm/chores/pm-linear-itg9.toon
.agents/pm/history/pm-linear-itg9.jsonl

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@greptile-apps

greptile-apps Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Greptile Summary

Adopts pm-cli 2026.7.28 and migrates activation/importer tests onto the real SDK harness.

  • Bumps extension/package/manifest version and pm-cli peer/dev deps to 2026.7.28.
  • Replaces hand-rolled api doubles in test/smoke.test.ts and test/atomic.test.ts with createExtensionTestHarness / runImporter.
  • Records pm-linear-itg9 chore artifacts and updates CHANGELOG for 2026.7.28 (including itg9).
  • Widens .gitattributes pm-json merge driver to .agents/pm/**/*.json.

Confidence Score: 5/5

This PR appears safe to merge; the prior changelog gate issue is addressed and no remaining blocking failures were identified in scope.

CHANGELOG 2026.7.28 now lists the closed pm-linear-itg9 entry required for the release; no other blocking failure remains from the prior review scope.

Important Files Changed

Filename Overview
test/smoke.test.ts Activation capabilities test now uses createExtensionTestHarness and asserts commands, fields, importers, exporter, preflight, and flags.
test/atomic.test.ts dry-run importer test uses harness.runImporter instead of a capture double; behavior assertions preserved.
CHANGELOG.md 2026.7.28 section now includes pm-linear-itg9 along with related closed items for this release window.
package.json Version and pm-cli peer/dev constraints bumped to 2026.7.28.
index.ts Module version constant aligned to 2026.7.28.

Reviews (2): Last reviewed commit: "chore(changelog): regenerate after closi..." | Re-trigger Greptile

Comment thread CHANGELOG.md Resolved

@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

🤖 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 `@CHANGELOG.md`:
- Around line 3-7: Update the 2026.7.28 release entry in CHANGELOG.md by adding
a bullet documenting the pm-cli upgrade and migration of tests to the real SDK
harness, alongside the existing Linear GraphQL and SDK handler types note.
🪄 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: 473a0ed1-51b2-4def-8ff9-979318dc0a49

📥 Commits

Reviewing files that changed from the base of the PR and between 0820724 and 7bbcd34.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (8)
  • .agents/pm/chores/pm-linear-itg9.toon
  • .agents/pm/history/pm-linear-itg9.jsonl
  • CHANGELOG.md
  • index.ts
  • manifest.json
  • package.json
  • test/atomic.test.ts
  • test/smoke.test.ts

Comment thread CHANGELOG.md Resolved
The changelog was generated before the pm item for this change was closed, so
the committed CHANGELOG.md was missing the item's own entry and changelog:check
failed in CI while passing locally against the stale file.

Where .gitattributes also changed, that is the 2026.7.28 prepare hook widening
the merge fence from .agents/pm/schema/*.json to .agents/pm/**/*.json so tracked
non-item JSON no longer line-conflicts between agents on different branches.
@unbraind

Copy link
Copy Markdown
Owner Author

@coderabbitai @greptileai @sourcery-ai Thanks — all four reviews upvoted, and this comment is the context each of you flagged as thin.

What this PR actually is. pm-cli 2026.7.28 (published 2026-07-28) closes fourteen issues this fleet filed upstream. The ones that change behaviour for an extension package:

Upstream What it fixed
GH-776 2026.7.27 changed output_format override semantics and corrupted all command output for overriding extensions
GH-772 a rejected command registration silently dropped every later sibling, leaving stubs that exit 0 with an arity error
GH-773 pm health reported permanent false merge-driver drift for repos installing the driver from their own devDependency
GH-764 one host-owned flag collision quarantined the entire extension

On the .gitattributes diff, which several of you asked about: it is generated by the 2026.7.28 prepare hook, not hand-edited. It widens the merge fence from .agents/pm/schema/*.json to .agents/pm/**/*.json so tracked non-item JSON (notably .managed-extensions.json) no longer line-conflicts between agents working on different branches. Reverting it would reintroduce that conflict class.

On the changelog commit in this PR: the first push generated CHANGELOG.md before closing the pm item for this change, so the file was missing the item’s own entry — changelog:check then passed locally against the stale file and failed in CI, which regenerates. That ordering mistake was repeated across all 18 packages in this wave and is fixed in each by regenerating after the close.

Verification: npm run release:check passes end to end — typecheck, build, full test suite, production audit, pack dry-run, changelog check.

Something worth knowing for future reviews of this fleet: 2026.7.28 makes the SDK loader hard-fail when an extension declares a host-owned global flag (--json, --quiet, --author, --path, …), with the message registerFlags flags[0] cannot shadow host-owned global flag "--json"; read it from context.global instead. That closes the GH-764 class for any package whose tests activate through createExtensionTestHarness. What the host still does not validate is flag token form — a flag declared as verbose or -v in a long field activates cleanly and is stored verbatim. Filed upstream as pm-cli#784.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@unbraind Thanks for the thorough context. That clarifies the generated .gitattributes and changelog updates, and confirms that the harness migration is intentionally exercising the new SDK activation and importer-dispatch behavior—not merely refactoring test doubles.

I’ll treat the expanded JSON merge fence as generated/required for this pm-cli release, and account for the createExtensionTestHarness host-flag collision check in future reviews. I’ll also avoid assuming flag-token form is validated until upstream resolves #784.

🐇🔎


✏️ Learnings added
Learnt from: unbraind
URL: https://github.com/unbraind/pm-linear/pull/49

Timestamp: 2026-07-28T04:24:29.568Z
Learning: In the pm-linear extension fleet, the `.gitattributes` merge-fence pattern `.agents/pm/**/*.json` is generated by the `unbrained/pm-cli` 2026.7.28 prepare hook. It intentionally covers tracked non-item JSON such as `.agents/pm/.managed-extensions.json`; reverting it to `.agents/pm/schema/*.json` would reintroduce cross-branch merge conflicts.

Learnt from: unbraind
URL: https://github.com/unbraind/pm-linear/pull/49

Timestamp: 2026-07-28T04:24:29.568Z
Learning: For pm-linear extensions using `unbrained/pm-cli` 2026.7.28 or later, activation through `createExtensionTestHarness` exercises SDK loader validation that rejects extension flags shadowing host-owned global flags such as `--json`, `--quiet`, `--author`, and `--path`; extensions must read those values from `context.global`. The host does not yet validate declared flag token form in a `long` field (for example, `verbose` or `-v`), tracked upstream in pm-cli issue `#784`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown

Thanks — that fills in all the gaps cleanly. Captured three rules for future reviews of this fleet:

  1. .gitattributes merge fence — generated by the prepare hook, .agents/pm/**/*.json is intentional. View rule

  2. Host-owned flag collision / flag token form — createExtensionTestHarness hard-fails on host-owned global shadows; flag token form (long field containing verbose/-v) is not yet validated by the host. pm-cli#784 is the upstream tracker. View rule

  3. Changelog two-commit pattern — generate → close pm item → regenerate is the correct ordering across this fleet; a regeneration commit is not a mistake. View rule

The upstream bug context (GH-764 quarantine, GH-772 silent sibling drop, GH-776 output_format corruption) also explains why this upgrade is correctness-critical rather than routine. Nothing further to block on — this looks good.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@unbraind
unbraind merged commit 061b424 into main Jul 28, 2026
7 checks passed
@unbraind
unbraind deleted the chore/adopt-2026-7-28-and-real-sdk-harness branch July 28, 2026 04:43
@coderabbitai coderabbitai Bot mentioned this pull request Aug 14, 2026
5 tasks done
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