Skip to content

Build and display the org-wide msdmd repository map - #44

Merged
erinepshovel-code merged 15 commits into
mainfrom
agent/org-msdmd-map
Aug 16, 2026
Merged

erinepshovel-code merged 15 commits into
mainfrom
agent/org-msdmd-map

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Contributor

What

Makes the website the organization-scale collector and display consumer for repo-owned msdmd data.

Flow:

repo source -> <repo>_msdmd.ts -> website org collector -> generated org map -> /projects/map/

Repository authority does not transfer to the website.

Collector

  • records each public repo's exact default-branch head during the existing GitHub refresh;
  • fetches project manifests and msdmd collection bytes from raw GitHub at those exact SHAs, avoiding a second per-repo REST lookup;
  • parses generated or hand-authored defineMsdmdCollection(...) files without evaluating them;
  • namespaces declarations by repo;
  • resolves only exact local, explicit repo, or globally unique declaration targets;
  • retains every unresolved edge as hmmm rather than guessing;
  • records repo head, collection path, collection SHA-256, declared source commit, and drift status;
  • emits deterministic src/_data/generated/orgMsdmd.json plus last-known-good snapshot when online.

Display

  • publishes /projects/map/;
  • provides a deterministic SVG repository relation map as progressive enhancement;
  • preserves complete static repository cards, cross-repo relation table, unresolved-edge list, and provenance receipts without JavaScript;
  • publishes the exact generated JSON at /assets/data/org-msdmd.json;
  • links the existing Projects index to the map.

Usage / limits

npm run refresh:data now runs refresh:github before refresh:msdmd. The repo-head lookup happens once in refresh:github; msdmd collection bodies use commit-pinned raw GitHub, so the feature does not double the REST request count.

Validation

Added tests/org-msdmd.test.mjs covering:

  • generated and hand-authored collection parsing without evaluation;
  • exact cross-repo resolution;
  • unresolved-edge preservation;
  • missing collection visibility;
  • deterministic repeated output;
  • source-commit drift visibility.

The repository's existing PR workflow runs the full npm run check plus Playwright browser/accessibility checks with GITHUB_TOKEN supplied.

hmmm

The website's checked-in root _msdmd.ts collection point predates this branch. The new source modules carry their own MODULE_BUILD/BOUNDARIES/CONTRACTS blocks, so its next canonical collection refresh will surface this collector and renderer; until then the org map will correctly expose any collection/source-head mismatch rather than silently treating the website's collection as current.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5b148dd0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +505 to +507
const repoData = JSON.parse(await readFile(GENERATED_REPOS, 'utf8'));
const inputs = await fetchRepositoryInputs(repoData.repositories || []);
const data = buildOrgMap(inputs);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the map when repository metadata is a fallback

When refresh:github falls back during a GitHub API outage or rate-limit event, repoData.fallback is true and the checked-in repos.last-known-good.json has no head_sha fields. Passing those repositories into this collector therefore marks every collection missing, after which the result is written as a successful map and last-known-good snapshot. The Pages workflow can consequently publish a zero-collection map during a transient upstream failure instead of preserving the previous map; detect the upstream fallback and use the organization-map fallback rather than rebuilding from headless entries.

Useful? React with 👍 / 👎.

Comment on lines +495 to +496
if (process.env.OFFLINE === '1') {
const fallback = JSON.parse(await readFile(SNAPSHOT_OUT, 'utf8'));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Seed the snapshot before enabling offline refreshes

On a clean checkout, OFFLINE=1 npm run refresh:data now always fails here because this commit does not add src/_data/snapshots/org-msdmd.last-known-good.json. The new refresh:msdmd step reaches this unconditional read before generating any map, producing ENOENT and aborting the offline build; commit a seed snapshot or provide a fallback that can be constructed from checked-in data.

Useful? React with 👍 / 👎.

Comment thread scripts/fetch-org-msdmd.mjs Outdated
Comment on lines +328 to +329
if (collection.repo && collection.repo !== item.name) {
hmmm.push(`Collection declares repo=${collection.repo}; consumed repository is ${item.name}.`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize declared repository identities before comparison

For generated collections that use the existing organization-qualified identity format—such as repo: "The-Interdependency/The-Interdependency.github.io" in The-Interdependency.github.io_msdmd.tsitem.name contains only the GitHub repository name. This comparison therefore reports a source-identity mismatch for a valid collection and pollutes its provenance evidence; compare against ${ORGANIZATION}/${item.name} or normalize both accepted forms first.

Useful? React with 👍 / 👎.

Comment on lines +478 to +480
} catch (error) {
const stderr = String(error?.stderr || '');
const status = /404|not found/i.test(stderr) ? 'missing' : 'invalid';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Distinguish download failures from invalid collections

When a commit-pinned raw download fails because of DNS, timeout, TLS, or a transient raw.githubusercontent.com outage, its stderr does not contain 404, so this branch labels the repository collection invalid. The collector then publishes the degraded map and overwrites the last-known-good snapshot instead of activating fallback, potentially turning a temporary network failure into missing production evidence; reserve invalid for bytes that were successfully downloaded but could not be parsed, and propagate transport failures to the snapshot fallback.

Useful? React with 👍 / 👎.

hmmm.push('Collection-declared source_commit does not match the repository head consumed by this website build.');
}

for (const declaration of collection.declarations || []) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate collection arrays before iterating them

If a syntactically valid remote collection contains a non-array declarations value, such as {}, parsing succeeds and the collection is marked ok, but this loop throws TypeError: object is not iterable. That aborts aggregation for every repository and invokes the global fallback rather than retaining this repository as explicit invalid evidence; validate declarations and gaps with Array.isArray as is already done for edges, and mark only the offending collection invalid.

Useful? React with 👍 / 👎.

Comment on lines +77 to +78
} catch {
return { sha: null, committed_at: null };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not treat head lookup errors as absent heads

If the organization repository listing succeeds but an individual commits API request transiently fails, this catch converts the error to a normal null head while leaving the overall snapshot in non-fallback mode. The refresh then skips that repository's reviewed manifest, marks its msdmd collection missing, and overwrites both last-known-good snapshots with the degraded data; distinguish a genuinely headless repository from an API failure and preserve the prior entry or fail into fallback for the latter.

Useful? React with 👍 / 👎.

@erinepshovel-code
erinepshovel-code merged commit 1c863d9 into main Aug 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant