diff --git a/etc/evergreen_yml_components/tasks/misc_tasks.yml b/etc/evergreen_yml_components/tasks/misc_tasks.yml index 87c79e2513c..7872a9add30 100644 --- a/etc/evergreen_yml_components/tasks/misc_tasks.yml +++ b/etc/evergreen_yml_components/tasks/misc_tasks.yml @@ -1110,6 +1110,16 @@ tasks: - "./src/evergreen/run_python_script_with_report.sh" - "validate-module-calls" - "modules_poc/merge_decls.py" + - command: subprocess.exec + type: test + params: + binary: bash + args: + - "./src/evergreen/run_python_script_with_report.sh" + - "ensure-browser-can-parse-output" + - "modules_poc/browse.py" + - "merged_decls.json" + - "--parse-only" - name: bazel_coverage tags: ["assigned_to_jira_team_devprod_correctness", "auxiliary"] diff --git a/modules_poc/browse.py b/modules_poc/browse.py index bbef7b9025b..b0beecc4277 100755 --- a/modules_poc/browse.py +++ b/modules_poc/browse.py @@ -49,7 +49,7 @@ class LocAndContext(NamedTuple): @classmethod def parse(cls, usage: str): - loc, ctx = usage.split("\t") + loc, _, ctx = usage.partition(" ") return cls(Loc.parse(loc), sys.intern(ctx)) @@ -224,11 +224,11 @@ def add_mod_loc_mapping_nodes(node: TreeNode, usages: Usages, kind: str, expand= continue # Currently only STATIC_ASSERT doesn't have a name. - [kind, *name] = loc.ctx.split(" ", 1) + kind, _, name = loc.ctx.partition(" ") mod_node.add_leaf( Text.assemble( fancy_kind(kind), - Text(" " + name[0], style="bold bright_white") if name else "", + Text(" " + name, style="bold bright_white") if name else "", f" {loc.loc}", ), loc.loc, @@ -516,6 +516,9 @@ for d in raw_decls: for mod, locs in d["other_mods"].items(): locs.sort() d["other_mods"][mod] = [Loc.parse(loc) for loc in locs] + # For now these aren't used in the browser + del d["vis_from"] + del d["vis_from_non_ns"] decls = sorted((Decl(**d) for d in raw_decls), key=lambda d: d.loc) del raw_decls @@ -565,7 +568,7 @@ for f in files.values(): files = {k: v for k, v in sorted(files.items(), key=lambda kv: kv[1].unknown_count, reverse=True)} modules = {d.mod for d in decls} -if __name__ == "__main__": +if __name__ == "__main__" and "--parse-only" not in sys.argv: app = ModularityApp() app.run() diff --git a/modules_poc/mod_scanner.py b/modules_poc/mod_scanner.py index 397d330c5bf..390ac090b0d 100755 --- a/modules_poc/mod_scanner.py +++ b/modules_poc/mod_scanner.py @@ -784,7 +784,7 @@ def find_usages(mod: str, c: Cursor, context: DecoratedCursor | None): # if this fails, something is missing in context_kinds or namespace_scope_context_kinds assert context - usage = f"{pretty_location(c.location)}\t{context.string_for_context}" + usage = f"{pretty_location(c.location)} {context.string_for_context}" d.used_from.setdefault(mod, set()).add(usage) diff --git a/modules_poc/util.jq b/modules_poc/util.jq index 9a081b31c6a..87b3ae52361 100644 --- a/modules_poc/util.jq +++ b/modules_poc/util.jq @@ -11,7 +11,14 @@ def _group_by_vis_map(vis_from): group_by(.mod) | map({ mod: .[0].mod, - locs: [.[].locs[]] | map(split("\t") | .[1]) | unique, + locs: [ + .[].locs[] | + split(" ") | + if length == 3 + then "\(.[1]) \(.[2])" # CXX_METHOD Foo::bar + else "\(.[1]) \(.[0])" # STATIC_ASSERT src/mongo/foo.cpp:123:45 + end + ] | unique, }), });