Skip to content

Commit 8f73e07

Browse files
committed
* Fixed that if a parent was type "argument", all children claims would be imported as "premises" (ie. in the "generic" child-group), even if the collection they were in was of a non-premise type (eg. "arguments"). [these non-premise children now all get imported into the "freeform" group]
* MS relinking a node under the same parent is now allowed, so long as the child-group is changing. (regarding of child-group types) * Fixed that pyroscope and tilt were using the same port.
1 parent 9597838 commit 8f73e07

File tree

5 files changed

+30
-17
lines changed

5 files changed

+30
-17
lines changed

Packages/app-server/src/db/commands/link_node.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,13 @@ pub async fn link_node(ctx: &AccessorContext<'_>, actor: &User, is_root: bool, i
9191

9292
assert_user_can_add_child(ctx, actor, &new_parent).await?; // defensive
9393

94-
let pasting_premise_as_relevance_arg = node_data.r#type == NodeType::claim && childGroup == ChildGroup::relevance;
95-
ensure!(oldParentID.as_ref() != Some(&newParentID) || pasting_premise_as_relevance_arg, "Old-parent-id and new-parent-id cannot be the same! (unless changing between truth-arg and relevance-arg)");
94+
// if the new-parent-id is the same as the old-parent-id, then only allow the re-link to proceed if the child-group is changing
95+
if Some(&newParentID) == oldParentID.as_ref()
96+
&& let Some(old_parent) = &old_parent
97+
{
98+
let old_link = get_first_link_under_parent(ctx, &nodeID, old_parent.id.as_str()).await?;
99+
ensure!(childGroup != old_link.group, "Old-parent-id and new-parent-id cannot be the same! (unless changing child-group)");
100+
}
96101

97102
if unlink_from_old_parent {
98103
let closest_map_root_node = if new_parent.rootNodeForMap.is_some() {

Packages/client/Source/Utils/DataFormats/JSON/ClaimGen/ImportHelpers.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ export const NewNodeResource = CreateAccessor((context: ImportContext, nodeData:
4848
const parentNodeType = parentNodeData ? CG_Node.GetNodeType(parentNodeData) : context.importUnderNode.type;
4949
const link = new NodeLink({
5050
group:
51-
// if this parent->child link is valid using child-group "generic", then do that
52-
NodeType_Info.for[parentNodeType].childGroup_childTypes.get(ChildGroup.generic)?.includes(nodeType)
53-
? ChildGroup.generic
54-
// else, fall back to using the "freeform" child-group
55-
: ChildGroup.freeform,
51+
// if parent is of type "argument", then use "freeform" child-group for anything *except* its "premises" and "atomic_claims" children
52+
// (since this is a special case where "generic" group results in the special "vertical" display-mode, which we only want for premises/atomic-claims)
53+
parentNodeType == NodeType.argument && (nodeData._originCollectionName != "premises" && nodeData._originCollectionName != "atomic_claims") ? ChildGroup.freeform :
54+
// else, if this parent->child link is valid using child-group "generic", go with that
55+
NodeType_Info.for[parentNodeType].childGroup_childTypes.get(ChildGroup.generic)?.includes(nodeType) ? ChildGroup.generic :
56+
// else, fall back to using the "freeform" child-group
57+
ChildGroup.freeform,
5658
orderKey: orderKey.toString(),
5759
//form: claimForm,
5860
});

Packages/js-common/Source/Commands/LinkNode_HighLevel.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,16 @@ export class LinkNode_HighLevel extends Command<Payload, {argumentWrapperID?: st
117117
this.newParent_data = this.newParent_data ?? GetNodeL2.NN(newParentID);
118118
this.orderKeyForOuterNode = this.orderKeyForOuterNode ?? GetHighestLexoRankUnderParent(newParentID).next().key;
119119

120-
//let pastingPremiseAsRelevanceArg = IsPremiseOfMultiPremiseArgument(this.node_data, oldParent_data) && createWrapperArg;
121-
//const pastingPremiseAsRelevanceArg = this.node_data.type == NodeType.claim && createWrapperArg;
122-
const pastingPremiseAsRelevanceArg = this.node_data.type == NodeType.claim && childGroup == ChildGroup.relevance;
123-
AssertV(oldParentID !== newParentID || pastingPremiseAsRelevanceArg, "Old-parent-id and new-parent-id cannot be the same! (unless changing between truth-arg and relevance-arg)");
120+
/*const pastingPremiseAsRelevanceArg = this.node_data.type == NodeType.claim && childGroup == ChildGroup.relevance;
121+
AssertV(oldParentID !== newParentID || pastingPremiseAsRelevanceArg, "Old-parent-id and new-parent-id cannot be the same! (unless changing between truth-arg and relevance-arg)");*/
122+
123+
// if the new-parent-id is the same as the old-parent-id, then only allow the re-link to proceed if the child-group is changing
124+
if (newParentID == oldParentID) {
125+
const oldLink = GetNodeLinks(oldParentID, nodeID)[0];
126+
AssertV(oldLink, `Cannot find old-link for node (${nodeID}) under old-parent-id (${oldParentID})!`);
127+
AssertV(childGroup != oldLink.group, "Old-parent-id and new-parent-id cannot be the same! (unless changing child-group)");
128+
}
129+
124130
//AssertV(CanContributeToNode(MeID(), newParentID), "Cannot paste under a node with contributions disabled.");
125131

126132
// if (command.payload.unlinkFromOldParent && node.parents.VKeys().length == 1 && newParentPath.startsWith(draggedNodePath)) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Remote (public):
156156
Port-assignment scheme: (ie. meaning of each digit in `ABCD`)
157157
* A) app/project [5: debate-map]
158158
* B) cluster [0: skipped, 1: local, 2: remote] (0 is skipped to avoid clashes with common ports, eg. 5000 for UPnP)
159-
* C) pod [0: web-server, 1: app-server, 2: postgres instance, 3: monitor, 4: hyperknowledge, 5: tilt]
159+
* C) pod [0: web-server, 1: app-server, 2: postgres instance, 3: monitor, 4: hyperknowledge, 5: pyroscope, 9: tilt]
160160
* D) variant [0: main, 1: served from webpack, etc.]
161161

162162
> Note: Not all web-accessible k8s services are shown in the list above. Specifically:

package-scripts.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ Object.assign(scripts, {
341341
return KubeCTLCommand(commandArgs[0], `-n postgres-operator port-forward $(${GetPodNameCmd_DB(commandArgs[0])}) 8081:5432`);
342342
}),*/
343343

344-
tiltUp_local: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt up -f ./Tilt/Main.star --context dm-local --port 5150 -- --env dev ${extraTiltArgs}`,
345-
tiltUp_local_release: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt up -f ./Tilt/Main.star --context dm-local --port 5150 -- --env dev --compileWithRelease ${extraTiltArgs}`,
346-
tiltDown_local: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt down -f ./Tilt/Main.star --context dm-local --port 5150 -- --env dev ${extraTiltArgs}`,
347-
tiltUp_ovh: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt up -f ./Tilt/Main.star --context dm-ovh --port 5250 -- --env prod ${extraTiltArgs}`,
348-
tiltDown_ovh: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt down -f ./Tilt/Main.star --context dm-ovh --port 5250 -- --env prod ${extraTiltArgs}`,
344+
tiltUp_local: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt up -f ./Tilt/Main.star --context dm-local --port 5190 -- --env dev ${extraTiltArgs}`,
345+
tiltUp_local_release: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt up -f ./Tilt/Main.star --context dm-local --port 5190 -- --env dev --compileWithRelease ${extraTiltArgs}`,
346+
tiltDown_local: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt down -f ./Tilt/Main.star --context dm-local --port 5190 -- --env dev ${extraTiltArgs}`,
347+
tiltUp_ovh: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt up -f ./Tilt/Main.star --context dm-ovh --port 5290 -- --env prod ${extraTiltArgs}`,
348+
tiltDown_ovh: `${PrepDockerCmd()} ${SetTiltEnvCmd()} tilt down -f ./Tilt/Main.star --context dm-ovh --port 5290 -- --env prod ${extraTiltArgs}`,
349349
// these are pod-specific tilt-up commands, for when you want to only update a single pod (well technically, that one pod plus all its dependencies, currently -- but still useful to avoid updating other 1st-party pods)
350350
tiltUp_ovh_webServer: Dynamic(()=>RunTiltUp_ForSpecificPod("dm-web-server", 10361)), // tilt-port +(10+1), as targeted tilt-up #1
351351
tiltUp_ovh_appServer: Dynamic(()=>RunTiltUp_ForSpecificPod("dm-app-server", 10362)), // tilt-port +(10+2), as targeted tilt-up #2

0 commit comments

Comments
 (0)