diff --git a/PROJECTS.md b/PROJECTS.md index bba91e3..083905f 100644 --- a/PROJECTS.md +++ b/PROJECTS.md @@ -18,7 +18,7 @@ package dependency lockfile and not inferred from naming prefixes. Each project has `name`, `kind` (`software_family` or `scientific_project`), optional `description`, `public`, and a `resources` object. Its optional lists are `software`, `dependencies`, `workspaces`, `tutorials`, `documentation`, -`assistants` and `records`. Each list contains resource IDs, in display order. +`assistants`, `profiling`, `inference`, `visualization`, `tests` and `records`. Each list contains resource IDs, in display order. An assistant is never required. An empty project catalogue is supported. Each resource has `name`, `public`, and one or both of: @@ -81,8 +81,8 @@ upkeep evidence, with documentation, tutorials, user-facing workspaces and assistants as first-class surfaces. Its current published implementation still covers assistant evidence; the broader contract and evidence migration are separate Mind tasks. These IDs/categories provide a coordination point, not a -new Broca evidence schema or copied ledger. A shared Broca inventory link does -not imply a project-specific assessment. +new Broca evidence schema or copied ledger. Links to Broca route communication resources to its dashboard; they do not +imply a project-specific assessment or implemented evidence coverage. Ears retains listening and feedback collection; Brain interprets and routes; Mind tracks implementation; Memory holds knowledge and citations; Cortex owns @@ -109,3 +109,23 @@ instance. Starter packaging, configurable capability locations, optional-organ activation and record-preserving upgrades are recorded follow-ups. No collaborator project or access is assumed. Shared multi-contributor operation is a later milestone. + +## Dashboard routing + +An optional top-level `routes` object maps relationship names to resource IDs +for the relevant dashboards. Each target must have a `published_url`. For example, +`"profiling": "pulse-dashboard"` routes profiling resources to a dashboard resource +named Pulse. Identity and URLs stay in instance configuration, not framework logic. + +Cards combine relationships routed to the same public dashboard into one row: the +organ name links to its dashboard and each resource name links to its source (with +a separate Published link when configured). The snapshot retains each typed +relationship for reuse. Broca groups docs, tutorials, workspaces and assistants; +Pulse profiling; Insight inference; Eyes visualization; Heart test workspaces. +These links convey responsibility, never a health or quality verdict. + +Without a route, or when its dashboard is not explicitly public, resources retain +their ordinary category row. No private dashboard name or URL enters the snapshot. +Old schema-version-1 configurations continue to work without `routes`; generic +`records` remains supported for existing instances, but this instance no longer +uses the generic Organ records row or the shared assistant evidence inventory. diff --git a/config/projects.json b/config/projects.json index c1d5983..0b04cf2 100644 --- a/config/projects.json +++ b/config/projects.json @@ -154,13 +154,6 @@ "public": true, "repo": "PyAutoNerves" }, - "broca-assistants": { - "name": "Broca assistant evidence (shared inventory)", - "public": true, - "repo": "PyAutoBroca", - "path": "assistants.json", - "published_url": "https://pyautolabs.github.io/PyAutoBroca/" - }, "array-docs": { "name": "PyAutoArray documentation source", "repo": "PyAutoArray", @@ -172,6 +165,66 @@ "repo": "PyAutoReduce", "path": "README.md", "public": true + }, + "broca-dashboard": { + "name": "Broca", + "repo": "PyAutoBroca", + "published_url": "https://pyautolabs.github.io/PyAutoBroca/", + "public": true + }, + "pulse-dashboard": { + "name": "Pulse", + "repo": "PyAutoPulse", + "published_url": "https://pyautolabs.github.io/PyAutoPulse/", + "public": true + }, + "insight-dashboard": { + "name": "Insight", + "repo": "PyAutoInsight", + "published_url": "https://pyautolabs.github.io/PyAutoInsight/", + "public": true + }, + "eyes-dashboard": { + "name": "Eyes", + "repo": "PyAutoEyes", + "published_url": "https://pyautolabs.github.io/PyAutoEyes/", + "public": true + }, + "heart-dashboard": { + "name": "Heart", + "repo": "PyAutoHeart", + "published_url": "https://pyautolabs.github.io/PyAutoHeart/", + "public": true + }, + "fit-tests": { + "name": "autofit_workspace_test", + "repo": "autofit_workspace_test", + "public": true + }, + "galaxy-visualization": { + "name": "autogalaxy_visualization", + "repo": "autogalaxy_visualization", + "public": true + }, + "galaxy-tests": { + "name": "autogalaxy_workspace_test", + "repo": "autogalaxy_workspace_test", + "public": true + }, + "lens-tests": { + "name": "autolens_workspace_test", + "repo": "autolens_workspace_test", + "public": true + }, + "cti-visualization": { + "name": "autocti_visualization", + "repo": "autocti_visualization", + "public": true + }, + "cti-tests": { + "name": "autocti_workspace_test", + "repo": "autocti_workspace_test", + "public": true } }, "projects": { @@ -199,11 +252,17 @@ "assistants": [ "fit-assistant" ], - "records": [ - "broca-assistants", - "fit-profiling", - "fit-inference", + "profiling": [ + "fit-profiling" + ], + "inference": [ + "fit-inference" + ], + "visualization": [ "fit-visualization" + ], + "tests": [ + "fit-tests" ] } }, @@ -250,8 +309,11 @@ "assistants": [ "galaxy-assistant" ], - "records": [ - "broca-assistants" + "visualization": [ + "galaxy-visualization" + ], + "tests": [ + "galaxy-tests" ] } }, @@ -282,11 +344,17 @@ "assistants": [ "lens-assistant" ], - "records": [ - "broca-assistants", - "lens-profiling", - "lens-inference", + "profiling": [ + "lens-profiling" + ], + "inference": [ + "lens-inference" + ], + "visualization": [ "lens-visualization" + ], + "tests": [ + "lens-tests" ] } }, @@ -330,10 +398,23 @@ "assistants": [ "cti-assistant" ], - "records": [ - "broca-assistants" + "visualization": [ + "cti-visualization" + ], + "tests": [ + "cti-tests" ] } } + }, + "routes": { + "workspaces": "broca-dashboard", + "documentation": "broca-dashboard", + "tutorials": "broca-dashboard", + "assistants": "broca-dashboard", + "profiling": "pulse-dashboard", + "inference": "insight-dashboard", + "visualization": "eyes-dashboard", + "tests": "heart-dashboard" } } diff --git a/scripts/organism_board.py b/scripts/organism_board.py index b9f7d9e..5406d96 100644 --- a/scripts/organism_board.py +++ b/scripts/organism_board.py @@ -283,6 +283,7 @@ def _render_html(snapshot: dict) -> str: PyAutoScientist Dashboard {t.hero(BOARD_KEY, "Dashboard")}{panel} {projects_html} +

Dashboards

{''.join(rows)}
diff --git a/scripts/project_resources.py b/scripts/project_resources.py index b5eff71..162b2d5 100644 --- a/scripts/project_resources.py +++ b/scripts/project_resources.py @@ -22,6 +22,10 @@ "tutorials": "Tutorials", "documentation": "Documentation", "assistants": "Assistants", + "profiling": "Profiling", + "inference": "Inference", + "visualization": "Visualization", + "tests": "Workspace tests", "records": "Organ records", } KINDS = {"software_family": "Software family", "scientific_project": "Scientific investigation"} @@ -59,7 +63,7 @@ def resolve(config: dict, body_map: dict) -> dict: """Resolve explicit relationships without inferring projects from repo names.""" if not isinstance(config, dict) or type(config.get("schema_version")) is not int or config["schema_version"] != 1: raise ValueError("unsupported project configuration schema_version") - if set(config) - {"schema_version", "resources", "projects"}: + if set(config) - {"schema_version", "resources", "projects", "routes"}: raise ValueError("unknown project configuration field") repos = body_map.get("repos") if isinstance(body_map, dict) else None if not isinstance(repos, dict): @@ -102,6 +106,15 @@ def resolve(config: dict, body_map: dict) -> dict: raise ValueError(f"resource {key}: repo or published_url required") resolved[key] = {"id": key, "name": item["name"], "links": links} + routes = config.get("routes", {}) + if not isinstance(routes, dict) or set(routes) - RELATIONS.keys(): + raise ValueError("routes must map known relationships to dashboard resource IDs") + for relation, key in routes.items(): + if not isinstance(key, str) or key not in resources: + raise ValueError(f"route {relation}: unknown dashboard resource") + if "published_url" not in resources[key]: + raise ValueError(f"route {relation}: dashboard requires published_url") + public_projects = [] for key, item in projects.items(): if set(item) - {"name", "public", "kind", "description", "resources"}: @@ -121,7 +134,12 @@ def resolve(config: dict, body_map: dict) -> dict: raise ValueError(f"project {key}: unknown resource reference") visible = [resolved[i] for i in ids if resources[i].get("public") is True] if visible: - groups.append({"relation": relation, "label": label, "resources": visible}) + group = {"relation": relation, "label": label, "resources": visible} + dashboard = routes.get(relation) + if dashboard and resources[dashboard].get("public") is True: + group["dashboard"] = {"id": dashboard, "name": resources[dashboard]["name"], + "url": resources[dashboard]["published_url"]} + groups.append(group) description = item.get("description", "") if not isinstance(description, str): raise ValueError(f"project {key}: description must be text") @@ -136,6 +154,21 @@ def load(config_path: Path, repos_path: Path) -> dict: yaml.safe_load(repos_path.read_text(encoding="utf-8"))) +def display_groups(project: dict) -> list[dict]: + """Combine rows sharing a dashboard; keep typed relationships in the snapshot.""" + groups = {} + for group in project["groups"]: + dashboard = group.get("dashboard") + key = ("dashboard", dashboard["id"]) if dashboard else ("relation", group["relation"]) + if key not in groups: + groups[key] = {"label": dashboard["name"] if dashboard else group["label"], + "url": dashboard["url"] if dashboard else None, "resources": []} + row = groups[key] + seen = {r["id"] for r in row["resources"]} + row["resources"].extend(r for r in group["resources"] if r["id"] not in seen) + return list(groups.values()) + + def render_markdown(snapshot: dict) -> str: def text(value): return re.sub(r"([\\\[\]*_`#|])", r"\\\1", html.escape(value)).replace("\n", " ") @@ -143,11 +176,14 @@ def text(value): lines = ["## Projects", "", "Connected resources; inventory is not a quality or readiness verdict."] for project in snapshot.get("projects", []): lines.extend(["", "### " + text(project["name"]), "", text(project["description"])]) - for group in project["groups"]: + for group in display_groups(project): + label = text(group["label"]) + if group["url"]: + label = f"[{label}]({quote(group['url'], safe='/:?=&%+#@~;,-_')})" for resource in group["resources"]: - links = " · ".join(f"[{text(link['label'])}]({quote(link['url'], safe='/:?=&%+#@~;,-_')})" - for link in resource["links"]) - lines.append(f"- {text(group['label'])}: {text(resource['name'])} — {links}") + links = " · ".join(f"[{text(resource['name'] if i == 0 else link['label'])}]({quote(link['url'], safe='/:?=&%+#@~;,-_')})" + for i, link in enumerate(resource["links"])) + lines.append(f"- {label}: {links}") return "\n".join(lines) @@ -156,13 +192,16 @@ def render_html(snapshot: dict) -> str: cards = [] for project in snapshot.get("projects", []): groups = [] - for group in project["groups"]: + for group in display_groups(project): entries = [] for resource in group["resources"]: - links = " · ".join(f'{esc(link["label"])}' - for link in resource["links"]) - entries.append(f'
  • {esc(resource["name"])} — {links}
  • ') - groups.append(f'
    {esc(group["label"])}
    ') + links = " · ".join(f'{esc(resource["name"] if i == 0 else link["label"])}' + for i, link in enumerate(resource["links"])) + entries.append(f'
  • {links}
  • ') + label = esc(group["label"]) + if group["url"]: + label = f'{label}' + groups.append(f'
    {label}
    ') content = f'
    {"".join(groups)}
    ' if groups else '

    No public resources configured.

    ' cards.append(f'''
    {esc(project['name'])}{esc(KINDS[project['kind']])} diff --git a/tests/projects_browser.cjs b/tests/projects_browser.cjs index 7f0be86..b28defa 100644 --- a/tests/projects_browser.cjs +++ b/tests/projects_browser.cjs @@ -23,6 +23,17 @@ const assert = require('node:assert/strict'); await page.goto(destination); await page.waitForFunction(() => !refreshing); assert.equal(await page.locator('.project-card').count(), 6); + assert(await page.locator('#projects-heading').isVisible()); + assert(await page.locator('#dashboards-heading').isVisible()); + assert.equal(await page.locator('#dashboards details').first().getAttribute('id'), 'board-brain'); + for (const [name, resource] of [['Pulse', 'lens-profiling'], ['Insight', 'lens-inference'], + ['Eyes', 'lens-visualization'], ['Heart', 'lens-tests'], + ['Broca', 'lens-workspace']]) { + const row = page.locator('#project-lens .summary-row').filter({ has: page.locator(`[data-resource="${resource}"]`) }); + assert.equal(await row.locator('dt a').textContent(), name); + assert((await row.locator('dt a').getAttribute('href')).endsWith(`/PyAuto${name}/`)); + } + assert.equal(await page.locator('[data-resource="broca-assistants"]').count(), 0); assert.equal(await page.locator('.project-card[open]').count(), 0); const summary = page.locator('#project-lens > summary'); await summary.focus(); diff --git a/tests/test_project_resources.py b/tests/test_project_resources.py index e3eedd0..e669b9d 100644 --- a/tests/test_project_resources.py +++ b/tests/test_project_resources.py @@ -124,3 +124,45 @@ def test_board_integration_and_offline_cli(inputs, tmp_path, monkeypatch, capsys assert html.index('data-orchestration-panel') < html.index('id="projects"') < html.index('id="dashboards"') assert "Alpha" in ob.render(snapshot, "md") assert "Secret records" not in ob.render(snapshot, "json") + + +def test_routes_combine_display_rows_without_losing_typed_relationships(inputs): + config, body_map = inputs + config["resources"]["communication"] = { + "name": "Communication", "public": True, "published_url": "https://example.org/board/"} + config["routes"] = {"documentation": "communication", "workspaces": "communication"} + config["projects"]["alpha"]["resources"]["workspaces"] = ["library"] + snapshot = pr.resolve(config, body_map) + groups = snapshot["projects"][0]["groups"] + assert {g["relation"] for g in groups} == {"software", "workspaces", "documentation"} + rows = pr.display_groups(snapshot["projects"][0]) + assert [r["label"] for r in rows] == ["Software", "Communication"] + assert [r["id"] for r in rows[1]["resources"]] == ["library", "docs"] + page = pr.render_html(snapshot) + assert '
    Communication
    ' in page + assert 'Shared code' in page + assert '[Communication](https://example.org/board/)' in pr.render_markdown(snapshot) + + +def test_private_dashboard_falls_back_without_leaking_metadata(inputs): + config, body_map = inputs + config["resources"]["private"]["published_url"] = "https://private.example.org/" + config["routes"] = {"documentation": "private"} + snapshot = pr.resolve(config, body_map) + assert "dashboard" not in snapshot["projects"][0]["groups"][1] + assert "private.example.org" not in json.dumps(snapshot) + assert "
    Documentation
    " in pr.render_html(snapshot) + + +@pytest.mark.parametrize("routes", [[], {"typo": "docs"}, {"profiling": "missing"}, + {"profiling": []}, {"tests": "library"}]) +def test_bad_routes_are_rejected(inputs, routes): + inputs[0]["routes"] = routes + with pytest.raises(ValueError): + pr.resolve(*inputs) + + +def test_dashboard_headings_remain_visible_and_separate(inputs): + snapshot = {"owner": "Example", "boards": [], "project_resources": pr.resolve(*inputs)} + page = ob.render(snapshot, "html") + assert page.index('

    Projects

    ') < page.index('

    Dashboards

    ') < page.index('id="dashboards"')