@aikdna/studio-core 0.6.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/quality/index.js +31 -1
- package/src/testlab/index.js +16 -0
- package/src/versioning/index.js +7 -2
package/package.json
CHANGED
package/src/quality/index.js
CHANGED
|
@@ -77,13 +77,43 @@ function computeReadiness(project) {
|
|
|
77
77
|
const feynmanRatio = lockedAxioms.length > 0 ? lockedAxioms.filter(ax => ax.feynman_restatement).length / lockedAxioms.length : 0;
|
|
78
78
|
const allFeynman = lockedAxioms.every(ax => ax.feynman_restatement) && lockedMisunderstandings.every(ms => !ms.locked || ms.feynman_restatement);
|
|
79
79
|
|
|
80
|
+
// Feynman quality threshold (v0.6.2)
|
|
81
|
+
const feynmanQuality = lockedAxioms.every(ax => {
|
|
82
|
+
if (!ax.feynman_restatement?.score) return false;
|
|
83
|
+
return ax.feynman_restatement.score.total >= 4;
|
|
84
|
+
});
|
|
85
|
+
const misunderstandingFeynmanQuality = lockedMisunderstandings.length === 0 ||
|
|
86
|
+
lockedMisunderstandings.every(ms => {
|
|
87
|
+
if (!ms.feynman_restatement?.score) return false;
|
|
88
|
+
return ms.feynman_restatement.score.total >= 3;
|
|
89
|
+
});
|
|
90
|
+
if (allFeynman && !feynmanQuality) {
|
|
91
|
+
warnings.push('Feynman: axiom restatements should score ≥4/5 for publishable grade');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Compare test results requirements (v0.6.4)
|
|
95
|
+
const withKdnaBetter = ratedTests.filter(t => t.result === 'with_kdna_better').length;
|
|
96
|
+
const withoutKdnaBetter = ratedTests.filter(t => t.result === 'without_kdna_better').length;
|
|
97
|
+
if (ratedTests.length > 0 && withoutKdnaBetter > 0) {
|
|
98
|
+
warnings.push(`${withoutKdnaBetter} test(s) favored response WITHOUT KDNA — domain may not improve judgment`);
|
|
99
|
+
}
|
|
100
|
+
if (ratedTests.length > 0 && withKdnaBetter < 3 && ratedTests.length >= 5) {
|
|
101
|
+
warnings.push(`Only ${withKdnaBetter} tests favor KDNA — recommend ≥3 for confidence`);
|
|
102
|
+
}
|
|
103
|
+
|
|
80
104
|
let grade = 'draft_grade';
|
|
81
105
|
if (locked.length >= 3 && axiomsComplete && feynmanRatio >= 0.5) grade = 'human_controlled';
|
|
82
106
|
if (grade === 'human_controlled' && ratedTests.length >= 5 && lockedSelfChecks.length >= 3) grade = 'tested_grade';
|
|
83
|
-
if (grade === 'tested_grade' && ratedTests.length >= 10 && lockedAxioms.length >= 3 && lockedSelfChecks.length >= 5 && blocking.length === 0 && allFeynman) {
|
|
107
|
+
if (grade === 'tested_grade' && ratedTests.length >= 10 && lockedAxioms.length >= 3 && lockedSelfChecks.length >= 5 && blocking.length === 0 && allFeynman && feynmanQuality && misunderstandingFeynmanQuality) {
|
|
84
108
|
grade = 'publishable_grade';
|
|
85
109
|
}
|
|
86
110
|
|
|
111
|
+
// Downgrade if governance issues exist
|
|
112
|
+
if (grade === 'publishable_grade' && govResult && !govResult.valid) {
|
|
113
|
+
grade = 'tested_grade';
|
|
114
|
+
warnings.push('Governance checks not passed — publishable downgraded to tested');
|
|
115
|
+
}
|
|
116
|
+
|
|
87
117
|
return buildResult(grade, blocking, warnings, project, { feynmanRatio, allFeynman, governance: govResult });
|
|
88
118
|
}
|
|
89
119
|
|
package/src/testlab/index.js
CHANGED
|
@@ -42,6 +42,22 @@ function linkTestToCards(testCase, cardIds) {
|
|
|
42
42
|
return testCase;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function applyTestResultsToCards(project, testCase) {
|
|
46
|
+
if (!testCase.result) return project;
|
|
47
|
+
const cards = project.cards || [];
|
|
48
|
+
for (const cardId of (testCase.linked_cards || [])) {
|
|
49
|
+
const card = cards.find(c => c.id === cardId);
|
|
50
|
+
if (!card) continue;
|
|
51
|
+
if (card.status === 'locked' && testCase.result === 'with_kdna_better') {
|
|
52
|
+
const { transitionCard } = require('../cards');
|
|
53
|
+
try {
|
|
54
|
+
transitionCard(card, 'tested', { by: testCase.rated_by || 'testlab', reason: `test ${testCase.id}: ${testCase.result}` });
|
|
55
|
+
} catch { /* card may have been already tested */ }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return project;
|
|
59
|
+
}
|
|
60
|
+
|
|
45
61
|
function generateTestSummary(project) {
|
|
46
62
|
const tests = project.tests || [];
|
|
47
63
|
const total = tests.length;
|
package/src/versioning/index.js
CHANGED
|
@@ -129,14 +129,19 @@ function bumpVersion(currentVersion, bumpType) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
function markBreakingChange(diff) {
|
|
132
|
+
const recommended = recommendVersionBump(diff);
|
|
132
133
|
const removedAxioms = diff.removed.filter(c => c.type === 'axiom');
|
|
133
134
|
const scopeWidening = diff.changed.filter(c => c.changes && 'applies_when' in c.changes &&
|
|
134
135
|
(c.changes.applies_when.after || []).length > (c.changes.applies_when.before || []).length);
|
|
136
|
+
const coreMeaningChanges = diff.changed.filter(c => c.changes &&
|
|
137
|
+
('one_sentence' in c.changes || 'full_statement' in c.changes));
|
|
138
|
+
|
|
135
139
|
return {
|
|
136
|
-
breaking:
|
|
140
|
+
breaking: recommended === 'major',
|
|
137
141
|
reason: removedAxioms.length > 0 ? `${removedAxioms.length} axiom(s) removed — breaking change` :
|
|
142
|
+
coreMeaningChanges.length > 0 ? `${coreMeaningChanges.length} core meaning change(s) — breaking change` :
|
|
138
143
|
scopeWidening.length > 0 ? `${scopeWidening.length} scope widening(s) — may affect existing behavior` : null,
|
|
139
|
-
recommended_bump:
|
|
144
|
+
recommended_bump: recommended,
|
|
140
145
|
};
|
|
141
146
|
}
|
|
142
147
|
|