Skip to content

feat(effector): registration - #613

Open
ccf-lisa[bot] wants to merge 2 commits into
effectors/16b-rule-lifecyclefrom
effectors/17-effector-registration
Open

ccf-lisa[bot] wants to merge 2 commits into
effectors/16b-rule-lifecyclefrom
effectors/17-effector-registration

Conversation

@ccf-lisa

@ccf-lisa ccf-lisa Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

What

effector.Service.Register stores an agent instance's effector registration (wire interface, registration; API LLD, agent-facing routes); the route comes in stack 3.

  • Validation (ValidateRegistration, field errors): action names, plugin, effect labels, rule kinds, on-clear, unique names, scheme names, value patterns (RE2), include/exclude patterns using declared schemes, and params: a schema inside the supported subset, defaults that match it, locked paths it has (* always).
  • The instance is recorded in the agent instance registry whatever its remote config mode (agentcfg.TouchFromEffectorRegistration), failing at the per-agent cap instead of being skipped like a heartbeat; the registration revision bumps when the body changes; the instance's actions (with params schema, defaults and locks) replace its previous ones.
  • Rule actions re-checked (RecheckRuleActions): ok when a fresh instance registers the effector action and the rule action's params still pass its schema and locks (rules.CheckParams), degraded otherwise.
  • The normalized base URL must match the one an admin set (ErrBaseURLMismatch, actions still stored); verification is enqueued (Jobs) while it is pending or was verified with another key.

Why

Plan: stack 2, PR 17, split: registration here, verification next (17b).

Test evidence

  • validate_test.go: every validation error path, params included.
  • registration_integration_test.go (Postgres): base URL missing / different / matching after normalisation, revision (idempotent, bumped on change), verification enqueued only when needed (and after a key rotation), invalid bodies store nothing, the instance cap; params stored (and null without); rule actions degrade when the schema or locks stop matching and recover; re-check with fresh, missing and stale registrations.
  • agentcfg: TestTouchFromEffectorRegistration (upsert, cap).

Gate on this branch: go build ./... pass; go vet -tags integration ./... pass; make lint (golangci-lint v2.15.0, CI config) 0 new issues; make test pass; make swag no diff; go mod tidy no diff; go test -tags integration -p 1 on ./internal/service/effector/ ./internal/service/relational/agentcfg/ ./internal/service/rules/ pass.

Size

Counted: 845 lines.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2870cdbe-6e39-4005-bb8b-8c8e3c96ec77

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@ccf-lisa
ccf-lisa Bot added this pull request to stack #604 December 1, 2026 18:00
@ccf-lisa
ccf-lisa Bot force-pushed the effectors/17-effector-registration branch from 2ebc4da to bab5da9 Compare December 1, 2026 18:49
ccf-lisa Bot added a commit that referenced this pull request Dec 2, 2026
Stack 3 as built (#619-#626) with counted lines, #613's count, and the
two decided follow-ups (#627 closed streams, #628 resumed repeats).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccf-lisa
ccf-lisa Bot force-pushed the effectors/17-effector-registration branch from bab5da9 to 1ef1440 Compare December 2, 2026 12:07
ccf-lisa Bot and others added 2 commits December 2, 2026 11:04
internal/service/effector: Service.Register stores an agent instance's
effector registration (wire-interface.md, Registration):

- the body is validated (action names, plugin, effect labels, rule
  kinds, on-clear, unique names, schemes, value patterns as RE2, target
  patterns using declared schemes, and params: a schema inside the
  supported subset, defaults that match it, locked paths it has) into
  field errors;
- the instance is recorded in the agent instance registry (failing at
  the per-agent cap, unlike heartbeats), its revision bumps when the
  body changes, and its actions (with params schema, defaults and locks)
  replace the previous ones;
- the agent's rule actions are re-checked: ok when a fresh instance
  registers the effector action and the rule action's params still pass
  its schema and locks, degraded otherwise;
- the base URL must match the one an admin set; verification is
  enqueued while it is pending or was verified with another key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CheckParams treats a stored lock list that doesn't decode as "*", so a
corrupt row locks every parameter instead of none (and ParamsMatch marks
the rule action degraded). Tests for CheckParams and ParamsMatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gusfcarvalho gusfcarvalho 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.

ccf-review: APPROVE

no findings.

Stack (gh stack 604): #592 → #593 → #594 → #595 → #596 → #597 → #598 → #599 → #600 → #601 → #602 → #603 → #605 → #606 → #607 → #608 → #609 → #610 → #611 → #612 → #613 → #614 → #615 → #616 → #617 → #618 → #619 → #620 → #621 → #622 → #623 → #624 → #625 → #626 → #627 → #628 → #629 → #630

This branch has not been deployed

No deployments
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