Skip to content

[quality] Unit suite is red on main: #334 added sourceUrl/id/asset rules without updating tests/validate-architectures.test.mjs #397

Description

@hivecommons-hive

Finding

npm run test:unit is red on main (verified at 60ddab0 after a clean npm ci, node v26.8.2):

ℹ tests 345
ℹ pass 341
ℹ fail 2

✖ accepts a valid catalog        (tests/validate-architectures.test.mjs:22)
✖ accepts records without assets (tests/validate-architectures.test.mjs:56)

AssertionError: 1 error(s) in architecture catalog:
  [error] acme-platform: sourceUrl must be an https URL; it is rendered as an href in the member directory

.github/workflows/ci.yml runs npm run test:unit on every pull_request, so the
"Validate repository" check is now failing for every open PR, not just one.

Cause

dc5fe09 ("fix: validate architecture catalog sourceUrl scheme and asset containment", #334)
added three new mandatory rules to scripts/validate-architectures.mjs:

  • sourceUrl must parse as an https: URL
  • id must match /^[a-z0-9][a-z0-9-]*$/
  • every asset must resolve inside static/img/architectures/

The validRecord fixture in tests/validate-architectures.test.mjs has no
sourceUrl field
, so both tests that assert status === 0 now fail. None of the
three new rules has a test of its own either — they were added without coverage.

Note that open PR #212 also edits this file, but only appends MDX-active-content
tests that reuse the same unfixed validRecord; merging it will not turn CI green.

Recommendation

Add the missing field to the fixture and cover the three rules #334 introduced.

  • Add sourceUrl: 'https://github.com/cncf/architecture/blob/main/acme-platform.md' to validRecord
  • Cover the sourceUrl rule: absent, http:, javascript:, unparseable, non-string
  • Cover the id slug rule with a rejected id
  • Cover asset containment: outside the prefix, .. traversal, non-string

Exact replacement for the fixture:

const validRecord = {
  id: 'acme-platform',
  title: 'Acme Platform',
  organization: 'Acme Corp',
  sourceUrl: 'https://github.com/cncf/architecture/blob/main/acme-platform.md',
  assets: ['/img/architectures/acme-platform/diagram.svg'],
};

Coverage evidence

Priority

  • Impact: high — the repository's only unit-test CI gate is red for all open PRs
  • Effort: low — test-only change, no production code

— hive: agent=quality backend=copilot model=claude-opus-5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityApproved by a Hive merger/owner for auto-merge on green CIhive/hosted-available-lke648397-260827-5n31Approved by a Hive merger/owner for auto-merge on green CIqualityApproved by a Hive merger/owner for auto-merge on green CItestingApproved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions