@bugb-technologies/bravos 1.9.3 → 1.12.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.
@@ -113,10 +113,9 @@ jobs:
113
113
  name: bravos-replay-ledger
114
114
  path: ${{ runner.temp }}/bravos-verified-ledger/hypotheses.json
115
115
  retention-days: 1
116
- # Context first. The annotate job runs only when a named person has confirmed what the product intends
117
- # (.guardlink/intent.md), or recorded that the team goes without (bravos context decline). The check is one
118
- # dependency-free script from the default branch; an agent in this workflow cannot open the gate, because nothing it
119
- # writes under .bravos/ or to the intent is ever staged.
116
+ # The intake's state, as a report. Annotation never waits for it: with no confirmed intent the agent judges against
117
+ # the draft in .guardlink/intent.md (or none), and this job says so in the run summary. The check is one
118
+ # dependency-free script from the default branch; nothing the agent writes under .bravos/ or to the intent is staged.
120
119
  context:
121
120
  if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
122
121
  runs-on: ubuntu-latest
@@ -133,23 +132,22 @@ jobs:
133
132
  with:
134
133
  node-version: 22
135
134
 
136
- - name: Context first
135
+ - name: Intake state
137
136
  id: gate
138
137
  run: |
139
138
  if [ ! -f .bravos/hooks/lib/context.mjs ]; then
140
- echo "::notice::This repository's bravos hook scripts predate the context check; run bravos sync. Annotating as before."
141
139
  echo "open=true" >> "$GITHUB_OUTPUT"
142
140
  elif node .bravos/hooks/lib/context.mjs gate . > "$RUNNER_TEMP/gate.txt"; then
143
141
  echo "open=true" >> "$GITHUB_OUTPUT"
144
142
  else
145
143
  echo "open=false" >> "$GITHUB_OUTPUT"
146
- { echo "### Annotation skipped: context first"; echo; cat "$RUNNER_TEMP/gate.txt"; } >> "$GITHUB_STEP_SUMMARY"
147
- echo "::notice::Annotation skipped: no confirmed intent and no recorded decline. Replay is unaffected."
144
+ { echo "### Annotating against the draft intent"; echo; cat "$RUNNER_TEMP/gate.txt"; } >> "$GITHUB_STEP_SUMMARY"
145
+ echo "::notice::Intake not confirmed: annotation runs against the draft intent. A person confirms it with bravos review intent."
148
146
  fi
149
147
 
150
148
  annotate:
151
149
  needs: [replay, context]
152
- if: always() && !cancelled() && needs.context.outputs.open == 'true' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
150
+ if: always() && !cancelled() && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
153
151
  runs-on: ubuntu-latest
154
152
  env:
155
153
  BRAVOS_LICENCE: ${{ secrets.BRAVOS_LICENCE }}
@@ -197,7 +195,10 @@ jobs:
197
195
  next unannotated files that `guardlink unannotated --json` lists. You are the agent: do
198
196
  the work in this session and never run guardlink annotate with an agent flag. Stop when
199
197
  `guardlink lint . --since ${{ steps.start.outputs.sha }} --json` reports 0 errors and
200
- `guardlink validate .` passes. Leave the changes uncommitted; a later step commits them
198
+ `guardlink validate .` passes. Intent confirmed: ${{ needs.context.outputs.open }}. Do not run
199
+ bravos-context or open the intake page here: judge against .guardlink/intent.md as it stands,
200
+ draft or confirmed, and without one say so in an @audit where a severity depends on intent.
201
+ Leave the changes uncommitted; a later step commits them
201
202
  and opens the pull request. Draft kits this run: ${{ needs.replay.outputs.drafts }}.
202
203
  Only when yes, for each newly testable exposure use the GuardLink translate method
203
204
  in this session to author or update one scoped JavaScript probe under .guardlink/cxg-replay/,
@@ -44,24 +44,22 @@ jobs:
44
44
  with:
45
45
  node-version: 22
46
46
 
47
- # Context first: Copilot is asked for a slice only when a named person has confirmed what the product intends
48
- # (.guardlink/intent.md), or recorded that the team goes without (bravos context decline).
49
- - name: Context first
47
+ # The intake's state, as a report: Copilot is asked for a slice whatever it is, and judges against the draft intent
48
+ # while no named person has confirmed it (.guardlink/intent.md).
49
+ - name: Intake state
50
50
  id: gate
51
51
  run: |
52
52
  if [ ! -f .bravos/hooks/lib/context.mjs ]; then
53
- echo "::notice::This repository's bravos hook scripts predate the context check; run bravos sync. Asking Copilot as before."
54
53
  echo "open=true" >> "$GITHUB_OUTPUT"
55
54
  elif node .bravos/hooks/lib/context.mjs gate . > "$RUNNER_TEMP/gate.txt"; then
56
55
  echo "open=true" >> "$GITHUB_OUTPUT"
57
56
  else
58
57
  echo "open=false" >> "$GITHUB_OUTPUT"
59
- { echo "### No slice requested: context first"; echo; cat "$RUNNER_TEMP/gate.txt"; } >> "$GITHUB_STEP_SUMMARY"
60
- echo "::notice::No slice requested: no confirmed intent and no recorded decline."
58
+ { echo "### Annotating against the draft intent"; echo; cat "$RUNNER_TEMP/gate.txt"; } >> "$GITHUB_STEP_SUMMARY"
59
+ echo "::notice::Intake not confirmed: the slice is judged against the draft intent. A person confirms it with bravos review intent."
61
60
  fi
62
61
 
63
62
  - name: Ask Copilot for the next slice
64
- if: steps.gate.outputs.open == 'true'
65
63
  env:
66
64
  GH_TOKEN: ${{ secrets.COPILOT_ASSIGN_TOKEN }}
67
65
  REPO: ${{ github.repository }}
@@ -84,6 +82,7 @@ jobs:
84
82
  - Follow the bravos-annotate skill (\`.claude/skills/bravos-annotate/SKILL.md\` or \`.agents/skills/bravos-annotate/SKILL.md\`) in slice mode, its default, on the files \`guardlink unannotated --json\` lists first.
85
83
  - Do the work yourself in this session. Never run guardlink annotate with an agent flag.
86
84
  - Stop when \`guardlink lint . --since $START --json\` reports 0 errors and \`guardlink validate .\` passes.
85
+ - Judge against \`.guardlink/intent.md\` as it stands, draft or confirmed; do not run bravos-context or open the intake page.
87
86
  - Change annotations only, not code, and open one pull request with them.
88
87
 
89
88
  Opened by the bravos nightly. While this issue is open the nightly opens no other; the next one comes after it closes.
@@ -165,7 +165,8 @@ jobs:
165
165
  # A design rule (a threat whose id starts inv-, written from the team's intent) that was holding, on a file
166
166
  # this PR changed after the rule's last refused test, must be named in the PR body by its INV id or its
167
167
  # threat id: the held result no longer describes the code. The same check as the pre-PR hook, at file
168
- # level, with git and jq. A rule no test has tried yet is listed in the summary, never blocked.
168
+ # level, with git and jq. A rule no test has tried yet is listed in the summary, never blocked. A rule still a draft
169
+ # in intent.md (the agent's, not yet confirmed by a person) counts the same, and is labelled so.
169
170
  - name: No untested change under a design rule
170
171
  env:
171
172
  PR_BODY: ${{ github.event.pull_request.body }}
@@ -200,6 +201,11 @@ jobs:
200
201
  | .outcome.at | strings | (sub("\\.[0-9]+Z$"; "Z") | fromdateiso8601)?] | min) }
201
202
  | select(.files | length > 0)]
202
203
  ' "$model" > "$touched"
204
+ # INV ids nobody has confirmed: the text after the last " — " starts with draft, or there is none.
205
+ drafts="$RUNNER_TEMP/bravos-rules-drafts.json"
206
+ jq -R -s '[split("\n")[] | capture("^\\s*[-*]\\s+(?<id>INV-[0-9]+)\\s*:\\s*(?<rest>.+)$")?
207
+ | select(.rest | split(" — ") | if length > 1 then (.[-1] | test("^\\s*draft\\b"; "i")) else true end) | .id] | unique
208
+ ' .guardlink/intent.md > "$drafts"
203
209
  # The last commit in this PR that touched each of those files, in seconds.
204
210
  times="$RUNNER_TEMP/bravos-rules-times.json"
205
211
  echo '{}' > "$times"
@@ -211,11 +217,11 @@ jobs:
211
217
  jq -r '.[] | select(.tested == null) |
212
218
  " " + ([.inv, .threat, (.files | join(", ")), "no test has tried this design rule yet"] | tojson)
213
219
  ' "$touched" >> "$GITHUB_STEP_SUMMARY"
214
- jq -r -L "$RUNNER_TEMP" --arg body "$PR_BODY" --slurpfile times "$times" 'include "named";
220
+ jq -r -L "$RUNNER_TEMP" --arg body "$PR_BODY" --slurpfile times "$times" --slurpfile drafts "$drafts" 'include "named";
215
221
  .[] | select(.tested != null) | . as $r | .files |= map(select(($times[0][.] // 0) > $r.tested))
216
222
  | select(.files | length > 0)
217
223
  | select((named($body; .threat) or named($body; .inv)) | not)
218
- | "\(.inv // "rule") \(.threat) — \(.files | join(", ")) (last tested \(.tested | todate | .[0:10]))"
224
+ | "\(.inv // "rule")\(.inv as $i | if ($i != null and any($drafts[0][]; . == ($i | ascii_upcase))) then " (draft: not yet confirmed by a person)" else "" end) \(.threat) — \(.files | join(", ")) (last tested \(.tested | todate | .[0:10]))"
219
225
  ' "$touched" > "$RUNNER_TEMP/bravos-rules-lapsed.txt"
220
226
  if [ -s "$RUNNER_TEMP/bravos-rules-lapsed.txt" ]; then
221
227
  echo "::error::This PR changes code under a design rule that was holding, after the rule was last tested. Replay its test (bravos-recheck), or name each rule (its INV id or threat id) in the PR body:"