@devries-cameron20 / composio Mirror · read-only / commits / 6dc8def35
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 06:00 UTC

fix(docs): expire KB review windows at their deadline, not the evening before (#5291)

This PR: - fixes the premature expiry behind https://github.com/ComposioHQ/composio/issues/5286: `verifyKb` rounded the time left before `reviewAfter` to whole days and treated 0 as expired, so from noon UTC on 2026-11-09 all 61 guides due `2026-11-10` were reported as "expired 0 day(s) ago" - decides expiry by comparing instants (`reviewAfter <= now`), the same rule `buildKbCatalog` already uses, so both gates flip at the same moment - floors the elapsed days only for the report text: "0 day(s) ago" on the deadline day, "1 day(s) ago" the next - leaves the verification-age and review-cliff warnings, and every guide date in the manifest, unchanged ## Still needed - The 61 guides reach their deadline at 2026-11-10T00:00Z. From then on the report is correct to flag them, and each one needs real editorial review (re-verify and set a new `reviewAfter`) or demotion to `needs-review`. This PR does not bump or demote anything. - https://github.com/ComposioHQ/composio/issues/5280 (support knowledge refresh failing) also has a separate GitHub App access error (404 while resolving the installation). This PR only removes the premature-expiry errors, so #5280 stays open, and no hosted App settings were changed. ## Verification - New boundary tests in `tests/static/kb-verify.test.ts`: the eve-of-deadline cases (12:25Z, 15:05Z, and 23:59:59.999Z on 2026-11-09) failed on `next` and pass now; the deadline instant and the next day report 0 and 1 days - `bun test tests/static/kb-verify.test.ts`: 27 passed; `bun run types:check` and oxlint pass - `bun run test` (docs static suite): 827 passed, 5 failed, all in `content-freshness.test.ts`, which does not import the KB verifier or any changed file (it builds temporary Git repositories), so they are unrelated to this change

Alberto Schiabel committed Nov 9, 2026 at 23:31 UTC 6dc8def35b2066c52b1c01bb092db1711f99c732
2 files changed +36 -11
docs/lib/kb/verify.ts
+11 -11
@@ -323,17 +323,17 @@ export function verifyKb(input: KbVerifyInput): KbVerifyReport {
323 }
324
325 const reviewAfter = guide.reviewAfter ? new Date(guide.reviewAfter) : null;
326 - if (reviewAfter && !Number.isNaN(reviewAfter.valueOf())) {
327 - const remaining = daysBetween(input.now, reviewAfter);
328 - if (remaining <= 0) {
329 - findings.push({
330 - severity: 'error',
331 - kind: 'review-window-expired',
332 - guideSlug: guide.slug,
333 - detail: `review window expired ${Math.abs(remaining)} day(s) ago`,
334 - evidence: `reviewAfter=${guide.reviewAfter}`,
335 - });
336 - }
326 + // Compare instants, as the catalog build does: rounding to whole days would
327 + // expire a guide from noon UTC on the eve of its deadline.
328 + if (reviewAfter && reviewAfter.valueOf() <= input.now.valueOf()) {
329 + const elapsedDays = Math.floor((input.now.valueOf() - reviewAfter.valueOf()) / 86_400_000);
330 + findings.push({
331 + severity: 'error',
332 + kind: 'review-window-expired',
333 + guideSlug: guide.slug,
334 + detail: `review window expired ${elapsedDays} day(s) ago`,
335 + evidence: `reviewAfter=${guide.reviewAfter}`,
336 + });
337 }
338
339 const lastVerified = guide.lastVerifiedAt ? new Date(guide.lastVerifiedAt) : null;
docs/tests/static/kb-verify.test.ts
+25
@@ -201,6 +201,31 @@ describe('verifyKb', () => {
201 expect(finding?.severity).toBe('error');
202 });
203
204 + describe('review window boundary', () => {
205 + const expiryFor = (at: string) =>
206 + verifyKb({
207 + manifest: MANIFEST,
208 + catalog,
209 + now: new Date(at),
210 + guides: [guide({ slug: 'due', body: 'text', reviewAfter: '2026-11-10' })],
211 + }).findings.find((entry) => entry.kind === 'review-window-expired');
212 +
213 + test.each(['2026-11-09T12:25:00Z', '2026-11-09T15:05:00Z', '2026-11-09T23:59:59.999Z'])(
214 + 'stays open before the deadline (%s)',
215 + (at) => {
216 + expect(expiryFor(at)).toBeUndefined();
217 + }
218 + );
219 +
220 + test('expires at the deadline', () => {
221 + expect(expiryFor('2026-11-10T00:00:00Z')?.detail).toBe('review window expired 0 day(s) ago');
222 + });
223 +
224 + test('counts whole days elapsed since the deadline', () => {
225 + expect(expiryFor('2026-11-11T12:00:00Z')?.detail).toBe('review window expired 1 day(s) ago');
226 + });
227 + });
228 +
229 test('flags a cohort of guides that all expire on one date', () => {
230 const guides = Array.from({ length: 6 }, (_, index) =>
231 guide({ slug: `guide-${index}`, body: 'text', reviewAfter: '2026-10-20' })