Repository navigation
feat(systems): the public half of system teardown — a structured membership read, a license-blind MCP proxy, and a gated remove panel (abilityai/trinity-enterprise#454) - #2756
Conversation
|
Resolve by merging |
…ity-enterprise#454) Rule #1: requirements before implementation. Records only what lives in this repo — the edition-agnostic membership primitive, the license-blind MCP proxy and the Vue gate — and states plainly that the teardown control plane is an entitlement-gated module in the private submodule (404 on an OSS build). The paid module's surface and internals stay in the private tree (ent#45). Also cross-references §33.1: a teardown is N of that soft-delete composed through the same endpoint, so the 180-day window, name reservation and schedule freeze are preserved by construction rather than re-implemented. Co-Authored-By: Claude Opus 5 <[email protected]>
…bilityai/trinity-enterprise#454) `system_member_names` keeps its signature and becomes a thin wrapper; the body moves verbatim into `system_membership`, which additionally returns the two facts the flat name list discarded: * `tags_readable` — the body degrades to the raw prefix on a tag-read failure, argued there for `restart` (over-capture restarts one container too many and logs it; under-capture restarts a subset and reports success). A verb that DELETES inverts the cheap half, so it can refuse on unverified membership instead of degrading — at its own call site, without forking THE ONE predicate into a fourth rule. * `evidence` (tag|prefix|both) — derived from the two sets that already decided membership, so it cannot disagree with them. Makes the prefix fallback's documented residual visible to a caller instead of silent. `SYSTEM_VIEW_AUTO_DESCRIPTION` replaces the inline f-string: nothing persists a system<->view link, so that description IS the identifier for the view a deploy auto-created, and a reader that has to find it again must not restate the literal. Behaviour-preserving, not asserted to be: the #2373 suite (33) and the whole ent#124/125/126 + systems set (325) pass unchanged against the wrapper. Co-Authored-By: Claude Opus 5 <[email protected]>
…rties (Abilityai/trinity-enterprise#454) #2373's fallback rule was wrong three times and each wrong rule passed the case test written for its predecessor, so the fallback is pinned as a PROPERTY through the new entry point: members ⊇ raw prefix match whenever the tags are unreadable, plus tagged ⊆ members whenever they are readable. Any future narrowing fails by construction, whatever shape it narrows on. Also pinned: the wrapper is a projection of `system_membership` (generated, AND source-anchored — a property cannot see a copied body that happens to agree today), evidence is keyed by exactly the members and true of each, and the auto-view description is asserted THROUGH `create_system_view` rather than by restating the literal. The named incidents stay as discrete cases: the eleven `vc-due-diligence-dd-*`, an agent named exactly `acme`, the sibling-prefixed `acme-api-worker`, and the `acme` vs `acme-extra` floor from the AC. One counterexample found by Hypothesis and fixed as a TEST bug, not a code one: `roster=[]` short-circuits before the tag read and so reports `tags_readable: True` by design — a destructive caller refuses on False, and refusing a teardown of a memberless system is a 503 where 404 is the truth. 17 passed under the derandomized `ci` profile and under `explore` (5000 examples); both lint guards clean. Co-Authored-By: Claude Opus 5 <[email protected]>
…Abilityai/trinity-enterprise#454) Invariant #13's third surface. The tool ships in the OSS bundle and knows nothing about entitlement: it proxies DELETE /api/enterprise/system-teardown/{name} and reports what the route says. `dry_run` defaults to TRUE — the opposite of `deploy_system`, deliberately: an unwanted preview costs a round trip, an unwanted execute costs a deleted fleet. The default lives in tool code, so it is pinned by a test that an `|| false` typo would fail. Refusals degrade rather than throw, and stay DISTINCT: 404 (no such build) / 403 (not licensed, or an agent key on a human-only verb) / 503 (membership unverified — flagged retryable, and says nothing was removed). A thrown error reaches the agent as an opaque transport failure it cannot reason about, and flattening the three is how a human on a user key gets told a licensed feature "doesn't exist". A `failed` report arriving as a 500 is kept as a RESULT — its per-member reasons are the only actionable output. Reads `ApiError.body` rather than regexing `ApiError.message`: the field is retained verbatim for exactly this purpose (ent#443), and its own docstring says the regex is what breaks when the message format changes. Found while writing the test, which constructs a real ApiError rather than a `{status}` stand-in that would have passed over broken body parsing. No server.ts change: createSystemTools is already in toolGroups, so the tool inherits the operatorOnly allow-list. tsc --noEmit clean; npm test 383 pass / 0 fail (364 before). Co-Authored-By: Claude Opus 5 <[email protected]>
…inity-enterprise#454) Library -> Systems gains the inverse of install: preview -> per-agent checklist -> acknowledgement -> remove. Gated on `system_teardown` in `enterprise_features`, so an OSS build's Systems section looks exactly as it did rather than offering a control whose route 404s. The preview is a CHECKLIST, not a list, and that is the design rather than decoration: a member whose `evidence` is `prefix` matched by name with no deploy tag to confirm it, so it may belong to a sibling system sharing this one's prefix. The server cannot tell — only the operator can — so the badge plus the opt-out IS the over-capture escape hatch, and the confirmed list goes back on execute to be intersected with freshly-resolved membership. Remove is gated on four conditions, each blocking something the others do not: the preview is current for the typed name, membership was verified, the consequence is acknowledged (ent#126's ack contract reused, not a second pattern), and at least one agent is checked. A disabled button says why. Honest reporting: tone switches on `status`, never the HTTP code (`partial` is 200, `failed` is 500 with the report as the body). skipped / failed / aborted render as three different things with per-reason operator copy, because a refusal is not a breakage and an un-attempted member is neither; `discarded` never claims recoverability. A timeout is "outcome unknown" and offers no retry — the server keeps deleting. `ManifestPreview`'s "there is no un-deploy" now tracks the CAPABILITY: still exactly true where the module is absent. Retiring it everywhere because one edition gained the verb would have been the dishonest fix. `DeployResult` gains a de-emphasised "Remove this system", also entitlement-gated (AC 7). Design contract: token-only (scanner reports 0 non-gray / 0 hex across all six systems files), both themes, primitives only, bounded member viewport with a stated total, no bare loading gate — the in-flight flags reach only BaseButton. Tests: 21 vitest store specs + 25 source-anchored contract assertions. Mutation-checked, and it found a real gap: "the preview is bound to its name" passed with the name comparison replaced by `true`, because `setTeardownName` nulls the preview and the null-check carried the assertion alone. The comparison guards a direct-assignment bypass, so the test now uses one. Frontend suite 2795 passed (2774 before); check:tokens clean. Co-Authored-By: Claude Opus 5 <[email protected]>
…es (Abilityai/trinity-enterprise#454) `system-manifest.md` gains entry-point rows (the gated route, the license-blind MCP tool, the UI's new status) and a "Teardown — the public half" section covering what lives in THIS repo: the membership split and why it is a wrapper rather than a fork, the one-constant auto-view description, the MCP degradation contract, the checklist UI, and the four tests. The gated verb's own design stays in the private tree (#151 doc-follows-the-code). Feature-flows index row added, per the standing rule that a row goes in even when the flow doc already exists. (The "newest ~20" cap on that table is already at 140 rows — pre-existing drift, deliberately not pruned here, since dropping 120 rows would bury this diff.) Area files: mcp-server.md `systems.ts (4)` -> `(5)`, backend.md's `system_service.py` line records the membership split and the constant, frontend.md records the gated half of the Systems section. Public docs carry the seam and the gate's name only — no paid-module internals. Verified by running the enterprise-docs-guard's own grep locally: clean. Co-Authored-By: Claude Opus 5 <[email protected]>
…bilityai/trinity-enterprise#454) `/sync-feature-flows` mapped every changed file to a flow; two changed files belong to a second flow each, and those were the gap: * `mcp-orchestration.md` — the System Tools table and the enumerated tool-count comment both said four. `teardown_system` makes five, with its license-blind degradation contract and its inverted `dry_run` default recorded where the other tools are catalogued. * `library-page.md` — the `#systems` section now hosts two panels, and the second renders nothing without the entitlement. Worth stating there because that page's doc is where someone checks why a tab looks different between editions. The index row's Flow column now names all three flows rather than only `system-manifest.md`. `system_service.py` also appears in `scheduling.md` and `agent-tags.md`, but only as the module that writes schedules and tags — nothing this change touched, so no update. Index is 552 lines against the skill's 400-line guidance. That is the pre-existing Recent Updates table at 140 rows against its own documented "~20" cap; my row is one line of it, and condensing 120 rows would bury this diff. Flagged, not fixed. Co-Authored-By: Claude Opus 5 <[email protected]>
…y-enterprise#454) Reusing ent#126's acknowledgement contract was right for the prop/emit shape and wrong for the `data-testid`. Install and remove can both be previewed on the same Library page, so a shared id puts two elements at one address — and `e2e/system-install.spec.js` addresses the install ack as `getByTestId('ack-checkbox')` in three places, which would be strict-mode ambiguous on an entitled build. It would NOT have failed CI: the teardown panel is unentitled there and renders nothing, so the collision is invisible to every check that runs today. That is exactly why it gets a test rather than a CI run. Found by reading the spec that shares the surface, while waiting on the e2e job. The pattern is worth sharing; the address is not. `ManifestPreview` keeps `ack-checkbox`; the teardown ack is `teardown-ack-checkbox`; the contract test now asserts BOTH — the shared prop/emit shape and the distinct ids. Frontend suite 2795 passed, check:tokens clean. Co-Authored-By: Claude Opus 5 <[email protected]>
…bilityai/trinity-enterprise#454) The per-id fix in the previous commit was the wrong SHAPE, and looking for a second instance found one immediately: `goto-fleet`, owned by DeployResult.vue and copied into TeardownResult.vue. Two collisions is the signal to write the rule instead of fixing instances. Install and remove are two panels on one Library page, and on an entitled build both can show a preview AND a result at once — so any id they share is strict-mode ambiguous for a Playwright `getByTestId(...)`, which is exactly how `e2e/system-install.spec.js` addresses both `ack-checkbox` and `goto-fleet`. None of it fails CI today: the teardown panel is unentitled there and renders nothing, so the collision is invisible to every check that runs. Hence a test rather than a CI run — `test_no_test_id_is_shared_with_the_install_panel_it_sits_beside` intersects the two panels' id sets and fails on any overlap, so a third collision cannot be introduced quietly. Measured: reintroducing the `goto-fleet` collision turns it red; control clean. Also drops a now-stale docstring line in TeardownPreview that still claimed the shared testid. Frontend suite 2795 passed. Co-Authored-By: Claude Opus 5 <[email protected]>
…ai/trinity-enterprise#454) `normalizeError` is shared with deploy, and its unknown-outcome copy read "Deployment may still be running — re-deploying creates duplicate agents." On a teardown timeout that is the opposite advice at the worst possible moment: the in-flight work is removal, and the members removed so far are already gone. The two sentences that are about WHAT was in flight move into `UNKNOWN_OUTCOME_COPY`, keyed by verb — everything else in the normalizer is verb-independent, which is why this stays one function. `teardown-preview` gets its own arm because a dry run writes nothing, so neither sentence may imply work in flight. The MCP tool copy is corrected alongside it: the 403 said "an agent-scoped key", which understates a gate that is now an allowlist refusing every machine credential; the 503 said "membership could not be verified", which no longer covers the case where the roster itself was unreadable; and `dry_run` now states that a member with no container is removed the same way, since that is what frees its name. Co-Authored-By: Claude Opus 5 <[email protected]>
…not (Abilityai/trinity-enterprise#454) Three docs claimed the teardown acknowledgement reuses ent#126's `data-testid="ack-checkbox"`. The code deliberately does the opposite and a guard test requires it to: both panels render on one Library page, so a shared address makes every `getByTestId('ack-checkbox')` strict-mode ambiguous. The PATTERN is what is reused (`:acknowledged` / `update:acknowledged`); the address is not. The flow and roadmap gain the roster-completeness ruling behind the private fix: every OSS sibling on this surface resolves its roster from containers, which is cosmetic for `get_system` / `restart_system` / `export_manifest` and is under-capture-reporting-success for a verb that claims completion — plus why the #2196 tri-state reader is what makes the ownership supplement safe, and why an unreadable Docker refuses rather than 404s. `learnings.md` records C1's class for the next planner: a guard that tests membership against a list the disqualified entries were just appended to is dead for the case its own comment describes, and the narrow test beside it passes either way. Co-Authored-By: Claude Opus 5 <[email protected]>
c6a7c2f to
1cd545a
Compare
…base string's (Abilityai/trinity-enterprise#454) BaseButton's shared class string carried `border-transparent` next to the reserved `border` width, while `secondary` — the one variant drawn BY its border — set `border-gray-300`. Both are single-class selectors, so specificity ties and emission order decides: Tailwind emits `.border-transparent` after `.border-gray-300` (rule 729 vs 698 on the live dev stylesheet), and the resting keyword won. Every secondary button rendered borderless in light mode — a white button on a white card with no outline — across 24 call sites. It survived review because dark mode won by accident rather than by design: `dark:border-gray-700` compiles to `.dark .border-gray-700`, one class heavier, which outranks the tie. The theme most of us work in was correct. The fix is the one `fieldClasses.js` already documents for FIELD_GHOST_CLASS one primitive over: the base string keeps the bare `border` (so the focus ring still costs no layout shift) and every variant names its own colour. Measured, not reasoned — resting border on the teardown panel's "Preview removal" control, before → after: light: rgba(0,0,0,0) → rgb(209,213,219) (gray-300) dark: rgb(55,65,81) → rgb(55,65,81) (gray-700, unchanged) Guard: tests/unit/baseButtonVariantBorder.spec.js pins the base string colour-free, asserts secondary is outlined in BOTH themes (the bug was theme-asymmetric, so a light-only pin would let the next edit break dark while staying green), and fails closed on a fifth variant that names no border colour. Mutation-checked: restoring `border-transparent` to the base string turns it red. Co-Authored-By: Claude Opus 5 <[email protected]>
…ilityai/trinity-enterprise#454) BaseInput is a three-part stack — label, control, help — so a flex row that holds one whole aligns against that whole box. `items-end` therefore put the button's bottom edge on the HELP TEXT's bottom rather than the control's, leaving "Preview removal" 22px below the field's centre where it read as a stranded caption instead of the field's action. Fixed by composing the row the way BaseInput documents and the way TemplateRegistryPanel already does it for the same control-plus-action shape: the panel owns the label and the help, and the row holds two control boxes, so alignment means what it says. `items-stretch` rather than `items-start` because the two primitives are deliberately different heights (field py-2 on a 20px line box = 38px; button py-[7px] on 13.5px/1.35 = 34px) and stretching the shorter one costs no magic number and overrides neither recipe. Measured on the live dev stack, before → after: input top/bottom 1295/1333 → 1295/1333 button top/bottom 1319/1353 → 1295/1333 centre delta +22px → 0px BaseInput carries the second half. Its `:aria-describedby` binding is applied AFTER `v-bind="controlAttrs"`, so with no `help` prop of its own it did not leave a caller's `aria-describedby` alone — it ERASED it, and the help paragraph stopped being announced the moment the panel took ownership of it. It now hands the attr back instead of winning a merge the caller never knew it had entered. Strictly additive: error and help still win, in that order, so no existing caller changes. There is no mount harness in this project (no @vue/test-utils, vitest runs environment: 'node'), so the a11y half is browser-verified rather than unit-pinned — on the live render the control resolves aria-describedby="v-1-help" to the help paragraph, and label[for] to "System name". Full unit suite green: 131 files, 2937 tests. Co-Authored-By: Claude Opus 5 <[email protected]>
…sits in (Abilityai/trinity-enterprise#454) Two h4s in this PR's own files were written without a size class and fell through to the UA default of 1em. On a 16px root that made the DEEPEST headings on the page the LARGEST — bigger than their four `text-sm` siblings and bigger than the h3 that contains all of them: h3 "Remove a deployed system" 14px h4 "Agents to remove" / "Also removed" / "Notes" 14px h4 "This removes running agents" 16px ← TeardownPreview.vue:149 h4 "Outcome unknown" 16px ← SystemTeardownPanel.vue:38 Both are warning callouts whose anatomy is identical to the danger callout at TeardownPreview.vue:8 — bordered box, icon span, heading, list — and that one already carries `text-sm`. So this was an inconsistency inside a single file, not a scale that needed inventing. All five h4s now measure 14px on the live render, matching the h3 they sit under. Scope is pinned to the three components this PR ADDS. Six more unsized headings exist on the install side (ManifestPreview ×2, DeployResult ×3, SystemInstallPanel ×2) and are left alone: they predate this branch, and TeardownResult's banner h3 is deliberately byte-identical to DeployResult's, so changing one half would break a parallel that was built on purpose. They are reported for their own issue rather than folded in here. Full unit suite green: 131 files, 2937 tests. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Resolve by running |
# Conflicts: # docs/memory/feature-flows.md # docs/memory/learnings.md
…lityai/trinity-enterprise#454) dev's ent#628 policy table landed while this branch was out. Every registered tool must carry a TOOL_ACCESS_POLICY row, and policyFor checks it AT REGISTRATION — so merging dev left the MCP server crash-looping on boot (ToolAccessPolicyError: tool 'teardown_system' has no entry; nine restarts on a live stack). PR CI never said so: the PR was CONFLICTING, which runs zero checks. The row is `baselined`, not `none`. The siblings can honestly say "a system name, not an agent" (deploy_system, restart_system); this one cannot — it takes the confirmed removal set as `agents` and deletes them. `agents` is absent from AGENT_TARGET_PARAMS, so a `none` row would have passed the shape check while saying something false. The owner names the fence that actually holds the line: the gated route requires role 'creator' AND a human caller. Proof: src/mcp-server npm test 440/440, including access.test.ts's "createServer boots: every registered tool has a row"; rebuilt image boots and stays up. Co-Authored-By: Claude Opus 5 <[email protected]>
…ilityai/trinity-enterprise#454) A fresh teardown preview ticked EVERY member regardless of `evidence`. A member the server matched by NAME with no deploy tag is one it cannot vouch for — and arriving ticked makes the escape hatch an opt-OUT on a verb that deletes. The 503 refusal does not already cover this. It fires only when the tag read FAILED (`membership_verified: false`, Remove disabled). A `prefix` member also appears in the HEALTHY state — tags read fine, that one agent simply has no tag row — where membership is verified, Remove is ENABLED, and the unconfirmable agent was pre-ticked beside it. #2373 ranks under-capture as cheaper than over-capture, which is right for `restart` and inverts for a verb that deletes; that inversion is why teardown refuses rather than degrades everywhere else, and the default handed it back in the one state the refusal misses. The rule moves to the STORE (`teardownDefaultSelection`) rather than staying in the panel's watcher, because `vitest.config.js` pins `environment: 'node'` with no component mounting: a default written into a `.vue` watcher is a decision no runnable test can execute, which is how this shipped. The panel now applies it and nothing else. Found by clicking through a live stack, not by any test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…or an opt-in (Abilityai/trinity-enterprise#454) The rendered half of the pre-tick fix. A `prefix` member now arrives UNTICKED, so its own copy had to stop saying "uncheck it if so" — that sentence describes a box that arrives ticked, and left in place it would have told the operator to undo a safeguard that had not been applied. The short selection is also stated above the list. Without it the unticked rows read as a miscount against the "N of M selected" counter beside them, and an operator who re-ticks them to "fix" the count has re-created the defect by hand. Guards are source-level because nothing renders this component: vitest is `environment: 'node'` with zero mounts, and the green `e2e` runs `system-install.spec.js`, which never touches teardown. They go through a new `_prose` helper that strips comments AND collapses wrapping — the first version of one of them matched its own JSDoc line, which is the trap `_code_only` already existed for, landing a third time. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…d no retry that cannot help (Abilityai/trinity-enterprise#454) Two defects in one banner. "Try the preview again in a moment" is advice for a transient fault. The condition this renders under is a failed database read — a schema or permission fault that does not clear on its own — so re-previewing produces the identical screen forever, which trains the operator to read a real stop as flakiness. It now says the fault is standing and offers the one thing that does work: the per-agent path the server's own refusal detail already names. The banner also named the TAG read specifically, and it cannot know that. `membership_verified` is `tags_readable AND roster_complete` — one boolean over two independent faults — so on the roster arm the copy was simply false: the tags read perfectly and it is the agent LIST that is incomplete. The banner now states the consequence, which IS identical either way, and quotes the server for the cause. That required routing the warnings. The roster line used to fall through to "Notes", which put the real fault in a footnote underneath a banner naming the other one. Both membership lines are now claimed by the banner while it renders, and `otherWarnings` is defined by SUBTRACTING what the banner took rather than by a second independent regex — two filters that must stay complementary are two chances to drop a line off the screen entirely. Also repairs an existing assertion that broke on the re-wrap: the phrase it pinned was split across two lines without a word changing, so it now goes through `_prose` like the rest. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…Abilityai/trinity-enterprise#454) "The acme tag goes with the agents (2 tagged)" was rendering `SystemTeardownTag.member_count`, which the service sets to `len(members)` — every candidate, tagged OR matched by name. So the word "tagged" overstated the tag the moment any member was `prefix`. In the refusal state it was worse than imprecise: the banner at the top of the same screen says the membership could not be confirmed, and this line then quoted a figure derived from that very read. Two statements about one read, opposite in confidence, on one screen. Dropped rather than reworded. The total the operator actually needs is already stated on the list itself ("N of M selected"), and the sentence's job is the other clause — that the tag is not a separate record to go and delete. The field is not wrong; `member_count` counts members and says so. Only the noun beside it in the UI was. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…lityai/trinity-enterprise#454) The flow doc described the old checklist ("the badge plus the opt-out is the mechanism") and said nothing about which boxes arrive ticked, which is the half that was wrong. It now records the opt-in/opt-out split and where the decision lives, why the refusal banner names no fault, how warning routing partitions, and that the tag line carries no count. Tests table and change history updated with it. The ledger entry is the transferable part: a UI default written in a `.vue` watcher is a decision no node-environment suite can execute, so it is reviewed by eye forever — move it to the store and the spec that already exists starts covering it. Plus the three smaller shapes this round produced: a boolean over two faults must name neither, a count rendered with a different noun than the field counts is a lie with a number on it, and warning routing partitions by subtraction. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…nity-enterprise#454) The preview watcher was not `immediate`, and the store outlives the component. `Library.vue` mounts the systems section lazily and nothing resets teardown state on unmount, so leaving the page and coming back remounts this panel onto a preview that is STILL current — and the watcher never fires for it. The removal set rendered with every box empty and "Select at least one agent", which makes this component's own stated default untrue on the second visit. Pre-existing (the previous all-members default had the same hole) and fail-safe in both directions, which is exactly why it survived: nothing breaks, the panel is just wrong and asks the operator to re-tick a set it had already reasoned about. Found by driving the real panel in a browser — the store spec cannot see it (the rule is correct; the wiring never ran) and neither can a source regex, until one is told to look for `immediate`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…pt-in one (Abilityai/trinity-enterprise#454) The server's prefix warning ends "Uncheck anything that does not belong before confirming" — the opt-OUT instruction this branch reversed. It rendered under "Notes", six lines below the panel's own "tick it only if it belongs", so one screen gave opposite instructions about the same row and the stale half read as the authoritative one, because it came from the server. Suppressed, which is the rule this component's docstring already states: a warning that has a dedicated block above is not repeated as prose. The prefix warning simply had no such block until the short-selection note gave it one, so it was the only member of that family still falling through. The excluded, ephemeral and unverified lines were already suppressed for exactly this reason. SUPPRESSED rather than MEMBERSHIP_FAULT: it is raised in the HEALTHY state too, where no banner renders at all. Visible only in situ — the warning comes from the enterprise module, so it is absent from every fixture in the frontend tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… before it (Abilityai/trinity-enterprise#454) `TeardownResult` rendered `result.warnings` unfiltered, so the server's prefix warning — which ends "Uncheck anything that does not belong before confirming" — appeared under Notes on the RESULT, beneath a report of what had already been removed. Advice for a decision already taken, in the opt-OUT wording the preview stopped using. Only that line is dropped. Every other warning is a statement of fact about what happened (agents excluded, members with no container, ephemeral members with no recovery window) and still reads correctly after the event. The preview gained this filter in 581a531; this component did not, because nothing renders either of them in CI and the preview is the one a source guard had been written against. Found by tearing a system down for real on a live stack. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
merge-train: ejected from today's train — rides the next one once fixed. Nothing was pushed to this branch. This is close, and the backend half is good work. The membership primitive, the MCP tool and the store all have real teeth — I verified by reverting each and watching tests go red ( What blocks it is that the destructive gate is the one decision left outside the executable layer. Two semantic mutations pass the entire suite — all 36 source-regex tests and all 29 executing store tests green:
The textual guards aren't vacuous — deleting a gate term or pre-ticking every member each turns something red. They're textual, and a DELETE gate needs semantic. The reason this is a fix rather than a rewrite: you already built the pattern and applied it one function over. What unblocks it: lift the Worth addressing while you're in there, not blocking on their own:
|
|
merge-train: not on the 2026-09-21 train either — carried over unfixed. Nothing was pushed to this branch. This branch's last commit predates yesterday's ejection comment, so the findings there stand unchanged and I have not re-derived them. See the note above for the detail and for what unblocks it. Not a re-review, just the queue state: this is the second consecutive train this PR has missed. If any of yesterday's findings look wrong to you, say so on the thread and I will re-verify that specific point rather than leave it parked — a disputed finding is a faster conversation than another week in the queue. |
# Conflicts: # docs/memory/learnings.md
…rors are one rule `teardownDefaultSelection` pre-ticked `evidence !== 'prefix'`. `evidence` is free-form text off the wire and the consumer DELETES, so a member arriving with the field absent, null, or carrying a future fourth value was pre-ticked by a denylist that had never heard of it. It was worse than one predicate: the polarity was hand-mirrored in THREE places, two of them in the template — the store's default, the "matched by name only" BaseBadge, and the explanation beneath it. The badge and the note tested `=== 'prefix'`, which is not the complement of `!== 'prefix'` for an unrecognised value, so such a member was pre-ticked AND unbadged AND unexplained: swept into a delete with no signal at all. All three now read one exported predicate, `isConfirmedMember`, an allowlist of positive confirmation (`tag` / `both` — what `system_service.py` actually emits). `teardownUnconfirmedMembers` is its complement by subtraction, so the pair partitions the roster by construction. Four cases + a partition property added to the spec that already executes this rule. Negative-controlled: restoring the denylist turns the three unrecognised-evidence cases red. The source guard's assertion moved with it — it pinned the literal `m.evidence === 'prefix'`, i.e. the implementation spelling, and now pins the shared predicate plus the absence of a raw comparison. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ming no mount harness exists Two things, one file. **The pin.** #2922 lands a ratchet that holds any spec with no baseline entry to ZERO source-text reads. This spec is new, so it fails that ratchet — the two PRs are individually green and jointly red, which is invisible to either one alone. It is a legitimate pin rather than a missing mount: the defect is a cascade tie broken by stylesheet EMISSION ORDER, and neither jsdom nor @vue/test-utils evaluates a stylesheet, so a mount would report the class list it was handed and prove nothing. That is exactly the case the marker exists to make visible to review. **The false rationale.** The docblock said vitest "runs `environment: 'node'` here with no mount harness". `environment: 'node'` is the DEFAULT only; a spec opts into jsdom per file and mounts, which 22 specs already do. Saying the harness does not exist is the claim #2918 was filed about, and repeating it in a new file is how the belief survives. The harness exists and is reachable — this spec stays at source level because a cascade is invisible to it, which is a different and true reason. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… target param The comment justified the `baselined` row by saying `agents` is absent from AGENT_TARGET_PARAMS, so a `none` row "would have passed the shape check and said something false". `agents` is in that set (`access.ts`), and `policyFor` THROWS on a `none` row whose parameters name an agent — the server refuses to boot. The row is right; its stated reason was the one thing about it that was wrong, and it understated why the row matters. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
merge-train —
|
# Conflicts: # docs/memory/learnings.md
vybe
left a comment
There was a problem hiding this comment.
merge-train: batch validated on train/20260921-1644 (#2939) — full suite green, regression diff 0 failures across all three seeds. Four mechanical fixes pushed to this branch and announced above (dev merge, the destructive default flipped to an allowlist across its three mirrors, the @source-text-pin that resolves the #2922 interaction, and two false 'no mount harness' rationales). Required checks green after the dev merge; the one stalled pytest seed was a hung xdist worker, and dev's own full suite at e4c225f (16775 passed, 0 failed, pgroup tests included) confirms the earlier pgroup red was the flake #2935 fixes. ent#454 needs status-in-dev by hand — 'Refs' is deliberate here.
Refs abilityai/trinity-enterprise#454 · epic abilityai/trinity-enterprise#122
Deploy had no inverse. Removing a manifest-deployed fleet meant
DELETE /api/agents/{name}once per member by hand — eleven times for the bundledvc-due-diligencemanifest — which is why the install UI warned "there is no un-deploy", why the bundled manifest's own header told operators to delete the fleet before re-deploying, and why the duplicate-deploy trap (_N-suffixed copies) had no recovery path.This is the public half of a two-repo change
ent#454 is a
type-featurein the enterprise tracker, so perCLAUDE.mdit is entitlement-gated by default and the verb itself lives in the private submodule. This PR carries only what belongs in this repo:trinity-enterprisesystem_teardownmodule (router + service + models)SYSTEM_VIEW_AUTO_DESCRIPTIONNeither submodule gitlink is bumped — verified on the remote after pushing (
git ls-tree origin/<branch> .claude src/backend/enterprisebyte-identical toorigin/dev), not withgit status, because this clone setsdiff.ignoresubmodules=alland a bump is invisible to bothstatusanddiffthere (the thing that ejected #2559 from the merge train). The enterprise gitlink moves after the private PR merges, as a separate step (the ent#279 precedent).The public half stands on its own on an OSS build: the MCP tool degrades on a 404 and the Vue panel renders nothing.
This PR merges FIRST.
trinity-enterprise's CI checks outAbilityai/trinityatref: dev, so the private module's 40 tests currently fail there withImportError: cannot import name 'system_membership'— they import the OSS primitive this PR adds. That is a structural property of the seam rather than a defect: a private module consuming a new OSS primitive cannot be CI-green before the OSS half is ondev. Nothing in this PR depends on the private one.The one interesting decision: refuse, don't degrade
system_member_names(#2373's ONE membership predicate) keeps its signature and becomes a thin wrapper; the body moves verbatim intosystem_membership, which additionally returns two facts the flat name list discarded:tags_readable— that body deliberately degrades to the raw name prefix when the tag read fails, and bug: post-deploy system endpoints — schedules silently dropped (nonexistent DB method), ungated restart, export round-trip breakage, prefix-collision membership #2373 argues the ranking at length: forrestart, over-capture restarts one extra container and logs it, while under-capture restarts a SUBSET and reports success. A verb that deletes inverts the cheap half — over-capture removes an innocent agent's container, and the metadata is recoverable but the container is gone. So teardown refuses (503, zero writes, zero audit) whererestartproceeds. Same data, different ranking, one predicate — the divergence is taken at the consumer's own call site, soget_system/restart_system/export_manifestkeep the behaviour they were designed around.evidence(tag|prefix|both) — why each name is a member, derived from the same two sets that already decided membership. The prefix fallback's documented residual (acmemay captureacme-extra-worker) becomes visible instead of silent, which is what lets the UI say "matched by name only" and take an operator's opt-out.Pinned as properties, because cases already failed here three times
#2373's fallback rule was wrong three times and each wrong rule passed the case test written for its predecessor (
learnings.md, 2026-08-31) — one of them returned 0 of 11 members for the flagship manifest, so a healthy fleet read as404 System not found. So the invariant is a Hypothesis property:members ⊇ raw prefix matchwhenever the tags are unreadable,tagged ⊆ memberswhenever they are readable, plus wrapper equivalence and evidence honesty over generated rosters. Any future narrowing fails by construction, whatever shape it narrows on. The named incidents stay as discrete cases — the fixture, not the ceiling.One counterexample Hypothesis found is kept as an honest asymmetry rather than papered over: an empty roster never reaches the tag read, so it reports
tags_readable: True. A destructive caller refuses onFalse, and refusing a teardown of a memberless system would be a 503 where 404 is the truth.SYSTEM_VIEW_AUTO_DESCRIPTIONNothing persists a system↔view link:
create_system_viewmarks the view it creates only by its description plus the system tag. That description is the identifier, so the literal moves into one constant shared by the writer and by any reader that has to find the view again.MCP — license-blind, and preview-first
teardown_systemproxies the gated route and knows nothing about entitlement. It never throws (a thrown error reaches an agent as an opaque transport failure it cannot reason about) and keeps three situations distinct: 404 (no such build) / 403 (not licensed, or an agent key on a human-only verb) / 503 (unverified membership, flagged retryable). Flattening them is how a human on a user key gets told a licensed feature "doesn't exist". Afailedreport arriving as a 500 comes back as a result — its per-member reasons are the only actionable output.It reads
ApiError.bodyrather than regexingApiError.message; that field exists for exactly this, and its own docstring says the regex is what breaks when the message format changes.dry_rundefaults totrue— the opposite ofdeploy_system. An unwanted preview costs a round trip; an unwanted execute costs a fleet.UI
Library → Systems gains a gated second panel: preview → per-agent checklist → acknowledgement → remove.
The preview is a checklist, which is the design rather than decoration: a
prefix-evidence member may belong to a sibling system, the server cannot tell which, so the badge plus the per-member box is the over-capture escape hatch. Which boxes arrive ticked is the load-bearing half — a confirmed member is ticked (opt-out), aprefixmember is unticked (opt-in), and the short selection is explained above the list. That default lives in the store (teardownDefaultSelection), not the panel's watcher, so a node-environment vitest can execute it; see the rendered-UI round below for why that matters. Remove is gated on four conditions — preview current for the typed name, membership verified, consequence acknowledged (ent#126'sack-checkboxcontract reused), ≥1 agent checked — and a disabled button says which is missing.Tone switches on
status, never the HTTP code.skipped/failed/abortedrender as three different things with per-reason copy, because a refusal is not a breakage and an un-attempted member is neither; adiscardedghost never claims recoverability. A timeout says "outcome unknown" and offers no retry — cancelling does not cancel the serial server-side removal.ManifestPreview's "there is no un-deploy" now tracks the capability. Retiring it everywhere because one edition gained the verb would have been the dishonest fix; it is still exactly true where the module is absent.Design contract: token-only (scanner: 0 non-gray, 0 hex across all six systems files), both themes, primitives only, bounded member viewport with a stated total, no bare loading gate — the in-flight flags reach only
BaseButton.AC 6, proven on a real stack:
acmevsacme-extraThe issue asks for a collision test pinning the #2373 predicate. Unit properties cover the
predicate; this covers the verb — real containers, really deleted, on a live stack
(isolated compose project on
:8100, branch @c73cf2875).Fixture — two systems, one name a prefix of the other:
"acme-extra-worker".startswith("acme-")is true, so a raw-prefix match claims it.Only its own tag excludes it. Both runs asked to remove every current member of
acmewith NO confirm list — nothing the harness did could spare the sibling, only the product could.
Run A — tag read genuinely broken (
ALTER TABLE agent_tags RENAME COLUMN tag TO …):GET /api/agents(reads tags, notry/except)membership_verifiedevidence: prefix— the over-capture is shown, not silentacme-extra-workerincludedRun B — tag read working:
membership_verified: trueacme-db+acme-web, bothevidence: bothacme-extra-workerstatus: torn_down; bothoutcome: deleted,recoverable: true(soft delete)acme-extra-workeraliveThat asymmetry is the design, not a flake: Docker-unreadable refuses on both paths; a
failed tag read renders a flagged preview and refuses only on execute. A preview that
cannot mutate anything is more useful showing you the over-capture than hiding it.
Three things that would have produced a false green, recorded because they nearly did:
docker/backend/Dockerfilenever COPYssrc/backend/enterprise, so the prod image isOSS-only and
verify-localgives zero coverage of the gated half. The proof stack mustuse the dev compose, whose
./src/backend:/appbind-mount is what puts the module in thecontainer. Entitlement needed no license —
EntitlementServiceis a Phase-0 stub, somounting is the grant.
ALTER TABLE agent_tags RENAME TO …self-heals: any probethat imports Trinity's
databaseruns schema init, andCREATE TABLE IF NOT EXISTSrecreates it empty (proven after the fact: old table 3 rows, new table 0). The run then
tests "system has no tags" — where
membership_verified: trueplus threeevidence: prefixmembers is the correct answer — while claiming to test a failed read. Rename a column;
never probe the system under test through a side channel that boots its own app context.
default-system.yamldeploys a system literally namedacme, so a fresh-DBproof stack must pin
TRINITY_DEFAULT_SYSTEM_MANIFEST=disabledor first-run seeding addsthree more members to the system under test.
Verification
Run, not read — every number below came from executing the command, and re-run after the
rebase onto
dev@eb41896f5.tests/unit/(/verify-local, py3.13)test_ent454_teardown_membership+test_ent454_teardown_frontend+test_2373_system_endpoints— 76 passedtest:unitdev's regenerated baselinestsc --noEmitclean; 383 passed / 0 failedcheck:tokenslint_root_test_placement/lint_sys_modulesverify-local--skip-agentis on the merits: zerodocker/**,startup.shorrequirements*.txtineither tree.
The verify stack layers on
docker-compose.prod.yml, which has no source mount — so it bootsan OSS-only edition. That is exactly the right primary check here: it proves the public
half does not require the submodule, the property this split depends on. It is also why the
real-stack proof above had to be run separately.
Teeth measured, not assumed. Eleven mutations, each killing ≥1 test against a clean control
(degrade-instead-of-refuse 3 · dry-run-falls-through 2 · stop-excluding-
is_system4 · dropreject_agent_principal1 ·require_role("admin")1 · auth-check-after-roster-read 2 ·ignore-confirmed-set 2 ·
agentspositional 3 · preview-POSTs-to-deploy 8 ·failed-as-error 1 ·gate removed 1).
One mutation survived the first pass and exposed a real gap: "the preview is bound to its
name" stayed green with the name comparison replaced by
true, because the setter nulls thepreview and the null-check carried the assertion alone. A test now uses the direct-assignment
bypass the comparison actually guards.
/reviewhas run — four defects, all fixed in this branchThe structural pass ran after the first push and found four real defects. Each is fixed,
tested, and committed here; the one that matters most is C1.
members, thenguarded "you named no removable member" with
confirmed & {m.name for m in members}— thevery set the strays had just joined. Dead for the all-stale case its own comment names: zero
attempts,
failedat 500, "Every attempt failed" in the UI, and an audit row for a teardownthat never began. The test beside it passed either way because it used
agents=[].agent_ownershiprow and nocontainer (bug: an agent whose container is gone becomes invisible, undeletable, and blocks its own name #1747 — routine after a Phase 1c recovery or a prune) was invisible to a verb that
reports completion. Now supplemented from ownership rows; unreadable Docker refuses
(503) instead of the old false
404 System not found. Safe only on the bug: Workspace roster lists agents with no container (DB-sourced roster vs Docker-as-truth) #2196 tri-state reader._find_auto_system_viewsused the admin-scopedlist_all_system_views(), disclosinganother user's private auto-view. Now filtered per caller.
reject_agent_principal+ connector: a two-item denylist over afree-text column that
scope='system'walks straight through (feature: first-class agent-scoped MCP keys — scope visibility, regeneration, and validation/enforcement of agent-key usage from agent containers #1854 already ruled on thisexact pair). Now an allowlist —
mcp_scope ∈ {None, "user"}, sentinel fails closed.The rendered-UI round — four more defects, found by clicking, not by CI
/reviewis a structural pass over the diff; it does not render. Nothing in CI renders thesecomponents either, and that is not an oversight to fix in passing —
vitest.config.jspinsenvironment: 'node'with zero component mounts,tests/unit/test_ent454_teardown_frontend.pyis source-level regex, and the green
e2erunssystem-install.spec.js, which never touchesteardown. So four defects survived a green board and a full
/review, and were found by drivinga live stack.
evidence— the one that matters. Anagent the server matched by NAME with no deploy tag arrived ticked, making the escape hatch
an opt-OUT on a verb that deletes. The 503 refusal does not cover it: that fires only when
the tag read FAILED, and a
prefixmember also appears in the healthy state — tags readfine, that one agent simply has no tag row — where
membership_verifiedis true and Remove isenabled. §3's own ranking argument is the reason: under-capture is cheaper than
over-capture for
restartand inverts for a verb that deletes, which is why teardownrefuses rather than degrades everywhere else. The default handed it back in the one state the
refusal misses. The rule moved to the store, where a node-environment test can execute it.
membership_verifiedistags_readable AND roster_complete— one boolean over two independentfaults — so on the roster arm the banner was simply false: tags readable, agent LIST
incomplete. It now states the consequence (identical either way) and quotes the server for the
cause. The roster warning used to fall through to "Notes", i.e. the real fault in a footnote
beneath a banner naming the other one.
(N tagged)was not a tag count.SystemTeardownTag.member_countislen(members)—every candidate, tagged or not — so the word overstated the tag whenever any member was
prefix, and in the refusal state it quoted a figure from the very read the banner saysfailed. Dropped; the total is already stated on the list.
fault that never clears — re-previewing returns the identical screen forever, training the
operator to read a real stop as flakiness.
A fifth, found by driving the real panel in a browser after the four above were fixed. The
preview watcher was not
immediate, and the store outlives the component:Library.vuemountsthe systems section lazily and nothing resets teardown state on unmount, so leaving the page and
returning remounts the panel onto a preview that is still current — the watcher never fires
for it, and the removal set rendered with every box empty and "Select at least one agent".
Pre-existing (the old all-members default had the same hole) and fail-safe in both directions,
which is why it survived; but it made the component's own stated default untrue on the second
visit. The store spec cannot see it — the rule is right, the wiring never ran.
Each guard was proven to bite by reverting the fix: the three copy/markup fixes → 5 red, the
banner-arm fix → 2 red, the remount fix → 1 red, the store rule → 4 of 5 red (the fifth is the
no-preview case, correctly insensitive).
Rendered and driven in a real browser, via a throwaway Vite+Playwright harness that mounts
the panel over a real pinia store — no backend, no stack. Measured there, not reasoned:
acme-dbisprefix)web=ON db=off worker=ONRemove 2 agentsprefix)Remove 0 agents, disabledRemove 0 agents, disabledRemove 2 agentsacme-db+ acknowledgeRemove 3 agents, enabledBoth themes screenshotted and read. Contrast measured on the two elements this round adds —
light 4.92 / 7.6, dark 10.99 / 9.7, all AA, and identical to their existing siblings, which
is the point: the recipe was matched, not reinvented. The harness is deliberately not
committed — a real render tier is the
ui-labeled e2e follow-up below, not something to smugglein here.
Three commits touch shared primitives — here is the scope reason
BaseButton.vueandBaseInput.vueare not this issue's files, so the blast radius is statedrather than assumed. Both were found through this panel and both are defects in the primitive,
not in the caller — fixing them at the call site would have left every other caller broken.
BaseButton:secondaryrendered borderless in light mode, across 24 call sites. The baseclass string carried
border-transparentbeside the reservedborderwidth whilesecondaryset
border-gray-300; equal specificity, so emission order decided and the resting keywordwon. It survived review because dark mode won by accident —
dark:border-gray-700compiles to
.dark .border-gray-700, one class heavier — so the theme most of us work in wascorrect. This is the
#2662cascade trap in the contract, and the fix is the shapefieldClasses.jsalready documents one primitive over: the base reserves the width, eachvariant names its colour. Guarded by
baseButtonVariantBorder.spec.js, which pins the basecolour-free, asserts both themes (the bug was theme-asymmetric, so a light-only pin would
let the next edit break dark while staying green), and fails closed on a fifth variant.
BaseInput::aria-describedbywas applied afterv-bind="controlAttrs", so a callerthat owned its own help text did not merely lose the merge — its
aria-describedbywaserased, and the help paragraph stopped being announced. Now handed back; error and help
still win in that order, so no existing caller changes.
Those three had never been through CI before this push. The
BaseButtonclaim is now measuredon a live render rather than taken on trust: the secondary control's resting border computes to
1px solid rgb(209,213,219)(gray-300) in light andrgb(55,65,81)(gray-700) in dark — visiblein both, which is exactly what the commit said and what it was not doing before.
One correction for the reader: the
BaseInputcommit message says "no@vue/test-utilsin thisproject". That was wrong — it is present at 2.5.1 and
tests/unit/portalThemeSwitch.spec.jsalready uses the
// @vitest-environment jsdomescape hatch. The a11y half is stillbrowser-verified rather than unit-pinned, so the conclusion stands; only the stated reason was.
Not claimed
not cover a partial failure mid-teardown (one member failing while others succeed) against real
containers — that path is unit-tested with an injected double, not proven live.
For the reviewer
Refs, notFixes: a cross-tracker closing keyword does not fire, sostatus-in-devonent#454 needs setting by hand, and the issue is closed manually at the release cut.
devfirst,and neither submodule pointer moves in it.
DELETE /api/systems/{name}; itships as
DELETE /api/enterprise/system-teardown/{name}?dry_run=<bool>, because all 15existing gated modules mount under
/api/enterprise/<module>with no exceptions, and anenterprise router on the OSS
/api/systemsprefix would be the first prefix split acrosseditions. Reverting is a one-line prefix change plus a route-order test — say the word.
Follow-ups to file (not this PR)
GET /api/systemsgroups by the last hyphen, not the bug: post-deploy system endpoints — schedules silently dropped (nonexistent DB method), ungated restart, export round-trip breakage, prefix-collision membership #2373 predicate —vc-due-diligence-dd-analyst→vc-due-diligence-dd, which the predicate resolves to[].The teardown UI deliberately never sources names from it. (bug, public)
delete_agent_endpoint's body intoservices/agent_service/lifecycle.py. Rightlong-term; wrong for this PR, which does not need the hottest destructive path in the
codebase moved. (refactor, public)
e2e/system-install.spec.jsrefuses to deploy for real "because there is no un-deploy". Onan entitled build that premise is now false. (test, public)
ui-labeled e2e that actually renders the teardown panel. Four defects reached a greenboard because three review layers all read this component's SOURCE and none mounted it; the
throwaway jsdom harness used in this round proves the shape works and was deliberately left
uncommitted rather than half-introducing a render tier. (test, public)
🤖 Generated with Claude Code