Skip to content

fix(share): harden 3-stage pipeline, fix tests, add demo#40

Merged
ashu17706 merged 1 commit intodevfrom
feat/smriti-share-v2
Feb 28, 2026
Merged

fix(share): harden 3-stage pipeline, fix tests, add demo#40
ashu17706 merged 1 commit intodevfrom
feat/smriti-share-v2

Conversation

@ashu17706
Copy link
Contributor

Summary

  • Fix broken things: rewrite team.test.ts with bun:test, fix unit-level dedup (was matching random UUID), fix duration calc (use timestamps not message count), fix replacereplaceAll for nested categories
  • DRY up code: extract shared callOllama() to src/team/ollama.ts with timeout + retry, extract slugify/datePrefix to src/team/utils.ts, deduplicate ~80 lines of boilerplate in share.ts
  • Fix tests: replace misleading tests that tested their own data with mocked Ollama tests that call real functions
  • Fix sync integration: segmented docs now round-trip through smriti sync (detect pipeline: segmented frontmatter)
  • Fix prompts: constrain Stage 1 categories, add {{title}} + heading instruction to all Stage 2 templates, remove hallucination-prone "links to further reading"
  • Add demo script: docs/demo-script.md — story-driven walkthrough of the full smriti workflow

Test plan

  • bun test test/team.test.ts — 8 tests pass (was 6 failures)
  • bun test test/team-segmented.test.ts — 15 tests pass (3 new mocked Ollama tests)
  • bun test — 572 pass, 13 fail (all 13 are pre-existing QMD/LlamaCpp GGUF model errors)
  • smriti share --project smriti --segmented — end-to-end with live Ollama
  • smriti sync — verify segmented docs import correctly

🤖 Generated with Claude Code

Priority 1 - Fix broken things:
- Rewrite test/team.test.ts with bun:test (was using console.assert, wrong imports)
- Fix unit-level dedup in share.ts (was matching on random UUID, now content_hash only)
- Fix duration calculation in segment.ts (use actual timestamps, not messageCount/2)
- Fix replace() → replaceAll() for nested category paths in share.ts

Priority 2 - Code quality:
- Extract shared callOllama() to src/team/ollama.ts with timeout + retry
- Extract shared slugify/datePrefix to src/team/utils.ts
- DRY up share.ts: extract resolveOutputDir, querySessions, writeManifest helpers
- Use isValidCategory from categorize/schema.ts instead of duplicate in segment.ts
- Remove unused SMRITI_DIR import from document.ts

Priority 3 - Test coverage:
- Replace misleading tests in team-segmented.test.ts with mocked Ollama tests
- Add generateDocument, generateDocumentsSequential, and fallback path tests
- Add real DB validation tests using isValidCategory

Priority 4 - Sync integration:
- Fix sync.ts to handle Stage 2 structured output (pipeline: segmented flag)
- Segmented knowledge docs are no longer write-only

Priority 5 - Prompt improvements:
- Constrain Stage 1 to use only listed categories (remove "other valid" text)
- Add {{title}} placeholder and heading instruction to all Stage 2 templates
- Remove hallucination-prone "Links to further reading" from topic template

Also adds docs/demo-script.md showing the full smriti workflow story.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Benchmark Scorecard (ci-small)

Bench Scorecard (ci-small)

threshold: 20.00%

metric baseline current (median) delta status
ingest_throughput_msgs_per_sec 1735.800 475.270 -72.62% WARN
ingest_p95_ms_per_session 6.960 24.085 +246.05% WARN
fts_p95_ms 0.410 0.694 +69.27% WARN
recall_p95_ms 0.436 0.766 +75.69% WARN

Summary: WARN (4 metrics)

@ashu17706 ashu17706 merged commit 2ea6180 into dev Feb 28, 2026
8 checks passed
@github-actions github-actions bot mentioned this pull request Feb 28, 2026
4 tasks
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