Personal Telegram developer console for GitHub
test: audit Telegram repository menu drill-downs (#30)
Adds actionable Issue and Release drill-down coverage, Telegram message/callback limit coverage, and recovery navigation checks. PR head CI #307 passed before merge.
davoodmehraban89 committed
Oct 4, 2026 at 17:38 UTC
f2379a4933b6b0be135979cc89c76db60e5bcf7b
8 files changed
+218
-6
README.md
+1
-1
@@ -10,7 +10,7 @@ V2.1 شامل Workspace Editor، Ops Console، Security Center، Configuration C
10
11
- منوی اصلی: پروژهها، وضعیت، ابزارهای توسعه، پیکربندی، امنیت و راهنما.
12
- دریافت فهرست Repositoryهای قابلدسترسی بهصورت زنده از GitHub API.
13
-- مشاهده جزئیات Repository، Pull Requestها، Commitها، Branchها، Issues، Releases و GitHub Actions.
13
+- مشاهده جزئیات Repository، Pull Requestها، Commitها، Branchها، Issues، Releases و GitHub Actions؛ Issue و Release دارای drill-down منبعمحور برای توضیح، وضعیت، برچسب/مسئول و Release notes هستند.
14
- مشاهده Workflow Run، Job، Step، bounded log و Artifact metadata.
15
- اجرای کنترلشدهٔ `Re-run failed jobs` و `Cancel workflow run` فقط بعد از Safe Approval.
16
- مرور پوشهها و فایلها و پیشنمایش فایلهای متنی مناسب.
docs/superpowers/plans/2026-10-04-telegram-menu-e2e-audit.md
new
+105
@@ -0,0 +1,105 @@
1
+# Telegram Menu E2E Audit Implementation Plan
2
+
3
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+**Goal:** Traverse every reachable Nexa Telegram menu path to its terminal views, verify that each report is source-backed, useful, recoverable and within Telegram limits, then replace weak reports with actionable equivalents.
6
+
7
+**Architecture:** Treat the production callback graph as the test surface. Add contract tests that enumerate every static menu callback plus representative dynamic GitHub/Workspace routes, then improve only the views/providers whose output lacks operational value. Keep public `/status` minimal and all provider mutation behind existing policy/approval boundaries.
8
+
9
+**Tech Stack:** Cloudflare Workers, JavaScript/Node 22, Telegram Bot API, GitHub REST API, Durable Objects, node:test.
10
+
11
+**Spec:** Current production menu/source behavior on `main`; user-directed exhaustive audit on 2026-10-04.
12
+
13
+## Global Constraints
14
+
15
+- Owner-only boundary remains unchanged.
16
+- READ actions do not require Safe Approval; WRITE/DESTRUCTIVE actions do.
17
+- No Secret, token, full source/draft material, or signed approval token enters diagnostics/audit output.
18
+- Public `/status` stays minimal health-only.
19
+- Telegram message text <= 4096 characters; callback_data <= 64 UTF-8 bytes.
20
+- Workspace GitHub writes remain branch-only (`nexa/edit-*`).
21
+- Explicit failure is preferred over fabricated success.
22
+
23
+## Review Focus
24
+
25
+- Every visible inline/persistent button resolves to a real view/action or is explicitly unavailable.
26
+- Terminal list views expose enough drill-down detail to make the report operationally useful.
27
+- Back/refresh paths do not strand the owner.
28
+- Dynamic GitHub/Workspace callbacks remain within Telegram callback limits.
29
+- Provider failures remain redacted and recoverable.
30
+
31
+---
32
+
33
+### Task 1: Build exhaustive menu-graph regression coverage
34
+
35
+**Files:**
36
+- Create: `test/telegram-menu-e2e.test.js`
37
+- Modify only if RED proves a routing defect.
38
+
39
+**Interfaces:**
40
+- Consumes: `GuidedNexaDevBot`, `OpsMenuManager`, GitHub plugin callback routing.
41
+- Produces: regression coverage for all static menu/ops/security/config/help callbacks and representative repository/CI/PR/branch/issue/release/workspace paths.
42
+
43
+- [ ] Write tests that traverse visible callbacks recursively with deterministic provider fixtures.
44
+- [ ] Assert every reachable view has useful non-empty text, recovery navigation, <=4096 chars and callback_data <=64 bytes.
45
+- [ ] Assert no unknown/placeholder callback silently falls back to a misleading success view.
46
+- [ ] Run the test and capture RED for any defects found.
47
+
48
+### Task 2: Upgrade weak repository reports
49
+
50
+**Files:**
51
+- Modify: `src/plugins/github/plugin.js`
52
+- Modify: `src/github.js` only when a missing READ endpoint is required.
53
+- Test: `test/telegram-menu-e2e.test.js`
54
+- Test: relevant GitHub provider tests.
55
+
56
+**Interfaces:**
57
+- Consumes: normalized GitHub service methods.
58
+- Produces: actionable repository drill-down views with safe back/refresh navigation.
59
+
60
+- [ ] Add RED assertions for list-only terminal reports that lack decision-useful detail.
61
+- [ ] Implement the minimum READ drill-down needed (prioritize Issue detail, Release detail, Commit detail where source data supports it).
62
+- [ ] Preserve pagination and Telegram limits.
63
+- [ ] Verify relevant tests GREEN.
64
+
65
+### Task 3: Audit operational/security/configuration reports
66
+
67
+**Files:**
68
+- Modify: `src/ops-menu.js` only for source-backed usefulness fixes.
69
+- Modify: `src/core/runtime-diagnostics.js` only if required by a proven gap.
70
+- Test: `test/telegram-menu-e2e.test.js`
71
+
72
+**Interfaces:**
73
+- Consumes: runtime diagnostics snapshot/self-check.
74
+- Produces: actionable owner-only operational reports without secret exposure.
75
+
76
+- [ ] Verify Status, Tools, Security and Configuration submenus to terminal views.
77
+- [ ] Replace descriptive-only output with source-backed state/action guidance where the current runtime already exposes it.
78
+- [ ] Keep configuration read-only and `/status` public output unchanged.
79
+
80
+### Task 4: Guide synchronization
81
+
82
+**Files:**
83
+- Modify: `src/guide-menu.js`
84
+- Modify: `README.md` only when behavior changed.
85
+- Test: `test/help-guide.test.js`
86
+
87
+**Interfaces:**
88
+- Consumes: final audited menu behavior.
89
+- Produces: Guide text matching actual controls and recovery paths.
90
+
91
+- [ ] Add/adjust Guide assertions for changed controls.
92
+- [ ] Update Guide/README to match source truth.
93
+- [ ] Verify Telegram limits.
94
+
95
+### Task 5: Full verification and delivery
96
+
97
+**Files:** no new production scope.
98
+
99
+- [ ] Run relevant tests.
100
+- [ ] Run full `npm test` and verify all discovered test files execute.
101
+- [ ] Review diff for owner boundary, approval, secret-redaction and `/status` regressions.
102
+- [ ] Open PR and verify CI and Cloudflare Preview.
103
+- [ ] Merge with expected-head lock.
104
+- [ ] Verify post-merge main CI and Deploy run target the exact merge SHA.
105
+- [ ] Independently verify active Cloudflare deployment/version, traffic and required bindings.
src/github.js
+14
@@ -433,6 +433,13 @@ export class GitHubService {
433
};
434
}
435
436
+ async getIssue(repoRef, issueNumber) {
437
+ const number = numericId(issueNumber, 'issue');
438
+ const { apiBase } = await this.getRepositoryContext(repoRef);
439
+ const issue = await this.requestJson(apiBase + '/issues/' + number, 'GitHub issue');
440
+ return { ...this.mapIssue(issue), body: issue.body || '', labels: (issue.labels || []).map(label => typeof label === 'string' ? label : label.name).filter(Boolean), assignees: (issue.assignees || []).map(user => user.login).filter(Boolean), createdAt: issue.created_at || '', updatedAt: issue.updated_at || '' };
441
+ }
442
+
443
async listReleases(repoRef, { perPage = 10, page = 1 } = {}) {
444
const count = clampPerPage(perPage, 10); const pageNumber = clampPage(page); const { apiBase } = await this.getRepositoryContext(repoRef);
445
const data = await this.requestJson(`${apiBase}/releases?per_page=${count}&page=${pageNumber}`, 'GitHub releases');
@@ -442,6 +449,13 @@ export class GitHubService {
449
}));
450
}
451
452
+ async getRelease(repoRef, releaseId) {
453
+ const id = numericId(releaseId, 'release');
454
+ const { apiBase } = await this.getRepositoryContext(repoRef);
455
+ const release = await this.requestJson(apiBase + '/releases/' + id, 'GitHub release');
456
+ return { id: release.id, tag: release.tag_name || '', name: release.name || release.tag_name || 'Release', body: release.body || '', draft: !!release.draft, prerelease: !!release.prerelease, publishedAt: release.published_at || release.created_at || '', author: release.author?.login || 'unknown', target: release.target_commitish || '', url: release.html_url || '' };
457
+ }
458
+
459
async rerunFailedWorkflowRun(repoRef, runId) {
460
const id = numericId(runId, 'workflow run'); const { apiBase } = await this.getRepositoryContext(repoRef);
461
return this.requestJson(`${apiBase}/actions/runs/${id}/rerun-failed-jobs`, 'GitHub rerun failed jobs', { method: 'POST', allowEmpty: true });
src/guide-menu.js
+1
-1
@@ -30,7 +30,7 @@ function guidePage(page) {
30
const pages = {
31
1: `📘 <b>راهنمای Nexa Dev — V2.1</b>\n<b>۱. شروع، منوهای اصلی و ابزارهای عملیاتی</b>\n➖➖➖➖➖➖➖➖➖➖\n\n<b>🏠 منوی اصلی</b>\nنقطهٔ برگشت امن شماست و همهٔ بخشهای اصلی را باز میکند.\n\n<b>📁 پروژهها / مخزنها</b>\nRepositoryهای قابلدسترسی GitHub را زنده میخواند و مسیر فایل، PR، Commit، CI، Branch، Issue، Release و Workspace را باز میکند.\n\n<b>📊 وضعیت</b>\nوضعیت واقعی Worker، مرز Owner-only، GitHub READ، WORKSPACE_STORE، Replay Guard، Approval signer و Plugin Registry را نشان میدهد. latency یا SLA ساختگی گزارش نمیشود.\n\n<b>🔧 ابزارها</b>\nکنسول عیبیابی فقطخواندنی است. «🩺 خودآزمایی» پیشنیازها را کنترل میکند؛ «🐙 تست اتصال GitHub» یک READ زنده انجام میدهد؛ «🧱 Runtime / Bindings» وضعیت Runtime و Durable Objectها را نشان میدهد؛ «🧩 Plugin Registry» Pluginها و Actionها را میشمارد؛ Ping فقط مسیر داخلی Bot را تست میکند.\n\n<b>⚙️ پیکربندی</b>\nدر V2.1 عمداً فقطخواندنی است. Runtime، Providerها، Workspace Editor و Pluginها را بدون نمایش Secret نشان میدهد و تنظیم حساس را از Telegram تغییر نمیدهد.\n\n<b>🔐 امنیت</b>\nSecurity Center است؛ Owner-only، Safe Approval، Replay protection و Policy عملیات را توضیح میدهد.\n\n<b>📘 راهنما</b>\nهمین راهنما را باز میکند و از منوی ثابت پایین Telegram هم در دسترس است.\n\n<b>🔄 بروزرسانی / بررسی مجدد</b>\nدادهٔ همان صفحه را دوباره میخواند و بهتنهایی WRITE انجام نمیدهد.\n\n<b>🔙 بازگشت</b>\nبه سطح قبلی ناوبری برمیگردد.`,
32
33
- 2: `📘 <b>راهنمای Nexa Dev — V2.1</b>\n<b>۲. پروژه، فایلها و مشاهده کد</b>\n➖➖➖➖➖➖➖➖➖➖\n\n<b>نام Repository</b>\nصفحهٔ پروژه را با Metadata زنده GitHub باز میکند.\n\n<b>📂 فایلها</b>\nساختار فایلها و پوشهها را باز میکند؛ 📁 وارد پوشه و 📄 پیشنمایش فایل را باز میکند.\n\n<b>✏️ Edit</b>\nبرای فایل متنی مجاز Workspace امن میسازد. فایل حساس، باینری، Git LFS یا خارج از Policy قابل Edit نیست.\n\n<b>🔀 Pull Requestها / PR</b>\nPRها و جزئیات آنها را میخواند. Files / Diff و Checks برای بررسی تغییر و نتیجهٔ کنترلها هستند.\n\n<b>📝 Commitها</b>\nآخرین Commitهای Repository را نمایش میدهد.\n\n<b>📊 وضعیت / تستها</b>\nآخرین وضعیت Workflowهای پروژه را خلاصه میکند.\n\n<b>🧪 CI / Actions</b>\nWorkflow Runها را باز میکند؛ جزئیات در فصل ۵ است.\n\n<b>🌿 Branches</b>\nBranchها و Compare نسبت به شاخهٔ پیشفرض را نشان میدهد.\n\n<b>🐛 Issues</b>\nIssueهای Repository را صفحهبندی میکند.\n\n<b>🏷 Releases</b>\nReleaseهای GitHub را نمایش میدهد.\n\n<b>⬅️ جدیدتر / قدیمیتر ➡️</b>\nبین صفحات نتایج جابهجا میشود و WRITE انجام نمیدهد.`,
33
+ 2: `📘 <b>راهنمای Nexa Dev — V2.1</b>\n<b>۲. پروژه، فایلها و مشاهده کد</b>\n➖➖➖➖➖➖➖➖➖➖\n\n<b>نام Repository</b>\nصفحهٔ پروژه را با Metadata زنده GitHub باز میکند.\n\n<b>📂 فایلها</b>\nساختار فایلها و پوشهها را باز میکند؛ 📁 وارد پوشه و 📄 پیشنمایش فایل را باز میکند.\n\n<b>✏️ Edit</b>\nبرای فایل متنی مجاز Workspace امن میسازد. فایل حساس، باینری، Git LFS یا خارج از Policy قابل Edit نیست.\n\n<b>🔀 Pull Requestها / PR</b>\nPRها و جزئیات آنها را میخواند. Files / Diff و Checks برای بررسی تغییر و نتیجهٔ کنترلها هستند.\n\n<b>📝 Commitها</b>\nآخرین Commitهای Repository را نمایش میدهد.\n\n<b>📊 وضعیت / تستها</b>\nآخرین وضعیت Workflowهای پروژه را خلاصه میکند.\n\n<b>🧪 CI / Actions</b>\nWorkflow Runها را باز میکند؛ جزئیات در فصل ۵ است.\n\n<b>🌿 Branches</b>\nBranchها و Compare نسبت به شاخهٔ پیشفرض را نشان میدهد.\n\n<b>🐛 Issues</b>\nIssueهای Repository را صفحهبندی میکند. با انتخاب هر مورد، <b>جزئیات Issue</b> شامل وضعیت، نویسنده، برچسبها، مسئولها، زمان بروزرسانی و متن Issue از GitHub نمایش داده میشود.\n\n<b>🏷 Releases</b>\nReleaseهای GitHub را نمایش میدهد. با انتخاب هر Release، <b>Release notes</b>، Tag، Target، نویسنده، زمان انتشار و وضعیت draft/pre-release از منبع GitHub باز میشود.\n\n<b>⬅️ جدیدتر / قدیمیتر ➡️</b>\nبین صفحات نتایج جابهجا میشود و WRITE انجام نمیدهد.`,
34
35
3: `📘 <b>راهنمای Nexa Dev — V2.1</b>\n<b>۳. Workspace و دکمههای ویرایش</b>\n➖➖➖➖➖➖➖➖➖➖\n\nپس از <b>✏️ Edit</b> یک Draft Durable ساخته میشود و هنوز GitHub تغییر نکرده است. Workspace در <code>WORKSPACE_STORE</code> نگهداری میشود.\n\n<b>📝 Workspace / باز کردن Draft</b>\nوضعیت Draft، Base snapshot و پیام Commit را نشان میدهد.\n\n<b>🧑💻 Editor</b>\nTelegram Mini App چندخطی را باز میکند. «ذخیره Draft» فقط Draft را در WORKSPACE_STORE ذخیره میکند و GitHub WRITE ندارد.\n\n<b>📎 بارگذاری فایل</b>\nمحتوای یک فایل متنی UTF-8 را جایگزین Draft میکند؛ مسیر مقصد Repository عوض نمیشود.\n\n<b>📝 Paste متن</b>\nمسیر fallback قدیمی با ورودی عادی Telegram است؛ مسیر اصلی V2.1 همان Mini App Editor است.\n\n<b>✍️ پیام Commit</b>\nپیام Commit بعدی را ثبت میکند.\n\n<b>🔍 Diff</b>\nOriginal و Draft را پیش از WRITE مقایسه میکند.\n\n<b>✅ آماده Commit</b>\nتغییر، Base و پیام Commit را اعتبارسنجی و Intent امن میسازد.\n\n<b>🗑 لغو Draft</b>\nWorkspace جاری را لغو میکند و GitHub دستنخورده میماند.`,
36
src/plugins/github/manifest.js
+3
-1
@@ -1,7 +1,7 @@
1
export const githubPluginManifest = Object.freeze({
2
id: 'github',
3
name: 'GitHub',
4
- version: 6,
4
+ version: 7,
5
commands: Object.freeze(['/repos']),
6
actions: Object.freeze({
7
'github.repos.list': Object.freeze({ risk: 'READ' }),
@@ -25,7 +25,9 @@ export const githubPluginManifest = Object.freeze({
25
'github.pr.files.list': Object.freeze({ risk: 'READ' }),
26
'github.pr.checks.list': Object.freeze({ risk: 'READ' }),
27
'github.issues.list': Object.freeze({ risk: 'READ' }),
28
+ 'github.issue.detail': Object.freeze({ risk: 'READ' }),
29
'github.releases.list': Object.freeze({ risk: 'READ' }),
30
+ 'github.release.detail': Object.freeze({ risk: 'READ' }),
31
'github.workspace.navigate': Object.freeze({ risk: 'READ' }),
32
'github.workspace.create': Object.freeze({ risk: 'READ' }),
33
'github.workspace.view': Object.freeze({ risk: 'READ' }),
src/plugins/github/plugin.js
+37
-2
@@ -323,7 +323,22 @@ async function issuesView(github, repoId, page = 1) {
323
: '<i>Issueی یافت نشد.</i>';
324
return {
325
text: `🐛 <b>Issues — ${escapeHtml(repo.name)}</b>\nصفحه: <b>${page}</b>\n➖➖➖➖➖➖➖➖➖➖\n${body}`,
326
- reply_markup: { inline_keyboard: [...explicitPagination('issues', repoId, page, !!issuePage.hasMore), [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]] }
326
+ reply_markup: { inline_keyboard: [
327
+ ...issues.slice(0, 20).map(issue => [{ text: `#${issue.number} ${short(issue.title, 42)}`, callback_data: `issuedetail:${repoId}:${issue.number}` }]),
328
+ ...explicitPagination('issues', repoId, page, !!issuePage.hasMore),
329
+ [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]
330
+ ] }
331
+ };
332
+}
333
+
334
+async function issueDetailView(github, repoId, issueNumber) {
335
+ const [repo, issue] = await Promise.all([github.getRepository(repoId), github.getIssue(repoId, issueNumber)]);
336
+ const labels = (issue.labels || []).map(label => `#${escapeHtml(label)}`).join(' ');
337
+ const assignees = (issue.assignees || []).map(name => `@${escapeHtml(name)}`).join(' ');
338
+ const body = escapeHtml(short(issue.body || '', 1800));
339
+ return {
340
+ text: `🐛 <b>Issue #${issue.number} — ${escapeHtml(repo.name)}</b>\n<b>${escapeHtml(issue.title)}</b>\n${stateIcon(issue.state)} ${escapeHtml(issue.state || 'unknown')} · ${escapeHtml(issue.author)} · ${issue.comments ?? 0} comments\nLabels: ${labels || '-'}\nAssignees: ${assignees || '-'}\nUpdated: ${escapeHtml(issue.updatedAt || issue.createdAt || '-')}\n➖➖➖➖➖➖➖➖➖➖\n${body || '<i>بدون توضیح.</i>'}`,
341
+ reply_markup: { inline_keyboard: [[{ text: '🔄 بروزرسانی', callback_data: `issuedetail:${repoId}:${issueNumber}` }, { text: '🔙 Issues', callback_data: `issues:${repoId}` }]] }
342
};
343
}
344
@@ -334,7 +349,21 @@ async function releasesView(github, repoId, page = 1) {
349
: '<i>هیچ Release منتشرشدهای برای این مخزن در GitHub وجود ندارد.</i>';
350
return {
351
text: `🏷 <b>Releases — ${escapeHtml(repo.name)}</b>\nصفحه: <b>${page}</b>\n➖➖➖➖➖➖➖➖➖➖\n${body}`,
337
- reply_markup: { inline_keyboard: [...listPagination('releases', repoId, page, releases.length, 10), [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]] }
352
+ reply_markup: { inline_keyboard: [
353
+ ...releases.slice(0, 10).map(release => [{ text: `🏷 ${short(release.tag || release.name, 42)}`, callback_data: `releasedetail:${repoId}:${release.id}` }]),
354
+ ...listPagination('releases', repoId, page, releases.length, 10),
355
+ [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]
356
+ ] }
357
+ };
358
+}
359
+
360
+async function releaseDetailView(github, repoId, releaseId) {
361
+ const [repo, release] = await Promise.all([github.getRepository(repoId), github.getRelease(repoId, releaseId)]);
362
+ const body = escapeHtml(short(release.body || '', 1800));
363
+ const flags = [release.draft ? 'draft' : '', release.prerelease ? 'pre-release' : ''].filter(Boolean).join(' · ');
364
+ return {
365
+ text: `🏷 <b>${escapeHtml(release.name)} — ${escapeHtml(repo.name)}</b>\nTag: <code>${escapeHtml(release.tag || '-')}</code>\nTarget: <code>${escapeHtml(release.target || '-')}</code>\nAuthor: ${escapeHtml(release.author || 'unknown')}\nPublished: ${escapeHtml(release.publishedAt || '-')}${flags ? `\nState: ${escapeHtml(flags)}` : ''}\n➖➖➖➖➖➖➖➖➖➖\n${body || '<i>بدون Release notes.</i>'}`,
366
+ reply_markup: { inline_keyboard: [[{ text: '🔄 بروزرسانی', callback_data: `releasedetail:${repoId}:${releaseId}` }, { text: '🔙 Releases', callback_data: `releases:${repoId}` }]] }
367
};
368
}
369
@@ -377,8 +406,12 @@ function resolveReadCallback(data) {
406
if (prchecks) return { actionId: 'github.pr.checks.list', kind: 'prchecks', repoId: prchecks.repoId, prNumber: prchecks.itemId, page: prchecks.page };
407
const issues = pagedSingle(value, 'issues');
408
if (issues) return { actionId: 'github.issues.list', kind: 'issues', ...issues };
409
+ const issuedetail = numericPair(value, 'issuedetail');
410
+ if (issuedetail) return { actionId: 'github.issue.detail', kind: 'issuedetail', repoId: issuedetail.repoId, issueNumber: issuedetail.runId };
411
const releases = pagedSingle(value, 'releases');
412
if (releases) return { actionId: 'github.releases.list', kind: 'releases', ...releases };
413
+ const releasedetail = numericPair(value, 'releasedetail');
414
+ if (releasedetail) return { actionId: 'github.release.detail', kind: 'releasedetail', repoId: releasedetail.repoId, releaseId: releasedetail.runId };
415
for (const [prefix, actionId] of CALLBACK_ACTIONS) {
416
if (value.startsWith(prefix)) return { actionId, kind: 'legacy' };
417
}
@@ -454,7 +487,9 @@ export function createGitHubPlugin({ github, menu, workspaces } = {}) {
487
if (read.kind === 'prfiles') return pullRequestFilesView(github, read.repoId, read.prNumber, read.page);
488
if (read.kind === 'prchecks') return pullRequestChecksView(github, read.repoId, read.prNumber, read.page);
489
if (read.kind === 'issues') return issuesView(github, read.repoId, read.page);
490
+ if (read.kind === 'issuedetail') return issueDetailView(github, read.repoId, read.issueNumber);
491
if (read.kind === 'releases') return releasesView(github, read.repoId, read.page);
492
+ if (read.kind === 'releasedetail') return releaseDetailView(github, read.repoId, read.releaseId);
493
return menu.renderByCallback(data);
494
}
495
};
test/help-guide.test.js
+1
-1
@@ -39,7 +39,7 @@ describe('Nexa Dev Bot - in-app V2.1 guide', () => {
39
}
40
41
const repoHelp = await menu.renderByCallback('help:2');
42
- for (const label of ['فایلها', 'Pull Request', 'Commit', 'CI / Actions', 'Branches', 'Issues', 'Releases']) {
42
+ for (const label of ['فایلها', 'Pull Request', 'Commit', 'CI / Actions', 'Branches', 'Issues', 'Releases', 'جزئیات Issue', 'Release notes']) {
43
assert.ok(repoHelp.text.includes(label), `repo guide missing ${label}`);
44
}
45
test/telegram-menu-e2e.test.js
new
+56
@@ -0,0 +1,56 @@
1
+import test from 'node:test';
2
+import assert from 'node:assert/strict';
3
+import { createGitHubPlugin } from '../src/plugins/github/plugin.js';
4
+
5
+const repoId = 123;
6
+const github = {
7
+ async getRepository() { return { id: repoId, name: 'nexa-dev-bot', fullName: 'davoodmehraban89/nexa-dev-bot', defaultBranch: 'main' }; },
8
+ async listIssuesPage() { return { items: [{ number: 7, title: 'Broken report', state: 'open', author: 'owner', comments: 3 }], hasMore: false }; },
9
+ async getIssue() { return { number: 7, title: 'Broken report', state: 'open', author: 'owner', comments: 3, body: 'Reproduction and expected result', labels: ['bug'], assignees: ['owner'], createdAt: '2026-10-04T10:00:00Z', updatedAt: '2026-10-04T11:00:00Z' }; },
10
+ async listReleases() { return [{ id: 9, tag: 'v2.1.0', name: 'V2.1', draft: false, prerelease: false, publishedAt: '2026-10-04T10:00:00Z' }]; },
11
+ async getRelease() { return { id: 9, tag: 'v2.1.0', name: 'V2.1', body: 'Production release notes', draft: false, prerelease: false, publishedAt: '2026-10-04T10:00:00Z', author: 'owner', target: 'main' }; }
12
+};
13
+const menu = { async renderByCallback() { return { text: 'fallback', reply_markup: { inline_keyboard: [] } }; } };
14
+const workspaces = { async getWorkspace() { return null; } };
15
+
16
+function callbacks(view) { return view.reply_markup.inline_keyboard.flat().map(button => button.callback_data).filter(Boolean); }
17
+function assertTelegramContract(view) {
18
+ assert.ok(view.text && view.text.length <= 4096);
19
+ for (const callback of callbacks(view)) assert.ok(Buffer.byteLength(callback, 'utf8') <= 64, callback);
20
+}
21
+
22
+test('issue list drills into actionable issue detail and preserves recovery navigation', async () => {
23
+ const plugin = createGitHubPlugin({ github, menu, workspaces });
24
+ const list = await plugin.resolveCallback(`issues:${repoId}`).execute();
25
+ assertTelegramContract(list);
26
+ assert.ok(callbacks(list).includes(`issuedetail:${repoId}:7`), 'issue list must expose detail drill-down');
27
+ const detail = await plugin.resolveCallback(`issuedetail:${repoId}:7`).execute();
28
+ assertTelegramContract(detail);
29
+ assert.match(detail.text, /Reproduction and expected result/);
30
+ assert.ok(callbacks(detail).includes(`issues:${repoId}`));
31
+});
32
+
33
+test('release list drills into source-backed release notes and preserves recovery navigation', async () => {
34
+ const plugin = createGitHubPlugin({ github, menu, workspaces });
35
+ const list = await plugin.resolveCallback(`releases:${repoId}`).execute();
36
+ assertTelegramContract(list);
37
+ assert.ok(callbacks(list).includes(`releasedetail:${repoId}:9`), 'release list must expose detail drill-down');
38
+ const detail = await plugin.resolveCallback(`releasedetail:${repoId}:9`).execute();
39
+ assertTelegramContract(detail);
40
+ assert.match(detail.text, /Production release notes/);
41
+ assert.ok(callbacks(detail).includes(`releases:${repoId}`));
42
+});
43
+
44
+test('repository report views always retain a project recovery route', async () => {
45
+ const emptyGithub = {
46
+ ...github,
47
+ async listIssuesPage() { return { items: [], hasMore: false }; },
48
+ async listReleases() { return []; }
49
+ };
50
+ const plugin = createGitHubPlugin({ github: emptyGithub, menu, workspaces });
51
+ for (const callback of [`issues:${repoId}`, `releases:${repoId}`]) {
52
+ const view = await plugin.resolveCallback(callback).execute();
53
+ assertTelegramContract(view);
54
+ assert.ok(callbacks(view).includes(`repo:${repoId}`), `${callback} must retain project recovery`);
55
+ }
56
+});