Mobiusi commited on
Commit
2abbdce
·
verified ·
1 Parent(s): 34613d5

sync sample package

Browse files
record_0421d3c5-ac9e-431c-a914-ee16e5570850.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "change_operation": "成员移除",
3
+ "faulty_code_source": "def can_commit_removal(acks, old_voters, new_voters):\n required = len(new_voters) // 2 + 1\n return len(set(acks) & new_voters) >= required\n",
4
+ "change_context": "A five-voter configuration {a, b, c, d, e} is being reduced to {a, b, c}. The removal decision receives acknowledgements from only {a, b}; this is a majority of the proposed configuration but not of the currently active five-voter configuration.",
5
+ "quorum_constraints": [
6
+ "For a five-voter old configuration, at least three old voters must acknowledge the transition.",
7
+ "For a three-voter new configuration, at least two new voters must acknowledge the transition.",
8
+ "During joint transition, require both majorities rather than substituting the new quorum for the old quorum.",
9
+ "Do not treat a proposed configuration as active before the transition is authorized."
10
+ ],
11
+ "validation_outcome": "未执行",
12
+ "root_cause_analysis": "The faulty function uses only the proposed configuration's quorum to authorize the removal. Because the proposed set is smaller, two acknowledgements suffice even though the old configuration requires three. The new configuration is therefore allowed to authorize its own activation without the old configuration's required support.",
13
+ "validation_code_source": "import unittest\n\ndef can_commit_removal_fixed(acks, old_voters, new_voters):\n acknowledgements = set(acks)\n old_majority = len(old_voters) // 2 + 1\n new_majority = len(new_voters) // 2 + 1\n return (len(acknowledgements & old_voters) >= old_majority\n and len(acknowledgements & new_voters) >= new_majority)\n\nclass RemovalQuorumTests(unittest.TestCase):\n def test_new_configuration_cannot_authorize_its_own_activation(self):\n old_voters = {'a', 'b', 'c', 'd', 'e'}\n new_voters = {'a', 'b', 'c'}\n acknowledgements = {'a', 'b'}\n self.assertTrue(can_commit_removal(acknowledgements, old_voters, new_voters))\n self.assertFalse(can_commit_removal_fixed(acknowledgements, old_voters, new_voters))\n\n def test_both_configurations_can_authorize_transition(self):\n old_voters = {'a', 'b', 'c', 'd', 'e'}\n new_voters = {'a', 'b', 'c'}\n acknowledgements = {'a', 'b', 'c'}\n self.assertTrue(can_commit_removal_fixed(acknowledgements, old_voters, new_voters))\n",
14
+ "repair_consistency_assessment": "Static review indicates that the candidate predicate preserves the old quorum requirement while also requiring the new quorum. The tests encode the premature-activation regression and a successful joint-quorum case, but they have not been executed.",
15
+ "configuration_transition_summary": "The old configuration must remain part of the authorization rule while the change is in transition. The candidate predicate requires majorities of both old and new sets before the transition can be committed; only afterward can the new set govern subsequent decisions."
16
+ }
record_5e260d06-e944-4951-89e0-f4f58845f699.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "change_context": "A new node d has joined as a learner and is not yet eligible to vote. The active voter set is {a, b, c}. If only a and b acknowledge a decision, they form a voter majority; an acknowledgement from d must not affect the quorum calculation.",
3
+ "change_operation": "成员加入",
4
+ "faulty_code_source": "def has_quorum(acks, voters, learners):\n members = voters | learners\n required = len(members) // 2 + 1\n return len(set(acks) & members) >= required\n",
5
+ "quorum_constraints": [
6
+ "Compute the majority threshold from voting members only.",
7
+ "Count acknowledgements only from the active voter set.",
8
+ "A learner must not increase the quorum threshold or substitute for a voter.",
9
+ "Update the voter set only when the membership protocol commits the learner's promotion."
10
+ ],
11
+ "validation_outcome": "未执行",
12
+ "root_cause_analysis": "The faulty function merges learners into the voting set before computing both the threshold and the acknowledgements. This incorrectly raises the threshold from two to three and also allows a learner's acknowledgement to count toward that threshold.",
13
+ "validation_code_source": "import unittest\n\ndef has_quorum_fixed(acks, voters):\n required = len(voters) // 2 + 1\n return len(set(acks) & voters) >= required\n\nclass LearnerPromotionTests(unittest.TestCase):\n def test_learner_does_not_increase_voting_threshold(self):\n voters = {'a', 'b', 'c'}\n learners = {'d'}\n acknowledgements = {'a', 'b'}\n self.assertFalse(has_quorum(acknowledgements, voters, learners))\n self.assertTrue(has_quorum_fixed(acknowledgements, voters))\n\n def test_learner_acknowledgement_cannot_replace_a_voter(self):\n voters = {'a', 'b', 'c'}\n learners = {'d'}\n acknowledgements = {'a', 'b', 'd'}\n self.assertTrue(has_quorum(acknowledgements, voters, learners))\n self.assertFalse(has_quorum_fixed(acknowledgements, voters))\n",
14
+ "repair_consistency_assessment": "Static review shows that the candidate function derives both the threshold and acknowledgement count solely from voters, so learner acknowledgements cannot change the result. The regression tests have not been run, and no runtime verification is claimed.",
15
+ "configuration_transition_summary": "Adding a learner does not change the active voter configuration. The voter set remains {a, b, c} until an explicit promotion transition; only then may the new node participate in quorum calculations under the applicable configuration rules."
16
+ }
record_8bc458c1-fd28-45e1-9806-803120883c7c.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "configuration_transition_summary": "The old and new voter sets remain jointly authoritative during the transition. A decision must satisfy both sets' quorum rules before the system can finalize the new configuration; the union must not be treated as a single voter set.",
3
+ "change_context": "During a joint-consensus transition, the old voter set is {a, b, c} and the new voter set is {c, d, e, f, g}. Acknowledgements from {a, b, d} reach the larger of the two majority thresholds when counted across the union, but do not form a majority in the new configuration.",
4
+ "change_operation": "联合共识",
5
+ "faulty_code_source": "def has_joint_quorum(acks, old_voters, new_voters):\n required = max(len(old_voters) // 2 + 1, len(new_voters) // 2 + 1)\n return len(set(acks) & (old_voters | new_voters)) >= required\n",
6
+ "quorum_constraints": [
7
+ "Count acknowledgements from each configuration independently.",
8
+ "Require at least floor(|old_voters| / 2) + 1 acknowledgements from the old configuration.",
9
+ "Require at least floor(|new_voters| / 2) + 1 acknowledgements from the new configuration.",
10
+ "Do not finalize a transition based solely on a majority of the union of the voter sets."
11
+ ],
12
+ "validation_outcome": "未执行",
13
+ "root_cause_analysis": "The faulty predicate counts distinct acknowledgements across the union of both configurations and compares that total with only the larger majority threshold. Joint consensus requires a separate majority from each configuration; a large union count can conceal a shortage in one side.",
14
+ "validation_code_source": "import unittest\n\ndef has_joint_quorum_fixed(acks, old_voters, new_voters):\n acknowledgements = set(acks)\n old_majority = len(old_voters) // 2 + 1\n new_majority = len(new_voters) // 2 + 1\n return (len(acknowledgements & old_voters) >= old_majority\n and len(acknowledgements & new_voters) >= new_majority)\n\nclass JointQuorumTests(unittest.TestCase):\n def test_majority_of_union_is_not_enough(self):\n old_voters = {'a', 'b', 'c'}\n new_voters = {'c', 'd', 'e', 'f', 'g'}\n acknowledgements = {'a', 'b', 'd'}\n self.assertTrue(has_joint_quorum(acknowledgements, old_voters, new_voters))\n self.assertFalse(has_joint_quorum_fixed(acknowledgements, old_voters, new_voters))\n\n def test_both_configurations_have_majorities(self):\n old_voters = {'a', 'b', 'c'}\n new_voters = {'c', 'd', 'e', 'f', 'g'}\n acknowledgements = {'a', 'b', 'c', 'd', 'e'}\n self.assertTrue(has_joint_quorum_fixed(acknowledgements, old_voters, new_voters))\n",
15
+ "repair_consistency_assessment": "Static review of the candidate predicate shows that it independently enforces both majorities, including when the sets overlap. The included regression tests have not been run, so runtime behavior is not claimed as verified."
16
+ }