Skip to content

Commit 030639a

Browse files
authored
chore: add ticket references to TODOs and enforce via CI (#71)
* chore: add proper ticket references to TODOs and fix small TODOs * Add a CI check and justfile task that ensures all TODO/FIXME/HACK comments include a ticket reference * fix: remove james bond ticket number with actual ticket number * fix: allow hacks without ticket references * fix: ref proper ticket
1 parent 65778cd commit 030639a

File tree

21 files changed

+79
-31
lines changed

21 files changed

+79
-31
lines changed

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ jobs:
8484
run: |
8585
taplo fmt --check
8686
87+
todo-tickets:
88+
name: Check ticketed TODOs
89+
runs-on: ubuntu-latest
90+
timeout-minutes: 5
91+
permissions:
92+
contents: read
93+
steps:
94+
- name: Checkout repository
95+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
96+
with:
97+
persist-credentials: false
98+
99+
- name: Check for ticketless TODOs
100+
run: bash contrib/check_ticketless_todos.sh
101+
87102
lint-success:
88103
name: Check that lints passed
89104
runs-on: ubuntu-latest
@@ -92,6 +107,7 @@ jobs:
92107
- clippy
93108
- fmt
94109
- taplo
110+
- todo-tickets
95111
timeout-minutes: 30
96112
steps:
97113
- name: Decide whether the needed jobs succeeded or failed

.justfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ doctest:
5050
functional-test:
5151
cd functional-tests && ./run_test.sh
5252

53+
# Check that all TODO/FIXME/HACK comments have ticket references
54+
check-todos:
55+
bash contrib/check_ticketless_todos.sh
56+
5357
# Run all lints and formatting checks
54-
lints: toml-check-fmt toml-lint check-fmt clippy functional-check-fmt functional-lint
58+
lints: toml-check-fmt toml-lint check-fmt clippy functional-check-fmt functional-lint check-todos
5559

5660
# Rust all tests
5761
test: unit-test doctest

bin/asm-runner/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) struct BitcoinConfig {
5555
/// Optional retry interval
5656
pub retry_interval: Option<Duration>,
5757
/// Connection string used in `bitcoin.conf => zmqpubrawblock`.
58-
// TODO: (@prajwolrg) We should be able to work with `hashblock_connection_string` since ASM
58+
// TODO(STR-2662): We should be able to work with `hashblock_connection_string` since ASM
5959
// runner used btc-client to fetch the full block. We don't use it here since the BlockEvent is
6060
// emitted only on the rawblock connection. Fix that.
6161
pub rawblock_connection_string: String,

bin/asm-runner/src/prover/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl InputBuilder {
7979
.context("anchor state not found")?;
8080
let anchor_state = asm_state.state();
8181

82-
// TODO: https://alpenlabs.atlassian.net/browse/STR-2958 Construct proper MohoState
82+
// TODO(STR-2958): Construct proper MohoState
8383
let inner_state_commitment = AsmStfProgram::compute_state_commitment(anchor_state);
8484
let moho_state = moho_types::MohoState::new(
8585
inner_state_commitment,

contrib/check_ticketless_todos.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
# Check that all TODO/FIXME comments include a ticket reference.
4+
#
5+
# Valid: TODO(STR-2105), FIXME(#123)
6+
# Invalid: TODO, TODO:, FIXME without a ticket
7+
#
8+
# Usage:
9+
# ./contrib/check_ticketless_todos.sh
10+
11+
set -euo pipefail
12+
13+
# Scan all source files for TODO/FIXME without ticket references.
14+
violations=$(grep -rn \
15+
--include='*.rs' --include='*.py' --include='*.sh' \
16+
--include='*.toml' --include='*.yml' --include='*.yaml' \
17+
--exclude-dir='target' --exclude-dir='.venv' \
18+
-E '\b(TODO|FIXME)\b' . \
19+
| grep -vE '(TODO|FIXME)\([A-Za-z]+-[0-9]+\)' \
20+
| grep -vE '(TODO|FIXME)\(#[0-9]+\)' \
21+
| grep -vE 'check_ticketless_todos\.sh' \
22+
| grep -vE 'TODO_TICKETS\.md' \
23+
|| true)
24+
25+
if [ -n "$violations" ]; then
26+
echo "ERROR: Found TODO/FIXME comments without ticket references."
27+
echo " Use the format TODO(PROJ-123) or FIXME(#456) instead."
28+
echo ""
29+
echo "$violations"
30+
exit 1
31+
fi
32+
33+
echo "OK: All TODO/FIXME comments have ticket references."
34+
exit 0

crates/common/src/msg.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ impl Message {
8787
}
8888
}
8989

90-
// [PLACE_HOLDER] Update the names to align with the team’s new naming convention.
91-
// TODO: [PLACE_HOLDER] L2ToL1Msg are not expected to be used as inter-proto messages. (probably
92-
// it's gonna be part of Aux input) Temporary alias
93-
pub type L2ToL1Msg = Message;
94-
9590
#[cfg(test)]
9691
mod tests {
9792
use std::any::Any;

crates/common/src/subprotocol.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,8 @@ pub trait Subprotocol: 'static {
149149
/// * `msgs` - Slice of messages received from other subprotocols
150150
/// * `l1ref` - L1 block being processed
151151
///
152-
/// TODO:
153-
/// Also generate the event logs that is later needed for other components
154-
/// to read ASM activity. Return the commitment of the events. The actual
155-
/// event is defined by the subprotocol and is not visible to the ASM.
152+
/// TODO(STR-3028): Enable log emission from process_msgs to support multi-round
153+
/// inter-subprotocol messaging
156154
fn process_msgs(state: &mut Self::State, msgs: &[Self::Msg], l1ref: &L1BlockCommitment);
157155
}
158156

crates/manifest-types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ pub use ssz_generated::ssz::{
3232
};
3333

3434
/// Type alias for a 32-byte hash.
35-
// TODO use Buf32 from identifiers?
35+
// TODO(STR-3027): use Buf32 from identifiers or use proper newtype instead
3636
pub type Hash32 = [u8; 32];

crates/manifest-types/src/payloads.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use strata_msg_fmt::TypeId;
1010
use crate::AsmLog;
1111

1212
// Define type IDs for these log types
13-
pub const DEPOSIT_INTENT_ASM_LOG_TYPE_ID: TypeId = 100; // TODO: Confirm the actual type ID
14-
pub const CHECKPOINT_ACK_ASM_LOG_TYPE_ID: TypeId = 101; // TODO: Confirm the actual type ID
13+
pub const DEPOSIT_INTENT_ASM_LOG_TYPE_ID: TypeId = 100; // TODO(STR-3029): Consolidate logs together
14+
pub const CHECKPOINT_ACK_ASM_LOG_TYPE_ID: TypeId = 101; // TODO(STR-3029): Consolidate logs together
1515

1616
/// Payload for a deposit intent ASM log.
1717
///

crates/stf/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
mod manager;
99
mod preprocess;
1010
mod stage;
11-
mod stf;
11+
mod transition;
1212
mod tx_filter;
1313
mod types;
1414

1515
pub use preprocess::pre_process_asm;
16-
pub use stf::compute_asm_transition;
16+
pub use transition::compute_asm_transition;
1717
pub use tx_filter::group_txs_by_subprotocol;
1818
pub use types::{AsmStfInput, AsmStfOutput};

0 commit comments

Comments
 (0)