Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions PROJECTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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.
119 changes: 100 additions & 19 deletions config/projects.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down Expand Up @@ -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"
]
}
},
Expand Down Expand Up @@ -250,8 +309,11 @@
"assistants": [
"galaxy-assistant"
],
"records": [
"broca-assistants"
"visualization": [
"galaxy-visualization"
],
"tests": [
"galaxy-tests"
]
}
},
Expand Down Expand Up @@ -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"
]
}
},
Expand Down Expand Up @@ -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"
}
}
1 change: 1 addition & 0 deletions scripts/organism_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ def _render_html(snapshot: dict) -> str:
<title>PyAutoScientist Dashboard</title><style>{t.css(BOARD_KEY)}{_EXTRA_CSS}</style></head>
<body>{t.hero(BOARD_KEY, "Dashboard")}{panel}
{projects_html}
<h2 id="dashboards-heading">Dashboards</h2>
<div id="dashboards" class="organ-grid" aria-label="Organ summaries">{''.join(rows)}</div>
<noscript><p>Publication snapshot. Open an organ for its latest evidence.</p></noscript>
<script type="application/json" id="scientist-snapshot">{data}</script>
Expand Down
61 changes: 50 additions & 11 deletions scripts/project_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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"}:
Expand All @@ -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")
Expand All @@ -136,18 +154,36 @@ 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", " ")

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)


Expand All @@ -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'<a href="{esc(link["url"], quote=True)}">{esc(link["label"])}</a>'
for link in resource["links"])
entries.append(f'<li data-resource="{esc(resource["id"])}"><span>{esc(resource["name"])}</span> — {links}</li>')
groups.append(f'<div class="summary-row"><dt>{esc(group["label"])}</dt><dd><ul>{"".join(entries)}</ul></dd></div>')
links = " · ".join(f'<a href="{esc(link["url"], quote=True)}">{esc(resource["name"] if i == 0 else link["label"])}</a>'
for i, link in enumerate(resource["links"]))
entries.append(f'<li data-resource="{esc(resource["id"])}">{links}</li>')
label = esc(group["label"])
if group["url"]:
label = f'<a href="{esc(group["url"], quote=True)}">{label}</a>'
groups.append(f'<div class="summary-row"><dt>{label}</dt><dd><ul>{"".join(entries)}</ul></dd></div>')
content = f'<dl>{"".join(groups)}</dl>' if groups else '<p>No public resources configured.</p>'
cards.append(f'''<details class="organ-card project-card" id="project-{esc(project['id'])}">
<summary><span>{esc(project['name'])}</span><span class="organ-status">{esc(KINDS[project['kind']])}</span></summary>
Expand Down
11 changes: 11 additions & 0 deletions tests/projects_browser.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
42 changes: 42 additions & 0 deletions tests/test_project_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<dt><a href="https://example.org/board/">Communication</a></dt>' in page
assert '<a href="https://github.com/OtherLab/renamed-code">Shared code</a>' 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 "<dt>Documentation</dt>" 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('<h2 id="projects-heading">Projects</h2>') < page.index('<h2 id="dashboards-heading">Dashboards</h2>') < page.index('id="dashboards"')
Loading