Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Merge batch 11-05 i1610: #3118 #3128 (#3135)

0xken15dd03286bfb65
diff --git a/backend/integration/superTabInbox.test.ts b/backend/integration/superTabInbox.test.ts
index 6c25ddc19..7507974a7 100644
--- a/backend/integration/superTabInbox.test.ts
+++ b/backend/integration/superTabInbox.test.ts
@@ -1019,10 +1019,14 @@ describe('reading many thread ranges at once', () => {
})
// anh Dee, 11-04 (#2742): "remove these messages", the "<machine> left the Swarm: ..." lines in every project chat. Those already
-// stored are read by nobody, and a project chat whose newest row is one does not stay unread.
-describe('a machine-left line stored before #2742', () => {
- const left = { text: 'Studio left the Swarm: its host confirmed its cleanup.', author: personAuthor(owner),
- source: { kind: 'machine-left', machine: 'Studio' } }
+// stored are read by nobody, and a project chat whose newest row is one does not stay unread. The same for the "<who> changed the
+// instructions" lines already stored (Dee and Ken, 11-05, #3165): read by nobody, in every app, whatever its version.
+describe.each([
+ ['a machine-left line stored before #2742', 'left the Swarm', { text: 'Studio left the Swarm: its host confirmed its cleanup.', author: personAuthor(owner),
+ source: { kind: 'machine-left', machine: 'Studio' } }],
+ ['an instructions line stored before #3132', 'changed the instructions', { text: 'Lead changed the instructions for owner: Routing: No Haiku.\n\nIn Routing:\nAdded: No Haiku.', author: personAuthor(owner),
+ source: { kind: 'instructions', projectId: 'lead', revision: 2 } }],
+])('%s', (_name, hidden, left) => {
/** The project chat as a person's first load serves it, with their read mark there. */
const served = async (tabId: string, as: AuthUser) => {
const data = (await get(`/api/super-tabs/${tabId}/parts`, as)).body.data
@@ -1037,7 +1041,7 @@ describe('a machine-left line stored before #2742', () => {
for (const as of [owner, peer]) {
const page = (await get(`/api/super-tabs/${s.tabId}/conversations/lead/messages`, as)).body.data.messages as any[]
expect(page.map(m => m.text)).toContain('Project latest')
- expect(JSON.stringify(page)).not.toContain('left the Swarm')
+ expect(JSON.stringify(page)).not.toContain(hidden)
expect(latestOf((await inbox(s.tabId, as)).body.data).lead).toBe('Project latest')
}
})
diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.ts
index 4240b3698..16dab12b3 100644
--- a/backend/src/superTabs/model.ts
+++ b/backend/src/superTabs/model.ts
@@ -622,8 +622,10 @@ export const NOTICE_READERS = {
'notice-digest': 'recipients',
// Each its own case in commands.ts, decided by the row (forRecipients): statuses, briefs, merges, starts, removals.
system: 'people',
- // A save of the project's instructions, with its summary: the team sees it without opening the document (instructions.ts).
- instructions: 'people',
+ // A save of the project's instructions was posted in the project chat until #3132 (Dee and Ken, 11-05): the rows stored
+ // before are read by nobody (#3165), and a project chat ending in one is served as read (read/servedTops.ts). A change is
+ // read in the Instructions history.
+ instructions: 'agent',
// A member removed one of the coordinator's notes: told to the coordinator alone (instructions.ts).
'note-removed': 'recipients',
'project-report': 'people', route: 'people', 'route-override': 'people', 'buddy-proposal': 'people', 'buddy-proposal-sent': 'people', 'buddy-session-ended': 'people',
diff --git a/cli/src/lib/swarmSkills.spec.ts b/cli/src/lib/swarmSkills.spec.ts
index 6e387f143..3f9384b90 100644
--- a/cli/src/lib/swarmSkills.spec.ts
+++ b/cli/src/lib/swarmSkills.spec.ts
@@ -143,6 +143,14 @@ describe('built-in Swarm skills', () => {
+ '- When a bug or failure is reported, decide its impact before anything else and say it, with the reason, in your reply. Impact 0: something that already shipped is broken, loses data, or stops people\'s or agents\' work (a stuck workflow). Impact 1: needed by users soon. Impact 2: planned goals. Impact 3: tools, docs, process.\n'
+ '- Impact 0 is a hotfix: give it an agent at once and put it ahead of everything else. Its reviews run in parallel. It ships in its own release as soon as its checks pass, outside the usual release spacing and inside the project\'s release hours unless a person says otherwise. The reporter hears the cause, the workaround and when the fix arrives.\n'
+ '- Check open work against these impacts whenever a new report arrives, and do not wait for someone to say urgent.\n\n'
+ // The named-owner section (Leo, 2026-11-05; task #3180): the Lead's alone, in both modes, right after the impact section.
+ const owner = '## Work that has an owner\n'
+ + '- When the project\'s instructions name an agent or a person for a job (an order, a queue, a device, a release), you do not do that job yourself, even when it is urgent. Message that owner with the priority or the change you want, and wait for them.\n'
+ + '- An urgent case means telling the owner first, at once and with the reason; it never means taking over.\n'
+ + '- Setting priorities is not doing the owner\'s job: ask for the order you want, and never reorder, stop or restart their work yourself.\n\n'
+ // The quota section (Dee, 2026-11-05; task #3180): the Lead's alone, in both modes, right after the named-owner section.
+ const quota = '## Spending a person\'s quota\n'
+ + '- You may spend a requester\'s own account quota on that person\'s own task without asking, as long as that account has more than 10% of its week left. Below 10%, ask the person, with your recommendation.\n\n'
// Last in the Default Lead text, which has no red flags: after a blank line, ending the text.
const requestsLast = `\n${requests.trimEnd()}\n`
// The shared-machine rules (Ken, 2026-10-28): the Builder's and the Reviewer's alone, in both modes, in a section of their
@@ -247,7 +255,7 @@ describe('built-in Swarm skills', () => {
it('has every role acknowledge with reactions and post only substance, the Lead adding 🚀 at a merge', () => {
for (const mode of ['orchestration', 'default'] as const) for (const role of ['lead', 'dev', 'review'] as const) {
const text = readFileSync(prepareSwarmSkill(fixture(), { role, key: 'session', mode }).file, 'utf8')
- expect(text, `${mode} ${role}`).toContain(`\n\n${reactions(role)}${role === 'lead' ? impact : ''}## ${role === 'lead' ? 'Requests and Done' : 'Shared machines and secrets'}\n`)
+ expect(text, `${mode} ${role}`).toContain(`\n\n${reactions(role)}${role === 'lead' ? impact + owner + quota : ''}## ${role === 'lead' ? 'Requests and Done' : 'Shared machines and secrets'}\n`)
expect(text.split('## Reactions\n'), `${mode} ${role}`).toHaveLength(2)
expect(text.split(rocket), `${mode} ${role}`).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(took), `${mode} ${role}`).toHaveLength(role === 'dev' ? 2 : 1)
@@ -323,6 +331,8 @@ describe('built-in Swarm skills', () => {
expect(text.split(ask)).toHaveLength(role === 'dev' ? 2 : 1)
expect(text.split(requests)).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(impact)).toHaveLength(role === 'lead' ? 2 : 1)
+ expect(text.split(owner)).toHaveLength(role === 'lead' ? 2 : 1)
+ expect(text.split(quota)).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(failedStart)).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(shared)).toHaveLength(role === 'lead' ? 1 : 2)
expect(text.split(report)).toHaveLength(role === 'lead' ? 2 : 1)
@@ -333,7 +343,7 @@ describe('built-in Swarm skills', () => {
expect(text.split(thread)).toHaveLength(role === 'lead' ? 2 : 1)
expect([cardLead, cardDev, cardReview].map(line => text.split(line).length)).toEqual([role === 'lead' ? 2 : 1, role === 'dev' ? 2 : 1, role === 'review' ? 2 : 1])
expect(sha(approved(text, 'orchestration', role).replace(whoReaches(role), '').replace(reactions(role), '').replace(twoHours, '').replace(terminal, '').replace(update, '').replace(overlap, '').replace(local, '').replace(failedStart, '').replace(mention, '').replace(lost, '').replace(checkpoint, '')
- .replace(limit, '').replace(digest, '').replace(decision, '').replace(ask, '').replace(impact, '').replace(requests, '').replace(shared, '').replace(report, '').replace(quiet, '')
+ .replace(limit, '').replace(digest, '').replace(decision, '').replace(ask, '').replace(impact, '').replace(owner, '').replace(quota, '').replace(requests, '').replace(shared, '').replace(report, '').replace(quiet, '')
.replace(missingStop, '').replace(reviewCheck, '').replace(moveMissing, '').replace(thread, '').replace(queue, '')
.replace(cardLead, '').replace(cardDev, '').replace(cardReview, ''))).toBe(sha256)
}
@@ -414,12 +424,12 @@ describe('built-in Swarm skills', () => {
const orchestration = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session' }).file, 'utf8')
expect(orchestration).toContain(`\n\n${requests}## Red flags`)
const plain = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode: 'default' }).file, 'utf8')
- expect(plain.endsWith(`Call the roles Product Manager, Engineer and Reviewer.\n${thread}\n${whoReaches('lead')}${reactionsBefore('lead').slice(1)}\n${impact.trimEnd()}\n${requestsLast}`)).toBe(true)
+ expect(plain.endsWith(`Call the roles Product Manager, Engineer and Reviewer.\n${thread}\n${whoReaches('lead')}${reactionsBefore('lead').slice(1)}\n${impact}${owner}${quota.trimEnd()}\n${requestsLast}`)).toBe(true)
})
it('gives each Lead skill an impact section right before its requests section, and no other role', () => {
for (const mode of ['orchestration', 'default'] as const) {
const lead = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode }).file, 'utf8')
- expect(lead).toContain(`${impact}${mode === 'default' ? requestsLast.slice(1) : requests}`)
+ expect(lead).toContain(`${impact}${owner}${quota}${mode === 'default' ? requestsLast.slice(1) : requests}`)
// The impact levels and every hotfix step the section promises.
for (const part of ['decide its impact before anything else', 'say it, with the reason, in your reply', 'Impact 0: something that already shipped is broken, loses data, or stops people\'s or agents\' work (a stuck workflow)',
'Impact 1: needed by users soon', 'Impact 2: planned goals', 'Impact 3: tools, docs, process', 'Impact 0 is a hotfix', 'an agent at once', 'ahead of everything else',
@@ -430,6 +440,26 @@ describe('built-in Swarm skills', () => {
}
}
})
+ it('tells each Lead, and no other role, not to do work its instructions give to a named owner, even when urgent', () => {
+ for (const mode of ['orchestration', 'default'] as const) {
+ const lead = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode }).file, 'utf8')
+ // Each promise: it names the jobs, bars doing them, covers the urgent case, and sends the change to the owner to wait on.
+ for (const part of ['## Work that has an owner', 'name an agent or a person for a job', 'you do not do that job yourself, even when it is urgent', 'Message that owner with the priority or the change you want, and wait for them',
+ 'An urgent case means telling the owner first', 'it never means taking over', 'never reorder, stop or restart their work yourself']) expect(lead).toContain(part)
+ for (const role of ['dev', 'review', 'buddy'] as const) {
+ expect(readFileSync(prepareSwarmSkill(fixture(), { role, key: 'session', mode }).file, 'utf8')).not.toContain('## Work that has an owner')
+ }
+ }
+ })
+ it('lets each Lead, and no other role, spend a requester\'s own quota on their task above 10% of the week, and ask below it', () => {
+ for (const mode of ['orchestration', 'default'] as const) {
+ const lead = readFileSync(prepareSwarmSkill(fixture(), { role: 'lead', key: 'session', mode }).file, 'utf8')
+ for (const part of ['## Spending a person\'s quota', 'a requester\'s own account quota on that person\'s own task without asking', 'more than 10% of its week left', 'Below 10%, ask the person, with your recommendation']) expect(lead).toContain(part)
+ for (const role of ['dev', 'review', 'buddy'] as const) {
+ expect(readFileSync(prepareSwarmSkill(fixture(), { role, key: 'session', mode }).file, 'utf8')).not.toContain('## Spending a person')
+ }
+ }
+ })
it('gives each Builder and Reviewer skill its shared-machine rules in a section of their own: before the red flags, or last', () => {
const lastBefore = { dev: '- Write to people in their language, without commands or internal ids. Call the roles Product Manager, Engineer and Reviewer.\n',
review: '## 4. Finish\nMark your review done with the verdict and revision.\n' }
@@ -524,6 +554,8 @@ describe('built-in Swarm skills', () => {
expect(text.split(ask)).toHaveLength(role === 'dev' ? 2 : 1)
expect(text.split(requestsLast)).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(impact)).toHaveLength(role === 'lead' ? 2 : 1)
+ expect(text.split(owner)).toHaveLength(role === 'lead' ? 2 : 1)
+ expect(text.split(quota)).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(failedStart)).toHaveLength(role === 'lead' ? 2 : 1)
expect(text.split(sharedLast)).toHaveLength(role === 'lead' ? 1 : 2)
expect(text.split(report)).toHaveLength(role === 'lead' ? 2 : 1)
@@ -534,7 +566,7 @@ describe('built-in Swarm skills', () => {
expect(text.split(thread)).toHaveLength(role === 'lead' ? 2 : 1)
expect([cardLead, cardDev, cardReview].map(line => text.split(line).length)).toEqual([role === 'lead' ? 2 : 1, role === 'dev' ? 2 : 1, role === 'review' ? 2 : 1])
expect(sha(approved(text, 'default', role).replace(whoReaches(role), '').replace(reactions(role), '').replace(terminal, '').replace(update, '').replace(overlap, '').replace(localDefault, '').replace(failedStart, '').replace(mention, '').replace(lost, '').replace(checkpoint, '')
- .replace(limit, '').replace(digest, '').replace(decision, '').replace(ask, '').replace(impact, '').replace(requestsLast, '').replace(sharedLast, '').replace(report, '').replace(quiet, '')
+ .replace(limit, '').replace(digest, '').replace(decision, '').replace(ask, '').replace(impact, '').replace(owner, '').replace(quota, '').replace(requestsLast, '').replace(sharedLast, '').replace(report, '').replace(quiet, '')
.replace(missingStop, '').replace(reviewCheck, '').replace(moveMissing, '').replace(thread, '').replace(queue, '')
.replace(cardLead, '').replace(cardDev, '').replace(cardReview, ''))).toBe(sha256)
expect(prepared.instructions).toMatch(/^Use the built-in swarm-tools skill /)
diff --git a/cli/src/lib/swarmSkills.ts b/cli/src/lib/swarmSkills.ts
index 8c3e8d415..b4aac10dd 100644
--- a/cli/src/lib/swarmSkills.ts
+++ b/cli/src/lib/swarmSkills.ts
@@ -176,6 +176,14 @@ For large work, post the group plan and get the owner's ok before assigning; onc
- Impact 0 is a hotfix: give it an agent at once and put it ahead of everything else. Its reviews run in parallel. It ships in its own release as soon as its checks pass, outside the usual release spacing and inside the project's release hours unless a person says otherwise. The reporter hears the cause, the workaround and when the fix arrives.
- Check open work against these impacts whenever a new report arrives, and do not wait for someone to say urgent.
+## Work that has an owner
+- When the project's instructions name an agent or a person for a job (an order, a queue, a device, a release), you do not do that job yourself, even when it is urgent. Message that owner with the priority or the change you want, and wait for them.
+- An urgent case means telling the owner first, at once and with the reason; it never means taking over.
+- Setting priorities is not doing the owner's job: ask for the order you want, and never reorder, stop or restart their work yourself.
+
+## Spending a person's quota
+- You may spend a requester's own account quota on that person's own task without asking, as long as that account has more than 10% of its week left. Below 10%, ask the person, with your recommendation.
+
## Requests and Done
- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.
- Right after you merge a group's pull request, record it: conversation.merged with the group and the PR link, and mergedAt for a merge you record later. The leaderboard counts the request as shipped at the merge, even if its work is lost or cancelled afterwards. Mark a group Done only after its pull request has merged.
@@ -506,6 +514,14 @@ When the project owner asks in chat to switch this project's skills (Default or
- Impact 0 is a hotfix: give it an agent at once and put it ahead of everything else. Its reviews run in parallel. It ships in its own release as soon as its checks pass, outside the usual release spacing and inside the project's release hours unless a person says otherwise. The reporter hears the cause, the workaround and when the fix arrives.
- Check open work against these impacts whenever a new report arrives, and do not wait for someone to say urgent.
+## Work that has an owner
+- When the project's instructions name an agent or a person for a job (an order, a queue, a device, a release), you do not do that job yourself, even when it is urgent. Message that owner with the priority or the change you want, and wait for them.
+- An urgent case means telling the owner first, at once and with the reason; it never means taking over.
+- Setting priorities is not doing the owner's job: ask for the order you want, and never reorder, stop or restart their work yourself.
+
+## Spending a person's quota
+- You may spend a requester's own account quota on that person's own task without asking, as long as that account has more than 10% of its week left. Below 10%, ask the person, with your recommendation.
+
## Requests and Done
- When you open a group for a person's request, asked in the project chat or proposed by their Buddy on their behalf, name them as its requester: requesterId on conversation.create, or conversation.requester for a group already open. It records only that they asked, never what they wrote. Name the message it came from as well: proposalMessageId for their Buddy's proposal, requestMessageId for their own message in the project chat. That message stays the task's one message in the chat; without one, the Swarm posts the title as them, marked as a task. The Swarm replies in its thread at each change, so you post no progress there.
- Right after you merge a group's pull request, record it: conversation.merged with the group and the PR link, and mergedAt for a merge you record later. The leaderboard counts the request as shipped at the merge, even if its work is lost or cancelled afterwards. Mark a group Done only after its pull request has merged.
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index 94bdcc21a..451f70ac3 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -2069,7 +2069,8 @@ class SuperTabController extends ChangeNotifier {
static bool _listed(SuperTabMessage m) =>
m.source['kind'] != 'update-request' &&
!m.terminalPrompt &&
- !m.terminalGap;
+ !m.terminalGap &&
+ !m.instructionsSave;
/// [id]'s messages with its steps' rows merged in by time (task steps
/// design): each step keeps its own conversation, shown inside its task.
diff --git a/desktop/lib/super_tabs/instructions_panel.dart b/desktop/lib/super_tabs/instructions_panel.dart
index 146ea756f..027cccd6a 100644
--- a/desktop/lib/super_tabs/instructions_panel.dart
+++ b/desktop/lib/super_tabs/instructions_panel.dart
@@ -49,40 +49,26 @@ bool _overLimit(String text) {
/// The project's instruction document in the Swarm's details frame: every member reads it, and a member who can
/// write saves a change with a one-line summary on the revision they read (spec: The instruction document).
-/// With [revision], it opens on History with that revision shown: what an
-/// instructions save's chat line links to (#3021).
Future<void> showSuperTabInstructions(
BuildContext context,
SuperTabController c,
- String projectId, {
- int? revision,
-}) => showAppDialog<void>(
+ String projectId,
+) => showAppDialog<void>(
context: context,
builder: (context) => SuperTabDialogScope(
controller: c,
projectId: projectId,
requireWrite: false,
- child: _InstructionsPanel(
- controller: c,
- projectId: projectId,
- revision: revision,
- ),
+ child: _InstructionsPanel(controller: c, projectId: projectId),
),
);
class _InstructionsPanel extends StatefulWidget {
- const _InstructionsPanel({
- required this.controller,
- required this.projectId,
- this.revision,
- });
+ const _InstructionsPanel({required this.controller, required this.projectId});
final SuperTabController controller;
final String projectId;
- /// The revision to open on, in History; null opens the document.
- final int? revision;
-
@override
State<_InstructionsPanel> createState() => _InstructionsPanelState();
}
@@ -134,11 +120,6 @@ class _InstructionsPanelState extends State<_InstructionsPanel> {
super.initState();
c.addListener(_onSwarm);
unawaited(_read());
- if (widget.revision case final revision?) {
- _view = _View.history;
- unawaited(_readHistory());
- unawaited(_pick(revision));
- }
}
@override
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dart
index c59abd464..ea31d5791 100644
--- a/desktop/lib/super_tabs/message_row.dart
+++ b/desktop/lib/super_tabs/message_row.dart
@@ -78,7 +78,6 @@ class SuperTabMessageRow extends StatefulWidget {
this.onOpenReply,
this.references = const {},
this.onOpenGroup,
- this.onOpenInstructions,
this.mentions = const [],
this.mentionAddresses = const {},
this.mentionLabels = const {},
@@ -153,9 +152,6 @@ class SuperTabMessageRow extends StatefulWidget {
final Map<int, String> references;
final ValueChanged<String>? onOpenGroup;
- /// Opens the revision an instructions save's line names
- /// ([SuperTabMessage.instructionsSave]), to read the change whole.
- final ValueChanged<({String projectId, int revision})>? onOpenInstructions;
final String author;
final SuperTabAgent? agent;
@@ -852,32 +848,6 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
),
),
),
- if ((
- message.deleted
- ? null
- : message.instructionsSave,
- widget.onOpenInstructions,
- )
- case (final saved?, final open?))
- Padding(
- padding: const EdgeInsets.only(
- top: grid.AppDesktop.menuInset,
- ),
- child: SuperTabLink(
- key: ValueKey(
- 'super-instructions-link-${message.id}',
- ),
- label: 'See revision ${saved.revision}',
- onTap: () => open(saved),
- child: Text(
- 'See revision ${saved.revision}',
- style: DesktopChrome.control(
- color: DesktopChrome.accent,
- medium: true,
- ),
- ),
- ),
- ),
if (message.editedAt != null &&
!message.deleted &&
_editing == null)
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index 02400ea89..132ce6280 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -1555,16 +1555,11 @@ class SuperTabMessage {
/// The project chat's line when linked work is Done (ship_row.dart).
bool get shipLine => source['kind'] == 'ship';
- /// The project and revision an instructions save's chat line names, which
- /// its "See revision" link opens (#3021); null for any other row.
- ({String projectId, int revision})? get instructionsSave =>
- switch ((source['kind'], source['projectId'], source['revision'])) {
- ('instructions', final String projectId, final num revision) => (
- projectId: projectId,
- revision: revision.toInt(),
- ),
- _ => null,
- };
+ /// A line the backend posted for an instructions save: no chat row and
+ /// nothing unread, since it gives a person nothing to do (Dee 11-05, task
+ /// #3165). The backend posts none since #3132; the History keeps every
+ /// revision.
+ bool get instructionsSave => source['kind'] == 'instructions';
/// A line the chat draws as its own row, with no sender's header (view.dart):
/// a message after it has no header to join (Diego, #2547).
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 9cd4c935b..6e53b87ff 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -3989,14 +3989,6 @@ class _SuperTabViewState extends State<SuperTabView>
username: name,
},
references: _references,
- onOpenInstructions: (saved) => unawaited(
- showSuperTabInstructions(
- context,
- c,
- saved.projectId,
- revision: saved.revision,
- ),
- ),
onOpenGroup: (id) {
setState(() => _showPullRequests = _showTasks = false);
c.select(id);
diff --git a/desktop/test/super_tab_instructions_rows_test.dart b/desktop/test/super_tab_instructions_rows_test.dart
new file mode 100644
index 000000000..4ee3d1370
--- /dev/null
+++ b/desktop/test/super_tab_instructions_rows_test.dart
@@ -0,0 +1,82 @@
+import 'package:flutter_test/flutter_test.dart';
+
+import 'super_tab_mentions_test.dart' show showView;
+import 'super_tab_quiet_chat_test.dart' show project, row;
+
+// Dee, 11-05 (task #3165): #lamp-gtm showed "Lead changed the instructions for
+// dee: ..." with its Removed/Added lines and "See revision N", which nobody can
+// act on. The backend posts none since #3132; the ones already in chats are no
+// row and nothing unread. Nothing is deleted: the instructions' History keeps
+// every revision.
+
+const _text =
+ 'Lead changed the instructions for dee: Routing: no Haiku.\n\n'
+ 'In Routing:\nRemoved: Haiku reviews.\nAdded: Opus reviews.';
+
+Map<String, dynamic> _saved(int sequence) => row(
+ 'saved-$sequence',
+ sequence,
+ _text,
+ source: {'kind': 'instructions', 'projectId': 'lead', 'revision': sequence},
+);
+
+void main() {
+ testWidgets('an instruction-change post is no chat row; other posts show', (
+ tester,
+ ) async {
+ final c = await showView(
+ tester,
+ project([row('m1', 1, 'A real update'), _saved(2), row('m3', 3, 'Next')]),
+ );
+ await c.loadMessages('lead');
+ await tester.pumpAndSettle();
+ expect(find.text('A real update'), findsOneWidget);
+ expect(find.text('Next'), findsOneWidget);
+ expect(find.textContaining('changed the instructions'), findsNothing);
+ expect(find.textContaining('Removed: Haiku reviews.'), findsNothing);
+ expect(find.textContaining('See revision'), findsNothing);
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('the chat lists only its other posts', (tester) async {
+ final c = await showView(
+ tester,
+ project([row('m1', 1, 'A real update'), _saved(2), _saved(3)]),
+ );
+ await c.loadMessages('lead');
+ expect([for (final m in c.messages('lead')) m.id], ['m1']);
+ });
+
+ testWidgets('a chat whose only new rows are instruction changes shows as '
+ 'read', (tester) async {
+ final server = project([
+ row('m1', 1, 'Hello'),
+ _saved(2),
+ _saved(3),
+ ], read: 1);
+ final c = server.controller();
+ await c.refresh();
+ addTearDown(c.dispose);
+ await c.loadMessages('lead');
+ final lead = c.snapshot!.conversation('lead')!;
+ expect(c.unread(lead), isFalse);
+ expect(c.unreadCount(lead), 0);
+ });
+
+ testWidgets('an instruction change beside a real post counts only the post', (
+ tester,
+ ) async {
+ final server = project([
+ row('m1', 1, 'Hello'),
+ _saved(2),
+ row('m3', 3, 'Real news'),
+ ], read: 1);
+ final c = server.controller();
+ await c.refresh();
+ addTearDown(c.dispose);
+ await c.loadMessages('lead');
+ final lead = c.snapshot!.conversation('lead')!;
+ expect(c.unread(lead), isTrue);
+ expect(c.unreadCount(lead), 1);
+ });
+}
diff --git a/desktop/test/super_tab_instructions_shots_test.dart b/desktop/test/super_tab_instructions_shots_test.dart
deleted file mode 100644
index 9d3fcfa8b..000000000
--- a/desktop/test/super_tab_instructions_shots_test.dart
+++ /dev/null
@@ -1,132 +0,0 @@
-import 'dart:io';
-import 'dart:ui' as ui;
-
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness/shared/theme/app_theme.dart' as grid;
-import 'package:harness/super_tabs/view.dart';
-
-import 'box_render_preview_test.dart' show loadPreviewFonts;
-import 'support/super_tab_fixture.dart';
-
-/// Set to a folder to write the PR's screenshots there.
-final shots = Platform.environment['SUPER_TAB_INSTRUCTIONS_SHOTS'];
-
-/// An instructions save's line in the project chat and the revision its link
-/// opens (Ken, 11-05, #3021), in both appearances, from made-up data only.
-void main() {
- setUpAll(() async {
- if (shots != null) await loadPreviewFonts();
- });
-
- for (final brightness in Brightness.values) {
- testWidgets('screenshots for review (${brightness.name})', (tester) async {
- final picture = GlobalKey();
- final server = ConversationServer();
- server.state['projects'] = [
- {
- ...projectFixture('lead', 'openharness', 'lead'),
- 'coordinatorName': 'Product Manager',
- 'instructionsRevision': 68,
- },
- ];
- server.instructions['lead'] = {
- 'projectId': 'lead',
- 'revision': 68,
- 'hash': 'hash-lead-68',
- 'text': '## Routing\n\n### Models\n\n- Reviewers run on Opus.\n',
- 'template': false,
- 'coordinatorName': 'Product Manager',
- 'notesRevision': 0,
- 'notes': <dynamic>[],
- };
- final now = DateTime.now().toUtc();
- server.instructionRevisions['lead'] = [
- {
- 'revision': 68,
- 'hash': 'hash-lead-68',
- 'summary': 'Routing: no Haiku.',
- 'writtenBy': {'kind': 'agent', 'id': 'pm'},
- 'askedBy': 'owner',
- 'at': now.subtract(const Duration(minutes: 3)).toIso8601String(),
- 'text':
- '## Routing\n\n### Models\n\n- No agent runs below high effort, '
- 'and none on Claude Haiku.\n- Reviewers run on Opus.\n',
- },
- ];
- server.append(
- 'River changed the instructions for owner: Routing: no Haiku.\n\n'
- 'In Routing › Models:\n'
- 'Removed: No agent runs below high effort.\n'
- 'Added: No agent runs below high effort, and none on Claude Haiku.\n'
- 'Added: Reviewers run on Opus.\n\n'
- 'In Workflow:\n'
- 'Added: The Engineer adds the review step when the pull request is '
- 'ready.\n\n'
- 'and 9 more changes.',
- );
- server.messages.last
- ..['author'] = const {
- 'kind': 'agent',
- 'id': 'pm',
- 'name': 'Lead',
- 'displayName': 'River',
- }
- ..['createdAt'] = now
- .subtract(const Duration(minutes: 3))
- .toIso8601String()
- ..['source'] = const {
- 'kind': 'instructions',
- 'projectId': 'lead',
- 'revision': 68,
- };
- final c = server.controller();
- addTearDown(c.dispose);
- await c.refresh();
- grid.AppTheme.brightness.value = brightness;
- addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);
- await tester.binding.setSurfaceSize(const Size(1280, 860));
- addTearDown(() => tester.binding.setSurfaceSize(null));
- await tester.pumpWidget(
- MaterialApp(
- theme: grid.buildAppTheme(brightness: brightness),
- builder: (context, child) =>
- RepaintBoundary(key: picture, child: child),
- home: Scaffold(
- body: SuperTabView(
- controller: c,
- onInvite: () {},
- onAddAgent: (_) {},
- onOpenTerminal: (_) {},
- machineName: (_) => 'Mac Studio',
- ),
- ),
- ),
- );
- await tester.pumpAndSettle();
- expect(find.text('See revision 68'), findsOneWidget);
-
- Future<void> shot(String name) async {
- if (shots == null) return;
- await tester.runAsync(() async {
- final boundary =
- picture.currentContext!.findRenderObject()!
- as RenderRepaintBoundary;
- final image = await boundary.toImage(pixelRatio: 1.5);
- final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
- await Directory(shots!).create(recursive: true);
- await File('$shots/instructions-$name-${brightness.name}.png')
- .writeAsBytes(bytes!.buffer.asUint8List());
- image.dispose();
- });
- }
-
- await shot('chat');
- await tester.tap(find.text('See revision 68'));
- await tester.pumpAndSettle();
- expect(find.byKey(const ValueKey('super-revision-text')), findsOneWidget);
- await shot('revision');
- });
- }
-}
diff --git a/desktop/test/super_tab_instructions_test.dart b/desktop/test/super_tab_instructions_test.dart
index b60f0a2ff..371ae2bb9 100644
--- a/desktop/test/super_tab_instructions_test.dart
+++ b/desktop/test/super_tab_instructions_test.dart
@@ -569,68 +569,6 @@ void main() {
expect(editorText(tester), 'Text of revision 7');
});
- // Ken, 11-05 (#3021): the save's chat line shows the lines it changed, and opens the revision it saved to read it whole.
- testWidgets(
- 'an instructions line in the chat opens the revision it saved',
- (tester) async {
- final (server, _) = await mount(
- tester,
- account: 'peer',
- messages: [
- {
- 'id': 'saved',
- 'conversationId': 'lead',
- 'sequence': 1,
- 'text':
- 'owner changed the instructions: Reviews run on Opus.\n\n'
- 'In Routing › Models:\nRemoved: Haiku reviews.\n'
- 'Added: Opus reviews.\n\nand 3 more changes.',
- 'createdAt': ago(const Duration(minutes: 5)),
- 'author': {'kind': 'person', 'id': 'owner', 'name': 'owner'},
- 'source': {
- 'kind': 'instructions',
- 'projectId': 'lead',
- 'revision': 8,
- },
- },
- {
- 'id': 'plain',
- 'conversationId': 'lead',
- 'sequence': 2,
- 'text': 'Thanks, I read it.',
- 'createdAt': ago(const Duration(minutes: 4)),
- 'author': {'kind': 'person', 'id': 'peer', 'name': 'peer'},
- },
- ],
- );
- seed(server);
- expect(find.textContaining('Haiku reviews.'), findsOneWidget);
- expect(find.textContaining('and 3 more changes.'), findsOneWidget);
- // One link, on the save's line only.
- final link = find.byKey(
- const ValueKey('super-instructions-link-saved'),
- );
- expect(link, findsOneWidget);
- expect(find.text('See revision 8'), findsOneWidget);
- expect(
- find.byKey(const ValueKey('super-instructions-link-plain')),
- findsNothing,
- );
- await tester.tap(link);
- await tester.pumpAndSettle();
- expect(find.text('Instructions › History'), findsOneWidget);
- expect(
- server.instructionReads.where((r) => r.endsWith('/revisions/8')),
- hasLength(1),
- );
- final text = tester.widget<TextField>(
- find.byKey(const ValueKey('super-revision-text')),
- );
- expect(text.readOnly, isTrue);
- expect(text.controller!.text, 'Text of revision 8');
- },
- );
-
testWidgets('a viewer has no Restore', (tester) async {
final (server, _) = await mount(tester, account: 'viewer');
seed(server);
diff --git a/mobile/lib/swarm/model.dart b/mobile/lib/swarm/model.dart
index f35f21bc3..d592dabc1 100644
--- a/mobile/lib/swarm/model.dart
+++ b/mobile/lib/swarm/model.dart
@@ -1472,16 +1472,11 @@ class SuperTabMessage {
SuperTabRoute? get route => SuperTabRoute.fromSource(source);
bool get routeOverride => source['kind'] == 'route-override';
- /// The project and revision an instructions save's chat line names, which
- /// its "See revision" link opens (#3021); null for any other row.
- ({String projectId, int revision})? get instructionsSave =>
- switch ((source['kind'], source['projectId'], source['revision'])) {
- ('instructions', final String projectId, final num revision) => (
- projectId: projectId,
- revision: revision.toInt(),
- ),
- _ => null,
- };
+ /// A line the backend posted for an instructions save: no chat row and
+ /// nothing unread, since it gives a person nothing to do (Dee 11-05, task
+ /// #3165). The backend posts none since #3132; the History keeps every
+ /// revision.
+ bool get instructionsSave => source['kind'] == 'instructions';
/// A task's root the server posted in its person's name (plain chat, #2294):
/// theirs to read, not their own writing, so it reads nothing before it and
diff --git a/mobile/lib/swarm/swarm_conversation.dart b/mobile/lib/swarm/swarm_conversation.dart
index 1c71f645a..fb896bbae 100644
--- a/mobile/lib/swarm/swarm_conversation.dart
+++ b/mobile/lib/swarm/swarm_conversation.dart
@@ -179,14 +179,19 @@ class SwarmConversation extends ChangeNotifier
/// The [messages] the chat lists: a reply only in its thread shows there
/// alone ([SuperTabMessage.inMainStream], the desktop's main stream), and
- /// what was typed into a terminal or a gap in its recording is no row
- /// ([SuperTabMessage.terminalPrompt], [SuperTabMessage.terminalGap]).
+ /// what was typed into a terminal, a gap in its recording or the line of an
+ /// instructions save is no row ([SuperTabMessage.terminalPrompt],
+ /// [SuperTabMessage.terminalGap], [SuperTabMessage.instructionsSave]).
List<SuperTabMessage> get stream {
if (!identical(_streamOf, messages)) {
_streamOf = messages;
_stream = List.unmodifiable(
messages.where(
- (m) => m.inMainStream && !m.terminalPrompt && !m.terminalGap,
+ (m) =>
+ m.inMainStream &&
+ !m.terminalPrompt &&
+ !m.terminalGap &&
+ !m.instructionsSave,
),
);
}
diff --git a/mobile/lib/swarm/swarm_conversation_page.dart b/mobile/lib/swarm/swarm_conversation_page.dart
index 73c3351a7..ae0fa4829 100644
--- a/mobile/lib/swarm/swarm_conversation_page.dart
+++ b/mobile/lib/swarm/swarm_conversation_page.dart
@@ -50,7 +50,6 @@ import 'swarm_link_previews.dart';
import 'swarm_message_edit.dart';
import 'swarm_message_link.dart';
import 'swarm_message_receipt.dart';
-import 'swarm_instructions_page.dart' show openSwarmInstructionsRevision;
import 'swarm_message_row.dart';
import 'swarm_need_rows.dart';
import 'swarm_paste.dart';
@@ -2267,12 +2266,6 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
readerId: c.reader.accountId,
references: references,
onOpenConversation: (id) => _openNumberedConversation(c, id),
- onOpenInstructions: (saved) => openSwarmInstructionsRevision(
- context,
- reader: c.reader,
- projectId: saved.projectId,
- revision: saved.revision,
- ),
grouped: grouped,
lit: lit,
followed: followed,
diff --git a/mobile/lib/swarm/swarm_instructions_page.dart b/mobile/lib/swarm/swarm_instructions_page.dart
index e9c62c372..875790448 100644
--- a/mobile/lib/swarm/swarm_instructions_page.dart
+++ b/mobile/lib/swarm/swarm_instructions_page.dart
@@ -31,202 +31,6 @@ void openSwarmInstructions(
),
);
-/// Opens one saved revision of [projectId]'s instructions, read only: where an
-/// instructions save's line in the chat leads (#3021).
-void openSwarmInstructionsRevision(
- BuildContext context, {
- required SwarmReader reader,
- required String projectId,
- required int revision,
-}) => unawaited(
- Navigator.of(context).push(
- phoneRoute(
- (_) => SwarmInstructionsRevisionPage(
- reader: reader,
- projectId: projectId,
- revision: revision,
- ),
- ),
- ),
-);
-
-/// One kept revision of a project's instructions: its text, who saved it, when
-/// and their summary. Read once when it opens, and again on a pull; a revision
-/// no longer kept says so.
-class SwarmInstructionsRevisionPage extends StatefulWidget {
- const SwarmInstructionsRevisionPage({
- super.key,
- required this.reader,
- required this.projectId,
- required this.revision,
- });
-
- final SwarmReader reader;
- final String projectId;
- final int revision;
-
- @override
- State<SwarmInstructionsRevisionPage> createState() =>
- _SwarmInstructionsRevisionPageState();
-}
-
-class _SwarmInstructionsRevisionPageState
- extends State<SwarmInstructionsRevisionPage> {
- SuperTabRevision? _saved;
- String? _error;
- bool _gone = false;
-
- @override
- void initState() {
- super.initState();
- unawaited(_read());
- }
-
- Future<void> _read() async {
- final reader = widget.reader;
- try {
- final answer = superTabMap(
- await reader.request(
- 'GET',
- superTabInstructionsPath(
- reader.tabId,
- widget.projectId,
- revision: widget.revision,
- ),
- ),
- );
- if (!mounted) return;
- setState(() {
- _saved = SuperTabRevision.fromJson(answer);
- _error = null;
- });
- } on SuperTabFailure catch (failure) {
- if (!mounted) return;
- setState(() {
- _gone = failure.statusCode == 404;
- _error = failure.message;
- });
- } on Object {
- if (!mounted) return;
- setState(() => _error = 'Couldn’t read this revision.');
- }
- }
-
- /// Who saved it: a person by name, an agent by its name, else Harness.
- String _writer(SuperTabRevision saved) {
- final snapshot = widget.reader.snapshot;
- final by = saved.writtenBy;
- return switch (by.kind) {
- 'person' =>
- snapshot?.people.where((p) => p.id == by.id).firstOrNull?.shownName ??
- 'a member',
- 'agent' =>
- snapshot?.agentName(by.id, fallback: 'Product Manager') ??
- 'Product Manager',
- _ => 'Harness',
- };
- }
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final project = widget.reader.snapshot?.projects
- .where((p) => p.id == widget.projectId)
- .firstOrNull;
- final saved = _saved;
- final quiet = Tty.of(context)
- .style(color: AppPalette.textFaint, size: 12.5);
- final error = _error;
- return Scaffold(
- backgroundColor: AppPalette.windowBg,
- body: SafeArea(
- bottom: false,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- SwarmTopBar(
- leading: SwarmBackButton(
- onPressed: () => Navigator.of(context).maybePop(),
- ),
- title: 'Instructions',
- subtitle: [
- if (project != null) '#${project.name}',
- 'revision ${widget.revision}',
- ].join(' · '),
- ),
- Expanded(
- child: RefreshIndicator(
- onRefresh: _read,
- child: SelectionArea(
- child: ListView(
- physics: const AlwaysScrollableScrollPhysics(),
- padding: EdgeInsets.fromLTRB(
- AppSpace.m,
- AppSpace.xs,
- AppSpace.m,
- MediaQuery.paddingOf(context).bottom + AppSpace.xl,
- ),
- children: [
- if (saved != null) ...[
- Text(
- '${_writer(saved)} · '
- '${relativeAgo(saved.at, clock.now())} · '
- '${saved.summary}',
- key: const ValueKey('swarm-revision-saved'),
- style: quiet,
- ),
- const SizedBox(height: AppSpace.s),
- for (final part in swarmTextParts(saved.text ?? ''))
- if (part.code)
- SwarmCodeBlock(code: part.text, name: part.name)
- else
- Padding(
- padding: const EdgeInsets.only(
- bottom: AppSpace.s,
- ),
- child: Text(part.text, style: swarmChatText(15)),
- ),
- ] else if (_gone)
- Text(
- 'Revision ${widget.revision} is no longer kept: '
- 'a project keeps its last 50.',
- key: const ValueKey('swarm-revision-gone'),
- style: swarmChatText(
- 15,
- color: AppPalette.textSecondary,
- ),
- )
- else if (error != null) ...[
- Text(
- error,
- key: const ValueKey('swarm-revision-error'),
- style: swarmChatText(
- 15,
- color: AppPalette.textSecondary,
- ),
- ),
- const SizedBox(height: AppSpace.s),
- Align(
- alignment: Alignment.centerLeft,
- child: SwarmButton(
- label: 'Try again',
- onPressed: () => unawaited(_read()),
- ),
- ),
- ] else
- Text('Loading…', style: quiet),
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
-}
-
/// A project's instruction document and its coordinator's notes (project
/// instructions, decisions 15 and 16). Read when it opens and again when the
/// project's `instructionsRevision` or `notesRevision` moves in the Swarm read;
diff --git a/mobile/lib/swarm/swarm_message_row.dart b/mobile/lib/swarm/swarm_message_row.dart
index 9f4c572e8..1edd45f43 100644
--- a/mobile/lib/swarm/swarm_message_row.dart
+++ b/mobile/lib/swarm/swarm_message_row.dart
@@ -293,7 +293,6 @@ class SwarmMessageRow extends StatelessWidget {
this.onLongPress,
this.references = const {},
this.onOpenConversation,
- this.onOpenInstructions,
});
final SuperTabMessage message;
@@ -344,10 +343,6 @@ class SwarmMessageRow extends StatelessWidget {
/// Opens a conversation resolved from [references].
final ValueChanged<String>? onOpenConversation;
- /// Opens the revision an instructions save's line names
- /// ([SuperTabMessage.instructionsSave]), to read the change whole.
- final ValueChanged<({String projectId, int revision})>? onOpenInstructions;
-
/// Null where the person cannot post, or in the thread itself.
final VoidCallback? onReply;
@@ -515,22 +510,6 @@ class SwarmMessageRow extends StatelessWidget {
onOpenConversation: onOpenConversation,
),
),
- if ((message.instructionsSave, onOpenInstructions) case (
- final saved?,
- final open?,
- ))
- TtyTap(
- key: ValueKey('swarm-instructions-link-${message.id}'),
- semanticsLabel: 'See revision ${saved.revision}',
- onTap: () => open(saved),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: AppSpace.xs),
- child: Text(
- 'See revision ${saved.revision}',
- style: swarmChatText(14, color: AppPalette.accentOnSurface),
- ),
- ),
- ),
if (message.editedAt != null)
Padding(
padding: const EdgeInsets.only(top: AppSpace.xs),
diff --git a/mobile/test/swarm/swarm_instructions_line_test.dart b/mobile/test/swarm/swarm_instructions_line_test.dart
deleted file mode 100644
index 9b22fb545..000000000
--- a/mobile/test/swarm/swarm_instructions_line_test.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness_mobile/swarm/model.dart';
-import 'package:harness_mobile/swarm/swarm_message_row.dart';
-
-/// An instructions save's line in the project chat shows what it changed and
-/// opens the revision it saved (Ken, 11-05, #3021).
-void main() {
- Widget row(
- Map<String, dynamic> source,
- void Function(({String projectId, int revision}))? open,
- ) => MaterialApp(
- home: Scaffold(
- body: ListView(
- children: [
- SwarmMessageRow(
- message: SuperTabMessage.fromJson({
- 'id': 'saved',
- 'conversationId': 'lead',
- 'text':
- 'owner changed the instructions: Reviews run on Opus.\n\n'
- 'In Routing › Models:\nRemoved: Haiku reviews.\n'
- 'Added: Opus reviews.\n\nand 3 more changes.',
- 'sequence': 1,
- 'author': {'kind': 'person', 'id': 'owner', 'name': 'owner'},
- 'createdAt': DateTime.utc(2026, 11, 5).toIso8601String(),
- 'source': source,
- }),
- name: 'owner',
- look: (picture: null, status: null),
- role: null,
- mentions: SwarmMentions(const []),
- grouped: false,
- lit: false,
- quote: null,
- actions: false,
- onTap: () {},
- onReply: null,
- onOpenInstructions: open,
- ),
- ],
- ),
- ),
- );
-
- testWidgets('shows the change and opens the revision it saved', (
- tester,
- ) async {
- final opened = <({String projectId, int revision})>[];
- await tester.pumpWidget(
- row({
- 'kind': 'instructions',
- 'projectId': 'p1',
- 'revision': 8,
- }, opened.add),
- );
- expect(find.textContaining('Removed: Haiku reviews.'), findsOneWidget);
- expect(find.textContaining('and 3 more changes.'), findsOneWidget);
- await tester.tap(find.text('See revision 8'));
- expect(opened, [(projectId: 'p1', revision: 8)]);
- });
-
- testWidgets('no link on any other line', (tester) async {
- await tester.pumpWidget(row({'kind': 'ship'}, (_) {}));
- expect(find.textContaining('See revision'), findsNothing);
- await tester.pumpWidget(row({'kind': 'instructions'}, (_) {}));
- expect(find.textContaining('See revision'), findsNothing);
- });
-}
diff --git a/mobile/test/swarm/swarm_instructions_page_test.dart b/mobile/test/swarm/swarm_instructions_page_test.dart
index 3178ac484..84fc3e801 100644
--- a/mobile/test/swarm/swarm_instructions_page_test.dart
+++ b/mobile/test/swarm/swarm_instructions_page_test.dart
@@ -58,7 +58,6 @@ void main() {
int revision = 3,
Object? Function(Map<String, dynamic>? body)? commands,
String role = 'owner',
- int? saved,
}) async {
final fake = FakeSwarm();
fake.routes['/api/super-tabs/$tab/parts'] = (_) {
@@ -70,7 +69,7 @@ void main() {
return load;
};
fake.routes['/api/super-tabs/$tab/changes'] = (_) => changes(cursor: 'c2');
- fake.routes[saved == null ? path : '$path/revisions/$saved'] = route;
+ fake.routes[path] = route;
if (commands != null) {
fake.routes['/api/super-tabs/$tab/commands'] = commands;
}
@@ -83,13 +82,7 @@ void main() {
await reader.refresh();
await tester.pumpWidget(
MaterialApp(
- home: saved == null
- ? SwarmInstructionsPage(reader: reader, projectId: project)
- : SwarmInstructionsRevisionPage(
- reader: reader,
- projectId: project,
- revision: saved,
- ),
+ home: SwarmInstructionsPage(reader: reader, projectId: project),
),
);
await tester.pumpAndSettle();
@@ -163,51 +156,6 @@ void main() {
expect(reads(fake), 2);
});
- // Ken, 11-05 (#3021): an instructions save's chat line opens the revision
- // it saved, to read the change whole.
- group('one revision', () {
- testWidgets('reads that revision alone and shows its text read only', (
- tester,
- ) async {
- final (:fake, reader: _) = await open(
- tester,
- saved: 7,
- route: (_) => {
- 'projectId': project,
- 'revision': 7,
- 'hash': 'h7',
- 'text': '## Routing\n- Reviews run on Opus.',
- 'summary': 'Reviews run on Opus',
- 'writtenBy': {'kind': 'person', 'id': me},
- 'askedBy': me,
- 'at': '2026-10-29T01:00:00.000Z',
- },
- );
- expect(fake.paths.where((p) => p == '$path/revisions/7'), hasLength(1));
- expect(reads(fake), 0);
- expect(find.textContaining('revision 7'), findsOneWidget);
- expect(find.textContaining('Reviews run on Opus.'), findsWidgets);
- expect(find.textContaining('ken · '), findsOneWidget);
- expect(find.text('Delete'), findsNothing);
- });
-
- testWidgets('one no longer kept says so', (tester) async {
- await open(
- tester,
- saved: 2,
- route: (_) => throw const SuperTabFailure(
- 'NOT_FOUND',
- 'This revision is unavailable.',
- statusCode: 404,
- ),
- );
- expect(
- find.text('Revision 2 is no longer kept: a project keeps its last 50.'),
- findsOneWidget,
- );
- });
- });
-
testWidgets('a backend without instructions says so', (tester) async {
await open(
tester,
diff --git a/mobile/test/swarm/swarm_instructions_shots_test.dart b/mobile/test/swarm/swarm_instructions_shots_test.dart
index 586d7971d..b8b61859c 100644
--- a/mobile/test/swarm/swarm_instructions_shots_test.dart
+++ b/mobile/test/swarm/swarm_instructions_shots_test.dart
@@ -8,9 +8,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/shared/theme/color_palette.dart';
-import 'package:harness_mobile/swarm/model.dart';
import 'package:harness_mobile/swarm/swarm_instructions_page.dart';
-import 'package:harness_mobile/swarm/swarm_message_row.dart';
import 'package:harness_mobile/swarm/swarm_reader.dart';
import 'package:harness_mobile/terminal/terminal_font_store.dart';
@@ -153,138 +151,4 @@ void main() {
}
debugDisableShadows = true;
}, skip: shots == null);
-
- // Ken, 11-05 (#3021): the save's line says what changed, and opens the
- // revision it saved.
- testWidgets('pictures of an instructions line and its revision', (
- tester,
- ) async {
- addTearDown(tester.view.reset);
- debugDisableShadows = false;
- tester.view.padding = const FakeViewPadding(top: 47 * 3, bottom: 34 * 3);
- addTearDown(tester.view.resetPadding);
- for (final palette in [HarnessPalette.graphite, HarnessPalette.paper]) {
- tester.view
- ..physicalSize = const Size(390, 844) * 3
- ..devicePixelRatio = 3;
- final brightness = palette.brightness;
- AppTheme.palette.value = palette;
- AppTheme.brightness.value = brightness;
- final fake = FakeSwarm();
- fake.routes['/api/super-tabs/$tab/parts'] = (_) => firstLoad();
- fake.routes['/api/super-tabs/$tab/changes'] = (_) =>
- changes(cursor: 'c2');
- fake.routes['/api/super-tabs/$tab/projects/$project/instructions/revisions/68'] =
- (_) => {
- 'projectId': project,
- 'revision': 68,
- 'hash': 'h68',
- 'text':
- '## Routing\n\n### Models\n\n- No agent runs below high '
- 'effort, and none on Claude Haiku.\n- Reviewers run on Opus.',
- 'summary': 'Routing: no Haiku.',
- 'writtenBy': {'kind': 'person', 'id': me},
- 'askedBy': me,
- 'at': DateTime.now()
- .subtract(const Duration(minutes: 3))
- .toIso8601String(),
- };
- final reader = SwarmReader(
- tabId: tab,
- accountId: me,
- request: fake.request,
- );
- addTearDown(reader.dispose);
- await tester.runAsync(reader.refresh);
- final boundary = GlobalKey();
- await tester.pumpWidget(
- RepaintBoundary(
- key: boundary,
- child: MaterialApp(
- debugShowCheckedModeBanner: false,
- theme: buildAppTheme(brightness: brightness),
- home: Builder(
- builder: (context) => Scaffold(
- backgroundColor: AppPalette.windowBg,
- body: SafeArea(
- child: ListView(
- children: [
- SwarmMessageRow(
- message: SuperTabMessage.fromJson({
- 'id': 'saved',
- 'conversationId': 'lead',
- 'text':
- 'River changed the instructions for ken: '
- 'Routing: no Haiku.\n\n'
- 'In Routing › Models:\n'
- 'Removed: No agent runs below high effort.\n'
- 'Added: No agent runs below high effort, and '
- 'none on Claude Haiku.\n'
- 'Added: Reviewers run on Opus.\n\n'
- 'and 9 more changes.',
- 'sequence': 1,
- 'author': {
- 'kind': 'agent',
- 'id': 'pm',
- 'name': 'River',
- },
- 'createdAt': DateTime.now()
- .subtract(const Duration(minutes: 3))
- .toIso8601String(),
- 'source': {
- 'kind': 'instructions',
- 'projectId': project,
- 'revision': 68,
- },
- }),
- name: 'River',
- look: (picture: null, status: null),
- role: 'PM',
- pm: true,
- mentions: SwarmMentions(const []),
- grouped: false,
- lit: false,
- quote: null,
- actions: false,
- onTap: () {},
- onReply: null,
- onOpenInstructions: (saved) =>
- openSwarmInstructionsRevision(
- context,
- reader: reader,
- projectId: saved.projectId,
- revision: saved.revision,
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ),
- );
- await tester.pumpAndSettle();
- Future<void> capture(String name) async {
- if (shots == null) return;
- await tester.runAsync(() async {
- final image =
- await (boundary.currentContext!.findRenderObject()!
- as RenderRepaintBoundary)
- .toImage(pixelRatio: 3);
- final png = await image.toByteData(format: ui.ImageByteFormat.png);
- await File('$shots/instructions-$name-${brightness.name}.png')
- .writeAsBytes(png!.buffer.asUint8List());
- image.dispose();
- });
- }
-
- await capture('line');
- await tester.tap(find.text('See revision 68'));
- await tester.pumpAndSettle();
- expect(find.textContaining('none on Claude Haiku.'), findsOneWidget);
- await capture('revision');
- }
- debugDisableShadows = true;
- }, skip: shots == null);
}
diff --git a/mobile/test/swarm/swarm_special_rows_test.dart b/mobile/test/swarm/swarm_special_rows_test.dart
index 2b9564632..2429eecca 100644
--- a/mobile/test/swarm/swarm_special_rows_test.dart
+++ b/mobile/test/swarm/swarm_special_rows_test.dart
@@ -398,6 +398,32 @@ void main() {
expect(find.text('Terminal recording interrupted'), findsNothing);
});
+ // Dee, 11-05 (task #3165): an instructions save's chat line gives a person
+ // nothing to do, so the ones already posted are no chat row. The History
+ // keeps every revision.
+ testWidgets('an instruction-change post is no chat row; others show', (
+ tester,
+ ) async {
+ await show(
+ tester,
+ backend([
+ row('said', 2, 'A real update', {}),
+ row(
+ 'saved',
+ 3,
+ 'Lead changed the instructions for dee: Routing: no Haiku.\n\n'
+ 'In Routing:\nRemoved: Haiku reviews.\nAdded: Opus reviews.',
+ {'kind': 'instructions', 'projectId': 'lead', 'revision': 8},
+ ),
+ row('later', 4, 'Next', {}),
+ ]),
+ );
+ expect(inRow('said', find.text('A real update')), findsOneWidget);
+ expect(inRow('later', find.text('Next')), findsOneWidget);
+ expect(find.textContaining('changed the instructions'), findsNothing);
+ expect(find.textContaining('See revision'), findsNothing);
+ });
+
group('an ordinary message says', () {
testWidgets('Terminal answer above a terminal\'s answer', (tester) async {
await show(