Repository navigation
[codex] Port universal applyTo to Cursor alwaysApply - #2030
Daniel Meppiel (danielmeppiel) merged 15 commits into
Conversation
750f6b0 to
6ef35bb
Compare
|
Rebased the one scoped PR commit onto the rewritten current |
13ae98d to
9e90e98
Compare
|
Rebased the scoped change onto current |
9e90e98 to
37d763a
Compare
|
Refreshed this PR onto current The implementation now preserves current-main frontmatter normalization and adds only the requested Cursor mapping: exactly one normalized Validation is summarized in the updated PR body: focused tests 172 passed/1 skipped, full spec-conformance 159 passed/2 skipped, full-tree Ruff checks green, and the docs build plus 967-link validation passed. The broader unit run's sole stop was the unrelated DNS-sensitive SSRF test documented in the body. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/apm_cli/integration/instruction_integrator.py:492
- This docstring uses a non-ASCII arrow character in the text "applyTo -> globs". The repo's encoding rules require printable ASCII in source files; replace it with plain "->" to avoid Windows encoding issues and match the rest of this module.
Parses existing YAML frontmatter, maps ``applyTo`` → ``globs``,
extracts or generates a ``description``, and rewrites the
frontmatter in Cursor's expected format. Explicit universal
``applyTo: "**"`` becomes ``alwaysApply: true`` instead of a glob.
tests/spec_conformance/test_manifest_reqs.py:817
- The conformance drift assertion needle "MUST contain
alwaysApply: trueand MUST NOT contain a" is truncated and too generic, which weakens the drift-detection contract (it could match unrelated spec text). Include the full phrase through "globsfield" (preserving the newline) to pin the intended invariant.
assert_spec_contains(
"`.cursor/rules/<name>.mdc`",
"MUST contain `alwaysApply: true` and MUST NOT contain a",
"MUST encode the source patterns in\n`globs`",
"MUST omit both `alwaysApply` and `globs`",
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 1 | Clean, minimal change that correctly translates universal applyTo intent into Cursor's native alwaysApply form. The conditional logic is well-placed inside the existing rendering path, maintains single-owner authority (_convert_to_cursor_rules owns Cursor frontmatter shape), and test coverage is thorough including edge cases. |
| DevX UX Expert | 0 | 0 | 0 | No CLI surface, command help, error wording, or first-run flow changes. The fix aligns emitted Cursor metadata with the platform's own schema, improving silent correctness for users who set universal applyTo -- good DevX, no action needed. |
| Supply Chain Security Expert | 0 | 0 | 0 | No new supply-chain attack surface: alwaysApply:true is semantically equivalent to the prior globs:'**' output; governance policy gates remain unchanged. |
| OSS Growth Hacker | 0 | 0 | 0 | Correctness fix for a high-value integration target (Cursor); removes silent friction for producers, strengthens the 'it just works' story. No conversion-surface regressions. |
| Doc Writer | 0 | 1 | 3 | Docs are accurate on the new two-case framing but consistently omit the third case (absent/empty applyTo -> neither key), which the spec covers correctly; all four pages need a short clause to close that gap. |
| Test Coverage Expert | 0 | 0 | 0 | All new behavioral paths (alwaysApply mapping, padded input, YAML-list universal, null applyTo) have dedicated unit tests plus an integration test deploying to filesystem. Critical surfaces are covered. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 2 follow-ups
- [Doc Writer] Document the absent/empty applyTo case across four docs pages -- Third behavioral case (no applyTo -> neither key emitted) is tested but undocumented; closes a reader confusion gap.
- [Python Architect] Extract _is_universal_glob predicate -- Readability improvement; makes domain knowledge self-documenting.
Architecture
classDiagram
direction LR
class BaseIntegrator {
<<Abstract>>
+integrate()
+cleanup()
}
class InstructionIntegrator {
+integrate_package_instructions_cursor()
+_convert_to_cursor_rules(content) str$
-_extract_frontmatter()
}
class parse_apply_to {
<<Pure>>
+parse_apply_to(raw) list~str~
}
class yaml_double_quote {
<<Pure>>
+yaml_double_quote(s) str
}
BaseIntegrator <|-- InstructionIntegrator
InstructionIntegrator ..> parse_apply_to : calls
InstructionIntegrator ..> yaml_double_quote : calls
note for InstructionIntegrator "Single owner of .mdc frontmatter shape;\nnew alwaysApply branch lives here"
class InstructionIntegrator:::touched
classDef touched fill:#fff3b0,stroke:#d47600
flowchart TD
A["_convert_to_cursor_rules(content)"] --> B["Extract YAML frontmatter\napplyTo, description"]
B --> C["parse_apply_to(apply_to)"]
C --> D{"globs == ['**']?"}
D -->|Yes| E["Emit alwaysApply: true"]
D -->|No| F{"len(globs) == 1?"}
F -->|Yes| G["Emit globs: single"]
F -->|No| H{"globs non-empty?"}
H -->|Yes| I["Emit globs: list"]
H -->|No| J["Omit globs entirely"]
E --> K["Append body, return .mdc string"]
G --> K
I --> K
J --> K
Recommendation
Unanimous panel, full test coverage, no security or breaking-change concerns. The doc gap is real but non-blocking -- file a follow-up issue and merge.
Full per-persona findings
Python Architect
- [nit] Extract universal-glob detection into a named predicate at
src/apm_cli/integration/instruction_integrator.py:520
The checkglobs == ["**"]encodes domain knowledge inline. A tiny helper like_is_universal_glob(globs)would make the intent self-documenting.
Suggested:def _is_universal_glob(globs: list[str]) -> bool: return globs == ["**"]
CLI Logging Expert -- inactive
No CLI output, logging, or diagnostic rendering changes; nothing in scope for this persona.
DevX UX Expert
No findings.
Supply Chain Security Expert
No findings.
OSS Growth Hacker
No findings.
Auth Expert -- inactive
PR touches only instruction-integrator serialization, spec conformance, and docs -- no auth, token, credential, or remote-host files changed.
Doc Writer
-
[recommended] Inline prose paragraph omits the absent/empty applyTo case for Cursor at
docs/src/content/docs/producer/author-primitives/instructions-and-agents.md:69
The new paragraph covers two cases (** -> alwaysApply, other -> globs) but omits the third: absent or empty applyTo emits neither key. Authors who omit applyTo will be confused.
Suggested: Append: 'WhenapplyTois absent or empty, APM emits neither key -- the rule deploys withoutalwaysApplyorglobs.' -
[nit] Instructions table row omits absent/empty applyTo case at
docs/src/content/docs/producer/author-primitives/instructions-and-agents.md:117
Table cell says 'other applyTo values -> globs:' but absent/empty -> neither is not mentioned.
Suggested: Extend the cell: '... ; absent or emptyapplyTo-> neither key emitted'. -
[nit] targets-matrix.md cursor bullet omits the absent applyTo case at
docs/src/content/docs/reference/targets-matrix.md:156
Same gap as above: reader debugging a rule with no applyTo gets no signal.
Suggested: Append '; absent or emptyapplyToomits both keys' to the bullet. -
[nit] Prose says 'explicit' applyTo: '**' but YAML-list form also triggers alwaysApply at
docs/src/content/docs/producer/author-primitives/instructions-and-agents.md:66
applyTo: ["**"](list form) also resolves to alwaysApply:true. The word 'explicit' without qualification implies only the scalar form.
Suggested: Rephrase to 'anapplyTovalue that resolves to a single universal**glob -- whether scalar or single-element list --'.
Test Coverage Expert
No findings.
Performance Expert -- inactive
No changes touch the performance fast-path (cache, transport, resolver, pipeline, materialization); the diff is a static frontmatter-format helper invoked once per file write with no loops, I/O, or algorithmic concerns.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
37d763a to
4799f53
Compare
|
Rebased onto current The upstream executable-consent amendment remains I also addressed the review-panel follow-ups in this head:
Validation on
The full-tree ruff invocation still reports seven pre-existing findings in untouched files; none are in this PR's files. |
Signed-off-by: WilliamK112 <[email protected]>
|
Resolved the latest main-branch conflicts in 8051fac. Main now owns Validation on the merged tree:
|
Signed-off-by: WilliamK112 <[email protected]>
Signed-off-by: WilliamK112 <[email protected]>
|
Merged current
Validation:
The required full unit command reaches 1,675 passed / 1 skipped, then fails |
|
Resolved the post-release conflict at Validation on the merged tree:
|
Preserve upstream req-tg-013 and assign the Cursor universal instruction contract to req-tg-014.
|
Resolved the latest main-branch conflict at Upstream now owns Validation on the merged tree:
The broader unit runs encountered two unchanged environment-sensitive network tests; both are documented in the updated PR description, including the passing isolated proxy-sensitive test. |
Preserve upstream req-rs-017 and advance the Cursor contract to OpenAPM revision 0.1.38.
|
Resolved the new post-update conflict at Current Fresh validation:
|
|
Resolved the latest main-branch conflict at Current Fresh validation:
|
|
Current I preserved the upstream frontmatter/YAML and plugin-intake changes. The YAML parser now returns Fresh validation:
The full |
|
Resolved the latest
Validation is green for the focused Cursor/manifest suite (192 passed, 1 skipped), full spec-conformance suite (197 passed, 2 skipped), 122-requirement orphan check, full Ruff check/format, auth-signal lint, architecture-boundary lint, and Mode B detector. An extended unit sweep passed 20,978 tests (plus expected skips/xfails); three unchanged current-main modules hit local DNS-dependent SSRF assumptions because their documentation-only hostnames resolve internally in this environment. The fresh hosted workflows are currently awaiting maintainer approval for this external-contributor branch. |
|
Resolved the latest conflict with current The reconciliation keeps main's new Fresh validation on the exact merged tree:
GitHub now reports the PR as mergeable; it remains blocked only on repository review/queue policy. |
Preserve the upstream GitLab sparse-transport work while retaining the Cursor universal applyTo behavior and req-tg-015 conformance coverage. Signed-off-by: Ching-Wei Kang <[email protected]>
|
Merged current Fresh validation on the exact merged tree: 336 relevant implementation/conformance tests passed, 2 skipped; the 123-requirement orphan check, focused Ruff check/format, architecture-boundary lint, auth-signal lint, Mode B detector, and diff checks all passed. GitHub now reports the branch mergeable; the remaining block is repository review/workflow policy. |
PR triage recommendationneeds-issue Recommendation only, not merge or scope approval. A responsible Linked issue#1744 (open). Current labels: Proposed classification
Suggested next actionKeep #1744 as the scope thread and wait for a maintainer to record Suggested PR commentThank you Ching Wei Kang (@WilliamK112) for contributing this pull request and for keeping it rebased. APM starts with an issue, not an implementation (https://github.com/microsoft/apm/blob/main/CONTRIBUTING.md). This PR already links #1744, but that issue is not labelled |
Reconcile microsoft#1744 with current main. Main now renders Cursor globs as one comma-joined scalar (microsoft#3002/microsoft#3011), owns req-tg-015 (Codex agent model) and Section 8.5.9 (Cursor hooks), and is at working-draft revision 0.1.57. Keep main's rendering and add only the universal branch: exactly one parsed `**` emits `alwaysApply: true` with no globs, via a named `_is_universal_glob` predicate (panel nit). Renumber the spec amendment to req-tg-018 / Section 8.5.10 / 0.1.58 (proposed), restate it against comma-scalar globs with the nine-case boundary from the apm-scope:v1 record, bind a nine-case conformance test, regenerate CONFORMANCE from main's coverage plus the new node IDs, update the apm-usage guide, author and targets-matrix docs (absent/empty/null case), and move the CHANGELOG entry to Unreleased. Co-authored-by: WilliamK112 <[email protected]> Co-authored-by: Copilot App <[email protected]>
The apm-scope:v1 record on microsoft#1744 requires installed-CLI proof of the nine applyTo source cases at project and user scope, idempotent reinstall, replacement of a previously generated `globs: **` rule, and preservation of handwritten neighboring rules. Add one real-binary lifecycle test parametrized over project and user scope that pins exact rule bytes, lock hashes and repeat-install snapshots. Mutation-break: removing the universal branch fails both scopes. Co-authored-by: WilliamK112 <[email protected]> Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 2 | Clean owner-extension of _convert_to_cursor_rules; predicate and description-null guard correctly scoped. No parallel authority. |
| Test Coverage Expert | 0 | 0 | 1 | All nine Done-when cases covered at unit, conformance and installed-CLI e2e tiers at project and user scope; ship. |
| Doc Writer | 0 | 1 | 2 | Docs match the code and cover absent/empty/null; cut the duplicated Cursor paragraph and say what Cursor does with keyless rules. |
| DevX UX Expert | 0 | 0 | 1 | Install converges to Cursor-native alwaysApply; no new flags or author fields; upgrade safe via lock hash. |
| OSS Growth Hacker | 0 | 0 | 2 | Docs and CHANGELOG document the mapping; two readability nits on conversion surfaces. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 5 follow-ups
- [Doc Writer] Deduplicate the new Cursor paragraph in instructions-and-agents.md that repeats the table row. -- Keep the table as the source of truth; add one reinstall sentence after it.
- [Doc Writer] Clarify that absent/empty/null applyTo in Cursor means the rule is applied by description, not always-on. -- Prevents confusing "neither key" with always-on.
- [OSS Growth Hacker] Rewrite the CHANGELOG entry to lead with the user-facing benefit. -- Primary upgrade-funnel surface; doc-writer also flagged length.
- [DevX UX Expert] Split the targets-matrix Cursor instructions bullet into three sub-bullets. -- Restores scanning parity with other targets.
- [Test Coverage Expert] Optional: parametrize the e2e test by case. -- Low priority; the req-tg-018 conformance test already gives per-case IDs.
Architecture
classDiagram
direction LR
class BaseIntegrator {
<<Base>>
+resolve_links(content, src, tgt) tuple
+sync_remove_files() dict
}
class InstructionIntegrator {
<<Integrator>>
+integrate_instructions_for_target() IntegrationResult
+_convert_to_cursor_rules(content) str
+_render_instruction(src, tgt, fmt) tuple
}
class PatternHelpers {
<<Module>>
+normalize_apply_to() str
+parse_apply_to() list
+escape_apply_to_segment() str
}
class UniversalGlobCheck {
<<Pure>>
+_is_universal_glob(globs) bool
}
BaseIntegrator <|-- InstructionIntegrator
InstructionIntegrator ..> PatternHelpers : imports
InstructionIntegrator ..> UniversalGlobCheck : calls
class InstructionIntegrator:::touched
class UniversalGlobCheck:::touched
classDef touched fill:#fff3b0,stroke:#d47600
flowchart TD
A["apm install --target cursor"] --> B["InstructionIntegrator"]
B --> E["_convert_to_cursor_rules"]
E --> G["normalize_apply_to + parse_apply_to"]
G --> I{"_is_universal_glob?"}
I -- "exactly one **" --> J["alwaysApply: true"]
I -- "other non-empty" --> K["globs: comma-joined scalar"]
I -- "empty" --> L["neither key"]
J --> M["write .cursor/rules/name.mdc"]
K --> M
L --> M
Recommendation
Ship after the merge worker folds the doc-writer's paragraph dedup and the CHANGELOG/targets-matrix prose polish (items 1-4 above). All behavior and test coverage is correct today; the follow-ups are prose-only. Daniel Meppiel (@danielmeppiel) and Sergio Sisternes (@sergio-sisternes-epam) should confirm the spec renumber (req-tg-018 / 8.5.10) and the proposed 0.1.58 revision.
Full per-persona findings
Python Architect
- [nit] _is_universal_glob is pattern-classification logic; natural home is patterns.py at
src/apm_cli/integration/instruction_integrator.py:40
One call site today, so inline placement is acceptable; move it to patterns.py if a second converter needs it. - [nit] Design patterns assessment: Base + subclass unchanged; pure predicate extracted per prior panel nit. No further pattern needed.
Test Coverage Expert
- [nit] E2E test checks nine cases in one loop per scope at
tests/integration/test_cursor_always_apply_e2e.py
Mitigated by the nine-way parametrized req-tg-018 conformance test.
Proof (passed):tests/integration/test_cursor_always_apply_e2e.py::test_cursor_universal_apply_to_installs_always_apply[project] + [user]-- proves: universal applyTo installs as alwaysApply:true without globs at both scopes; other forms unchanged; reinstall idempotent; legacy globs:** replaced; handwritten rules preserved. [multi-harness-support,devx]
Doc Writer
- [recommended] New Cursor paragraph repeats the table row at
docs/src/content/docs/producer/author-primitives/instructions-and-agents.md:66
Suggested: delete it; keep the table row and add one reinstall sentence after the table. - [nit] Say what Cursor does with keyless rules at
docs/src/content/docs/producer/author-primitives/instructions-and-agents.md:123 - [nit] Trim the 53-word CHANGELOG entry at
CHANGELOG.md:24
DevX UX Expert
- [nit] targets-matrix Cursor bullet is ~290 chars at
docs/src/content/docs/reference/targets-matrix.md
Suggested: three sub-bullets.
OSS Growth Hacker
- [nit] CHANGELOG entry leads with implementation detail at
CHANGELOG.md:24 - [nit] targets-matrix Cursor line breaks scanning parity at
docs/src/content/docs/reference/targets-matrix.md:167
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.
Addresses APM Review Panel follow-ups 1-5 on head 0c5d527: drop the author-page paragraph that duplicated the Cursor table row (keep the row as source of truth, add the reinstall note after the table), say that keyless Cursor rules are chosen from `description`, split the targets-matrix Cursor bullet into three sub-bullets, lead the CHANGELOG line with the user-facing change, and compare all nine e2e renders in one dict so a failure names every mismatched case. Co-authored-by: WilliamK112 <[email protected]> Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Doc Writer | 0 | 0 | 0 | All three prior findings resolved; nested bullets render correctly; no new doc issues. |
| Test Coverage Expert | 0 | 0 | 0 | Dict-equality assertion resolves the prior nit; no src change; coverage intact. |
| DevX UX Expert | 0 | 0 | 0 | Prior nit resolved; table stays the single source of truth with a clear reinstall note. |
| OSS Growth Hacker | 0 | 0 | 0 | CHANGELOG leads with the user benefit; targets-matrix scanning parity restored. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
All five prior follow-ups are folded and confirmed by the originating panelists. No advisory items remain. Ready for Daniel Meppiel (@danielmeppiel) and Sergio Sisternes (@sergio-sisternes-epam) to review and land at their discretion.
Folded in this run
- (merge) Merged current main; kept main's comma-scalar Cursor
globs:and added only the universal branch; renumbered the amendment to req-tg-018 / Section 8.5.10 / 0.1.58 (proposed); regenerated CONFORMANCE; moved the CHANGELOG line to Unreleased -- resolved in 3329039. - (panel 2026-08-18) Extract
_is_universal_globpredicate -- resolved in 3329039. - (panel 2026-08-18) Document the absent/empty
applyTocase -- resolved in 3329039. - (scope record) Cursor target docs and apm-usage guide describe the mapping -- resolved in 3329039.
- (scope record) Installed-CLI nine-case test at project and user scope, idempotent reinstall, replacement of prior
globs: **output, handwritten rules preserved -- resolved in 0c5d527. - (panel) Deduplicate the author-page Cursor paragraph; note that keyless rules are chosen from
description; split the targets-matrix bullet; lead the CHANGELOG with the user change; one dict assertion for all nine e2e cases -- resolved in 685bd3e.
Copilot signals reviewed
src/apm_cli/integration/instruction_integrator.py:492-- LEGIT: non-ASCII arrow in the docstring (resolved in 3329039; the merged docstring is ASCII).tests/spec_conformance/test_manifest_reqs.py:817-- LEGIT: truncated spec needle (resolved in 3329039; the new req-tg-018 needles pin the full phrases).
Regression-trap evidence (mutation-break gate)
tests/integration/test_cursor_always_apply_e2e.py(project, user) andtest_consumer_maps_cursor_universal_instruction_to_always_apply[scalar|padded|list]-- removed the_is_universal_globbranch; 5 tests FAILED as expected; guard restored.
Lint contract
Ruff check and format (src/, tests/, the architecture linter scripts, and the Windows probe entry), pylint R0801, scripts/lint-auth-signals.sh, and scripts/lint-architecture-boundaries.sh were all silent at 685bd3e.
CI
At 685bd3e, CI, Merge Gate, CodeQL, NOTICE Drift Check, Deploy Docs, PR eligibility evidence, and license/cla all passed. Spec conformance (including the CONFORMANCE regeneration diff gate) passed at 0c5d527; spec files are unchanged since then. 0 CI fix iterations were needed.
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #2030 | 685bd3e |
ship_now | 2 | 6 | 0 | 2 | green | MERGEABLE | BLOCKED | pending required review |
Convergence
2 outer iterations; 2 Copilot rounds (drained, no new output). Final panel stance: ship_now. Ready for maintainer review.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-review-worker. This comment is AI-generated and may contain errors.
c2c2e0d
into
microsoft:main
Clean merge of #3644 and #2030; no lockfile or autopilot package changes. Co-authored-by: sergio-sisternes-epam <[email protected]> Co-authored-by: Copilot App <[email protected]>
…tterns Resolve Appendix D conflict: main took 0.1.58 for req-tg-018 (#2030); this PR's req-pl-018 clause (g) amendment becomes 0.1.59, count 138 (133 MUST, 5 SHOULD). Co-authored-by: Copilot App <[email protected]>
Summary
Closes #1744.
This ports APM's explicit universal instruction intent to Cursor's native always-on rule shape. When a source instruction declares
applyTo: "**", Cursor output now emitsalwaysApply: trueand omitsglobs:. Scoped patterns still emitglobs:as before.This follows the maintainer clarification on #1744: do not add a new APM source
alwaysApplyfield; translate the existing universalapplyTo: "**"intent into Cursor's native form.What changed
**) toalwaysApply: true.applyTofree of bothalwaysApplyandglobs.req-tg-015in Section 8.5.9, its manifest/index entry, and regenerated conformance statements.Current-main reconciliation
mainthrough1cab81dcinb42d7ba4.req-pl-018and its OpenAPM 0.1.40 amendment.main.Validation
git diff --check: passedSigned-off-by: WilliamK112 [email protected]