Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
# [SEC A END]

# [SEC B START] Greetings
GREETING = "Hello v1"
GREETING = "Howdy from FEATURE"
SIGNOFF = "Thanks,"
def greet(name):
return f"{GREETING}, {name}"
# feature chooses different punctuation & placement
return f"{SIGNOFF} {name}. {GREETING}"
# SEC B filler 001
# SEC B filler 002
# SEC B filler 003
Expand Down Expand Up @@ -77,6 +79,9 @@ def greet(name):
# [SEC C START] Math helpers
def add(a, b):
return a + b

def multiply(a, b):
return a * b
# SEC C filler 001
# SEC C filler 002
# SEC C filler 003
Expand Down Expand Up @@ -110,9 +115,9 @@ def add(a, b):
# [SEC C END]

# [SEC D START] Logger
LEVEL = "INFO"
LEVEL = "WARN"
def get_logger():
fmt = "[%(levelname)s] %(message)s"
fmt = "[%(levelname)s] %(name)s: %(message)s" # feature adds logger name
return (LEVEL, fmt)
# SEC D filler 001
# SEC D filler 002
Expand Down Expand Up @@ -147,9 +152,10 @@ def get_logger():
# [SEC D END]

# [SEC E START] Versioning
VERSION = "1.0.0"
VERSION = "1.5.0"
def compute_version():
return VERSION
# feature appends -feature
return VERSION + "-feature"
# SEC E filler 001
# SEC E filler 002
# SEC E filler 003
Expand Down Expand Up @@ -183,7 +189,8 @@ def compute_version():
# [SEC E END]

# [SEC F START] Flags
FEATURE_X = False
FEATURE_X = True
FEATURE_Y = False
# SEC F filler 001
# SEC F filler 002
# SEC F filler 003
Expand Down
15 changes: 9 additions & 6 deletions handbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ version: 1
<!-- Ch1 filler 030 -->

# Chapter 2: Coding Standards
- Use black/ruff
- Use black/ruff (lenient)
- 100-col limit
- Docstrings required
- Docstrings preferred, type hints optional
<!-- Ch2 filler 001 -->
<!-- Ch2 filler 002 -->
<!-- Ch2 filler 003 -->
Expand Down Expand Up @@ -77,6 +77,8 @@ version: 1
- main is protected
- feature branches from main
- rebase before merge
- PRs must reference a ticket
- Merge via squash
<!-- Ch3 filler 001 -->
<!-- Ch3 filler 002 -->
<!-- Ch3 filler 003 -->
Expand Down Expand Up @@ -144,9 +146,10 @@ version: 1
<!-- Ch4 filler 030 -->

# Chapter 5: Release Process
- bump version
- tag release
- version bump via tool
- tag &amp; sign release
- publish artifacts
- canary 10% for 1h
<!-- Ch5 filler 001 -->
<!-- Ch5 filler 002 -->
<!-- Ch5 filler 003 -->
Expand Down Expand Up @@ -180,8 +183,8 @@ version: 1

# Chapter 6: Incident Response
- SEV1 page immediately
- RCA within 72h
- Postmortem doc
- RCA start within 48h
- Postmortem by end of week
<!-- Ch6 filler 001 -->
<!-- Ch6 filler 002 -->
<!-- Ch6 filler 003 -->
Expand Down
15 changes: 9 additions & 6 deletions pipeline.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ WHERE deleted = false;
CREATE TEMP TABLE t_active AS
SELECT id, name
FROM t_users
WHERE active = true;
WHERE active = true AND name <> ''
ORDER BY name;
-- S2 filler 001
-- S2 filler 002
-- S2 filler 003
Expand Down Expand Up @@ -113,9 +114,10 @@ LEFT JOIN purchases p ON p.user_id = a.id;

-- [STAGE 4 START] aggregate revenue
CREATE TEMP TABLE t_rev AS
SELECT id, SUM(amount) AS revenue
SELECT id, SUM(amount) AS revenue -- feature keeps raw sum
FROM t_join
GROUP BY id;
GROUP BY id
HAVING SUM(amount) &gt; 0; -- feature adds HAVING
-- S4 filler 001
-- S4 filler 002
-- S4 filler 003
Expand Down Expand Up @@ -149,10 +151,11 @@ GROUP BY id;
-- [STAGE 4 END]

-- [STAGE 5 START] write outputs
INSERT INTO reporting.users_daily (id, name, revenue, dt)
SELECT j.id, j.name, r.revenue, CURRENT_DATE
INSERT INTO reporting.users_daily (id, name, revenue, yyyymm)
SELECT j.id, j.name, r.revenue, TO_CHAR(CURRENT_DATE, 'YYYYMM')
FROM t_join j
JOIN t_rev r USING (id);
-- feature writes to yyyymm column instead of dt
-- S5 filler 001
-- S5 filler 002
-- S5 filler 003
Expand Down Expand Up @@ -186,7 +189,7 @@ JOIN t_rev r USING (id);
-- [STAGE 5 END]

-- [STAGE 6 START] finalize
VACUUM ANALYZE;
ANALYZE VERBOSE; -- feature alternative finalization
-- S6 filler 001
-- S6 filler 002
-- S6 filler 003
Expand Down