Skip to content
MINH VO A working notebook
by an engineer in Vietnam
Foundation8 min read

Practice ownership with a bounded engineering task

Turn a vague CSV export fix into a bounded task with a failing example, data checks and clear handoff, while separating serialization from delivery and import.

Watercolor notebooks, an open sketchbook and a wooden pencil on a cream surface

Owning a bounded engineering task means taking responsibility for its result, dependencies and handoff while keeping the scope explicit. You do not need to redesign an entire subsystem to practice that skill. A small correction can require careful judgment about user expectations, evidence and the decisions that belong to someone else.

My standard is that another engineer should be able to tell what changed, why it is sufficient, and what remains unresolved without reconstructing my investigation. This article is for an early-career developer who can read a short function and run a local test. We will turn a fictional “fix the catalog export” request into a complete, limited piece of work.

Replace the vague request with an observable failure

Suppose a catalog exports two text columns, item_id and label. Its current implementation joins field values with commas and joins records with line breaks. A label such as Red, blue therefore appears to contain an extra column. A label with an embedded newline can appear to start another record.

Write the problem in terms of the consuming workflow: a reader using the agreed CSV format must recover the original two fields for every selected catalog item. “Make the download work” does not identify that failure. “Use a CSV library” names an implementation before establishing what the user needs.

Keep a minimal reproduction with an ordinary label, a comma, a double quote, an embedded newline and non-ASCII text. Include a leading-zero identifier such as 007 because it is a text identifier, not the number seven. These examples cover different formatting obligations; five copies of an ordinary word would add little evidence.

The initial deliverable is a short issue description with the input, expected parsed records and observed mismatch. That makes the task reviewable even before a patch exists. It also gives the reviewer a chance to point out an incorrect assumption about the consumer or the export schema.

Agree on the small contract

For this exercise, the contract is UTF-8 CSV with a header, comma-separated fields, double-quote escaping, and CRLF between records. Preserve the supplied item order and exact string contents. Each selected item contributes one two-field data record; an empty selection produces only the header. The existing caller supplies a finite sequence of already validated two-string records that can be encoded as UTF-8.

RFC 4180 describes quoting fields containing commas, quotes or line breaks, and doubling a quote within a quoted field. It is an informational memo, not a guarantee that every spreadsheet uses identical conventions. Our exercise adopts an explicit format so the producer and intended consumer have something concrete to agree on.

The scope covers serialization and its regression evidence. It does not decide which catalog items the caller selects, who may export them, or whether the selection is a consistent database snapshot. Those existing responsibilities still matter. Before calling the work complete, identify where they are enforced and ensure the patch leaves their intended behavior intact.

A bounded export correction connects the failure, format contract, implementation and handoff, with separate owners for selection and deliveryView full-size image ↗

The boundary describes responsibility for this change. It does not remove the need to check the surrounding request path.

If the issue actually requires exporting millions of records, the in-memory implementation below may be the wrong unit of work. If the consumer demands a typed workbook, CSV quoting alone will not supply that behavior. Surface either finding with its consequence and a proposed scope revision. Expanding the task silently makes it harder to review; ignoring the finding leaves the user with a correction that does not solve the real problem.

Make the formatting example executable

Python’s CSV documentation describes the writer’s quoting controls and the reader’s string results. It also explains why newline handling matters. Use the established serializer rather than growing a collection of comma-replacement rules.

The following function operates on the validated records described above. It deliberately builds a small result in memory and returns bytes. The assertions parse those bytes back into records, which checks the data contract instead of judging whether the file looks aligned in a text editor.

import csv
import io


def render_catalog_csv(records):
    # records: finite iterable of validated, UTF-8-encodable
    # (item_id, label) string pairs in the intended export order.
    output = io.StringIO(newline="")
    writer = csv.writer(output, lineterminator="\r\n")
    writer.writerow(("item_id", "label"))
    writer.writerows(records)
    return output.getvalue().encode("utf-8")


records = (
    ("007", "Plain"),
    ("008", "Red, blue"),
    ("009", 'He said "ready"'),
    ("010", "Line one\nLine two"),
    ("011", "Cà phê"),
)
expected = [["item_id", "label"], *map(list, records)]
payload = render_catalog_csv(iter(records))
parsed = list(csv.reader(io.StringIO(payload.decode("utf-8"), newline="")))
assert parsed == expected
assert len(parsed) == 6 and all(len(row) == 2 for row in parsed)
assert parsed[1][0] == "007"
assert render_catalog_csv(()) == b"item_id,label\r\n"

broken = "\r\n".join(
    ",".join(row) for row in [("item_id", "label"), *records]
) + "\r\n"
broken_rows = list(csv.reader(io.StringIO(broken, newline="")))
assert broken_rows != expected
assert broken_rows[2] == ["008", "Red", " blue"]
print(f"{len(parsed) - 1} data records; {len(parsed)} records with header")

The output reports five data records and six records including the header. The newline inside one label remains part of that field. Counting physical text lines would answer a different question. The broken comma-joining version demonstrates the original failure: the comma label becomes three fields rather than two.

Quoting the comma-containing label yields two parsed strings while plain comma joining yields threeView full-size image ↗

The quotes structure the serialized record. They are not extra quote characters in the parsed label.

This local check establishes serialization behavior for these inputs. It does not establish that an HTTP response contains these exact bytes, that the selected records are authorized, or that a particular spreadsheet import preserves text identifiers. A spreadsheet can interpret 007 as a number even when a CSV parser returns the string unchanged. Verify the intended import workflow if that is part of the acceptance contract.

Keep the patch small and the evidence complete

Google’s guidance on small changes defines a useful unit as a self-contained change and includes its related tests. The important boundary is conceptual. Splitting the serializer correction from the test that reveals the bug would not automatically make the review clearer.

A proposed patch can replace the joining logic, add the parser-based regression cases, and document the chosen encoding and dialect at the interface. It need not rename every export function or migrate the entire catalog API. If a prerequisite refactoring is needed, explain its role and keep each intermediate state usable.

Then check the actual caller. Confirm that it passes the intended two fields in the intended order, and that its response handling preserves the returned bytes. For a repository task, that means inspecting the relevant code and running an appropriately scoped integration check. The isolated function above cannot substitute for evidence from a request path that it never executes.

EvidenceWhat it answers
Original failing fixtureDoes the regression test expose the reported defect?
Parsed corrected resultAre the agreed text fields and record boundaries preserved?
Caller and response checkDoes the real export path use the correction and deliver its bytes?
Intended consumer checkDoes the supported import workflow interpret the file as required?

Do not turn this table into four checkmarks copied from another task. Record what was actually inspected or executed. If the consumer is unavailable, distinguish the completed serializer evidence from the pending import check and identify who can supply it. A clear handoff is more useful than an unsupported claim that the export is now universally compatible.

Handle a new finding without losing the task

Imagine the caller starts streaming output before all records have been validated. A later invalid record could leave a partially downloaded file. That finding concerns response and validation behavior, beyond replacing the formatting routine. Capture a concrete example and discuss whether it blocks the requested correction or needs a separate change. Its priority depends on the existing product contract and consequences.

The in-memory function returns only after successful serialization and encoding, but that observation does not prove atomic delivery over a network. The client can still disconnect, or the response path can fail. Keep the boundary of each claim aligned with the part of the system you tested.

Close the task with the observed before-and-after behavior, the exact scope, verification results and any unresolved dependency. If a follow-up exists, give it an owner and a clear question rather than an unassigned “improve exports” reminder. A reviewer should be able to accept the completed correction without accidentally approving the deferred work.

For practice, take one vague issue and prepare the same packet: a failing example, a small behavioral contract, a proposed implementation boundary and a claim-to-evidence table. Ask what new fact would make the scope inadequate. Use the answer to adjust the task before calling it complete.

Sources & further reading

  1. RFC 4180: Common Format and MIME Type for CSV Files, October 2005
  2. Python: CSV File Reading and Writing
  3. Google Engineering Practices: Small CLs
← Back to the journal
All notes

Illustration

100%