Skip to content

fix(systems): apply and deploy results name only what was observed or done (#4130) - #4152

Merged
vybe merged 21 commits into
devfrom
feature/4130-apply-result-truth
Nov 1, 2026
Merged

vybe merged 21 commits into
devfrom
feature/4130-apply-result-truth

Conversation

@vybe

@vybe vybe commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4130. The apply and deploy results now say only what was observed or done in that run: a real run's summary.write and adopted[] name only what landed, declared-only members are never re-read, restarted or marked applied, "nothing to deploy" is a named 400 instead of a failed deploy, and delivery and gate-marker outcomes the code already held are reported instead of dropped. Stacked on #4150 — base is feature/4131-bare-naming-edges; the stack merges together in order. Draft until validated.

What

  • _apply_report: adopted[] empty on refused, kept on an invalid dry run, on a real run only members whose system tag landed (per name and tag). The adoption line is one helper in both tenses.
  • summary.build(landed=): a real run counts only the writes that landed, each by its own key (set name, skill, gate, capability, edge target, tag); dry runs, report and unobserved keep plan counts.
  • Declared-only members: skipped in the post-write re-read, applied: None, never restart_required.
  • Deploy: named 400 nothing_to_deploy after name resolution on dry and real runs; additive agents_declared_only on all three return sites (create-mode golden regenerated once); the delivery note lists every per-skill failed/conflict; a set whose skills are all held records unchanged; gate_marker_not_written reported on apply and warned on deploy.
  • MCP apply_system and deploy_system descriptions say only what the code does (apply_system 1,984 of 2,048 characters). Flow doc, requirements line and user doc updated.
  • tests/unit/test_4130_apply_result_truth.py: 25 tests over the real apply route and the real deploy route on the real database facade, one per corrected statement.

Rulings carried (plan file)

  • Named 400 for an empty deploy. Adopted kept on invalid dry runs, empty on refused, landed-only on real runs. applied: None for declared-only. agents_declared_only added with its golden. The deploy delivery and gate-marker guards stay although, for a member deploy creates, they cannot fire today: members start after the skills and gates steps, and both marker paths need a running container. No per-member skill_held_back change.

Review + security

/review (report-only): MERGEABLE, 0 critical. Fixed in ebc3928da: a failed-branch test for agents_declared_only, the 400 pinned through the route, description headroom. /cso --diff: 0 findings. Fix mutation: ten targeted reversions each red against named tests.

Tests

Targeted: 397 passed on the engine, naming, declared-only, #4131 and #2373 suites; 132 passed after the fix on the four touched suites. MCP suite 1,113 pass. Not run here: the full unit island (CI runs it once the stack is retargeted to dev).

Before merge

Merge #4145, #4146 and #4150 first. No migration, no image rebuild.

Handoffs

#4132 (export round-trip) stacks on this branch; #4134 owns the service refactor.

🤖 Generated with Claude Code

Trinity Agent (trinity) and others added 17 commits November 1, 2026 01:15
…rough real facade methods (#4128)

GET /api/systems/{name} called db.get_agent_permissions and
db.get_agent_folder_config, neither of which exists on DatabaseManager,
inside one try: permissions, folders AND schedules were absent for every
member. The exporter's folder read had the same missing name and
subscripted the pydantic row as a dict, so `folders` was never exported;
its permission block probed agents[0] only, so a system whose first
member had no outgoing edge exported no edges.

- get_system: one try per key; edges via get_permitted_agents narrowed
  to the caller's accessible roster (what the direct permissions route
  shows); folders via get_shared_folder_config by attribute.
- export_manifest: folders via get_shared_folder_config, a failed read
  named in `# unobserved:`; permission block computed in one pass over
  every member, filtered to members, full-mesh only over >= 2 keyed
  members (tag-only members are outside the universe).
- KNOWN_FACADE_GAPS loses get_agent_folder_config and
  get_agent_permissions; the 2373 raising=False stub and the 1759
  MagicMock stub that supplied the missing method now name the real one.

Mutation: with routers/systems.py and services/system_service.py
reverted to the base, 11 of 13 tests in test_4128_system_detail_export.py
and test_every_db_call_resolves_on_databasemanager go red; restored
byte-identical (sha256 checked).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GET /api/systems split every accessible agent's name at its last hyphen
and called the left part a system: a naming: bare member was dropped,
content-writer invented a `content` system, and acme-api-worker landed
in `acme-api`. The list now reads the system tag deploy and apply write
(one batched get_tags_for_agents read over the caller's roster), lists
the roster agents that carry it, and lists a tag only with evidence it
is a system: the auto-created system view for it, a system_apply audit
row naming it, or a carrier named `<tag>-*`. A plain tag is not listed.
Unreadable tags (or evidence) are a named 503, kept a 503 past the outer
handler. created_at is filled from the roster's `created` field, so the
newest-first sort works.

Mutation: with list_systems reverted, tests 1-6 and 8 of
test_4129_systems_list_bare.py go red (7 is a ruling pin, green on the
old code); dropping `except HTTPException: raise` reds test 6; listing
every tag reds test 7.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…4129)

The MCP list_systems description stated the removed rule (group by the
part before a hyphen); it now says the list names systems deployed or
applied from a manifest, by their tag, and that a plain tag is not one.
The teardown_system warning is kept and reworded to match. The flow doc's
GET /api/systems line and the teardown-panel sentence follow, and name the
accepted gap: a bare-named system created by POST /deploy with no
system_view and never applied leaves no evidence, so it is not listed
until deploy records that its tag is a system.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e allowlist entry (#4128)

The GET /api/systems/{system_name} section of the system-manifest flow
still named db.get_agent_permissions/get_agent_folder_config/
get_agent_schedules, none of which the handler calls; it now names
get_permitted_agents (narrowed to the caller's accessible set),
get_shared_folder_config, list_agent_schedules and the per-key try.
get_agent_schedules has no caller left, so it leaves KNOWN_FACADE_GAPS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The flow doc's detailed GET /api/systems section and its System Grouping
section still described the old last-hyphen split; both now state the tag
evidence rule (roster tag read, three evidence kinds, members from the
roster, the two named 503s, created_at). The gap sentence also names audit
retention pruning a bare system's only evidence.

Test 9 makes the system-view read and the audit read raise and asserts the
named 503. Red with the inner 503 replaced by a bare re-raise (both cases
fell through to the outer 500); green with the route restored byte-identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The assertion message still said GET /api/systems groups by the last hyphen.
Message text only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-only out of the evidence gate (#4131)

Case 1: a manifest key accepts the create route's charset ([a-z0-9_.-],
chained `_N` suffixes included) in both naming modes, so an exported
`writer_2` / `acme-writer_2` member parses again; every other bad key keeps
the named 400. The drift note recognises chained copies.

Case 2: `system_membership(naming=)`. Apply passes the manifest's naming;
under `bare` membership is the tag (the tag read still runs, so an outage
still refuses). With no naming (restart, get, export) bare is inferred as
export infers it: tags readable and every tagged member unprefixed. A
prefixed system keeps the #2373 union. A declared untagged bare name is
adopted whatever its shape; an undeclared untagged `<system>-x` is neither
member, drift nor blocker.

`deploy: false` names are excluded from the evidence gate in both modes.

test_2373: the renamed-member case now carries a tagged prefixed member
(the union property), and the accepted residual is pinned beside it.

Mutation: with the service change reverted, 21 tests in
test_4131_bare_naming_edges.py / test_2373 go red; restored, all green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t, restart route tests, docs (#4131)

Case 3: `deploy: false` governs apply only. When a declared-only name is a
roster member by tag, apply adds the report `declared_only_member_tagged`
naming restart and teardown and the hand untag remedy; nothing is written.

The adoption warning names the explicit `?naming=bare` export when an
adopted name starts with `<system>-` (a default export infers prefixed).

Restart and get route tests run the real routes over the real db facade:
a bare member is handled, an untagged prefix lookalike and another
system's tagged member are not; a prefixed system still restarts its
untagged member; the tagged declared-only member is restarted, as the
report says.

Docs: the requirements sentence that pinned the refusal now states the
adopt rule; declared-only and the tag; flow-doc paragraphs with the one
accepted residual; user doc; MCP restart/export text for the inferred-bare
rule.

Mutation: with this checkpoint's service change reverted, the case-3
report test and the warning test go red; restored, all green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Engine truth for apply (CP1 of #4130):

- `adopted[]` and the adoption line: a dry run (valid or invalid) shows the
  plan; a refused run lists nobody and drops the line; a real run lists only
  members whose system tag landed (per (name, tag), so a default tag that
  landed is not an adoption) and says it in the past tense.
- `summary.<group>.write` on a real run counts only landed writes
  (`ApplyOutcome.landed`, `summary.build(landed=)`); a refused run counts
  none. `report` / `unobserved` stay plan counts.
- A declared-only member is not re-read after the writes (no spurious
  "could not be re-read" warning) and its `applied` is None.

Mutation: with the system_service/summary changes reverted, 10 tests in
tests/unit/test_4130_apply_result_truth.py go red (refused/partial/default-tag
/past-tense adoption, raised-writer/held-skill/refused summary, absent and
live declared-only re-read, applied None).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Delivery and deploy truth (CP2 of #4130, code and tests):

- Deploy of a manifest whose every member is `deploy: false` is a named
  400 `nothing_to_deploy` on the dry run and the real run, raised after
  name resolution (validate_manifest is unchanged; apply still reports).
- `SystemDeployResponse.agents_declared_only` (additive, default []) on
  all three return sites; the warnings line stays. The create-mode golden
  is regenerated once under #4130 for the new key only.
- Apply's `skill_delivery` note lists every per-skill failed/conflict
  entry (e.g. `deploy: marker_not_written: ...`); a set whose skills were
  all held already records `current="unchanged"` instead of nothing.
- `set_gate`'s `marker_not_written` is a `gate_marker_not_written` report
  on apply and a warning line on deploy; deploy also warns when a skill
  assignment's delivery report names a failed skill. For a member deploy
  creates, both deploy lines are unreachable today (members start after
  the skills and gates phases); they read a return value already held.

Mutation: with these service changes reverted, 9 tests in
tests/unit/test_4130_apply_result_truth.py go red (nothing_to_deploy x2,
agents_declared_only x2, marker note, unchanged set, deploy delivery
warning, gate marker on apply and deploy).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…agent test (#4131)

- In a prefixed system an untagged `<system>-x` declared-only member is a
  member by name, so restart and teardown reach it. Apply now says so with
  the report `declared_only_member_prefixed` (no write). Mutation: with the
  new branch disabled, TestPrefixedDeclaredOnlyUntagged goes red.
- The adoption warning names the other-direction residual: a bare system
  with a prefix-shaped tagged member is read as prefixed by restart,
  teardown, get and export, so an untagged lookalike is reached by name.
  The flow doc says the same.
- Plan test 13: a tagged declared-only agent that is only shared with the
  caller gets no apply report, and restart still reaches it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes CP2 of #4130: the deploy_system description names
`agents_declared_only[]` and the `nothing_to_deploy` 400; apply_system's
says a real run's `summary.write` and `adopted[]` name only what landed
(kept under the 2,048-character description cap). Flow doc, roadmap
(one added line) and user doc updated to match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-result-truth

# Conflicts:
#	src/backend/services/system_service.py
… headroom (#4130)

- The `failed` (500) deploy branch is now driven through the real
  POST /api/systems/deploy route with a declared-only member; it asserts
  `agents_declared_only` in the 500 body. Went red with the field removed
  from that branch (test_the_failed_branch_carries_the_declared_only_names).
- The `nothing_to_deploy` 400 is pinned through the route on both dry and
  real runs, not only on the service.
- apply_system MCP description trimmed from 2,043 to 1,984 characters
  (cap 2,048) with no fact dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r and field (#4130)

`ApplyOutcome.landed` was a (member, step) set, so two writes of one kind on
one member with one failure still counted 2 in `summary.<group>.write`. The
executor's `attempt()` now records (member, step, key) — the skill(s), set,
gate's skill, capability, seat role, edge target or tag the write wrote — and
`summary.build(landed=)` counts a write change only when a write of its own
key landed. Dry-run, `report` and `unobserved` counts are unchanged, and a
run where everything landed still reports the plan counts.

`SystemApplyFailure` gains an additive `key` (None for a member-wide write)
so `failed[]` names which of two same-kind writes did not land.

Regression tests (real apply route handler, real db facade):
- two skill sets on one member, one held for its unwritten gate -> skills.write == 1,
  failed[] = (lead, skill_sets, ops-core)
- two gates on one member, one set_gate raising -> gates.write == 1,
  failed[] = (lead, gates, deploy)
Mutation: with the summary predicate reverted to per-(member, field) both
tests go red (assert 2 == 1); restored byte-identical (sha256 OK).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@trinity-ability trinity-ability 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.

PR Validation Report (re-validation)

PR: #4152 - fix(systems): apply and deploy results name only what was observed or done (#4130)
Author: vybe
Branch: feature/4130-apply-result-truth (42fbe35) → feature/4131-bare-naming-edges (00db259, stacked on #4150)
Files Changed: 13 (+769/-84), validated against the stacked base, not dev
Lane: B (no lane-C or schema paths; MCP tool text and user docs touched, so Step 6.6 applies)

This pass re-checks the single Critical from the earlier REQUEST CHANGES review (summary.<group>.write counted per (member, step)) against the fix commit 42fbe3538, and re-runs everything else at the new tip.

Summary

Category Status Notes
Commit Messages ✅ conventional fix(systems): with the issue on every commit; the fix commit records its own mutation
Base Branch ✅ stacked on #4150 by design; the stack retargets to dev in order
PR Size ✅ 13 files
Status Auto-Promotion ✅ Fixes #4130
Roadmap ✅ #4130: P3, type-bug
Requirements ✅ requirements/roadmap.md line now says "each by its own key"
Architecture ➖ no new endpoint or table; two additive response fields (agents_declared_only, failed[].key)
Feature Flows ✅ feature-flows/system-manifest.md describes (member, step, key) and failed[].key
Feature Flow Format ➖ existing flow, edited in place
Security Check ✅ no keys, emails, IPs, secrets, mode flips or host paths in the diff
Infrastructure ➖ none
Build Packaging ➖ no new top-level backend directory
Config Packaging ➖ no new env var
File Modes / Host Paths ✅ none
Structural Review ⚠️ /review ran report-only (MERGEABLE, per the PR body), not posted on the PR
Merge Gate ⚠️ every check that ran on 42fbe35 is green (typecheck+unit, gitleaks, guards, schema-parity, verify-non-root, prod-image-smoke). The Tier 1 head-seed pytest and regression diff do not run on a non-dev base; they must be green once the stack is retargeted. dev-ci: success
Test Adequacy ✅ 28 tests in the new file, including the two multi-write regressions over the real apply route
Code Quality ✅ the earlier Critical is fixed (see below)
Requirements Trace ✅ each change maps to a case in #4130
Product Fit ✅ all #4130 cases met, case 3 included
Product Bar 7–11 ✅ MCP text, flow, requirements and user doc agree with the code

Documentation Checklist

  • Commit messages are descriptive
  • Roadmap updated (n/a, bug)
  • Requirements updated
  • Architecture updated (n/a)
  • Feature flow updated
  • Feature flows index updated (n/a, no new flow)

Security Checklist

  • No API keys or tokens
  • No real email addresses
  • No IP addresses
  • No .env files
  • No hardcoded secrets
  • No credential files
  • Infrastructure changes justified (none)

The earlier Critical: resolved

ApplyOutcome.landed is now (member, step, key), and summary.build counts a write change only when a write of its own key landed (summary.py, write_keys + the any((mp.name, c.field, k) in landed …) predicate). I checked each counted group's plan desired against the key= its executor passes, because a mismatch there would under-count a fully landed run:

group field plan desired executor key= match
skills list of missing skills names (written) / held (held back) ✅ any landed skill counts the one change
skill_sets [set], one change per set op.args["set"] ✅
gates {"skill": key, …}, one change per gate skill ✅
grants list of missing capabilities, one change cap, one op each ✅ any landed capability counts the one change
seat cfg.seat role (= cfg.seat) ✅
person_seats report only — ➖

extras still strips write/report/unobserved before update, so grants.held_back / roles.held_back cannot overwrite the landed count.

My two reproductions, re-run at 42fbe35 (independent scratch tests over the same world fixture through apply_manifest, not the PR's route helper; deleted afterwards):

  • skill_sets: [ops-core, notes-set] + a gate on deploy with set_gate raising → status: partial, summary.skills.write == 1 (was 2), failed[] = (gates, deploy) and (skill_sets, ops-core, gate_not_written…).
  • two gates, one set_gate raising → summary.gates.write == 1 (was 2), failed[] = [(gates, research)].

Undercount controls (same scratch run): everything landing gives the plan counts for skills + sets + gates + members, for two grants on one member (grants.write 1 = plan 1), and for a seat (roles.write 1 = plan 1).

Mutation: I put the summary predicate back to per-(member, field) and four tests went red: the PR's two TestSummaryCountsEachWriteByItsOwnKey tests and my two reproductions, all 2 == 1. The file was restored with git checkout and the worktree was clean afterwards.

Additive SystemApplyFailure.key

  • Optional[str] = None, declared last; every construction site uses keywords (system_service.py: fail() plus the four direct sites, which leave it None). Nothing in src/ constructs the model positionally or matches it by exact dict shape. The frontend has no consumer of the apply failed[]. The deploy response's failed[] is a different model and is unchanged, and so is the create-mode golden (test_ent695_create_mode_golden.py passes).
  • _write_key joins a multi-skill write ("a, b"), so failed[] names held-back skills as one entry. That matches the one plan change they share.
  • MCP: apply_system description is 1,984 / 2,048 characters, unchanged by the fix commit. Its sentence "a real run's write and adopted[] name only what landed" is now true. deploy_system is 1,191. tool-description-budget.test.ts + systems*.test.ts: 54 pass, 0 fail.

Execution coverage (§5.4)

changed symbol / test file executed by live consumer verdict
summary.write_keys / build(landed=) per key TestSummaryCountsEachWriteByItsOwnKey (2), TestSummaryCountsLandedWrites (4) _apply_report → POST /api/systems/apply ✅
attempt(..., key=) / out.landed 3-tuples same, plus every real-run test in the apply suites execute_apply_plan, _run_op, skills/gates/grants/seats.run ✅
SystemApplyFailure.key / _write_key both new tests assert failed[].key SystemApplyResponse.failed ✅
_apply_report adopted / declared-only / deploy 400 / delivery / marker unchanged since the last pass, still green as before ✅

New tests contain no source-text assertions. Fix-PR mutation: the per-(member, field) revert above turns 4 tests red.

Suites at 42fbe35: test_4130_apply_result_truth.py 28 passed; the neighbouring apply, deploy, naming, declared-only, gates, grants, seats, skills, summary, lease, route, golden, #2373, #4129 and #4131 suites: 531 passed, 0 failed.

Product fit (Step 6.6)

check verdict evidence
Approved (not incubating) ✅ #4130, type-bug
Scope ↔ issue ✅ cases 1–5 and the additive deploy field are met. Case 3 now holds in the multi-write case too
Open-core tier ✅ existing OSS-core apply/deploy; no gate added or moved
Doctrine ✅ none
Bar 7–11 ✅ all surfaces updated and consistent

Issues Found

Critical (Block Merge)

  • None.

Warnings (Review Required)

  • Merge gate: once the stack is retargeted to dev, Tier 1 pytest (head) + regression diff must be green before merge (merge #4145, #4146, #4150 first, as the PR body says).
  • /review verdict lives only in the PR body.

Suggestions (Optional)

  • The PR body's "What" bullet still reads "a real run counts only (member, field) writes that landed". The code, docstrings, flow, requirements and user doc all say "each by its own key". Worth a one-word edit so the body matches the fix.
  • Carried over: nothing_to_deploy would also fire for a manifest with zero agents if validation ever let one through, and its message would then be wrong. This is probably unreachable.

Recommendation

APPROVE

The one blocking defect from the earlier review is fixed at its root. Each landed write is now keyed by what it wrote, and every counted group's plan keys match the executor's. Both reproductions now return 1. A per-(member, field) revert turns the new tests red. There is no undercount when everything lands, and the additive failed[].key breaks no consumer. This review supersedes my earlier REQUEST CHANGES review.

🤖 Generated with Claude Code

@trinity-ability trinity-ability 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.

PR Validation Report

PR: #4152 - fix(systems): apply and deploy results name only what was observed or done (#4130)
Author: vybe
Branch: feature/4130-apply-result-truth (ebc3928) → feature/4131-bare-naming-edges (00db259, stacked on #4150)
Files Changed: 11 (+646/-65), validated against the stacked base, not dev
Lane: B (no lane-C or schema paths; MCP tool text and user docs touched, so Step 6.6 applies)

Summary

Category Status Notes
Commit Messages ✅ conventional fix(systems): with the issue on every commit
Base Branch ✅ stacked on #4150 by design; the stack retargets to dev in order
PR Size ✅ 11 files
Status Auto-Promotion ✅ Fixes #4130
Roadmap ✅ #4130: P3, type-bug, status-ready
Requirements ✅ one line in requirements/roadmap.md
Architecture ➖ no new endpoint or table; one additive response field
Feature Flows ✅ feature-flows/system-manifest.md updated
Feature Flow Format ➖ existing flow, edited in place
Security Check ✅ no keys, emails, IPs or secrets; enterprise-docs pattern 0 hits
Infrastructure ➖ none
Build Packaging ➖ no new top-level backend directory
Config Packaging ➖ no new env var
File Modes / Host Paths ✅ none
Structural Review ⚠️ /review ran report-only (MERGEABLE, 0 critical, per the PR body) but was not posted on the PR. It did not catch the finding below
Merge Gate ⚠️ stacked PR: the checks that ran are green (typecheck+unit, gitleaks, guards, schema-parity, verify-non-root, prod-image-smoke). The Tier 1 head-seed pytest and regression diff did not run because the base is not dev. They must be green once the PR is retargeted. dev-ci: success
Test Adequacy ✅ 26 tests over the real apply and deploy routes on the real DB facade
Code Quality ❌ summary.write still counts a held-back or failed write when a sibling write in the same (member, step) landed. See Critical
Requirements Trace ✅ each change maps to a case in #4130
Product Fit ❌ issue case 3 is only partly met (see Critical); the other cases are met
Product Bar 7–11 ✅ MCP text, flow, requirements and user doc all updated (one sentence in them overstates, see Critical)

Documentation Checklist

  • Commit messages are descriptive
  • Roadmap updated (n/a, bug)
  • Requirements updated
  • Architecture updated (n/a)
  • Feature flow updated
  • Feature flows index updated (n/a, no new flow)

Security Checklist

  • No API keys or tokens
  • No real email addresses
  • No IP addresses
  • No .env files
  • No hardcoded secrets
  • No credential files
  • Infrastructure changes justified (none)

Execution coverage (§5.4)

changed symbol / test file executed by live consumer verdict
_apply_report adopted / adoption line TestAdoptedSaysWhatHappened (5) apply_manifest → apply route ✅
summary.build(landed=) TestSummaryCountsLandedWrites (4) _apply_report ⚠️ executes, but only one write per (member, step) is tested; the multi-write case is wrong (Critical)
declared-only re-read skip / applied: None TestDeclaredOnlyIsNotTouched (4) execute_apply_plan, _apply_report ✅
deploy nothing_to_deploy 400 / agents_declared_only TestDeployNamesDeclaredOnly incl. route-level 400 deploy_manifest → route ✅
delivery_change / deploy_delivery_warning / delivery_failures delivery tests (4) skills.run, assign_manifest_skills ✅
gate marker_not_written (apply + deploy) marker tests (2) gates.run, gates.deploy ✅ (deploy guard can't fire for a just-created member today; the PR says so)
ent695_create_mode_golden.json test_ent695_create_mode_golden.py regenerated once, logged in regenerated_by ✅

Fix mutation (run here): reverting the adopted[] landed-only filter and the declared-only applied: None makes 4 named tests go red. Neighbouring suites (#2373, #4131, the apply engine, apply route, lease, golden, declared-only, gates, grants, naming, seats, skills, summary): 503 passed. New file: 26 passed.

Product fit (Step 6.6)

check verdict evidence
Approved (not incubating) ✅ #4130 status-ready, type-bug
Scope ↔ issue ❌ cases 1, 2, 4, 5 and the additive deploy field are met. Case 3 is only partly met (see Critical)
Open-core tier ✅ existing OSS-core system apply/deploy; no gate added or moved
Doctrine ✅ none
Bar 7–11 ✅ every surface is updated (MCP description, flow, requirements, user doc)

The rulings carried from the plan (named 400, adopted kept on invalid dry runs, applied: None, the additive field with its golden, keeping the deploy guards that cannot fire today) are the operator's. This review does not reopen them.

Issues Found

Critical (Block Merge)

  • summary.<group>.write counts by (member, step), not by write, so issue case 3 still reproduces. out.landed is keyed (name, step) (system_service.py attempt, the out.landed.add((name, step)) line), and summary.build counts every write change whose (mp.name, c.field) is in that set (summary.py, the (mp.name, c.field) in landed line). A member has one change per skill set (skills.py, skill_set_missing) and one per gate (gates.py, gate_missing/gate_differs). If one of those writes is held back or raises while a sibling write in the same step lands, both are counted. Reproduced on this head with the PR's own world fixture:

    • skill_sets: [ops-core, notes-set], gate on deploy (a member of ops-core), set_gate raises → failed names skill_sets: gate_not_written… for ops-core, yet summary.skills.write == 2. A set held back for its gate is counted as a write, which is case 3 of #4130.
    • two gates on one member, one set_gate raises → failed names it, yet summary.gates.write == 2.

    The PR's own text promises the opposite: summary.py ("a skill held back for its gate, a writer that raised … are not" counted), models.py ("only the LANDED writes"), and the MCP apply_system description ("a real run's write … name only what landed").

Warnings (Review Required)

  • Merge gate: once the stack is retargeted to dev, the Tier 1 pytest (head) and regression diff must be green before merge. They have not run on this PR.
  • /review was not posted on the PR. Its verdict exists only in the PR body.
  • Granularity, for reference: a single skills change covers several skill names (desired=[...]). With mixed held/landed skills it counts 1, the same as the plan. That is consistent with change-count semantics and is not part of the Critical finding.

Suggestions (Optional)

  • nothing_to_deploy also fires for a manifest with no agents at all, if validation ever lets that through. The message ("every member is declared-only") would then be wrong. It is probably unreachable, but worth one assertion.

Recommendation

REQUEST CHANGES

The adoption, declared-only, deploy-400, delivery and marker corrections are right, well tested and mutation-proven. The summary count, though, still states something the run did not do in the multi-write case, and that is the exact case #4130 lists. The MCP description now tells agents the count can be trusted.

This PR requires the following changes before merge:

- [ ] Count `summary.<group>.write` per landed write, not per (member, step). For example, record landed ops by identity (or by (member, step, key): set name / gate skill / capability) and match each write change to its op(s). Grants have N ops per change: count the change when any of its ops landed, or count per capability.
- [ ] Add the two regression tests above (one set held + one landed → skills.write == 1; one of two gates raises → gates.write == 1).
- [ ] Keep the docstring, model comment and MCP wording true to whatever granularity ships.

Please address these items and request re-review.

🤖 Generated with Claude Code

@trinity-ability trinity-ability added status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) and removed status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) labels Nov 1, 2026
@trinity-ability

Copy link
Copy Markdown
Contributor

Fix for the review's summary.write defect is in 42fbe35: a landed write is now counted by its own key (skill, set, gate, capability, seat), so two writes of one kind on one member with one failure count 1. failed[].key names the write that did not land. Two route-level regression tests cover it, and both go red with the fix reverted.

…into pr-4152

# Conflicts:
#	src/mcp-server/src/tools/systems.ts
@vybe
vybe changed the base branch from feature/4131-bare-naming-edges to dev November 1, 2026 21:44
@vybe
vybe merged commit 8c17e06 into dev Nov 1, 2026
28 checks passed
@vybe
vybe deleted the feature/4130-apply-result-truth branch November 1, 2026 22:06
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.

2 participants