fix(share): harden 3-stage pipeline, fix tests, add demo#40
Merged
Conversation
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>
Contributor
Benchmark Scorecard (ci-small)Bench Scorecard (ci-small)threshold: 20.00%
Summary: WARN (4 metrics) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
team.test.tswith bun:test, fix unit-level dedup (was matching random UUID), fix duration calc (use timestamps not message count), fixreplace→replaceAllfor nested categoriescallOllama()tosrc/team/ollama.tswith timeout + retry, extractslugify/datePrefixtosrc/team/utils.ts, deduplicate ~80 lines of boilerplate inshare.tssmriti sync(detectpipeline: segmentedfrontmatter){{title}}+ heading instruction to all Stage 2 templates, remove hallucination-prone "links to further reading"docs/demo-script.md— story-driven walkthrough of the full smriti workflowTest 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 Ollamasmriti sync— verify segmented docs import correctly🤖 Generated with Claude Code