Add automated schema freshness checks#95
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
✅ Files skipped from review due to trivial changes (5)
📝 WalkthroughWalkthroughAdds a startup schema freshness check (daily throttle) invoked from the CLI, config support for ChangesSchema Freshness Detection
Sequence DiagramsequenceDiagram
participant CLI as CLI Command<br/>Dispatch
participant Freshness as maybeWarnForStaleSchema
participant Config as Config<br/>Loading
participant Metadata as Bundled<br/>Schema Metadata
participant Cache as Freshness<br/>Cache
participant API as GraphQL<br/>API
participant Output as Schema<br/>Output/Stderr
CLI->>Freshness: call with commandName, paths, env
Freshness->>Freshness: skip if commandName === 'schema'
Freshness->>Config: load LinearConfig
Freshness->>Metadata: load bundled metadata
Freshness->>Cache: read freshness cache (throttle)
alt cache hit within throttle window
Freshness-->>CLI: return (cached result)
else
Freshness->>API: run introspection query
API-->>Freshness: live schema fingerprint
Freshness->>Cache: write updated cache
alt drift detected
alt autoUpdate enabled
Freshness->>Output: write schema.json, schema-meta.json
Freshness->>Output: print update status to stderr
else
Freshness->>Output: print stale-schema warning
end
end
end
CLI->>CLI: execute command handler
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli/main.ts`:
- Around line 328-336: The advisory schema check currently blocks command
execution because main awaits maybeWarnForStaleSchema before calling
registration.handler; change this so the check runs asynchronously and does not
delay the handler: invoke maybeWarnForStaleSchema(...) without awaiting (e.g.,
fire-and-forget using void or scheduling it) and attach a .catch(...) that logs
any errors to avoid unhandled rejections, then immediately return await
registration.handler(args.positionals.slice(1), options); ensure you call
maybeWarnForStaleSchema with the same arguments (commandName, args.profile,
args.configFile, args.credentialsFile, args.apiUrl, env) so the behavior is
preserved but non-blocking.
In `@tests/core/schema/freshness.test.ts`:
- Around line 85-86: Replace the fragile near-future Date instances used as the
now property in the freshness tests with a far-future fixed timestamp (e.g. new
Date("2099-01-01T00:00:00.000Z")) to avoid date-coupled flakes; update every
occurrence of the object key now: new Date("2026-05-23T...") in the freshness
test cases (the places where the tests pass a now property into the
freshness-checking helpers) to use the single far-future constant date instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 97472db1-550a-468c-a5b0-a1423925169c
⛔ Files ignored due to path filters (1)
src/generated/embedded-skills.tsis excluded by!**/generated/**
📒 Files selected for processing (12)
CHANGELOG.mddocs/schema-and-generated.mdpackage.jsonskills/linearctl/SKILL.mdsrc/cli/main.tssrc/core/config/config-file.tssrc/core/output/envelope.tssrc/core/schema/freshness.tssrc/index.tstests/core/config/config-file.test.tstests/core/output-envelope.test.tstests/core/schema/freshness.test.ts
f2dec40 to
cb40714
Compare
Summary
Closes #94.
Tests
Summary by CodeRabbit
New Features
Documentation
Tests
Chore