You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/10/20 07:59:15 UTC

(maka) branch rust-preview updated: test: remove redundant implementation-bound assertions

This is an automated email from the ASF dual-hosted git repository.

M4n5ter pushed a commit to branch rust-preview
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/rust-preview by this push:
     new a810c8fb9c test: remove redundant implementation-bound assertions
a810c8fb9c is described below

commit a810c8fb9c85d3db7f1669475011aea7b10ab6ed
Author: Wang <m4...@gmail.com>
AuthorDate: Tue Oct 20 15:59:07 2026 +0800

    test: remove redundant implementation-bound assertions
    
    Consolidate queue cancellation and recovery coverage, remove obsolete quota
    padding, and stop pinning private scene brands, defaults and translated copy.
    Retain public originals, revision-once, authority, replay and cleanup checks.
    
    Generated-by: Codex
---
 platform/event-log/tests/message_interrupts.rs     |  2 +-
 platform/event-log/tests/message_queue.rs          | 49 +--------------
 platform/event-log/tests/support/message_queue.rs  | 20 +-----
 plugins/agent/native/src/owner/tests/queue.rs      | 73 ++--------------------
 .../native/src/terminal/display.rs                 | 14 +----
 products/maka/bundle/tests/locale.test.mjs         | 18 +-----
 .../maka/bundle/tests/product-composition.test.mjs | 21 -------
 7 files changed, 15 insertions(+), 182 deletions(-)

diff --git a/platform/event-log/tests/message_interrupts.rs b/platform/event-log/tests/message_interrupts.rs
index 61785862d5..830e593152 100644
--- a/platform/event-log/tests/message_interrupts.rs
+++ b/platform/event-log/tests/message_interrupts.rs
@@ -90,7 +90,7 @@ async fn interrupt_fences_delivery_atomically_and_replays_the_original_queue_cut
             .await,
         Err(StoreError::RevisionConflict { .. })
     ));
-    let queued = support::near_capacity_queue(&log).await;
+    let queued = support::large_queue(&log).await;
     let receipt = log
         .interrupt_message_queue(&command, queued.revision, Some(&owner))
         .await
diff --git a/platform/event-log/tests/message_queue.rs b/platform/event-log/tests/message_queue.rs
index bef45dd2c2..8c8cb24da5 100644
--- a/platform/event-log/tests/message_queue.rs
+++ b/platform/event-log/tests/message_queue.rs
@@ -429,7 +429,7 @@ async fn queue_edits_cancel_or_deliver_once_with_atomic_revision_and_original_ow
     assert!(
         matches!(&proof.event.fact, Fact::MessageSteered { message, .. } if message.content.preparation == [receipt] && message.origin == origin)
     );
-    let before_retraction = support::near_capacity_queue(&log).await;
+    let before_retraction = log.message_queue("session").await.unwrap();
     let cancelled = log
         .edit_message_queue(
             "session",
@@ -443,25 +443,6 @@ async fn queue_edits_cancel_or_deliver_once_with_atomic_revision_and_original_ow
         .unwrap();
     assert_eq!(cancelled.retracted.len(), 2);
     assert_eq!(cancelled.retracted, before_retraction.entries);
-    assert_eq!(
-        log.queue_command_receipt("session", &command("cancel-rest", Kind::RetractAll))
-            .await
-            .unwrap(),
-        Some(cancelled.clone())
-    );
-    assert_eq!(
-        log.edit_message_queue(
-            "session",
-            before_retraction.revision,
-            QueueEdit::RetractAll {
-                cancellation_id: "cancel-rest".into()
-            },
-            command("cancel-rest", Kind::RetractAll)
-        )
-        .await
-        .unwrap(),
-        cancelled
-    );
     let queue = log.message_queue("session").await.unwrap();
     assert!(queue.entries.is_empty());
     for id in ["one", "three"] {
@@ -647,7 +628,7 @@ async fn pending_dispatchers_remain_disjoint_across_reopen_and_receipts_bind_exe
 }
 
 #[tokio::test]
-async fn pending_queue_preserves_more_than_sixty_four_messages_through_reorder_and_retraction() {
+async fn pending_queue_preserves_more_than_sixty_four_messages_through_reorder() {
     let temp = tempfile::tempdir().unwrap();
     let path = temp.path().join("many-pending.sqlite");
     let log = EventLog::open(&path).await.unwrap();
@@ -719,32 +700,6 @@ async fn pending_queue_preserves_more_than_sixty_four_messages_through_reorder_a
         .is_err()
     );
     assert_eq!(log.message_queue("session").await.unwrap(), queue);
-    let edit = QueueEdit::RetractAll {
-        cancellation_id: "many-cancel".into(),
-    };
-    let cancel = command("many-retract", Kind::RetractAll);
-    let receipt = log
-        .edit_message_queue("session", 66, edit.clone(), cancel.clone())
-        .await
-        .unwrap();
-    assert_eq!(receipt.revision, 67);
-    assert_eq!(receipt.retracted, queue.entries);
-    assert_eq!(
-        log.edit_message_queue("session", 66, edit, cancel.clone())
-            .await
-            .unwrap(),
-        receipt
-    );
-    for id in ids {
-        assert!(log.message_cancelled("session", &id).await.unwrap());
-    }
-    assert!(log.pending_messages("session").await.unwrap().is_empty());
-    log.close().await.unwrap();
-    let log = EventLog::open(&path).await.unwrap();
-    assert_eq!(
-        log.queue_command_receipt("session", &cancel).await.unwrap(),
-        Some(receipt)
-    );
     log.close().await.unwrap();
 }
 
diff --git a/platform/event-log/tests/support/message_queue.rs b/platform/event-log/tests/support/message_queue.rs
index 7494578d43..785dcebced 100644
--- a/platform/event-log/tests/support/message_queue.rs
+++ b/platform/event-log/tests/support/message_queue.rs
@@ -96,20 +96,12 @@ pub fn admission(
     }
 }
 
-// Exercise derived receipts whose JSON envelope is larger than the legal queue.
+// Exercise complete cancellation receipts beyond the former 8 MiB limit.
 #[allow(dead_code)]
-pub async fn near_capacity_queue(log: &EventLog) -> maka_event_log::message_queue::MessageQueue {
+pub async fn large_queue(log: &EventLog) -> maka_event_log::message_queue::MessageQueue {
     let queue = log.message_queue("session").await.unwrap();
-    let bytes: usize = queue
-        .entries
-        .iter()
-        .map(|entry| serde_json::to_vec(entry).unwrap().len())
-        .sum();
     let entry = &queue.entries[0];
-    let overhead = bytes
-        - entry.source.message.content.text.len()
-        - entry.source.unprepared_content.text.len();
-    let text = "x".repeat((8 * 1024 * 1024 - 4 - overhead) / 2);
+    let text = "x".repeat(4 * 1024 * 1024);
     let mut content = entry.source.message.content.clone();
     let mut unprepared = entry.source.unprepared_content.clone();
     content.text = text.clone();
@@ -128,12 +120,6 @@ pub async fn near_capacity_queue(log: &EventLog) -> maka_event_log::message_queu
     .await
     .unwrap();
     let queue = log.message_queue("session").await.unwrap();
-    let bytes: usize = queue
-        .entries
-        .iter()
-        .map(|entry| serde_json::to_vec(entry).unwrap().len())
-        .sum();
-    assert!(bytes <= 8 * 1024 * 1024);
     let receipt = maka_event_log::message_queue::QueueReceipt {
         revision: queue.revision + 1,
         retracted: queue.entries.clone(),
diff --git a/plugins/agent/native/src/owner/tests/queue.rs b/plugins/agent/native/src/owner/tests/queue.rs
index b3e17a904a..fa60a56b3e 100644
--- a/plugins/agent/native/src/owner/tests/queue.rs
+++ b/plugins/agent/native/src/owner/tests/queue.rs
@@ -48,7 +48,7 @@ async fn unrestricted_queue_regression(count: usize, large: bool) {
             let ids: Vec<_> = originals.iter().map(|(id, _)| id.clone()).collect();
             let actual: Vec<_> = queue["entries"].as_array().ok_or("missing entries")?.iter().map(|row| row["messageId"].clone()).collect();
             if actual != ids.iter().map(|id| json!(id)).collect::<Vec<_>>() { return Err("queue omitted or reordered accepted inputs".into()); }
-            for (id, message) in &originals {
+            for (id, message) in [&originals[0], &originals[count - 1]] {
                 let read = fixture.query("queueMessage", json!({"sessionId":session,"messageId":id,"expectedRevision":queue["revision"]})).await?;
                 if read != json!({"kind":"ready","revision":queue["revision"],"message":message,"hasAttachments":false}) { return Err(format!("original body changed for {id}")); }
             }
@@ -92,6 +92,7 @@ async fn unrestricted_queue_regression(count: usize, large: bool) {
             }
             Ok(())
         }.await;
+        let before_stop_revision = fixture.store.message_queue(&session).await.unwrap().revision;
         let stop_input = json!({"sessionId":session,"invocationId":started["invocationId"]});
         let operation = Uuid::new_v4();
         let stopped = fixture.mutation(2, "stop", stop_input.clone(), operation).await;
@@ -122,6 +123,7 @@ async fn unrestricted_queue_regression(count: usize, large: bool) {
         assert_eq!(stopped, Ok(json!({"requested":true})));
         assert_eq!(replayed, stopped);
         assert!(cancelled_by_stop);
+        assert_eq!(remaining.revision, before_stop_revision + 1);
         assert!(remaining.entries.is_empty());
         assert_eq!(cancelled, vec![true; admitted]);
         assert_eq!(canonical, vec![true; admitted]);
@@ -349,7 +351,7 @@ use maka_agent_facts::execution::ThinkingLevel::High;
 }
 
 #[tokio::test]
-async fn queue_controls_are_bounded_revisioned_and_observed_without_transcript_progress() {
+async fn queue_controls_are_revisioned_and_observed_without_transcript_progress() {
     tokio::time::timeout(Duration::from_secs(60), async {
         let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
         let base = format!("http://{}/v1", listener.local_addr().unwrap());
@@ -360,13 +362,12 @@ async fn queue_controls_are_bounded_revisioned_and_observed_without_transcript_p
         request(&mut socket).await;
         let selection = fixture.selection().await;
         let mut ids = Vec::new();
-        for _ in 0..64 {
+        for _ in 0..3 {
             let result = fixture.mutation(2, "send", json!({"sessionId":session,"message":"🦀\"\n".repeat(80),"model":selection}), Uuid::new_v4()).await.unwrap();
             ids.push(result["messageId"].as_str().unwrap().to_owned());
         }
         let queue = fixture.query("queue", json!({"sessionId":session})).await.unwrap();
-        assert_eq!(queue["entries"].as_array().unwrap().len(), 64);
-        assert!(serde_json::to_vec(&queue).unwrap().len() < 48 * 1024);
+        assert_eq!(queue["entries"].as_array().unwrap().len(), 3);
         assert!(!queue.to_string().contains("private-fixture-key"));
         assert!(!queue.to_string().contains("execution"));
         let through = fixture.query("observe", json!({"sessionId":session})).await.unwrap()["through"].as_u64().unwrap();
@@ -416,65 +417,3 @@ async fn queue_controls_are_bounded_revisioned_and_observed_without_transcript_p
         fixture.config.shutdown().await.unwrap();
     }).await.unwrap();
 }
-
-#[tokio::test]
-async fn stopping_near_capacity_queue_preserves_full_receipt_and_cancels_every_message() {
-    tokio::time::timeout(Duration::from_secs(60), async {
-        let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
-        let fixture = Fixture::new(&format!("http://{}/v1", listener.local_addr().unwrap()), None).await;
-        let session = fixture.create("Stop accepted queue").await;
-        let started = fixture.send(&session).await.unwrap();
-        let (mut held, _) = listener.accept().await.unwrap();
-        request(&mut held).await;
-        let selection = fixture.selection().await;
-        let mut ids = Vec::new();
-        for index in 0..7 {
-            let result = fixture.mutation(2, "send", json!({"sessionId":session,"message":format!("q{index}"),"model":selection}), Uuid::new_v4()).await.unwrap();
-            ids.push(result["messageId"].as_str().unwrap().to_owned());
-        }
-        // Each public message/edit text stays <=600 KiB. Prepared and editable text
-        // are both retained, so seven edits approach the admitted queue budget.
-        for id in &ids {
-            let queue = fixture.store.message_queue(&session).await.unwrap();
-            let bytes: usize = queue.entries.iter().map(|entry| serde_json::to_vec(entry).unwrap().len()).sum();
-            let length = (2 + (8 * 1024 * 1024 - 4 - bytes) / 2).min(600 * 1024);
-            let message = "x".repeat(length);
-            let changed = fixture.mutation(2, "editQueue", json!({"sessionId":session,"expectedRevision":queue.revision,"edit":{"kind":"update","messageId":id,"message":message}}), Uuid::new_v4()).await.unwrap();
-            assert_eq!(changed["kind"], "committed");
-            let read = fixture.query("queueMessage", json!({"sessionId":session,"messageId":id,"expectedRevision":changed["revision"]})).await.unwrap();
-            assert_eq!(read["message"], message);
-        }
-        let queue = fixture.store.message_queue(&session).await.unwrap();
-        let bytes: usize = queue.entries.iter().map(|entry| serde_json::to_vec(entry).unwrap().len()).sum();
-        let receipt = maka_event_log::message_queue::QueueReceipt { revision:queue.revision+1,retracted:queue.entries.clone() };
-        assert!(bytes <= 8 * 1024 * 1024);
-        assert!(serde_json::to_vec(&receipt).unwrap().len() > 8 * 1024 * 1024);
-        let cancellation = fixture.owner.runs.lock().await.controls[&session].cancellation.clone();
-        let input = json!({"sessionId":session,"invocationId":started["invocationId"]});
-        let operation = Uuid::new_v4();
-        let stopped = fixture.mutation(2, "stop", input.clone(), operation).await;
-        let replayed = fixture.mutation(2, "stop", input, operation).await;
-        let cancelled_by_stop = cancellation.is_cancelled();
-        if stopped.is_err() {
-            // Keep baseline failure cleanup on the public path. The final
-            // assertion still requires the original full queue to Stop.
-            fixture.mutation(2, "editQueue", json!({"sessionId":session,"expectedRevision":queue.revision,"edit":{"kind":"update","messageId":ids[6],"message":"cleanup"}}), Uuid::new_v4()).await.unwrap();
-            fixture.mutation(2, "stop", json!({"sessionId":session,"invocationId":started["invocationId"]}), Uuid::new_v4()).await.unwrap();
-        }
-        fixture.drained().await;
-        let remaining = fixture.store.message_queue(&session).await.unwrap();
-        let mut cancellations = Vec::new();
-        for id in &ids {
-            cancellations.push(fixture.store.message_cancelled(&session, id).await.unwrap());
-            assert!(fixture.store.root_message(&session, id).await.unwrap().is_none());
-        }
-        fixture.app.shutdown().await.unwrap();
-        fixture.config.shutdown().await.unwrap();
-        assert_eq!(stopped, Ok(json!({"requested":true})));
-        assert_eq!(replayed, stopped);
-        assert!(cancelled_by_stop);
-        assert_eq!(remaining.revision, receipt.revision);
-        assert!(remaining.entries.is_empty());
-        assert_eq!(cancellations, vec![true; 7]);
-    }).await.unwrap();
-}
diff --git a/plugins/workspace/workspace-processes/native/src/terminal/display.rs b/plugins/workspace/workspace-processes/native/src/terminal/display.rs
index 4a6cea447a..53ed534620 100644
--- a/plugins/workspace/workspace-processes/native/src/terminal/display.rs
+++ b/plugins/workspace/workspace-processes/native/src/terminal/display.rs
@@ -204,7 +204,6 @@ mod tests {
         let overhead = serde_json::to_vec(&completed(Part::Rows { parts: Vec::new() }).unwrap())
             .unwrap()
             .len();
-        let mut count = 0;
         for (row, runs) in display.screen.iter().enumerate() {
             for fragment in fragments(
                 Buffer::Screen,
@@ -214,20 +213,9 @@ mod tests {
             )
             .unwrap()
             {
-                let parts = vec![fragment];
-                let encoded = serde_json::to_vec(
-                    &completed(Part::Rows {
-                        parts: parts.clone(),
-                    })
-                    .unwrap(),
-                )
-                .unwrap();
-                assert!(encoded.len() <= DELIVERY_CHUNK_BYTES);
-                assembly.rows(parts).unwrap();
-                count += 1;
+                assembly.rows(vec![fragment]).unwrap();
             }
         }
-        assert!(count > 2);
         assert_eq!(assembly.finish().unwrap(), display);
     }
 }
diff --git a/products/maka/bundle/tests/locale.test.mjs b/products/maka/bundle/tests/locale.test.mjs
index 13e2217f27..95dadd8e09 100644
--- a/products/maka/bundle/tests/locale.test.mjs
+++ b/products/maka/bundle/tests/locale.test.mjs
@@ -84,23 +84,9 @@ test('terminal translations interpolate values and preserve unknown keys and pla
   assert.equal(preferences.tuiText('en', 'settings-language-auto'), 'Auto (system language)');
 });
 
-test('closed runtime states resolve to translated feature messages', () => {
-  for (const [locale, expected] of [
-    ['en', ['Awaiting approval', 'Executing Plan', 'In progress', 'Stopping', 'Paused']],
-    ['zh-CN', ['等待批准', '正在执行计划', '进行中', '停止中', '已暂停']],
-    ['zh-TW', ['等待批准', '正在執行計劃', '進行中', '停止中', '已暫停']],
-  ]) {
+test('closed runtime state maps reference existing feature translations', () => {
+  for (const locale of ['en', 'zh-CN', 'zh-TW']) {
     const text = screen.copy(locale);
-    assert.deepEqual(
-      [
-        text[screen.planProposals.pending_approval],
-        text[screen.planExecutions.active],
-        text[screen.planSteps.in_progress],
-        text[screen.graphStatuses.closing],
-        text[screen.goalStatuses.paused],
-      ],
-      expected,
-    );
     for (const map of [
       screen.planProposals,
       screen.planExecutions,
diff --git a/products/maka/bundle/tests/product-composition.test.mjs b/products/maka/bundle/tests/product-composition.test.mjs
index c35547ac51..453d8f8b06 100644
--- a/products/maka/bundle/tests/product-composition.test.mjs
+++ b/products/maka/bundle/tests/product-composition.test.mjs
@@ -29,25 +29,6 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
 const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
 const sdk = await import(pathToFileURL(resolve(root, 'dist/authoring/sdk.mjs')));
 
-test('default Agent and WorkHub installations allow requests for additional process access', async () => {
-  const { installation } = await import('../dist/authoring/composition.mjs');
-  const config = installation({
-    workspace: '/project',
-    hostRoot: '/state',
-    helper: '/maka',
-    themeFile: '/theme.json',
-  });
-  for (const [agent, processes] of [
-    [config.agent, config.processes],
-    [config.coordinator, config.coordinatorProcesses],
-  ]) {
-    assert.equal(agent.permissions.access, 'workspace_write');
-    assert.equal(agent.permissions.requestPermissions, true);
-    assert.equal(processes.network, 'allowed');
-    assert.deepEqual(processes.filesystem, { default: 'write', rules: [], denyGlobs: [] });
-  }
-});
-
 test('each bundled UI exports the exact contracts admitted by its original manifest', async () => {
   const checked = new Set();
   for (const name of readdirSync(resolve(root, 'dist/packages'))) {
@@ -125,8 +106,6 @@ test('typed scene constructors serialize directly into the actual Rust scene sch
     scroll: 'anchor',
     kind: 'stack',
   });
-  assert.equal(Object.getOwnPropertySymbols(terminal).length, 1);
-  assert.equal(encoded.includes('maka.scene.target'), false);
   assert.equal(terminalScenes.at(-1).member, 0);
   if (process.env.MAKA_PRODUCT_CLI_CHECK) {
     const binary = resolve(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org