feat: add schema drift detection (#50)#99
Open
Astro-Han wants to merge 2 commits intojackwener:mainfrom
Open
Conversation
- New `src/drift.ts` module with `detectDrift()` and `formatDriftWarning()` - Warns on stderr when columns have >= 80% empty values - Integrated into main.ts between command execution and output rendering - 13 unit tests covering all edge cases
8ffa8e7 to
f68c71a
Compare
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.
Description
Add runtime schema drift detection that warns users when command output fields are suspiciously empty, indicating upstream API structure changes.
Related issue: #50
How it works
After a command executes and before output renders,
detectDrift()checks each declared column's empty-value ratio (null,undefined,''). If any column is >= 80% empty across valid object rows (minimum 3), a yellow warning is printed to stderr:New
src/drift.tsmodule withdetectDrift()andformatDriftWarning()— standalone, no side effects. Integrated intocli.tsbetween command execution and output rendering (warning only, no exit code change).Closes #50 (core detection layer — CI cron and LLM repair interface deferred to follow-up)
Type of Change
Checklist
Screenshots / Output
No drift warning (all fields populated) — expected behavior for healthy adapters.
Test results