Per spec §3.7.5, a new {@code witness} list "becomes active AFTER the new + * DID log has been published". So while witnesses are already active, every + * entry — including one that changes the list (e.g. from two witnesses + * to one) or one that turns witnessing off ({@code {}}) — MUST be witnessed by + * the list that was in effect before this entry. The replacement list + * only governs subsequent entries. Returning the prior list here also closes the + * loophole where a controller could unilaterally shrink or remove oversight in a + * single unapproved entry. + * + *
The only exception is the first activation: when no witnesses were active
+ * before, there is no prior list to defer to, so the newly merged list applies
+ * immediately.
*/
private WitnessConfig authorizedWitnesses(Parameters priorParams, Parameters entryDelta) {
WitnessConfig priorActive = priorParams.getWitness();
- Parameters merged = priorParams.merge(entryDelta);
- WitnessConfig mergedActive = merged.getWitness();
- boolean turningOff = priorActive != null && priorActive.isActive()
- && (mergedActive == null || !mergedActive.isActive());
- if (turningOff) {
+ if (priorActive != null && priorActive.isActive()) {
return priorActive;
}
- return mergedActive;
+ // First activation: no prior witnesses, so the new list applies to this entry.
+ return priorParams.merge(entryDelta).getWitness();
}
private WitnessProofEntry buildProofEntry(String versionId, WitnessConfig authorized,
diff --git a/docs/AGENTS.md b/docs/AGENTS.md
index 572289d..80e40a8 100644
--- a/docs/AGENTS.md
+++ b/docs/AGENTS.md
@@ -161,6 +161,20 @@ Use [Conventional Commits](https://www.conventionalcommits.org/):
- `docs: update README with resolve example`
- `chore: configure JaCoCo for coverage reporting`
+## Changelog and Commit Workflow
+
+After completing any change to the codebase, the agent MUST:
+
+1. **Update the changelog.** Add a summary of the change under the `## [Unreleased]`
+ section of `CHANGELOG.md`, in the appropriate `### Added` / `### Changed` /
+ `### Fixed` / `### Removed` subsection (create the subsection if it does not yet
+ exist). Follow the existing style: reference the spec section and/or issue number
+ for non-obvious behaviour.
+2. **Propose a commit message.** End the response with a suggested
+ [Conventional Commits](https://www.conventionalcommits.org/) commit message for the
+ change, so the developer can review and commit it. Do not commit on the developer's
+ behalf unless explicitly asked.
+
## How to Work on This Project
1. Read `docs/ARCHITECTURE.md` for the full technical design.
@@ -169,3 +183,5 @@ Use [Conventional Commits](https://www.conventionalcommits.org/):
4. Run `./mvnw clean verify` with JDK 21 after every change to ensure tests, Checkstyle, SpotBugs, and
coverage run locally.
5. Keep dependencies minimal. Don't add a library for something that can be done in 20 lines.
+6. After every change, update the `[Unreleased]` section of `CHANGELOG.md` and propose a
+ commit message (see [Changelog and Commit Workflow](#changelog-and-commit-workflow)).
diff --git a/pom.xml b/pom.xml
index afc6dd1..67dd9a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@