Skip to content
Open
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
3 changes: 2 additions & 1 deletion okf/src/reference_agent/viewer/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)

_INDEX_NAME = "index.md"
_LOG_NAME = "log.md"
_LINK_RE = re.compile(r"\]\(([^)\s]+\.md)(?:#[A-Za-z0-9_\-]*)?\)")
_TYPE_PALETTE = {
"BigQuery Dataset": "#8b5cf6",
Expand Down Expand Up @@ -89,7 +90,7 @@ def _extract_links(body: str, doc_dir: Path, bundle_root: Path) -> list[str]:
def _walk_concepts(bundle_root: Path) -> list[Concept]:
concepts: list[Concept] = []
for md_path in sorted(bundle_root.rglob("*.md")):
if md_path.name == _INDEX_NAME:
if md_path.name in {_INDEX_NAME, _LOG_NAME}:
continue
rel = md_path.relative_to(bundle_root).with_suffix("")
concept_id = "/".join(rel.parts)
Expand Down
4 changes: 3 additions & 1 deletion okf/tests/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def _make_bundle(root: Path) -> None:
COUNT(DISTINCT user_id) per day.
""",
)
# An auto-generated index that should NOT appear as a concept node.
# Reserved files that should NOT appear as concept nodes.
_write(root / "index.md", "# My Bundle\n- tables/users\n- tables/events\n")
_write(root / "log.md", "# Update history\n")


def _extract_bundle_data(html: str) -> dict:
Expand Down Expand Up @@ -113,6 +114,7 @@ def test_index_md_is_not_a_concept(tmp_path: Path):
data = _extract_bundle_data(out.read_text(encoding="utf-8"))
ids = {n["data"]["id"] for n in data["nodes"]}
assert "index" not in ids
assert "log" not in ids
assert ids == {
"datasets/my_dataset",
"tables/users",
Expand Down