Skip to content

AR-260 Accept factory label for Linear scope#334

Merged
khaliqgant merged 1 commit into
mainfrom
ar-260-factory-label-scope
Jun 14, 2026
Merged

AR-260 Accept factory label for Linear scope#334
khaliqgant merged 1 commit into
mainfrom
ar-260-factory-label-scope

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

  • add safety.requireLabel config with default factory and label-aware Linear factory scope checks
  • keep title-prefix scope and synthetic probe detection title-only
  • cover label-only dispatch, title/label scope matrix, wrong-team rejection, disabled label path, and non-synthetic label behavior

Tests

  • npm run typecheck:node
  • npx vitest run packages/factory-sdk/src/safety/factory-scope.test.ts packages/factory-sdk/src/config/schema.test.ts packages/factory-sdk/src/orchestrator/factory.test.ts
  • npx vitest run packages/factory-sdk/src/orchestrator/factory.test.ts
  • npx vitest run packages/factory-sdk/src/safety/factory-scope.test.ts packages/factory-sdk/src/config/schema.test.ts
  • npx vitest run packages/factory-sdk/src
  • git diff --check

Note: one concurrent run of the focused vitest command alongside typecheck hit an existing timing-sensitive heartbeat assertion; rerunning the orchestrator file alone passed.

Review in cubic

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1058d4d2-cd0b-4fe4-8323-0a4a2cc1c93a

📥 Commits

Reviewing files that changed from the base of the PR and between be264cf and 3ada667.

📒 Files selected for processing (6)
  • packages/factory-sdk/src/config/schema.test.ts
  • packages/factory-sdk/src/config/schema.ts
  • packages/factory-sdk/src/orchestrator/factory.test.ts
  • packages/factory-sdk/src/safety/factory-scope.test.ts
  • packages/factory-sdk/src/safety/factory-scope.ts
  • packages/factory-sdk/src/writeback/linear.ts

📝 Walkthrough

Walkthrough

Adds a requireLabel field (defaulting to 'factory') to the factory-sdk safety configuration. isInFactoryScope is extended with label-extraction helpers and a combined predicate that accepts issues matching either the configured title prefix or the required label, plus the team key. Schema, writeback config, and tests are updated accordingly.

Changes

requireLabel safety scope feature

Layer / File(s) Summary
Schema and config contracts for requireLabel
packages/factory-sdk/src/config/schema.ts, packages/factory-sdk/src/config/schema.test.ts, packages/factory-sdk/src/writeback/linear.ts
Adds safety.requireLabel: z.string().default('factory') to FactoryConfigSchema, adds optional requireLabel?: string to MountLinearWritebackConfig.safety, and updates safetyFromConfig to derive and propagate requireLabel with its default.
isInFactoryScope: label-aware scoping logic
packages/factory-sdk/src/safety/factory-scope.ts
Adds requireLabel to FactoryScopeSafety and NormalizedFactoryScopeSafety, widens isInFactoryScope/assertInFactoryScope issue types to include optional labels, introduces DEFAULT_FACTORY_LABEL, normalizeSafety, normalizeRequiredLabel, and label-extraction helpers for nodes/edges payloads. Updates factoryScopeFailureReason to mention the label requirement.
isInFactoryScope unit tests
packages/factory-sdk/src/safety/factory-scope.test.ts
New Vitest suite covering title/label/team acceptance, neither-match rejection, wrong-team rejection, empty-label disabling label-scope, and case-insensitive raw payload label matching.
Orchestrator integration tests for label-based dispatch
packages/factory-sdk/src/orchestrator/factory.test.ts
Widens FactoryConfigOverrides to allow partial safety overrides; adds/adjusts tests for label-or-prefix scope, empty requireLabel, dispatching by label without title prefix, skipping unreconciled label-only drafts, not treating factory label as a probe marker, and not closing PRs for label-only non-synthetic issues.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AgentWorkforce/pear#229: Scaffolds FactoryConfigSchema in src/config/schema.ts, which this PR extends with the safety.requireLabel field and updated schema tests.
  • AgentWorkforce/pear#235: Introduces the factory orchestrator implementation that this PR's new dispatch and scope integration tests build directly on.

Poem

🐇 A label called factory, fresh on the scene,
No longer just prefixes keep issues clean.
With requireLabel checked node by node,
The scope-check now travels a label-lit road.
Hop hop, said the rabbit — the tests all turn green! 🌿

🚥 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 summarizes the main change: adding factory label support for Linear scope checks, which aligns with the changeset's primary objective.
Description check ✅ Passed The description provides relevant context about the changes, including the new safety.requireLabel config, scope behavior, and test coverage that directly relate to the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 ar-260-factory-label-scope

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed due to a network error.


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 and usage tips.

@khaliqgant khaliqgant merged commit e7571b7 into main Jun 14, 2026
5 checks passed
@khaliqgant khaliqgant deleted the ar-260-factory-label-scope branch June 14, 2026 15:20
@agent-relay-code

Copy link
Copy Markdown
Contributor

No code changes made. I found no validated PR-blocking issues in the current checkout.

Addressed comments

  • gemini-code-assist[bot]: quota warning only; no actionable review item.
  • coderabbitai[bot]: review-in-progress summary only; no actionable finding to validate.

Validation

  • Affected tests: npx vitest run packages/factory-sdk/src/safety/factory-scope.test.ts packages/factory-sdk/src/orchestrator/factory.test.ts packages/factory-sdk/src/config/schema.test.ts packages/factory-sdk/src/writeback/writeback.test.ts passed.
  • Local CI-equivalent sequence passed: npm run verify:mcp-resources-drift && npm run lint && npm run typecheck:web && npm run typecheck:node && npm test && npx vitest run && npm run build.
  • Working tree is clean after validation.

Not printing READY because I could not confirm GitHub-reported mergeability and live check status from the available PR metadata.

@agent-relay-code

Copy link
Copy Markdown
Contributor

No code changes made. I found no validated PR-blocking issues in the current checkout.

Addressed comments

  • gemini-code-assist[bot]: quota warning only; no actionable review item.
  • coderabbitai[bot]: summary/walkthrough reported no actionable comments; docstring coverage warning is advisory/out-of-scope for this PR and not a validated repo CI failure.
  • coderabbitai[bot]: ESLint tool install failed from network error in CodeRabbit; local npm run lint completed with warnings only, no PR-scoped fix needed.
  • agent-relay-code[bot]: prior review summary only; I revalidated current checkout independently.

Validation

  • npm ci completed.
  • Local CI-equivalent sequence passed through resource drift, lint, typechecks, and node tests.
  • Initial full npx vitest run hit the known timing-sensitive heartbeat assertion at packages/factory-sdk/src/orchestrator/factory.test.ts:1631; rerunning full Vitest passed: 54 files, 802 tests.
  • npm run build passed.
  • Follow-up npm run verify:mcp-resources-drift passed after build.

GitHub metadata reports PR #334 is already merged/closed, so I’m not printing READY.

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