Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Phuire-Research/Stratimux into RipD…
Browse files Browse the repository at this point in the history
…otPath
  • Loading branch information
REllEK-IO committed May 9, 2024
2 parents 259696c + 18ceff4 commit 4e5770c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ When in doubt simplify.
## Change Log ![Tests](https://github.com/Phuire-Research/Stratimux/actions/workflows/node.js.yml/badge.svg)
### **BREAKING** Strong Fast Lock Step v0.1.62
* Devised a means to ensure a lock step execution of incoming actions
* Due to each stage being ran once regardless of their selector being changed, some plans may receive the wrong value if not determining if that stage has been ran for the first time. See priority.test.ts for details.
* Due to each stage being ran once regardless of their selector being changed, some plans may receive the wrong value if not determining if that stage has been ran for the first time. See priority.test.ts for the example: if (changes.length > 0) {//}
* This also impacted the *axiumWaitForOpenThenIterate* helper function, but now works as intended via no longer checking for the latest lastStrategy change.
* [*Note* Removed CI checks for 14.x and 16.x due to updating dependencies.](https://github.com/Phuire-Research/Stratimux/pull/213/commits/6b93c57fa2dab8869f1508970c44a8300ef444be)
### Strong Fast Time v0.1.61
* Created the new *axiumTimeOut* helper function
* This will add a specified action to the axium tail property after some specified time.
Expand Down
4 changes: 2 additions & 2 deletions src/concepts/axium/axium.concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export type AxiumState = {
removeConceptQue: Concept[],
badPlans: Plan[];
badActions: Action[];
timer: NodeJS.Timer[];
tailTimer: NodeJS.Timer[];
timer: NodeJS.Timeout[];
tailTimer: NodeJS.Timeout[];
timerLedger: Map<number, [(() => Action)[], number]>
}

Expand Down
2 changes: 1 addition & 1 deletion src/model/axium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function createAxium(
if (_axiumState.tailTimer.length > 0) {
const timer = _axiumState.tailTimer.shift();
if (timer) {
clearTimeout(timer as NodeJS.Timeout);
clearTimeout(timer);
}
}
const modeIndex = _axiumState.modeIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/model/stagePlanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type Plan = {
export type Stage = (
concepts: Concepts,
dispatch: (action: Action, options: dispatchOptions, ) => void,
changes?: KeyedSelector[]
changes: KeyedSelector[]
) => void;

export type Staging = {
Expand Down
2 changes: 1 addition & 1 deletion src/model/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const axiumTimeOut = (concepts: Concepts, func: () => Action, timeOut: nu
// If timer exists, first index of timerList would exist
const timerList = Object.keys(ledger).map(t => Number(t)).sort((a, b) => a - b);
if (timerList[0] > timed) {
clearTimeout(timer as NodeJS.Timeout);
clearTimeout(timer);
axiumState.timer.shift();
const slot = axiumState.timerLedger.get(timed);
if (slot) {
Expand Down
14 changes: 6 additions & 8 deletions src/test/priority/priority.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('Priority Test', (done) => {
concluded++;
}
};
const firstRun = [true, true, true];

const priorityTest = createAxium('Priority Test', [
createExperimentPriorityConcept()
], true, true, true);
Expand All @@ -47,17 +47,15 @@ test('Priority Test', (done) => {
});
}
}, {priority});
const thirdStage = (name: string, expected: number, priority: number, pos: number) => createStage((concepts, dispatch) => {
const thirdStage = (name: string, expected: number, priority: number) => createStage((concepts, dispatch, changes) => {
const priorityState = select.state<ExperimentPriorityState>(concepts, experimentName);
if (priorityState && !firstRun[pos]) {
if (priorityState && changes.length > 0) {
// expect(order).toBe(expectedOrder);
console.log(`${name} Incoming Value: ${priorityState.value}, expecting: ${expected}`);
// expect(priorityState.value).toBe(expected);
dispatch(axiumKick(), {
iterateStage: true
});
} else {
firstRun[pos] = false;
}
}, {selectors: [experimentPriorityValueSelector], priority});
const concludePlan = (name: string, func: () => StagePlanner) => createStage(() => {
Expand All @@ -72,7 +70,7 @@ test('Priority Test', (done) => {
'Low Priority Plan', [
firstStage(LOW, LOW_PRIORITY),
secondStage(LOW, 1, LOW_PRIORITY),
thirdStage(LOW, 111, LOW_PRIORITY, 0),
thirdStage(LOW, 111, LOW_PRIORITY),
concludePlan(LOW, () => low),
]);
const HIGH = 'High';
Expand All @@ -81,7 +79,7 @@ test('Priority Test', (done) => {
'High Priority Plan', [
firstStage(HIGH, HIGH_PRIORITY),
secondStage(HIGH, 100, HIGH_PRIORITY),
thirdStage(HIGH, 100, HIGH_PRIORITY, 1),
thirdStage(HIGH, 100, HIGH_PRIORITY),
concludePlan(HIGH, () => high),
]);
const MID = 'Mid';
Expand All @@ -90,7 +88,7 @@ test('Priority Test', (done) => {
'Mid Priority Plan', [
firstStage(MID, MID_PRIORITY),
secondStage(MID, 10, MID_PRIORITY),
thirdStage(MID, 110, MID_PRIORITY, 2),
thirdStage(MID, 110, MID_PRIORITY),
concludePlan(MID, () => mid),
]);
setTimeout(() => {
Expand Down

0 comments on commit 4e5770c

Please sign in to comment.