Hidden plans #44
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plans used by agent for machine control have to be hidden from users, just shown the exectuions for example like http://192.168.31.41:5173/plans/machine-control
Claimed — branch
issue/44-hidden-plans. Doing: hide the shared system plans (machine-control,evidence-gather,agent-test) from the dashboard plans list and rule plan-pickers for non-instance-operators, keep/plans/{id}detail and its executions reachable by not filtering$plans.Issue #44 — Hidden plans
Restated goal
Plans the agent uses for its own machine control — the shared system plans
(
machine-control,evidence-gather,agent-test,middleware/src/types.tsSYSTEM_PLAN_IDS) — must stop appearing to users as plans. The operator stillwants to reach their executions, which is what the example URL
/plans/machine-controlshows (Recent executions tab)."Done" for the operator: a normal org user opening
/planssees only their ownplans and the copy-and-edit templates — no
machine-control/evidence-gather/agent-testrows, and no plan-picker entry that lets a rule be aimed at them —while
/plans/machine-control(and the execution detail pages) still resolve.An instance operator (
user.instanceOperator) still sees everything, becauseUC-MW-142makes the shared plans instance-operator-visible.Scope
Change (frontend presentation layer only):
dashboard/src/routes/plans/+page.svelte— derive the list from$plansminus system plans when the viewer is not an instance operator; use the
filtered list for rows, counts, search, and
listSelectionAfterLoad'sknownIds. Per-row selection and the whole detail pane are unchanged.dashboard/src/lib/types.ts— add theSYSTEM_PLAN_IDS/isSystemPlan()mirror ofmiddleware/src/types.ts(constants only; nointerface change, so
check-type-mirror.pyis unaffected).dashboard/src/lib/components/RuleFormFields.svelte+ its two callers — feedthe plan picker the same filtered list, so a rule cannot be aimed at
machine-control(a user has no reason to match an alert to the agent'sinternal control plan). Callers:
dashboard/src/routes/plans/rules/+page.svelte,dashboard/src/routes/plans/rules/new/+page.svelte.docs/use-cases/frontend/UC-FE-97-hidden-system-plans.md— new UC (highestfrontend id is 96).
dashboard/src/lib/usecases-frontend.test.ts—describe('UC-FE-97 …').Will not touch:
middleware/**—GET /planskeeps returning system plans.UC-MW-142andmiddleware/src/access.tscanRead()make shared plans readable by everyoneand are covered by existing tests (
uc-mw-142-ownership.test.ts,uc-mw-tenancy-isolation.test.tsassert a member can read/plans/machine-controland/plans/evidence-gather). A middleware filterwould break those contracts and hide the plans from the instance operator too.
dashboard/src/lib/api-cache.ts—$plansstays complete. The detail route/plans/[id]and/plans/executions/[id]look the plan up in$plans; acache-level filter would break exactly the URL in the issue.
dashboard/src/routes/plans/[id]/+page.svelteand the executions pages — theexecutions surface the operator asked for already exists (Recent executions
tab +
/plans/executions/{id}) and needs no change.plans/(product content), any DB schema, any middleware type shape, anydependency.
UC decision
New UC:
UC-FE-97— "System plans stay out of the plan list"(
docs/use-cases/frontend/UC-FE-97-hidden-system-plans.md, copied from_TEMPLATE.md).Implementation:dashboard/src/routes/plans/+page.svelte(real page, notmiddleware/src/app.ts), plusdashboard/src/lib/types.ts isSystemPlan.Tests:dashboard/src/lib/usecases-frontend.test.ts(file text will mentionUC-FE-97).related:UC-FE-39(plan row opens detail),UC-MW-142(shared-planreadability) — both get the back-link added, which is required by
_check.py's bidirectional rule, so those two files are edited too(front-matter
related:and the Related heading only;UC-FE-39andUC-MW-142Stories are unaffected by this change).Existing UCs affected in behaviour, not rewritten:
UC-FE-39(list contents),UC-FE-41(detail page — explicitly unchanged),UC-MW-142(readability stays).UC-FE-97will state the list-level rule;UC-FE-39keeps owning the layout.Ordered tasks
python3 $FJ comment 44 --file …/issue-44.plan.mdexits 0SYSTEM_PLAN_IDS/isSystemPlantodashboard/src/lib/types.ts.cd dashboard && bun run checkdashboard/src/routes/plans/+page.svelte(rows, counts,knownIds); update theLastheader field.cd dashboard && bun run checkRuleFormFields.svelte+ 2 callers; updateLast.cd dashboard && bun run checkUC-FE-97UC file; add back-links inUC-FE-39andUC-MW-142.python3 docs/use-cases/_check.pydescribe('UC-FE-97 …')todashboard/src/lib/usecases-frontend.test.ts.cd dashboard && bun run testCommit after each of tasks 2–6 (
dashboard: …,docs: …,Refs #44).Open questions (assumption taken)
Rationale: the issue says "hidden from users", not "removed";
UC-MW-142deliberately makes shared plans readable by everyone, and the middleware has
no concept of "hidden". Rejected alternative: filter in
middleware/src/routes/plans.tsGET /plans— that contradictsuc-mw-142-ownership.test.ts/uc-mw-tenancy-isolation.test.tsanduc-mw-165-template-library.test.ts, and would also hide them from theinstance operator, who is the one who needs them.
the instance and needs
machine-controlto tune it;UC-MW-142grants themthe read. Instance-operator is
page.data.user.instanceOperator.issue links it as the place where executions show. Making the dashboard filter
$plansat the cache layer would break it; that is why the filter lives inthe page derivation.
disk-cleanupetc.) also be hidden? Assumption:no. They are the documented copy-and-edit library (
UC-MW-165,docs/templates.md) and are meant to be seen.an alert to
agent-testis not a supported workflow; hiding the option is theminimal consistent rule. Rejected: validate/refuse server-side — that is a
middleware behaviour change with its own UC and is not what the issue asks.
can read a system plan already could before this change
(
UC-MW-142); this is a presentation change, not an access-control change.Risk
bun run check(svelte-check) red if the+page.svelteedit is malformed —fallback: revert the page edit, keep the
types.tshelper + UC, reportPARTIAL.usecases-frontend.test.tsUC-FE-39block asserts the page source containslistSelectionAfterLoad,Search plans...,maxChars={28},Open plan,api.plans.health,EMPTY_COPY.plans,Recent executions,Open incidentsand not
DataTable. The edit must keep all of those strings.UC-MW-19 plan survives a second buildApp on the same dbis a knownpre-existing red in the middleware suite; not chased.
related:links is the one edit that can trip_check.py(bidirectionalrule); fix forward, do not weaken the checker.
+page.sveltefilter alone (tasks 2/3/5/6), drop the picker filter, report it.
REVIEW: FIXED 2 — findings: stray
<<<<<<< HEADconflict marker committed in dashboard/src/lib/usecases-frontend.test.ts:1487 broke the suite parse (fixed5442e17); hidden-plans code comments still cited UC-FE-97 after the renumber to UC-FE-98 (fixed865a38b); RuleFormFields.svelte listed in plan Scope but filter applied at both callers instead — equivalent, only two render sites (accepted); dashboard/src/lib/plans.ts touched though not in plan Scope — browsablePlans helper (accepted); UNFIXED: issue-44.report.md never written by implementer (session ended early, no claims to verify)DONE — branch issue/44-hidden-plans, 7 commits, PR #56 opened against agent-develop (the run never merges): #56
System plans (machine-control, evidence-gather, agent-test) are hidden from the /plans list and rule plan-pickers for non-instance-operators via a browsablePlans() helper; /plans/machine-control detail and its executions stay reachable (plan list filter only, $plans cache untouched). Instance operators still see everything (UC-MW-142).
Recovery note: the prior run died after pushing but before opening the PR; this run finished the step. PR #55 (plan download) merged into agent-develop in between and took UC-FE-97, so the branch was rebased (force-with-lease) and the UC renumbered to UC-FE-98; the renumber had clobbered UC-FE-97 plan-download links in UC-FE-41, restored in
09719d3.Independent review (9router/reviewer, fresh session): REVIEW: FIXED 2 — stray conflict marker in usecases-frontend.test.ts (
5442e17), stale UC-FE-97 citations retitled to UC-FE-98 (865a38b); report file absence noted (implementer session ended early).Gates on final head: UC catalog 0 (frontend 95), ai-headers 0 (571), type-mirror 0, dashboard bun run test 246 pass / 16 files, bun run check 0 errors (7 pre-existing warnings), hidden test UC-OP-02 pass, rg 'Showing lines' clean outside rule text. Middleware and agent untouched.
Refs #44