Merge pull request 'Let the current Dev account edit execution briefs' (#414) from fix/dev-ticket-editor-access into main
Some checks failed
DuneRealms Web CI / web (push) Has been cancelled

This commit is contained in:
unimatrix 2026-11-19 20:45:12 +00:00
commit 26835f96e3
4 changed files with 13 additions and 2 deletions

View file

@ -18,7 +18,7 @@ $render=function($key)use($jf,$values,$jc,$je){
?>
<section class="dev-box dev-jarvis-request" id="new-task">
<div class="dev-task-heading"><div><p class="eyebrow">A REQUEST IS NOT AN EXECUTED ACTION</p><h2>J.A.R.V.I.S. request desk</h2></div><img src="/assets/seals/team-dev-150.png" width="64" height="64" alt="Development bureau seal"></div>
<p>Choose the execution route, identify the exact targets and define the evidence needed to finish. Your request is preserved in a private ticket. Approval does not issue a key or execute a change.</p>
<p>Use English. Choose the execution route, identify the exact targets and define the evidence needed to finish. Your request is preserved in a private ticket. Approval does not issue a key or execute a change.</p>
<form method="post" id="jarvis-dev-request">
<input type="hidden" name="action" value="create"><input type="hidden" name="csrf" value="<?=$je($_SESSION['dune_dev_csrf'])?>"><input type="hidden" name="submission" value="<?=$je($_SESSION['dune_dev_submission'])?>">
<fieldset><legend>1 · Route &amp; destination</legend><div class="dev-fields"><?php foreach(['title','workflow','type','system','environment']as$k)$render($k);?></div><p id="jarvis-route-help" role="status">A supported data operation uses an existing Jarvis action. A browser or access problem does not turn it into a developer operation.</p></fieldset>

View file

@ -104,6 +104,7 @@ function dune_jarvis_execution_brief($values) {
$parts=['J.A.R.V.I.S. REQUEST v1 — '.dune_jarvis_routes()[$route],"State: REQUESTED / NOT EXECUTED. Ticket approval does not execute an operation.","Execution route\n".$steps[$route]];
foreach(dune_jarvis_fields()as$key=>[$label])if(($values[$key]??'')!=='')$parts[]=$label."\n".$values[$key];
if($route==='existing')$parts[]="Recorded action template version: ".($values['action_template_version']??'unknown')."\nTyped action parameters:\n".($values['action_parameters']??'{}');
$parts[]='Language: use English for new user-facing text, documentation, ticket updates and completion reports. Preserve proper names and original quotations when needed.';
$parts[]='Completion requires actual results, preserved-record checks and an audit/receipt reference. Clearly distinguish planned, simulated, staged, deployed and executed. Never include a secret key in ticket text or attachments.';
return implode("\n\n",$parts);
}

View file

@ -30,7 +30,7 @@ function dune_dev_transition($identity,$action,$state,$note) {
if($action==='deny'&&$state==='pending')return 'denied';
throw new RuntimeException('This action is not available for the current task state.');
}
function dune_dev_priority_editor($identity) {return dune_dev_owner($identity)||(strtolower($identity['username']??'')==='dev'&&in_array('web_dev',$identity['ranks']??[],true));}
function dune_dev_priority_editor($identity) {return dune_dev_owner($identity)||(strtolower($identity['username']??'')==='dev'&&dune_dev_team($identity));}
function dune_dev_legacy_fields() {
return [
'title'=>['Task title',true,160,'input','A short, specific outcome'],

View file

@ -27,4 +27,14 @@ $bad=valid_request();$bad['execution_state']='completed';[$v,$e]=dune_dev_valida
check(str_contains(dune_dev_execution_brief(['objective'=>'Old request']),'Legacy request'),'Legacy ticket was reinterpreted as an executable instruction');
$original=['title'=>'Old title','objective'=>'Original request'];$copy=$original;dune_dev_execution_brief($original);check($original===$copy,'Legacy request data mutated');
$owner=['username'=>'unimatrix999','ranks'=>['owners']];check(dune_dev_owner($owner),'Existing owner approval changed');check(!dune_dev_owner(['username'=>'unimatrix999','ranks'=>['user']]),'Name alone gained owner authority');
check(str_contains(dune_dev_execution_brief($v),'Language: use English'),'English execution requirement missing');
$dev=['username'=>'dev','ranks'=>['network_admin']];
check(dune_dev_team($dev)&&dune_dev_submitter($dev)&&dune_dev_priority_editor($dev),'Current Dev account cannot read/write Dev requests');
check(dune_dev_transition($dev,'complete','approved','Verified completion evidence attached.')==='completed','Dev cannot close approved work');
check(!dune_dev_owner($dev),'Dev gained owner approval authority');
check(!dune_dev_priority_editor(['username'=>'dev','ranks'=>['user']]),'Dev name alone grants editing');
check(!dune_dev_priority_editor(['username'=>'other','ranks'=>['network_admin']]),'Unrelated account gained Dev editing');
$managed=['username'=>'dev','nativePermissionManagement'=>false,'permissions'=>['web.tickets.dev'],'ranks'=>['user']];
check(dune_dev_priority_editor($managed),'Managed Dev permission was ignored');
$managed['permissions']=[];check(!dune_dev_priority_editor($managed),'Removed Dev permission still allows editing');
echo json_encode(['passed'=>$checks,'failed'=>0,'ticket_created'=>false,'keys_issued'=>0])."\n";