Skip to content

Module 01 · Lesson 1.2

Mapping Entry Points and Data Flow

45 minUpdated 13 Nov 2026Part of Codebase Discovery and Orientation · Existing Project Engineering
On this page
  1. What you will learn
  2. What an entry point is
  3. Worked scenario: the portal order
  4. Step-by-step workflow
  5. Tracing with an assistant
  6. Reusable prompt
  7. Expected output
  8. Common errors and fixes
  9. Validation checklist
  10. Hands-on exercise
  11. Knowledge check
  12. References

A folder tree shows where files live. It does not show how the system behaves. To change an existing system safely you need to know how work arrives, which code handles it, where data is read and written, and what happens afterwards that nobody mentions in the request. That picture comes from entry points and data flow.

In this lesson you will list the entry points of a service, trace one path through it, and record the result as a map you can check. You will use an AI assistant to speed up the tracing, but every hop it names must be one you can point to in the code.

The examples continue with Tidewell Wholesale and its fictional tidewell-orders service from Reading an Unfamiliar Codebase. The company, people and data are invented.

What you will learn

  • List the entry points of a service: web routes, background jobs, scheduled tasks, command-line scripts and message consumers.
  • Trace one request from its entry point to storage and back, recording a file and function for every hop.
  • Identify side effects, such as emails, queued jobs and external calls, that a change could trigger.
  • Use an assistant to propose a trace, and check each hop against the code.

Before you start

What an entry point is

An entry point is any place where something outside the code starts the code running. A user clicking a button is not an entry point; the HTTP request it produces is. Systems tend to have more entry points than their documentation admits, and the ones nobody remembers are the ones that break when you change shared code.

KindWhat starts itWhere to look in a Python and Django service
Web routeAn HTTP requesturls.py files, then the view each route names
Background taskA message on a queueFunctions marked as tasks; the worker command in the compose or deploy files
Scheduled jobA clockCelery beat settings, cron files, CI schedules, the hosting platform's scheduler
Command-line scriptA person or a scriptmanage.py commands, scripts/, Makefile targets
Event or webhook consumerAnother systemRoutes that accept callbacks; queue consumers
Migration or startup hookA deploymentMigration files, app ready() methods, entrypoint scripts
Six kinds of entry point. A service may have all of them.

Data flow is what the code does with the input after that: which functions transform it, which stores it reads and writes, which services it calls, and what it returns. Together, entry points and data flow answer the question 'if I change this function, what runs it, and what depends on what it produces?'

Call path
The ordered list of functions a single request passes through, from entry point to the last store or external call.
Side effect
Anything the code does besides returning a value: writing a row, queueing a job, sending an email, calling another service.
Seam
A place where behaviour can be observed or replaced without editing the code around it, such as a function boundary or an interface. Good seams are where you will later add tests.

Worked scenario: the portal order

You still need to add a minimum order value for Standard-band trade customers. Your reading question asks where an order is validated and totalled. First you list the entry points that can create or change an order, because a rule added only to the portal would be bypassed by any other route.

Bash
# Routes that mention orders
git grep -n "orders" -- "*urls.py"

# Every caller of the order-creation function
git grep -n "create_order(" -- "*.py"

# Tasks, scheduled jobs and management commands
git grep -nE "@shared_task|@app.task|beat_schedule" -- "*.py"
ls orders/management/commands scripts 2>/dev/null

Finding the ways an order can be created. Search tracked files only.

Result in the fictional repositoryIllustrative — your output will differ
api/urls.py:14:    path("orders/", views.OrderCreateView.as_view()),
orders/services.py:31:def create_order(customer, lines, source):
api/views.py:58:        order = create_order(customer, lines, source="portal")
dispatch/importers.py:44:        order = create_order(customer, lines, source="edi")
orders/management/commands/replay_orders.py:22:    create_order(c, l, source="replay")
orders/tasks.py:9:@shared_task
orders/tasks.py:10:def send_order_confirmation(order_id):

There are three callers, not one: the portal, an EDI importer in dispatch/ that receives orders from larger customers, and a replay command used by support. Your rule belongs in or near create_order, not in the portal view. The importer is a finding in itself, because nobody mentioned it. It also raises a question for a person: should EDI customers on the Standard band be subject to the minimum?

Now trace the portal path, which is the most common one. You read each function in turn and write down what it receives, what it does to data, and what it calls next.

HopLocationWhat happensData written or side effect
1api/urls.py, OrderCreateViewRoutes POST /api/orders/None
2api/views.py, post()Authenticates the customer, parses lines from JSON, calls create_orderNone
3orders/services.py, create_order()Checks stock, calls the totals function, savesOrder and OrderLine rows in a transaction
4invoicing/totals.py, price_order()Applies price band and contract prices via legacy/pricing_v1.pyNone; returns totals
5orders/services.pyQueues the confirmation after the transaction commitsJob on the Redis queue
6orders/tasks.py, send_order_confirmation()Renders and sends the emailEmail to the customer; audit row
The portal call path, with one row per hop.

The table exposes two things a folder tree would not. Totals are calculated inside the transaction and before the confirmation is queued, so a rejection should happen before hop 3 saves anything. And hop 6 is a side effect a careless change could trigger twice. If your rule rejected orders late, after the queue call, customers could receive a confirmation for an order that does not exist.

Step-by-step workflow

  1. Step 1: List entry points by kind

    Work down the kinds in the table above. For each, search for the mechanism and note every instance. Include things outside the repository that you can see traces of, such as a scheduler setting that names a job.

    What you should see: A list of entry points, each with the file that shows it.

  2. Step 2: Pick the path that matches your reading question

    Choose one entry point to trace first, usually the most used. Note the others as 'not yet traced' rather than skipping them silently.

    What you should see: One chosen path and a list of others still to do.

  3. Step 3: Trace forwards from the entry point

    Open each function, read what it does, and follow the next call. Use search to find definitions you cannot find by eye. Write one row per hop: location, action, data or side effect.

    What you should see: A call-path table with a file and function in every row.

  4. Step 4: Mark stores and side effects

    Circle every database write, cache write, queued job, file write and external call. These are what a change can damage, and what a test must observe.

    What you should see: Each hop labelled as pure, store access, or side effect.

  5. Step 5: Find other callers of shared code

    For any function you plan to change, search for every caller. Shared functions are how a change to one path breaks another.

    What you should see: A caller list for each function you may touch.

  6. Step 6: Confirm by running one case

    Run the path locally with a safe test record, or run an existing test that covers it, with a debugger or log lines to show the hops happen in the order you wrote. Mark the table 'confirmed' only for hops you saw run.

    What you should see: A map in which each hop is either confirmed by running or marked as read-only.

Trace of the portal order
  1. POST /api/orders/

    api/urls.py

  2. View

    api/views.py: authenticate, parse

  3. create_order

    orders/services.py

  4. price_order

    invoicing/totals.py

  5. Save and commit

    Order and OrderLine rows

  6. Confirmation task

    orders/tasks.py: email

Stages in the order they run. The queue call must come after the commit.

Tracing with an assistant

An assistant can follow calls quickly, but only through code you have given it. If you paste only the view, it will guess what create_order does from the name, and it will do so fluently. Give it the real source of each function on the path and ask it to quote the line where each hop happens. A claimed hop with no quoted line is a hypothesis.

Ask for the opposite as well. After a trace is agreed, ask what else in the pasted code reads or writes the same tables. The answer is a list of places to check, not a conclusion. It is a good way to find the replay command that nobody told you about, but only if that code was in the material.

Reusable prompt

Call-path tracer

Turns the source of the functions on one path into a call-path table with quoted evidence and a list of unknowns.

I am tracing one request through an existing Python service so I can change it safely. Act as a careful reader, not an authority.

Entry point: POST /api/orders/ (route in api/urls.py)
Question: Where is the order validated and totalled, and what side effects follow?

Below is the source of the functions I believe are on the path. Use ONLY this code.
--- api/views.py: OrderCreateView.post ---
(paste source)
--- orders/services.py: create_order ---
(paste source)
--- invoicing/totals.py: price_order ---
(paste source)
--- orders/tasks.py: send_order_confirmation ---
(paste source)

Produce:
1. A table of hops in execution order: location, what happens, data written or side effect. For each hop quote the exact line that makes the call.
2. Any point where the order of operations matters, for example work done before or after a commit.
3. Anything that looks like it is called but is not defined in the material. Do not guess what it does.
4. What I would need to look at next to find other callers of create_order.
Show the reusable template

Replace each {{placeholder}} with your own details.

I am tracing one request through an existing service so I can change it safely. Act as a careful reader, not an authority.

Entry point: {{entry_point}}
Question: {{reading_question}}

Below is the source of the functions I believe are on the path. Use ONLY this code.
{{function_sources}}

Produce:
1. A table of hops in execution order: location, what happens, data written or side effect. For each hop quote the exact line that makes the call.
2. Any point where the order of operations matters, for example work done before or after a commit.
3. Anything that looks like it is called but is not defined in the material. Do not guess what it does.
4. What I would need to look at next to find other callers of {{function_to_change}}.

Expected output and limitations

A table with one row per hop, each with a location and a quoted line; a short note on ordering concerns; a list of names that are called but not defined in what you pasted; and a suggested search for other callers. A useful response admits gaps instead of filling them.

Sample responseIllustrative — your output will differ
Hops
1. api/views.py, OrderCreateView.post - calls create_order(customer, lines, source="portal"). Quote: order = create_order(customer, lines, source="portal")
2. orders/services.py, create_order - calls price_order(lines, customer.band). Quote: totals = price_order(lines, customer.band)
3. orders/services.py - saves inside transaction.atomic(), then queues the task. Quote: transaction.on_commit(lambda: send_order_confirmation.delay(order.id))

Ordering
- Totals are computed before the save, so a rejection raised here prevents any row being written.
- The confirmation is queued on commit, so a rollback sends nothing.

Called but not defined in the material
- contract_unit_price (used by price_order): source not provided.

Next search
- git grep -n "create_order(" to list every caller, not only the portal view.

Limitations to keep in mind

  • The trace is only as complete as the code you pasted; anything outside it is guesswork unless the assistant says so.
  • Static reading misses signals, middleware and configuration-driven behaviour.
  • A well-formatted table is not evidence. Open each quoted line and check it exists.
  • Which entry points run in production, and how often, cannot be learned from source alone.

Common errors and how to fix them

Tracing only the portal path and changing shared code

Why it happens: The first entry point found was assumed to be the only one.

Fix: Search for every caller of the function you will change before editing it, and list each entry point by kind.

A trace with a gap between two hops

Why it happens: A signal, decorator, middleware or setting runs code that no call mentions.

Fix: Search for registration code, and confirm by running the path with log lines or a debugger.

Accepting a trace built from function names

Why it happens: The assistant was given only the view and inferred the rest.

Fix: Provide the source of every function on the path and require a quoted line for each hop.

Validation checklist

Tick each item once you have confirmed it.

Hands-on exercise

Map one path in a real repository

In a repository you may study, choose one user-visible behaviour, list the service's entry points, and trace one of them to storage. Produce a call-path table and a list of other callers of the main function on the path.

You will need

  • A repository you are permitted to read, with at least one web route and one background or command-line entry point.
  • Your reading log from the previous lesson, if you have one.
  • The prompt template from this lesson, if your policy allows its use with your code.

Acceptance criteria

Your work is done when every one of these is true.

Hints (2)
  • If you cannot run the project, confirm hops by finding a test that exercises them.
  • Search for the function name with the open parenthesis to find calls rather than definitions.
Show a model answer

A strong answer starts from a narrow behaviour, such as 'what happens when a user uploads an avatar', and lists entry points in a table by kind. Its call-path table is short but precise: each hop names a function and says what it does to data. It marks the one place where a file is written and the one place a job is queued, and notes whether the job is queued before or after the transaction commits. It lists at least one caller the author did not expect, and it labels which hops were run rather than read. A weak answer describes the framework's request cycle in general terms and names no functions.

Knowledge check

Choose an answer, then check it. Nothing is recorded — this is for you.

  1. 1.You plan to add a rule inside a function called by the web route. What should you do first?
    Show the answer and explanation

    Answer: A. Shared functions are reached from other entry points, such as importers and scripts, so a search shows what else the change affects. Running only the route's tests is tempting, but they cannot reveal callers they do not exercise. The assistant can only report callers in the code you gave it, and renaming does not help find existing callers.

  2. 2.Why is it important to know whether a job is queued before or after a transaction commits?
    Show the answer and explanation

    Answer: B. If the job runs but the order was rolled back, the customer could receive a confirmation for an order that is not saved. Speed is not the issue here, and the last option is not a general rule.

  3. 3.An assistant's trace says control passes from the view to a function you cannot find in the code. What is the best response?
    Show the answer and explanation

    Answer: C. A hop you cannot locate is either invented or driven by dynamic behaviour, and searching and running the path distinguishes the two. Trusting a consistent-looking trace is the tempting mistake. Deleting the hop hides a possible real step, and a second answer is just another guess.

Written by
PromptFable Editorial
Last updated 13 Nov 2026
Review
Reviewed by Waseem Nadir, Technical Reviewer
Last reviewed 27 Nov 2026

References

Primary sources for the technical details in this lesson. Vendor platforms change — check the official page if anything here looks different from what you see.

PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.