Skip to content

fix: Safe Footer Injection tests failing — frontmatter extraction #1626

Closed as duplicate

Description

@ashleyshaw

Problem

Two test failures in Safe Footer Injection tests:

Test 1: extractFrontmatterSafely should extract frontmatter from standard YAML format

  • File: .github/scripts/__tests__/inject-footers-safe.test.js and scripts/__tests__/inject-footers-safe.test.js
  • Failure: Expected frontmatter to contain --- delimiter, but received empty string
  • Impact: Frontmatter extraction is not working correctly

Test 2: should handle long YAML frontmatter (10+ lines)

  • File: .github/scripts/__tests__/inject-footers-safe.test.js
  • Failure: Body should not contain frontmatter field names (e.g., name:), but does
  • Impact: Frontmatter is not being properly separated from body content

Root Cause

The extractFrontmatterSafely function is not correctly parsing YAML frontmatter delimited by --- markers.

Solution

Review and fix the frontmatter extraction logic in the safe footer injection script to properly:

  1. Detect YAML frontmatter delimiters (---)
  2. Extract frontmatter content between delimiters
  3. Separate frontmatter from body content

Related

  • Blocks: Push to remote
  • Status: Pre-existing (failing on develop)

Definition of Ready (DoR)

  • Reproduction steps clearly documented
  • Expected vs actual behavior defined
  • Environment/version information captured
  • Related issues/PRs linked
  • Severity/impact assessed
  • Acceptance criteria for fix defined

Definition of Done (DoD)

  • Bug fix verified and reproduction steps no longer apply
  • Root cause identified and documented
  • Tests added/updated to prevent regression; CI green
  • No new warnings or errors introduced
  • Docs/changelog updated
  • Backport considered (if applicable)
  • Release notes prepared

Activity

  1. linear-code commented on Aug 7, 2026

    @linear-code
  2. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

    ✅ Template check passed after update. Thanks for fixing the issue body.

  3. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

    ⏱️ Aging and SLA annotation

    • Age: 5 day(s)
    • SLA state: Within SLA
    • Thresholds: warn at 7 days, breach at 14 days
    • Last updated: 2026-08-12T22:41:57.383Z

    Maintained by project-meta-sync workflow.

  4. self-assigned this
    on Aug 7, 2026
  5. added theissue type on Aug 7, 2026
  6. added this to the v1.1 milestone on Aug 29, 2026
  7. eleshar commented on Sep 27, 2026

    @eleshar
    Contributor

    The reported failures no longer reproduce — verified on develop at afe166eb51:

    $ npx jest --config .jest.config.cjs --testPathPatterns "inject-footers-safe"
    Test Suites: 1 passed, 1 total
    Tests:       9 passed, 9 total
    

    One of the two named test files is also gone, so the duplicate-location half of this is resolved as well:

    path named in this issue state
    .github/scripts/__tests__/inject-footers-safe.test.js gone
    scripts/__tests__/inject-footers-safe.test.js present, 9/9 pass

    scripts/inject-footers-safe.js is still in the tree and still exercised, so nothing was deleted to make this pass — the two frontmatter extraction assertions named in the report (extractFrontmatterSafely against standard YAML, and the 10+ line long-frontmatter case) are both green.

    Note for accuracy: this was not fixed by #3588, which never touched inject-footers-safe. It was resolved by the earlier script consolidation that moved .github/scripts/ into scripts/. Closing on that basis.

  8. eleshar commented on Sep 27, 2026

    @eleshar
    Contributor

    Reported failures no longer reproduce: scripts/tests/inject-footers-safe.test.js passes 9/9 on develop (afe166e), and the duplicate .github/scripts/ copy is gone. Resolved by the earlier script consolidation, not by #3588.

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

Metadata

Metadata

Assignees

Type

Fields

Priority

None yet

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions