Skip to content

Surface errors when product MD manifest sync fails( Close #30 )#31

Open
kiannidev wants to merge 1 commit into
aglover1221:mainfrom
kiannidev:fix/append-product-md-silent-noop
Open

Surface errors when product MD manifest sync fails( Close #30 )#31
kiannidev wants to merge 1 commit into
aglover1221:mainfrom
kiannidev:fix/append-product-md-silent-noop

Conversation

@kiannidev
Copy link
Copy Markdown

Summary

Fixes #30appendProductMdSource() silently returned when the product MD was missing or had malformed frontmatter. Upload and approve flows reported { ok: true } while the canonical MD sources: list stayed stale.

Related Issue

Fixes #30

Change Type

  • Bug fix
  • Regression tests
  • New feature
  • UI change
  • Security fix

What Changed

  • appendProductMdSource() throws when MD file is missing or frontmatter block is invalid
  • approveCandidate() and manualUpload() catch MD sync errors and return { ok: false, error: "..." } instead of success
  • API routes already map ok: false to HTTP 400
  • Added tests/unit/append-product-md.test.ts (3 cases)

Files Changed

File Change
lib/pipeline/sources.ts Throw on MD sync failure; propagate from approve/upload
tests/unit/append-product-md.test.ts Missing MD, bad frontmatter, happy path

Validation

./node_modules/.bin/tsc --noEmit   # pass
npm run build                      # pass
npm test                           # 3 new + existing tests

Test Plan

  • Corrupt {slug}.md frontmatter (remove --- delimiters)
  • POST upload PDF — expect 400 with Product MD missing valid frontmatter block
  • Valid MD — upload succeeds and sources: list updated in frontmatter

appendProductMdSource now throws on missing MD or malformed frontmatter.
approveCandidate and manualUpload return ok:false so upload/approve APIs
do not report success when the MD sources list was not updated.
Fixes aglover1221#30
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.

[bug] appendProductMdSource silently skips MD manifest update on missing or malformed frontmatter

1 participant