Skip to content

refactor(interaction): move the moving-target decision policy into the runtime gate - #3631

Merged
thymikee merged 4 commits into
mainfrom
refactor/moving-target-policy-runtime
Oct 15, 2026
Merged

thymikee merged 4 commits into
mainfrom
refactor/moving-target-policy-runtime

Conversation

@thymikee

@thymikee thymikee commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #3538 (owner comment 6145734277). The moving-target baseline stays in contracts, and the policy moves to its only consumer.

  • Baseline stays cross-layer. MovingTargetBaseline now sits in packages/contracts/src/runtime-contract.ts, next to CommandSessionRecord.movingTargetBaseline. Daemon core (session-state.ts, deferred-interaction-outcome.ts) imports it from there, still as a type-only import.
  • Policy moves. MOVING_TARGET_GATE_WINDOW_MS, MOVING_TARGET_GATE_SAMPLE_GAP_MS, the MovingTargetGateDecision union and movingTargetGateDecision move into src/commands/interaction/runtime/moving-target-gate.ts. The gate is their only consumer; a grep of packages, src and scripts found no other importer of a policy symbol.
  • Tests move unchanged. The 7 decision tests move into moving-target-gate.test.ts, the gate's mirror test file.
  • Removed:
    • the ./moving-target-gate subpath in packages/contracts/package.json
    • @agent-device/contracts/moving-target-gate in scripts/layering/contracts-exports.snapshot.json
    • packages/contracts/src/moving-target-gate{,.test}.ts

No behavior change. 10 files, +208/−241. No fallow baseline referenced the old path.

This PR also deletes the stale replay-maestro-backend.ts APPROVED_OVER_CEILING row. That deletion is the follow-up #3623 left for the next PR off main.

Validation

pnpm check:affected --run at ea0db1646 passed. A package manifest changed, so it ran the full check set, including format, lint, typecheck, layering, fallow, build, package, integration-node, macos-coverage, vitest-related, production-exports and the compat suites. The eager-closure budgets do not grow.

The earlier run at e7701ae3f failed only on the stale approval row, which this PR now deletes. A cold review found nothing, and both cubic findings (header wording) are fixed in b478e8a61.

…e runtime gate

MovingTargetBaseline stays in contracts beside CommandSessionRecord; the
window and sample-gap constants, the decision union, and
movingTargetGateDecision move into the runtime gate, their only consumer.
The decision tests move with them, unchanged.
…path

The module is gone; remove its exports-map entry and its line in the
contracts export snapshot.
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.25 MB 5.25 MB 0 B
Package (unpacked) 5.25 MB 5.25 MB 0 B
Package (download) 1.58 MB 1.58 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 29.0 ms 27.9 ms -1.0 ms
CLI --help 82.2 ms 80.5 ms -1.7 ms

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/commands/interaction/runtime/moving-target-gate.ts Outdated
Comment thread src/commands/interaction/runtime/moving-target-gate.ts Outdated
#3623 put the entry on main, so the merge-base now carries it and the
no-growth rule governs it; the stale-row check asks the next PR to remove it.
@thymikee

Copy link
Copy Markdown
Member Author

This looks good at ea0db16. The policy moves to its only consumer, the baseline type stays in contracts beside the session record field, and no importer of the removed subpath is left. All 22 checks pass, and there are no conflicts. I did not run the vitest or fallow gates locally; I relied on your pnpm check:affected run and on CI.

Not blocking, take or leave both: MOVING_TARGET_GATE_WINDOW_MS and movingTargetGateDecision at moving-target-gate.ts:76 are only imported by the colocated test, so you could test through guardResolvedTargetAgainstMotion instead; and the module header at moving-target-gate.ts:25 is now four paragraphs and could be trimmed to the invariant.

Two earlier threads are fixed at this commit, so please resolve them: the header now limits the guarantee to selector and @ref targets (#3631 (comment)), and it says the gate dispatches the requested interaction instead of the tap (#3631 (comment)).

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 15, 2026
@thymikee
thymikee merged commit fc224bc into main Oct 15, 2026
22 checks passed
@thymikee
thymikee deleted the refactor/moving-target-policy-runtime branch October 15, 2026 10:38
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-15 10:38 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant